Skip to content

fix(diffusion): preserve lazy quantization exports and per-backend lookup - #42249

Open
Tokha233 wants to merge 5 commits into
sgl-project:mainfrom
Tokha233:fix/diffusion-quant-import-cycle
Open

Tokha233 wants to merge 5 commits into
sgl-project:mainfrom
Tokha233:fix/diffusion-quant-import-cycle

Conversation

@Tokha233

@Tokha233 Tokha233 commented Oct 2, 2026 •

Copy link
Copy Markdown
Contributor

Motivation

Upstream #42494 now defers diffusion quantization imports until registry lookup, fixing the cold LinearBase import cycle originally reported here. Its lookup still imports every backend and no longer exposes the configuration classes directly from the package. This PR resolves only the requested backend while retaining the previous package-level class exports, registry aliases, and custom registration behavior.

Changes

Keep QuantizationConfig available during package initialization. Resolve and cache implementation classes through module __getattr__, and look up built-in configurations by their export name. Preserve kitchen_int8 → convrot_int8, distinct ModelOpt configuration classes, and user-defined configurations.

Fresh-process regression tests cover linear, hf_diffusers_utils, the standalone AR module, and ConvRot config imports. Registry tests cover all built-ins, package exports, repeated lookups, the deprecated alias, and custom registration failures.

Validation

Synced with upstream bab04cd7913ff50d1bf1a677a2d10e5015dc4c3b, including #42494. This preserves the upstream HIP H3 and CI changes.

RTX 5090 D v2, Python 3.12, PyTorch 2.13.0+cu130:

  • 117 passed, 24 subtests passed across cold imports/registry, import isolation, ConvRot backends, and transformer quantization.
  • Changed-file pre-commit and git diff --check passed.
  • Complete source content verified against the local Git index and working-tree changes before the remote run. Cold subprocesses use Hugging Face offline mode.
python -m pytest -q \
  python/sglang/multimodal_gen/test/unit/test_quantization_imports.py \
  python/sglang/multimodal_gen/test/unit/test_diffusion_import_isolation.py \
  python/sglang/multimodal_gen/test/unit/test_convrot_int8_backends.py \
  python/sglang/multimodal_gen/test/unit/test_transformer_quant.py

Earlier native AMD CI passed the four cold-import checks on a previous head; the synchronized head still needs hosted AMD validation. No model-forward math, precision, thresholds, or inference speedup claim. Codex assisted with implementation and testing.


CI States

Latest PR Test (Base): ❌ Run #37256707983
Latest PR Test (Extra): ❌ Run #37256707704
Latest PR Test (AMD ROCm 10): ❌ Run #37256707869

@mickqian

mickqian commented Oct 3, 2026

Copy link
Copy Markdown
Collaborator

/tag-and-rerun-ci

@github-actions github-actions Bot added the run-ci CI: run the baseline test suite on this PR label Oct 3, 2026
@Tokha233

Tokha233 commented Oct 3, 2026

Copy link
Copy Markdown
Contributor Author

Native AMD results for 4c427fe7 are now available. In MI300 unit job 111112737647, all four fresh-process cold imports pass, including linear, hf_diffusers_utils and test_ar_models, followed by the built-in export/alias and custom-registration coverage. The 2-GPU partition 1 job also reaches the standalone model tests instead of the earlier LinearBase circular-import collection failure.

The full AMD unit step is not green: it hits its 30-minute step timeout at test_pipeline_group_releases_process_groups, after the new import tests passed; other existing FP8/Qwen/performance-policy failures occur earlier. The four cold subprocesses take approximately 48 seconds on this runner. I am not treating the incomplete full sweep as a pass or claiming the timeout is unrelated to the additional test cost. The suite may need a targeted rerun or partitioning to establish completion within its budget.

CUDA unit, 5090, B200, component-accuracy and XPU checks pass. The remaining CUDA 2-GPU partition 1 failure reports Wan load times 106.03 s / 91.77 s versus limits 79.92 s / 58.00 s, and LTX-2.5 E2E 15.57 s versus 12.68 s. Those timings need same-runner base comparison; thresholds remain unchanged. NPU still fails at the wheel download (403), before model tests.

The separate FP8 fix #42255 has now passed its targeted tests on real MI300 hardware. The other platform-policy/fallback fixes #42250/#42256/#42257 still await CI authorization.

@Tokha233

Tokha233 commented Oct 3, 2026

Copy link
Copy Markdown
Contributor Author

Synced with upstream ce617d4, including #42240's LTX dispatch correction and the merged FP8 fix #42255. The lazy-import implementation and four independent cold-import regressions are unchanged.

Further inspection of the previous AMD timeout found that the existing nine performance-failure runner tests occupied about 1,366.5 s of the 1,800 s step budget, from adjacent log timestamps. Each scenario restarts pytest for an initial attempt plus six retries: 63 pytest startups. The four new cold imports separately took 47.5 s, so I am not claiming zero contribution from this PR's test cost. The separate test-only fix #42359 batches the nine independently parametrized scenarios into the same seven real attempts, preserving per-case failure/metric/JUnit checks.

On the updated head 2909028: 116 passed + 22 passing subtests, 42.13 s pytest (53.60 s whole process), in the combined import/isolation/ConvRot/transformer-quant suite. Source tree verified: 4,127 Python files, zero mismatches or extras. Changed-file pre-commit passes. Environment: RTX 5090 D v2 / Torch 2.13.0+cu130.

