Skip to content
Merged
Show file tree
Hide file tree
Changes from 1 commit
Commits
Show all changes
31 commits
Select commit Hold shift + click to select a range
b24c827
Studio images: family batch adapters, measured batching race and per-…
danielhanchen Nov 26, 2026
28a9ecb
Studio images: no coalescing wait at a shape with no admitted size; r…
danielhanchen Nov 26, 2026
f437380
Studio images: a batch size that loses the race drops its CUDA graphs
danielhanchen Nov 26, 2026
58e0db6
Studio images: test that a measured win coalesces at the winning size…
danielhanchen Nov 26, 2026
6c55fd6
Studio images: members a fired batch could not take coalesce again be…
danielhanchen Nov 26, 2026
f5b1cec
Studio images: no shared call while FBCache can run; decode coalesced…
danielhanchen Nov 26, 2026
e8879fb
Studio images: FBCache coupling test holds with the length guard and …
danielhanchen Nov 26, 2026
731542d
Studio images: free the failed call before the halved retry; key race…
danielhanchen Nov 26, 2026
a8e5e17
Studio images: an edit at a new reference size never evicts a text-to…
danielhanchen Nov 26, 2026
9f0b357
Studio images: batch-size graphs get their own pool and graph budget;…
danielhanchen Nov 26, 2026
51c1217
Studio images: the race's batched-eager arm really runs with the grap…
danielhanchen Nov 26, 2026
bae160e
Studio images: key batching race verdicts by card topology
danielhanchen Nov 26, 2026
95de9ec
Studio images: price and scope batched CUDA graphs by what they hold
danielhanchen Nov 27, 2026
fe47b92
Studio images: seeded joins, eager wins and static compiles follow wh…
danielhanchen Nov 27, 2026
1a97100
Studio images: pin the Fast CFG interval in the batch key
danielhanchen Nov 27, 2026
53efa94
Studio images: the eager arm stays eager, graphed verdicts keep their…
danielhanchen Nov 27, 2026
8ca902e
Studio images: an aborted race size drops the batched graphs its warm…
danielhanchen Nov 27, 2026
3221b2c
Merge remote-tracking branch 'origin/main' into studio-batch-infra-main
danielhanchen Nov 27, 2026
92efbc1
Studio images: block graph handles never count a graphed race winner …
danielhanchen Nov 27, 2026
705da24
Studio images: a graphed race verdict holds only beside a live graph …
danielhanchen Nov 27, 2026
0d7d96d
Studio images: a measured batching win serves only with a passing G2c…
danielhanchen Nov 27, 2026
395de8b
Studio images: the race's replay check compares row 0 with its solo r…
danielhanchen Nov 27, 2026
e5b8e38
Studio images: the quality gate reads the path a race really ran, and…
danielhanchen Nov 27, 2026
71e85dc
Studio images: the race picks a qualifying arm first and refuses size…
danielhanchen Nov 27, 2026
67a7dcd
Studio images: a batched warm-up that runs out of memory keeps the si…
danielhanchen Nov 27, 2026
0dac8dd
Merge remote-tracking branch 'origin/main' into studio-batch-g2c-gate
danielhanchen Nov 27, 2026
7859edb
Studio images: the race never measures across a change in how the loa…
danielhanchen Nov 27, 2026
9173835
Studio images: the route leaves MOSS to the engine, and an eager win …
danielhanchen Nov 27, 2026
6e6b15b
Studio images: an adapted load never consumes the adapter-free batchi…
danielhanchen Nov 27, 2026
6332acb
Studio images: withhold an eager batching win once a same-size graph …
danielhanchen Nov 27, 2026
9993ecd
Merge remote-tracking branch 'origin/main' into studio-batch-g2c-gate
danielhanchen Nov 27, 2026
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Prev Previous commit
Next Next commit
Studio images: price and scope batched CUDA graphs by what they hold
A graphed race verdict admits its size only while the load holds that
batch-size graph; otherwise the eager arm's own verdict applies, with
seeded joins off. Batched recording is refused on offloaded loads, and
an OOM while recording one runs the call like the other unrecorded
shapes. The admission estimate is k times the size-1 graph's own pool
growth, with free memory read on the operands' card. A batched key that
a size-1 call replays becomes a size-1 graph, and a placement change
clears the batched and edit labels.

