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: key batching race verdicts by card topology
The cards the host shows and how the load spans them (component split, CFG
replica, layer split) are now part of the verdict key, so a race on one card
never decides a two-card load and the other way round.
  • Loading branch information
danielhanchen committed Nov 26, 2026
commit bae160e9cf067fba295790f9efb5ef8ffc6f3bd1
29 changes: 29 additions & 0 deletions studio/backend/core/inference/diffusion_batch_race.py
Original file line number Diff line number Diff line change
Expand Up @@ -186,6 +186,34 @@ def _compile_state(state: Any) -> str:
return "static" if static else "dynamic"


def topology(state: Any) -> str:
"""Cards the host shows and how this load spans them (component split, CFG replica, layer split): a verdict on one
topology says nothing about another (Kaggle 2xT4: per-card replicas beat the split only from 2 users up)."""
try:
import torch
count = int(torch.cuda.device_count()) if torch.cuda.is_available() else 0
except Exception: # noqa: BLE001
count = 0
pipe = getattr(state, "pipe", None)
parts = [f"cards{count}"]
try:
from . import diffusion_multigpu as mg

info = mg._PLACEMENTS.get(pipe) if pipe is not None else None
if info:
moved = ",".join(sorted(str(m) for m in info.get("moved") or ()))
parts.append(f"split:{info.get('primary')}>{info.get('secondary')}:{moved}")
if pipe is not None and mg._CFG_ROUTERS.get(pipe) is not None:
parts.append("cfg_replica")
from .diffusion_layer_split_plan import layer_split_status

if pipe is not None and layer_split_status(pipe):
parts.append("layer_split")
except Exception: # noqa: BLE001 - unreadable placement: its own key, never another load's verdict
parts.append("placement?")
return "+".join(parts)


def load_key(state: Any) -> str:
"""Everything about the load a verdict depends on (the card side comes from the probe fingerprint)."""
from .diffusion import _denoiser_streams_from_host
Expand Down Expand Up @@ -218,6 +246,7 @@ def load_key(state: Any) -> str:
"graphs" if getattr(state, "cuda_graphs", ()) else "nographs",
_compile_state(state),
str(getattr(state, "transformer_cache", None) or ""),
topology(state),
)
return "|".join(parts)

Expand Down
24 changes: 24 additions & 0 deletions studio/backend/tests/test_image_batch_infra.py
Original file line number Diff line number Diff line change
Expand Up @@ -901,3 +901,27 @@ def recording(**kw):
not bypassed for rows, bypassed in seen if rows == 1
), "serial renders keep their graphs"
assert state_flag["bypassed"] is False


def test_a_verdict_is_keyed_by_the_card_topology(monkeypatch):
"""A verdict on one card says nothing about a two-card split of the same load (or a CFG replica)."""
import core.inference.diffusion_multigpu as mg

pipe = types.SimpleNamespace()
state = types.SimpleNamespace(pipe = pipe, offload_policy = "none", cuda_graphs = ())
one = race.topology(state)
monkeypatch.setattr(mg, "_PLACEMENTS", {id(pipe): None})
split = {"primary": "cuda:0", "secondary": "cuda:1", "moved": ["text_encoder"]}

class Box(dict):
def get(
self,
key,
default = None,
):
return split if key is pipe else default

monkeypatch.setattr(mg, "_PLACEMENTS", Box())
two = race.topology(state)
assert one != two and "split:cuda:0>cuda:1:text_encoder" in two
assert race.load_key(state).endswith(two)