Repository navigation
Conversation
Use the existing XPU RMSNorm op for guarded bsz=1 FP16 decode norms while preserving the native fallback for all other paths.
Reuse the existing XPU RMSNorm op for guarded weightless QK norm decode shapes while retaining the model-local fallback.
Signed-off-by: Xiangyu Tian <109123695+xiangyuT@users.noreply.github.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.
Scope and current state
This PR is anchored to the exact Muse-Glimmer v0.29 source baseline:
baseline/muse-glimmer-v029-2026092198dff2a81d747d1dba01a47f939f48c3526d420648f43667b0bd5e7bec3ed87c185987e44c915d9b6d92b1bfbf32767ecda8e819613eb151e70030ad(
0.1.14.1tag); no kernels source change is included.The earlier two model-local MuseGlimmer RMSNorm commits were intentionally
reverted. The current implementation is a standard-layer integration and
generic XPU dispatch change; no worker monkeypatch is included.
Upstream source conclusion
Current upstream
mainstill definesMuseGlimmerRMSNormas a plaintorch.nn.Moduleinvllm/model_executor/models/muse_glimmer.py. Itsforwardperforms FP32 cast, reduction, rsqrt and weight multiplication directly. The
Muse decoder calls these modules directly, including QK norm.
The generic vLLM
RMSNormandGemmaRMSNormclasses do haveCustomOp/XPUdispatch paths, but MuseGlimmer does not instantiate those classes. Therefore:
vllm-xpu-kernelscannot intercept the current Muse Python normchain;
layernorm.pydispatch does not affect MuseGlimmer;models/muse_glimmer.pyis thewrong boundary; a minimal conversion to standard norm-layer declarations is
a separate modeling cleanup required to expose the generic dispatch.
References:
RMSNorm, includinghas_weight=False: https://github.com/vllm-project/vllm/blob/e9f169d16b9408bb9ae44f75072b91a5521d733c/vllm/model_executor/layers/layernorm.py#L30-L116GemmaRMSNormimplementation: https://github.com/vllm-project/vllm/blob/a0d3e5c16e96b62ec5c7f741952cfddc99534faf/vllm/model_executor/layers/layernorm.py#L130-L194Implemented design
The worker-level monkeypatch draft is not the recommended implementation. A
more idiomatic path is to make MuseGlimmer declare the standard vLLM norm
layers, exactly as Gemma and Qwen3.5 do:
GemmaRMSNormfor the four sandwich norms (weight + 1semantics);RMSNorm(..., has_weight=False)for QK and embedding norms;RMSNormfor the final scale norm.Those are model semantics, not model-specific fast-path code. They preserve the
checkpoint parameter names and allow all backends to use the same fallback
behavior. The implementation backports upstream's XPU
GemmaRMSNorm.forward_xpuand its_xpu_ops.pywrappers into the v0.29 branch.The exact kernels commit
6d92b1bfbf32767ecda8e819613eb151e70030adalreadyprovides
gemma_rms_normandfused_add_gemma_rms_norm; no kernels sourcechange is needed for the ordinary norm optimization. The existing generic XPU
RMSNormpath already accepts an optional weight for weightless norms.This design removes the model-local Python reduction from the optimized path,
keeps backend dispatch in
layernorm.py, and remains compatible with nativeand non-XPU execution. A strict prohibition on any
muse_glimmer.pywiringchange would force an implicit worker transform and is not aligned with the
other vLLM model implementations.
Current validation
Commit
48f43667b0bd5e7bec3ed87c185987e44c915d9bcontains the implementationand XPU dispatch tests. Static compilation and diff checks passed.
On
vllm/vllm-openai-xpu:v0.29.0, using devices 2/3 and the exact Muse model:gemma_rms_normprobe: max error0;0.0009765625, aliases preserved;0;32768/512, two warmups, seeds 42/43/44:36.609,36.791,36.701 ms/token, mean36.700;10/10, invalid0.The default V2 runner measured
39.029 ms/token; it is retained separatelybecause the historical
34.156 ms/tokencandidate used V1. A unitrace targetrequest completed, but the profiler output lacked decode-step/raw kernel events,
so no structural trace claim is made.
Residual-fusion boundary
The current MuseGlimmer sandwich order is
norm(attention_output) + residual,while vLLM's existing
fused_add_rms_normisnorm(attention_output + residual). Enabling the existing op would change themodel math. The downstream
norm_add_normpath is a separate primitive thatfuses
norm(x) * w1 + residualfollowed by a second norm. If pursued, it needsa generic XPU op/layer with a native fallback and guarded shape/dtype dispatch;
it must not be represented as
fused_add_rms_norm. It should be reviewed andvalidated separately from the standard norm conversion.
Historical evidence (not a current PR claim)
The previously tested model-local candidate, which is no longer in the effective
PR diff, achieved:
60.758 ms/token45.258 ms/token34.156 ms/token3843 -> 13472825 -> 329Both historical candidate stages passed the available E2E output checks. The
final historical candidate also passed the serial 5-shot GSM8K smoke:
10/10, invalid0, with all ten output text hashes matching upstream.These numbers are retained as diagnostic evidence only; they must be reproduced
after implementation is moved to the accepted XPU-only boundary.
Remaining validation and limitations
environment, including non-XPU, BF16, prefill, non-contiguous and fallback
paths.
kernel trace is captured; the current target request is retained but lacks
decode-step/raw kernel events.
norm-add-normfusion remains intentionally out of scope for thisimplementation and requires a separate generic primitive.
No formal acceptance, long-duration stability, or full accuracy claim is made by
this PR. The detailed local evidence is retained under
codex_output/muse-glimmer-decode-trace-20260921/.