[skip ci]
  • Loading branch information
danielhanchen committed Nov 27, 2026
commit 95de9ec6bdbd98b395f2dbe777e3314f21d3d33c
3 changes: 2 additions & 1 deletion studio/backend/core/inference/diffusion.py
Original file line number Diff line number Diff line change
Expand Up @@ -5234,9 +5234,10 @@ def _measured_sizes(
from . import diffusion_batch_race
from .image_request_batching import batch_max
try:
return diffusion_batch_race.lookup(
found = diffusion_batch_race.lookup(
state, width, height, guidance, range(2, batch_max() + 1), steps = steps
)
Comment on lines +5276 to +5279

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

P2 Badge Exclude unmeasured adapter sets from measured batching admission

After an adapter-free resident load records an eager batching win with a quality PASS, the same verdict also authorizes batching when LoRAs are subsequently applied or the model is reloaded with adapters: load_key() excludes adapters, and this lookup never checks _race_adapters_active(). The refusal in batch_race() only prevents measuring adapted loads; it does not prevent consuming the base model's verdicts. Consequently, an otherwise serial adapted load can enter measured batching, including automatic explicitly seeded joins based on the base model's bit-exact checks. Reject adapter-bearing loads and requests when consuming these verdicts, or include the adapter selection in the measurement identity.

Useful? React with 👍 / 👎.

Copy link
Copy Markdown
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Fixed in 6e6b15b. _measured_sizes now returns no verdicts when the load carries adapters with a non-zero weight (applied, baked in, or requested at load, the same check the race uses to refuse). An adapted load therefore keeps today's rules: a resident or graphed load serves one request at a time, a streamed load keeps its unmeasured default, and coalesce_seeded_ok is False, so an explicitly seeded request never joins on the base model's exactness. A zero-weight adapter still reads the base verdicts. New test test_an_adapted_load_never_consumes_the_adapter_free_verdicts fails before the change.

return {k: diffusion_batch_race.effective_verdict(v, k, state) for k, v in found.items()}
except Exception: # noqa: BLE001 - no verdict: today's rules
return {}

Expand Down
39 changes: 38 additions & 1 deletion studio/backend/core/inference/diffusion_batch_race.py
Original file line number Diff line number Diff line change
Expand Up @@ -537,7 +537,8 @@ def batch(
break
report["sizes"][str(size)] = verdict
if not verdict.get("promoted"):
# A losing size never runs batched here: its graphs would only pin pool memory.
# A losing size never runs batched here: drop its graphs (their own pool returns to the card; under
# BATCH_POOL_ENV=shared they stay in the one pool for the next capture).
dropped = 0
for handle in handles:
drop = getattr(handle, "drop_batched", None)
Expand Down Expand Up @@ -585,6 +586,42 @@ def _neighbour_check(solo, batch, prompts: list, seeds: list, *, eager: bool) ->
}


def batched_graph_sizes(state: Any) -> Optional[set]:
"""Batch sizes every recording graph handle of this load holds a graph for now; None when the load has no graphs."""
handles = list(getattr(state, "cuda_graphs", ()) or ())
if not handles:
return None
held = None
for handle in handles:
batched = getattr(handle, "_batched", None) or {}
cache = getattr(handle, "cache", None) or {}
sizes = {int(v) for k, v in batched.items() if k in cache}
held = sizes if held is None else held & sizes
return held or set()


def effective_verdict(verdict: dict, size: int, state: Any) -> dict:
"""The verdict as it applies now: one won on the graphed arm holds only while that batch-size graph exists (user
calls never record one); otherwise the size is admitted only if the eager arm passed on its own."""
if not isinstance(verdict, dict) or verdict.get("arm") != "batched":
return verdict
Comment on lines +858 to +859

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

P2 Badge Revalidate eager winners when later races install matching graphs

If a size wins on the eager arm at canvas A, then a later race wins on the graph arm at canvas B with the same tensor shapes (for example, the same dimensions and guidance but a different step count), this early return still admits A as eager. The second race has installed a graph that GraphedForward will replay for A, and the request route does not force eager execution. Having drop_batched() only enforces the winner immediately after its race; it does not prevent later captures from changing that path. Consequently, an eager-only quality PASS and eager reproducibility checks can authorize graph-backed requests. Force the recorded eager path per request, or withhold its verdict whenever matching graphs have subsequently appeared.

Useful? React with 👍 / 👎.

Copy link
Copy Markdown
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Fixed in 6332acb. effective_verdict now withholds any promoted eager-path verdict (an eager-arm win, or a graphed win falling back to its eager arm) while a step-graph handle holds a batch-size graph of that size. Graphs key on tensor shapes, and a later race at another canvas or step count can record one with the same shapes, so the eager path could no longer be guaranteed. Withheld sizes fall back to serial, and seeded joins are refused with them. A graphed win at its own canvas and layout still holds, and other sizes are unaffected. New test test_an_eager_win_is_withheld_once_a_later_race_records_a_graph_of_that_size fails before the change; 338 batching and graph tests pass.

held = batched_graph_sizes(state)
if held is None or int(size) in held:
return verdict
eager = (verdict.get("arms") or {}).get("batched_eager")
if isinstance(eager, dict):
# The neighbour check ran on the graphed arm: it vouches for nothing here, so no seeded joins either.
return dict(
verdict,
promoted = bool(eager.get("promoted")),
arm = "batched_eager",
graph_missing = True,
neighbour_exact = False,
replay_exact = False,
)
return dict(verdict, promoted = False, graph_missing = True)


def seeded_join_ok(verdict: Optional[dict]) -> bool:
"""A seeded request may join a batch of this size only when the measured path is neighbour-exact (G2a) and its
row replays bit for bit from the seed alone (G2b): otherwise the returned seed would not reproduce the image."""
Expand Down
96 changes: 78 additions & 18 deletions studio/backend/core/inference/diffusion_cuda_graph.py
Original file line number Diff line number Diff line change
Expand Up @@ -90,10 +90,13 @@ def _batch_pool_budget_bytes() -> Optional[int]:
return None


def _free_device_bytes() -> Optional[int]:
def _free_device_bytes(index: Optional[int] = None) -> Optional[int]:
"""Free bytes on card ``index`` (the call's operands), else the current card."""
try:
torch = _torch()
free, _total = torch.cuda.mem_get_info()
free, _total = (
torch.cuda.mem_get_info() if index is None else torch.cuda.mem_get_info(index)
)
return int(free)
except Exception: # noqa: BLE001 - unreadable: the recording's own OOM path still guards
return None
Expand Down Expand Up @@ -1118,6 +1121,34 @@ def _allocator_segments() -> list:
return snapshot["segments"]


def _pool_id_bytes(pool: Any) -> int:
"""Device bytes pool id ``pool`` holds now, 0 if unreadable or None."""
if pool is None:
return 0
try:
want = tuple(pool)
return sum(
int(seg.get("total_size", 0))
for seg in _allocator_segments()
if tuple(seg.get("segment_pool_id") or ()) == want
)
except Exception: # noqa: BLE001
return 0


def _first_device_index(args: tuple, kwargs: dict) -> Optional[int]:
torch = _torch()
for value in (*args, *kwargs.values()):
index = (
getattr(getattr(value, "device", None), "index", None)
if torch.is_tensor(value)
else None
)
if index is not None: # a CPU operand says nothing about the card
return index
return None


def _pool_bytes(graph: Any) -> int:
"""Device bytes the graph's private pool holds (shared by every graph of the load), 0 if unreadable."""
try:
Expand Down Expand Up @@ -1584,6 +1615,21 @@ def _release(self) -> None:
# the recordings ran on their own capture stream, whose cuBLAS workspace outlives them
release_cached_outside_capture(clear_cublas = getattr(self, "placement", None) is not None)

def _invalidate_for_placement(self, token: Any) -> None:
"""The recorded graphs replay the weight addresses of the placement they saw; a new placement records anew."""
if self.cache:
self.stats["invalidations"] += 1
# Not reset(): its empty_cache on every model-offload onload makes the next onload pay the
# cudaMallocs again. The dropped pool's blocks stay with the allocator.
dropped = [getattr(e, "pool_token", None) for e in self.cache.values()]
self.cache.clear()
_note_dropped_pools(dropped) # the next capture flushes it before it records
_drop_pool_if_unused() # the next capture must not record into a pool no graph holds
getattr(self, "_batched", {}).clear()
getattr(self, "_edit_keys", set()).clear()
self._warmed.clear()
self.valid_token = token

def _unbatched_count(self) -> int:
batched = getattr(self, "_batched", {})
return sum(1 for k in self.cache if k not in batched)
Expand All @@ -1598,29 +1644,39 @@ def _eviction_victim(self, incoming_edit: bool) -> Any:
return victim
return next((k for k in self.cache if k not in batched), None)

def _batched_refusal(self, rows: tuple) -> Optional[str]:
def _batched_refusal(
self,
rows: tuple,
device: Optional[int] = None,
) -> Optional[str]:
"""Why a call carrying ``rows`` requests may not record a new graph here, else None."""
count, capture = rows
if getattr(self, "_batched_off", None):
return self._batched_off
if not capture:
return "no recording on a user's request"
if getattr(self, "placement", None) is not None:
# A failed recording under an offload placement poisons the whole load; only resident loads record them.
return "offloaded denoiser: batched calls run eager"
if count not in BATCH_GRAPH_SIZES:
return f"batch size {count} has no graph"
batched = getattr(self, "_batched", {})
if sum(1 for k in batched if k in self.cache) >= MAX_BATCHED_GRAPHS:
return "batched graph cap reached"
need = int(self.stats.get("pool_bytes", 0) or 0) * count
# Priced from the size-1 graph's own pool growth, not the whole shared pool.
need = int(self.stats.get("size1_graph_bytes", 0) or 0) * count
budget = _batch_pool_budget_bytes()
if budget is not None and need > budget:
return "over the batched graph pool budget"
free = _free_device_bytes()
free = _free_device_bytes(device)
if free is not None and need and need > free - BATCH_GRAPH_MARGIN_MB * 2**20:
return "not enough free memory for a batched graph"
return None

def drop_batched(self, size: Optional[int] = None) -> int:
"""Drop the batched graphs (of ``size`` only, when given); the size-1 graphs stay. Returns how many."""
"""Drop the batched graphs (of ``size`` only, when given); the size-1 graphs stay. Returns how many. Their memory
goes back only from their own pool (the default): with ``BATCH_POOL_ENV=shared`` the size-1 graphs keep the one
pool alive and nothing returns to the card."""
batched = getattr(self, "_batched", {})
keys = [k for k, v in batched.items() if size is None or v == int(size)]
gone = [getattr(self.cache.pop(k), "pool_token", None) for k in keys if k in self.cache]
Expand Down Expand Up @@ -1959,16 +2015,7 @@ def __call__(self, *args, **kwargs):
# The recorded graphs replay the weight addresses of the placement they saw; a new placement records anew.
token = self.placement.token()
if token != self.valid_token:
if self.cache:
self.stats["invalidations"] += 1
# Not reset(): its empty_cache on every model-offload onload makes the next onload pay the
# cudaMallocs again. The dropped pool's blocks stay with the allocator.
dropped = [getattr(e, "pool_token", None) for e in self.cache.values()]
self.cache.clear()
_note_dropped_pools(dropped) # the next capture flushes it before it records
_drop_pool_if_unused() # the next capture must not record into a pool no graph holds
self._warmed.clear()
self.valid_token = token
self._invalidate_for_placement(token)
refusal = self.placement.refusal(self.stats)
if self._judge and speed_check_enabled():
self._judge_keys()
Expand Down Expand Up @@ -2050,7 +2097,7 @@ def __call__(self, *args, **kwargs):

rows = _BATCH_ROWS.get() if entry is None else None
if rows is not None and rows[0] > 1:
refusal = self._batched_refusal(rows)
refusal = self._batched_refusal(rows, _first_device_index(eager_args, eager_kwargs))
if refusal is not None:
self.stats["batch_eager"] += 1
return self._eager_as_recorded(eager_args, eager_kwargs)
Expand Down Expand Up @@ -2211,7 +2258,8 @@ def __call__(self, *args, **kwargs):
)
exc.__traceback__ = None
self._release()
return self._eager(eager_args, eager_kwargs)
# The size-1 graphs keep replaying: run like the other unrecorded shapes beside them.
return self._eager_as_recorded(eager_args, eager_kwargs)
if self.placement is not None:
self.placement.recover() # the eager retry must not wait on the dead capture's copies
self.placement.release_slots() # nothing will replay into the ring for this load
Expand Down Expand Up @@ -2258,6 +2306,11 @@ def __call__(self, *args, **kwargs):
self._sealed_scopes.add(scope)
if self.plan is not None:
self.cache[key] = self.cache.pop(key)
if key in getattr(self, "_batched", {}):
now = _BATCH_ROWS.get()
if now is None or now[0] <= 1:
# A size-1 call (true CFG has two rows too) replays this graph: it is a size-1 graph now.
self._batched.pop(key, None)

live: list = []
_flatten((args, kwargs), live)
Expand Down Expand Up @@ -2466,6 +2519,7 @@ def _capture(
# An explicit pool id, never None: a capture that fails must hand its pool back (retire_failed_capture).
box = _pool_box()
pool = box[0]
pool_before = _pool_id_bytes(pool)
if pool is None and callable(getattr(torch.cuda, "graph_pool_handle", None)):
pool = torch.cuda.graph_pool_handle()
recorder = _graph_without_flush if recapture else _graph_with_flush
Expand All @@ -2485,6 +2539,12 @@ def _capture(
if skip_stats is not None:
skip.stats = skip_stats
self.stats["pool_bytes"] = _pool_bytes(graph)
if _BATCH_ROWS.get() is None or _BATCH_ROWS.get()[0] <= 1:
# This size-1 graph's own pool growth: what a batch-k graph of it is priced from (k times).
grown = max(0, int(self.stats["pool_bytes"]) - int(pool_before))
self.stats["size1_graph_bytes"] = max(
int(self.stats.get("size1_graph_bytes", 0)), grown
)
if key is not None:
self._recorded[key] = None
while len(self._recorded) > 4 * self.max_graphs:
Expand Down
79 changes: 78 additions & 1 deletion studio/backend/tests/test_diffusion_cuda_graph.py
Original file line number Diff line number Diff line change
Expand Up @@ -2542,7 +2542,7 @@ def test_a_size_one_capture_failure_still_poisons(stub_torch):
def test_the_batched_pool_budget_refuses_a_recording(stub_torch, monkeypatch):
handle = _armed()
handle(_t((1, 4)), timestep = _t((1,)), return_dict = False)
handle.stats["pool_bytes"] = 512 * 2**20
handle.stats["size1_graph_bytes"] = 512 * 2**20
monkeypatch.setenv(cg.BATCH_GRAPH_POOL_ENV, "600")
with cg.batch_rows(2, capture = True):
handle(_t((2, 4)), timestep = _t((2,)), return_dict = False)
Expand Down Expand Up @@ -2697,3 +2697,80 @@ def edit(ref_len, value):
replays, captures = handle.stats["replays"], handle.stats["captures"]
t2i(9.0)
assert handle.stats["replays"] == replays + 2 and handle.stats["captures"] == captures


# ---------------------------------------------------------------- kernel / graph rule review (#19837)


@side_stream
def test_a_placement_change_forgets_the_batched_labels(stub_torch):
"""A placement token change clears every graph: the batched labels go with them (no stale size-k bookkeeping)."""
handle = _armed()
handle(_t((1, 4)), timestep = _t((1,)), return_dict = False)
with cg.batch_rows(2, capture = True):
handle(_t((2, 4)), timestep = _t((2,)), return_dict = False)
assert handle._batched
handle.placement = types.SimpleNamespace(
token = lambda: "moved", refusal = lambda stats: None, mode = "model"
)
handle.valid_token = "before"
handle._invalidate_for_placement("moved")
assert handle.cache == {} and handle._batched == {}


@side_stream
def test_a_graph_a_size_one_call_also_replays_is_not_a_batched_graph(stub_torch):
"""Two requests without CFG and one request with true CFG can share a graph key (two rows either way): once a
size-1 call replays it, dropping the batched graphs (a lost race) must not take it away."""
handle = _armed()
with cg.batch_rows(2, capture = True):
handle(_t((2, 4)), timestep = _t((2,)), return_dict = False)
assert sorted(handle._batched.values()) == [2]
handle(_t((2, 4)), timestep = _t((2,)), return_dict = False) # a size-1 true-CFG step, same shapes
assert handle.drop_batched(2) == 0 and len(handle.cache) == 1


@side_stream
def test_batched_admission_prices_the_size_one_graph_not_the_whole_pool(stub_torch, monkeypatch):
"""need = the size-1 graph's own pool growth x k: a pool already holding other graphs does not make batch 4
look unaffordable."""
# The shared pool holds 5 GiB before the size-1 capture and 5 GiB + 256 MiB after it.
monkeypatch.setattr(cg, "_pool_bytes", lambda graph: 5 * 2**30 + 256 * 2**20)
monkeypatch.setattr(cg, "_pool_id_bytes", lambda pool: 5 * 2**30)
handle = _armed()
handle(_t((1, 4)), timestep = _t((1,)), return_dict = False)
assert handle.stats["size1_graph_bytes"] == 256 * 2**20
seen = []
monkeypatch.setattr(
cg, "_free_device_bytes", lambda index = None: seen.append(index) or 4 * 2**30
)
monkeypatch.setenv(cg.BATCH_GRAPH_POOL_ENV, "2048")
with cg.batch_rows(4, capture = True):
handle(_t((4, 4), device_index = 1), timestep = _t((4,), device_index = 1), return_dict = False)
assert (
handle.stats["batch_captures"] == 1
), "1 GiB for batch 4 fits a 2 GiB budget and 4 GiB free"
assert seen == [1], "free memory is read on the card the call runs on"


@side_stream
def test_a_placed_load_records_no_batched_graph(stub_torch):
"""Under an offload placement a failed batched recording would poison the whole load: no batched graphs there."""
handle = _armed()
handle.placement = types.SimpleNamespace(mode = "group")
assert handle._batched_refusal((2, True)) is not None


@side_stream
def test_out_of_memory_recording_a_batch_falls_back_like_the_other_recorded_shapes(
stub_torch, monkeypatch
):
handle = _armed()
handle(_t((1, 4)), timestep = _t((1,)), return_dict = False)
used = []
real = handle._eager_as_recorded
monkeypatch.setattr(handle, "_eager_as_recorded", lambda a, k: used.append(1) or real(a, k))
stub_torch._records["graph_error"] = RuntimeError("CUDA out of memory")
with cg.batch_rows(2, capture = True):
handle(_t((2, 4)), timestep = _t((2,)), return_dict = False)
assert used == [1] and handle.poisoned is False
30 changes: 30 additions & 0 deletions studio/backend/tests/test_image_batch_infra.py
Original file line number Diff line number Diff line change
Expand Up @@ -925,3 +925,33 @@ def get(
two = race.topology(state)
assert one != two and "split:cuda:0>cuda:1:text_encoder" in two
assert race.load_key(state).endswith(two)


def test_a_graphed_verdict_admits_a_size_only_while_its_graph_exists(monkeypatch):
"""A verdict won on the graphed arm says nothing once that batch-size graph is gone (restart, LoRA reset, OOM):
the size is then admitted only if the eager arm passed on its own."""
graphed_win = {
"promoted": True,
"arm": "batched",
"arms": {"batched": {"promoted": True}, "batched_eager": {"promoted": False}},
}
both_win = {
"promoted": True,
"arm": "batched",
"arms": {"batched": {"promoted": True}, "batched_eager": {"promoted": True}},
}
handle = types.SimpleNamespace(cache = {"k2": object()}, _batched = {"k2": 2})
with_graph = types.SimpleNamespace(cuda_graphs = (handle,))
without = types.SimpleNamespace(
cuda_graphs = (types.SimpleNamespace(cache = {"k1": 1}, _batched = {}),)
)
assert race.effective_verdict(graphed_win, 2, with_graph)["promoted"] is True
assert race.effective_verdict(graphed_win, 2, without)["promoted"] is False
assert race.effective_verdict(both_win, 2, without)["promoted"] is True
assert not race.seeded_join_ok(
race.effective_verdict(dict(both_win, neighbour_exact = True), 2, without)
)
restarted = types.SimpleNamespace(cuda_graphs = (types.SimpleNamespace(cache = {}, _batched = {}),))
assert race.effective_verdict(graphed_win, 2, restarted)["promoted"] is False
no_graphs = types.SimpleNamespace(cuda_graphs = ())
assert race.effective_verdict(graphed_win, 2, no_graphs)["promoted"] is True