#42359's complete file was separately measured on the same host: upstream 888.28 s -> candidate 117.36 s (86.8% less time). All nine child scenarios still run seven times; the complete file also passes with an already-expired outer retry budget. These are local test-runtime results, not a claim that the full AMD suite now passes. No timeout/threshold/retry-limit changes.

Please authorize CI for #42359 and evaluate this updated head. Remaining platform-policy/PTX/LoRA fixes are still separate in #42250/#42256/#42257.

@Tokha233 Tokha233 changed the title fix(diffusion): defer quantization implementation imports fix(diffusion): preserve lazy quantization exports and per-backend lookup Oct 4, 2026
@Tokha233

Tokha233 commented Oct 4, 2026 •

Copy link
Copy Markdown
Contributor Author

Synced with upstream #42494 at b62a8588. The remaining change preserves package-level config exports and resolves only the requested quantization backend; the upstream HIP/CI fixes are retained. Fresh 5090 D v2 validation at that head: 117 passed + 24 subtests, with changed-file pre-commit passing. The PR description reflects the final diff rather than claiming the already-merged cold-import fix.

Source hashes, diffs, and logs for that validation: https://github.com/Tokha233/ComfyUI-H3-SpeedKit/tree/8791760/evidence/pr-maintenance-1005 .

CI update, 2026-10-05 07:22 UTC, current head 4ced9efe: Mick's upstream sync is retained. Lint, XPU, and NPU are green. The CUDA run finished failed, despite successful 5090, B200, component-accuracy, and unit jobs. The current CUDA unit suite reports 3,831 passed, 134 skipped, 3 xfailed, and 353 passing subtests.

Current-head CUDA failure breakdown:

  • 1-GPU partition 3: longlive2_i2v exhausted seven attempts. First attempt failed InputValidationStage (332.5055 ms vs 143.02 ms limit); subsequent failures were ImageVAEEncodingStage, 1,659.0462–4,265.9093 ms vs 1,656.666 ms limit (last: 1,700.8711 ms). ltx_2_3_hq_pipeline initially exceeded load latency but passed on attempt 2.
  • 2-GPU partition 2: ltx_2_3_two_stage_ti2v_2gpus remained above E2E/denoise limits through six attempts; last E2E 12,938.9763 ms vs 12,108.8 ms limit. The existing retry-budget guard declined attempt 7 (142.8 s left vs estimated 146.0 s needed). The initial fsdp-inference and ltx_2_two_stage_t2v failures recovered on attempt 2. H3 Ref2VA passed both requests and both consistency checks in this partition.
  • 2-GPU partition 0 was stopped by the existing fail-fast health check after 1-GPU partition 3 failed; its tests did not execute. The later coverage failure includes ten missing 2-GPU cases, including H3 T2VA, so this run does not validate those cases.
  • 2-GPU partition 1 passed on attempt 2; LTX-2.5 decoder E2E and Wan load latency failed initially. This is retry recovery, not proof of stable latency.

Current-head AMD has now finished failed, with 5/6 diffusion partitions passed. 2-GPU partition 1 again hit the 180-minute step timeout at 06:45 UTC. Its first pass reported 13 passed, 1 skipped, 1 error; H3 T2VA and Ref2VA both passed. The only reported case error was ltx_2_5_diffusion_decoder_2gpus: six completed attempts each reported Server not ready within 1200.0s; attempt 7 was still warming up when the overall step timed out. This is different from the previous head's seven completed readiness timeouts. On every current-head attempt both ranks logged the 3-tile decoder split; the last logs show Inductor warnings. This reproduces the startup failure across two heads, but still does not identify its underlying cause. A diagnostic run capturing both rank stacks around tile decode/FlexAttention compilation and the final tile gather, with GPU utilization, is preferable to another blind retry. The observed current CUDA failures are timing guards, not SSIM/import assertions, but without a same-runner base comparison their relationship to this PR is still unproven. A maintainer-side same-runner base/head comparison for the two persistent timing cases, followed by completion of the fail-fast-skipped partition, would help distinguish a regression from CI timing instability. No performance threshold, timeout, or retry setting has been changed.

Previous-head results (`b62a8588`; retained for history, not current-head validation)
  • Previous-head CUDA base, XPU, and NPU completed successfully. The CUDA diffusion unit suite reported 3,831 passed, 134 skipped, 3 xfailed, and 353 passing subtests.
  • Previous-head AMD finished with 5/6 diffusion partitions successful. In 2-GPU partition 1, the initial pass reported 13 passed, 1 skipped, 1 error. Both minimax_h3_t2va_2gpu_h100 and minimax_h3_ref2va_video_audio_2gpu_h100 passed their two requests. The remaining error was ltx_2_5_diffusion_decoder_2gpus: server readiness timeout after 1,200 seconds on all seven attempts, followed by the workflow step's 180-minute timeout. The last warmup logs reach diffusion decoder tiling (3 tiles across 2 ranks) and Inductor warnings; they do not establish the underlying stall's cause. This was a startup/warmup timeout, not an SSIM assertion. The maintainer sync did not change python/sglang/multimodal_gen, so it should not be described as a proven fix for that timeout.
  • Previous-head CUDA 2-GPU partition 1 passed on attempt 6 under the existing retry policy. LTX average denoise was 390.36 / 325.26 / 361.57 / 455.01 / 396.37 ms on failed attempts, then 267.01 ms on the passing attempt. Wan also had an initial load-latency failure. This is eventual CI success, not evidence of stable LTX latency or a proven performance fix.

No tolerance, startup timeout, or retry policy has been changed by this PR.

This branch has not been deployed

No deployments
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

diffusion SGLang Diffusion quant LLM Quantization run-ci CI: run the baseline test suite on this PR

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants