Repository navigation
[NPU] Add capability-based Gemma RMSNorm dispatch - #32908
Closed
TallMessiWu wants to merge 5 commits into
Closed
TallMessiWu wants to merge 5 commits into
TallMessiWu wants to merge 5 commits into
Conversation
npu_gemma_rms_norm has no kernel registered for socVersion ascend950 (A5), causing graph capture to fail with "does not support opType [GemmaRmsNorm]". Gemma RMSNorm equals normalize(x) * (1 + weight), so a plain npu_rms_norm with gamma = 1 + weight is mathematically equivalent and is implemented across A2/A3/A5.
Only Ascend A5 (soc_version 260 / ascend950) lacks the npu_gemma_rms_norm kernel; A2/A3 (910) support it. Branch on is_npu_a5() so A5 uses the equivalent npu_rms_norm(x, 1 + weight) fallback while A2/A3 keep the native fused op, mirroring vllm-ascend's per-device dispatch.
Contributor
|
Caution The consumer version of Gemini Code Assist on GitHub has been sunset. All code review activity has officially ceased. |
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.
Important
WIP - please do not review this PR yet.
This PR is a concrete architecture-comparison branch. Please hold off on reviewing it until the WIP notice is removed.
Purpose of this draft
This draft provides a functionally equivalent alternative to #32745 together with sgl-project/sgl-kernel-npu#638, so we can compare the ownership boundary without comparing different feature coverage.
Both alternatives now implement the same product behavior:
sgl-kernel-npuTriton kernelsgl-kernel-npuTriton kernelnpu_rms_normfallbacknpu_rms_normfallbackBoth
GemmaRMSNormandGemma3RMSNormdelegate their ordinary and residual paths through the selected implementation.The intended comparison is therefore only architectural:
NPUDeviceOperator.sgl-kernel-npuowns product detection and provider selection.The comparison should help determine the better long-term extension point for other operators with product-specific behavior, considering ownership, duplicated dispatch code, future Ascend products, dependency boundaries, and test surface.
Summary
is_npu_a5()NPUDeviceOperatorfacade for ordinary and residual-add Gemma RMSNormsgl-kernel-npuTriton kernel on Ascend 950, and conservative decomposed fallbacks for unknown productsGemmaRMSNormandGemma3RMSNormordinary/residual NPU paths through the facadeSGLANG_NPU_FORWARD_NATIVE_GEMMA_RMS_NORMas a debugging switchContext
Qwen3.5 uses Gemma RMSNorm. The native
npu_gemma_rms_normoperator is available on Ascend 910B/910C but has no registered kernel on Ascend 950, so directly calling it prevents Qwen3.5 from running on Ascend 950.This PR intentionally keeps product detection and provider selection in SGLang. It depends only on the existing Triton Gemma kernel import path and does not require the new stable API proposed by sgl-project/sgl-kernel-npu#638.
Validation
GemmaRMSNormandGemma3RMSNormordinary/residual pathspy_compile, Black, isort, andgit diff --checkpassedresourcemodule; it remains available for normal Linux CIStatus
This remains a WIP comparison branch and is not proposed as a replacement for #32745 yet.
CI States
Latest PR Test (Base): ❌ Run #30529969847
Latest PR Test (Extra): ❌ Run #30529969638