Repository navigation
[BugFix] Restore vllm_c IR op priority and torch.nn.RMSNorm for Qwen-Image (#4964) - #5009
Merged
Gaohan123 merged 6 commits intoJul 10, 2026
Conversation
…roject#4964) The v0.24 rebase adopted upstream inductor-aware CUDA defaults that select native-only RMSNorm when compilation is active. For Qwen-Image diffusion this forces the denoise loop onto a slower native decomposition path instead of vLLM CUDA kernels, causing large nightly perf regressions. Restore Omni's default IR op priority to prefer vllm_c kernels while keeping the existing VLLM_USE_OINK_OPS behavior. Fixes vllm-project#4964 Signed-off-by: NumberWan <wantszkin2003@gmail.com>
|
Codex usage limits have been reached for code reviews. Please check with the admins of this repo to increase the limits by adding credits. |
Signed-off-by: NumberWan <wantszkin2003@gmail.com>
Contributor
Author
|
@SamitHuang @Gaohan123 PTAL |
Gaohan123
reviewed
Jul 10, 2026
Gaohan123
left a comment
Collaborator
There was a problem hiding this comment.
Please add a UT to protect it
Revert to the vllm-project#4074 RMSNorm backend for Qwen-Image diffusion layers. Avoids vLLM IR dispatch overhead on the denoise hot path. Signed-off-by: NumberWan <wantszkin2003@gmail.com>
NumberWan
requested review from
Isotr0py,
RuixiangMa,
SamitHuang,
ZJY0516,
david6666666,
princepride,
wtomin and
yenuo26
as code owners
July 10, 2026 08:21
Gaohan123
reviewed
Jul 10, 2026
…#4964) Assert inductor-active configs still prefer vllm_c over native for rms_norm and fused_add_rms_norm, including VLLM_USE_OINK_OPS ordering. Signed-off-by: NumberWan <wantszkin2003@gmail.com>
NumberWan
force-pushed
the
fix/4964-restore-vllm-c-ir-priority
branch
from
July 10, 2026 08:28
319b313 to
efed12d
Compare
This was referenced Jul 10, 2026
Closed
Gaohan123
reviewed
Jul 10, 2026
Gaohan123
left a comment
Collaborator
There was a problem hiding this comment.
Please supplement performance comparison with P1+P2 and main
Contributor
Author
The supplement performance has been added . Details have been added in the PR description |
Gaohan123
enabled auto-merge (squash)
July 10, 2026 16:58
wkutak
pushed a commit
to wkutak/vllm-omni-cosmos-genai-nim
that referenced
this pull request
Jul 13, 2026
…Image (vllm-project#4964) (vllm-project#5009) Signed-off-by: NumberWan <wantszkin2003@gmail.com> Signed-off-by: Wojciech Kutak <wkutak@nvidia.com>
bowieshi
pushed a commit
to bowieshi/vllm-omni
that referenced
this pull request
Jul 14, 2026
…Image (vllm-project#4964) (vllm-project#5009) Signed-off-by: NumberWan <wantszkin2003@gmail.com>
Claisenn
added a commit
to Claisenn/vllm-omni
that referenced
this pull request
Aug 1, 2026
…Image (Same As vllm-project#5009) (vllm-project#5017) Signed-off-by: NumberWan <wantszkin2003@gmail.com>
This was referenced Sep 4, 2026
khairulkabir1661
pushed a commit
to khairulkabir1661/vllm-omni
that referenced
this pull request
Sep 25, 2026
…Image (vllm-project#4964) (vllm-project#5009) Signed-off-by: NumberWan <wantszkin2003@gmail.com>
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Purpose
Fixes #4964
After the v0.24 rebase (#4709), Qwen-Image nightly perf regressed for two independent reasons. This PR lands both fixes in one place:
vllm_omni/platforms/cuda/platform.pynative-only RMSNorm dispatchvllm_omni/diffusion/models/qwen_image/qwen_image_transformer.pytorch.nn.RMSNormShort Summary
](Qwen-Image vs main, local H200): After this PR, serving
latency_mean−26.9% (1.7263s → 1.2613s; 512², 10 steps, C=1) andtest_qwen_image_matches_diffusersaccuracy recovers (SSIM 0.9477 → 0.9786, PSNR 26.20 → 31.09 dB; FAIL → PASS).Part 1 — Platform: restore
vllm_cIR op priorityProblem
CudaOmniPlatform.get_default_ir_op_priority()followed upstream inductor-aware CUDA defaults. When inductor compilation is active,rms_norm/fused_add_rms_normpriority becomes["native"]only.For Qwen-Image diffusion, this forces repeated RMSNorm calls in the denoise loop onto a slower native decomposition path instead of vLLM CUDA (
vllm_c) kernels, causing large nightly perf regressions across Qwen-Image workloads.This part restores Omni's CUDA default IR op priority to
["vllm_c", "native"]while preserving existingVLLM_USE_OINK_OPSbehavior.Before / After Rebase
Before #4709, Omni CUDA platform always preferred
vllm_ckernels, regardless of whether inductor compilation was active:get_default_ir_op_priority()["vllm_c", "native"]always["native"]when inductor active["vllm_c", "native"]always (= pre-#4709)_C::rms_normaten::meandecomposition_C::rms_norm#4709 copied upstream vLLM 0.24 logic: inductor on → prefer
nativefor op fusion (reasonable for LLM AR). Qwen-Image already rantorch.compilepre-#4709 but keptvllm_c— diffusion denoise loops are RMSNorm-heavy andvllm_cis faster. Part 1 removes theusing_inductorbranch #4709 added.Root cause (Part 1)
["vllm_c", "native"]["native"]only_C::rms_norm/vllm::rms_norm_kernelaten::meanx ~2000)Part 1 — Test plan and result
Local validation on H200, Qwen-Image-2512, 512×512.
Kernel dispatch(profiler,4 steps,offline)
stage_0_gen_msaten::meana560ed18(broken)Profiler shows RMSNorm dispatch switching from native decomposition back to
_C::rms_norm.E2E serving(C=1,20 steps,n=10)
latency_meanc45ac74d(v0.23)a560ed18(v0.24, broken)Part 1 recovers the kernel path and most of the profiler gap, but E2E serving on v0.24 does not fully return to v0.23 levels — likely additional v0.24 rebase overhead outside RMSNorm.
Qwen-Image-2512 pixelwise vs diffusers (3 variants; skip P1+P2)
test_qwen_image_2512_matches_diffusers_pixelwise— 1664×928, 50 steps, seed=42. Thresholds: mean_abs_diff ≤ 3e-2, p99_abs_diff ≤ 4e-1.All three pass pixelwise thresholds vs diffusers. Part 1 IR priority change does not materially shift 2512 output vs main.
Non-Qwen A/B — FLUX.1-dev (justify global platform default)
Part 1 only — isolates platform IR priority (
native-only vsvllm_c+native).FLUX.1-dev uses
vllm.model_executor.layers.layernorm.RMSNorm(same IR dispatch path as #4964).Local validation: H200, v0.24 venv, single GPU, C=1.
Serving perf (512², 8 steps, n=5):
latency_mean["native"]only["vllm_c", "native"]Accuracy (FLUX.1-dev offline cross-variant, 512², 8 steps, seed=42): main vs Part 1 — SSIM 0.992, PSNR 41.27 dB (output unchanged).
Other models on the same
vllm.model_executor.layers.layernorm.RMSNormIR path (Part 1 applies; local A/B not run unless noted):FLUX.1-dev, FLUX.2 / FLUX.2 Klein, Wan22S2V, HunyuanVideo15, SD3, OmniGen2, LongCat, Ernie, Ovis, LTX-2 / LTX-2.3 (local serving A/B: parity).
tests/platforms/test_cuda_ir_op_priority.py(CPU):CompilationMode.NONE/VLLM_COMPILE/STOCK_TORCH_COMPILE→rms_norm == ["vllm_c", "native"]VLLM_USE_OINK_OPS=1→rms_norm == ["oink", "vllm_c", "native"]Part 2 — Model: restore
torch.nn.RMSNormfor Qwen-ImageProblem
Separate from Part 1: Qwen-Image transformer norm layers were switched back to
vllm.RMSNormin #3588 while adding AutoRound W4A16 — an accidental revert of #4074.torch.nn.RMSNorm— fixed SSIM (#4029) and improved latencyvllm.RMSNormwhile adding AutoRound support#3588 did not require vLLM
RMSNormon norm layers themselves (W4A16 quant targets Linear weights). Part 2 restores #4074's backend while keeping #3588 quant paths intact.torch.nn.RMSNormbypasses vLLM IR /vllm_cdispatch on Qwen-Image's RMSNorm-heavy denoise loop — independent of Part 1's platform priority.Change (Part 2)
vllm_omni/diffusion/models/qwen_image/qwen_image_transformer.pyonly:norm_q/norm_knorm_added_q/norm_added_ktxt_normPart 2 — Test plan and result
Local validation: H200, v0.24 venv, Qwen-Image, 512×512.
Serving benchmark (#4074-style: 10 steps, n=10, C=1)
latency_meanthroughput_qpslatency_p50vllm.RMSNorm, native IR (#4709)torch.nn.RMSNorm,vllm_cIRThis PR vs main:
latency_mean−26.9% (1.7263s → 1.2613s).Part 2 isolation (Part 1 held fixed; supplementary)
latency_meanthroughput_qpslatency_p50vllm.RMSNorm(P1 fixed; Part 2 reverted)torch.nn.RMSNorm(P1+P2)Holding Part 1 constant, Part 2 alone:
latency_mean−10.1%.Accuracy vs diffusers (
test_qwen_image_matches_diffusers, 512², 20 steps)vllm.RMSNorm, native IR (#4709)torch.nn.RMSNorm,vllm_cIRMain regresses on both Part 1 (IR path) and Part 2 (
vllm.RMSNormsince #3588). This PR fixes both.Part 2 isolation (Part 1 held fixed; supplementary)
vllm.RMSNorm(P1 fixed; Part 2 reverted)torch.nn.RMSNorm(P1+P2)Holding Part 1 constant, Part 2 alone recovers accuracy vs diffusers (PSNR 29.52 → 31.09).
Unit / regression tests (Part 2)
test_qwen_image_matches_diffuserstest_qwen_image_autoround_w4a16_loadtest_qwen_image_autoround_w4a16_generateConfirms W4A16 checkpoint still loads and generates correctly with
torch.nn.RMSNorm.How Part 1 and Part 2 relate
CI test plan (combined)
tests/platforms/test_cuda_ir_op_priority.py(Part 1, local CPU)test_qwen_image_matches_diffusers(Part 2, local)test_qwen_image_autoround_w4a16_load/_generate(Part 2, local)BEFORE SUBMITTING: read CONTRIBUTING.md and run the precheck-pr skill with the code agent for a self-check against project conventions.
(anything written below this line will be removed by GitHub Actions)