Skip to content

fix(orchestrator): gate diffusion behaviour on registry kind, not the xdit name - #1117

Open
sushildubey171 wants to merge 1 commit into
AMD-AGI:mainfrom
sushildubey171:fix/scriptable-registry-checks
Open

fix(orchestrator): gate diffusion behaviour on registry kind, not the xdit name#1117
sushildubey171 wants to merge 1 commit into
AMD-AGI:mainfrom
sushildubey171:fix/scriptable-registry-checks

Conversation

@sushildubey171

Copy link
Copy Markdown

Description: what and why

hunyuan_image3 is registered kind=scriptable with throughput_unit="img/s" and ships baseline_hunyuan_image3.yaml / profile_hunyuan_image3.yaml — but several call sites decide "is this a diffusion workload?" by comparing the framework name to "xdit". Those sites silently treat it as an LLM workload.

Before this change a hunyuan_image3 session:

behaviour should be
SharedState._roofline_throughput_unit tok/s img/s (its own registry entry)
bypass analysis report unit tok/s img/s
bypass diffusion-roofline sidecar not emitted emitted
bypass steady-state default off on
steady-window repeat threshold LLM threshold diffusion threshold (2)
compute_roofline_breakdown_from_state LLM decode roofline diffusion ceiling

All of these now consult framework_registry (is_scriptable / throughput_unit), which is already the canonical predicate in 26 other places. executors/profile.py:632 is the pattern I followed — it calls is_scriptable() for the server-less branch and only then narrows to xdit for the xfuser-specific check, with a comment noting hunyuan_image3 must not trigger it.

The kernel tools keep working standalone: they try the registry and fall back to a name check, mirroring the existing _is_scriptable_framework helper in tracelens_analysis.py.

Deliberately not changed. I went through every "xdit" literal in non-test code; most are correct and are left alone: the xfuser pip name and xDiT git URL, XditAdapter registration, per-framework config paths, the PATH guard for the xdit console script + hipcc, the XDIT_* env blacklist, the xDiT default grid seeds, and the xfuser baked-profiler verification. cli/model_gate.py already calls is_scriptable() with the literal only as an import-failure fallback.

The two health-warning codes keep their bypass_xdit_* spelling for wire stability even though the condition is now generic; only their messages change from "xDiT" to "diffusion". Renaming those codes felt like a separate call for you to make.

Linked issue(s)

Addresses item 3 of #1114 (see my correction comment there — my original "15 hardcoded comparisons" was a raw grep count and overstated it; this PR covers the subset that is genuinely wrong). Does not close #1114, whose main ask is an SGLang diffusion route.

This is also the prerequisite that issue names: with the kind checks registry-driven, adding a new scriptable framework gets closer to the "single-table edit" framework_registry's own docstring promises. I deliberately did not add an sglang-diffusion entry here — without a matching Magpie wrapper script (external repo) it would be dead config, and #1114 is asking you how you'd want that shaped.

Tests: added/updated? commands run?

No test in the tree referenced hunyuan_image3 before this change, which is why the divergence went unnoticed. The new tests assert against every registry entry rather than a hardcoded list, so a future framework cannot regress the same way:

  • scriptable detection and throughput unit match FRAMEWORKS[*].kind / .throughput_unit for all entries, in both the tool and the reader
  • the standalone fallback path (registry import forced to fail) still classifies xdit and hunyuan_image3 correctly
  • compute_roofline_breakdown_from_state routes xdit and hunyuan_image3 to the diffusion ceiling, and sglang/vllm/atom to the decode path
  • unknown/empty framework still resolves to tok/s + decode
pytest src/hyperloom/agents/kernel/tests                     ->  1146 passed, 23 skipped
pytest <roofline_ceiling, framework_adapters, diffusion_roofline,
        xdit_integration_units, backend_gating>              ->   264 passed
ruff check                                                   ->  clean
ruff format --check                                          ->  identical before/after (no new debt)

I did not run the full suite to completion locally — it exceeds ~10 min in my environment — so I ran the kernel-agent tree plus the modules consuming these call paths.

Breaking changes: no

Serving frameworks and unknown/empty names are unchanged: the registry falls back to sglang, so they still resolve to tok/s and the decode roofline. The only behaviour that changes is for kind=scriptable frameworks other than xdit — i.e. hunyuan_image3 — which now gets the diffusion treatment its registry entry already declared. Warning code strings are unchanged.

… xdit name

``hunyuan_image3`` is registered ``kind=scriptable`` with
``throughput_unit="img/s"`` and ships baseline/profile configs, but several
call sites decide "is this a diffusion workload?" by comparing the framework
name to ``"xdit"``. Those sites silently treat it as an LLM workload.

Concretely, before this change a hunyuan_image3 session:

  - reported ``tok/s`` from ``SharedState._roofline_throughput_unit`` and from
    the bypass analysis report, contradicting its own registry entry
  - got no workload-level diffusion roofline sidecar from the bypass route
  - did not get the scriptable steady-state default, and used the LLM repeat
    threshold when locating its denoise loop
  - fell through ``compute_roofline_breakdown_from_state`` to the LLM decode
    roofline instead of the diffusion ceiling

All of these now consult ``framework_registry`` (``is_scriptable`` /
``throughput_unit``), which is already the canonical predicate elsewhere in
the tree -- ``executors/profile.py`` calls ``is_scriptable()`` for the
server-less branch and only then narrows to ``xdit`` for the xfuser-specific
check, which is the pattern followed here.

The kernel tools keep working standalone: they try the registry and fall back
to a name check, mirroring the existing ``_is_scriptable_framework`` helper in
``tracelens_analysis``.

Deliberately NOT changed, because the ``xdit`` literal is correct there: the
xfuser pip name and xDiT git URL, ``XditAdapter`` registration, per-framework
config paths, the PATH guard for the ``xdit`` console script, the XDIT_* env
blacklist, the xDiT default grid seeds, and the xfuser baked-profiler check.

The two health-warning codes keep their ``bypass_xdit_*`` spelling for wire
stability even though the condition is now generic; only their messages are
reworded from "xDiT" to "diffusion". Renaming them is a separate call.

Behaviour for serving frameworks and for unknown/empty names is unchanged --
the registry falls back to sglang, so those still resolve to tok/s and the
decode roofline.

No test in the tree referenced hunyuan_image3 before this change, which is
why the divergence went unnoticed; the added tests assert against every
registry entry rather than a hardcoded list, so a future framework cannot
regress the same way.

Co-Authored-By: Claude Opus 5 (1M context) <noreply@anthropic.com>
@sushildubey171
sushildubey171 requested a review from a team as a code owner August 6, 2026 17:27
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.

Diffusion support is xDiT-only: no SGLang multimodal_gen route, and Wan/FLUX.2 denoisers missing from the diffusion FLOP model

1 participant