Skip to content

Studio diffusion: reuse the early quant probe's result instead of spawning a second child - #16910

Merged
danielhanchen merged 3 commits into
mainfrom
studio-quant-probe-overlap-reuse
Nov 6, 2026
Merged

danielhanchen merged 3 commits into
mainfrom
studio-quant-probe-overlap-reuse

Conversation

@danielhanchen

Copy link
Copy Markdown
Member

Summary

Follow-up to #16882, which starts the quant scheme probe child early on a cold image load. Three cases spawned a second child that the serial probe never needed:

  1. The early child ends with no table (hit the 180 s _CHILD_PROBE_TIMEOUT, or exited without a result). _scheme_supported saw no early table and spawned a fresh child, so a wedged probe stalled the first load twice as long (about 360 s instead of 180 s) before the in-process fallback. The early thread now records that its child ran without a table, and the load goes straight to the in-process probe, as it does after a failed serial child.
  2. The startup warm races the early child. If a load arrives before the startup warm (prewarm_probe_table) takes the probe lock, the warm blocks on the lock while the early child runs, then finds _SMOKE_CACHE empty and runs its own child. The early thread now writes its definite verdicts into _SMOKE_CACHE, as prewarm_probe_table does, so the warm sees them.
  3. A plan that never reaches the probe (the bf16 seed path that returns before _planned_quant_scheme) discarded the early table. Where the verdicts cannot be persisted (UNSLOTH_DIFFUSION_PROBE_CACHE=0, no card UUID, no storage root, or no passing scheme), every such plan spawned another child. Those verdicts are now kept in _SMOKE_CACHE, the same verdicts the serial probe caches.

The out-of-memory case is unchanged: a None verdict is still not cached, and the load still takes it from the early table without a second child. UNSLOTH_DIFFUSION_PROBE_OVERLAP=0 still restores the serial probe exactly.

Evidence

CPU only, the probe child replaced by a fake (sleep plus table), same harness on all three trees: base = f85c190501 (before #16882), merged = 9c084751ab (#16882), this branch.

case base merged #16882 this PR
child ends with no table: children / wall (child = 1.0 s) 1 / 1.20 s 2 / 2.05 s 1 / 1.05 s
startup warm blocked behind the early child: children 1 2 1
3 plans on the bf16 seed path, verdicts not persistable: children 0 3 1
3 plans on the bf16 seed path, persistence on: children 0 1 1
  • 96 enumerated planner cells (auto / explicit x keeps-bf16 x eager x prior verdict state x child outcome): with UNSLOTH_DIFFUSION_PROBE_OVERLAP=0 all 96 traces match base exactly on both trees; with overlap on, free VRAM is never read, and the planner never returns, while a probe child or the overlap thread is alive.
  • Remaining extra child versus base: a plan that never reaches the probe still pays one early child per process (disclosed in Studio diffusion: overlap the quant scheme probe with the planner import on a cold image load #16882), now once instead of per plan.

Tests

  • studio/backend/tests/test_diffusion_probe_overlap.py: 3 new tests (no-table child spawned once, startup warm reuses the early table, verdicts kept on a plan that never reaches the probe). All 3 fail on origin/main and pass here; the 6 existing tests pass on both. The fixture now stubs the in-process probe body (_run_smoke_probe) instead of _smoke_probe, so a cached verdict is answered the way the real code answers it.
  • 18 related backend test files (probe, quant, cold start, early probe): 2305 passed, 13 skipped; the one failure (test_diffusion_comfy_community_files.py::test_moss_pipeline_takes_a_supplied_vae) fails the same way on origin/main.

Not proven

  • No GPU run: the timings above use a fake child. The fix only changes which cached table the load reads, not the probe itself.

…wning a second child

Follow-up to #16882. The early probe child's verdicts now land in the smoke cache, and a child that
ends with no table is recorded, so the load, the startup warm and later plans no longer spawn a
second child after it.
@chatgpt-codex-connector

chatgpt-codex-connector Bot commented Nov 6, 2026 •

Copy link
Copy Markdown

Codex Review Summary

This comment shows the latest Codex review activity on this pull request.

Review Status Commit Review trigger
📝 Code Review ✅ Completed 2026-11-06T13:08:33.575121Z 0396225 Manual request
ℹ️ About Codex in GitHub

Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you

  • Open a pull request for review
  • Mark a draft as ready
  • Comment "@codex review" or "@codex security review".

Codex reacts with 👀 while any review is running, comments if it has suggestions, and reacts with 👍 once all reviews finish with no findings.

@danielhanchen

Copy link
Copy Markdown
Member Author

@codex review

@chatgpt-codex-connector

Copy link
Copy Markdown

Codex Review: Didn't find any major issues. Nice work!

Reviewed commit: 0396225719

ℹ️ About Codex in GitHub

Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you

  • Open a pull request for review
  • Mark a draft as ready
  • Comment "@codex review".

If Codex has suggestions, it will comment; otherwise it will react with 👍.

Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".

@danielhanchen
danielhanchen merged commit 5e79ea3 into main Nov 6, 2026
@danielhanchen
danielhanchen deleted the studio-quant-probe-overlap-reuse branch November 6, 2026 17:04
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant