Add activation mode to com.microsoft::GatedRMSNorm for SiLU/Swish/Sigmoid across CPU, CUDA, and WebGPU - #32512
Merged
kunal-vaishnavi merged 9 commits intoSep 18, 2026
Conversation
|
Azure Pipelines: There may be pipelines that require an authorized user to comment /azp run to run. |
Contributor
There was a problem hiding this comment.
Copilot wasn't able to review any files in this pull request.
💡 Configure MCP servers for context-aware, tailored reviews. Learn more in the docs.
Co-authored-by: kunal-vaishnavi <115581922+kunal-vaishnavi@users.noreply.github.com>
Copilot
AI
changed the title
[WIP] Extend GatedRMSNorm operator to support sigmoid-gated behavior
Add Sep 9, 2026
activation mode to com.microsoft::GatedRMSNorm for SiLU/Swish/Sigmoid across CPU, CUDA, and WebGPU
Copilot started reviewing on behalf of
Ti-Tai Wang (titaiwangms)
September 9, 2026 18:44
View session
Contributor
There was a problem hiding this comment.
🟡 Changes recommended
The CUDA negative sigmoid path loses precision, its stability test cannot detect that regression, and generated operator documentation is stale.
Once you've addressed the issues Copilot identified, you can request another Copilot review.
Review details
- Files reviewed: 10/10 changed files
- Comments generated: 3
- Review effort level: Balanced
Co-authored-by: kunal-vaishnavi <115581922+kunal-vaishnavi@users.noreply.github.com>
Co-authored-by: kunal-vaishnavi <115581922+kunal-vaishnavi@users.noreply.github.com>
Co-authored-by: kunal-vaishnavi <115581922+kunal-vaishnavi@users.noreply.github.com>
Co-authored-by: kunal-vaishnavi <115581922+kunal-vaishnavi@users.noreply.github.com>
Ti-Tai Wang (titaiwangms)
previously approved these changes
Sep 10, 2026
Co-authored-by: kunal-vaishnavi <115581922+kunal-vaishnavi@users.noreply.github.com>
Co-authored-by: kunal-vaishnavi <115581922+kunal-vaishnavi@users.noreply.github.com>
Co-authored-by: kunal-vaishnavi <115581922+kunal-vaishnavi@users.noreply.github.com>
Copilot started reviewing on behalf of
Ti-Tai Wang (titaiwangms)
September 15, 2026 20:13
View session
Contributor
There was a problem hiding this comment.
🟢 Approval recommended
The cross-EP implementation and tests are coherent, with only a non-blocking documentation-scope mismatch.
Review details
- Files reviewed: 12/12 changed files
- Comments generated: 1
- Review effort level: Balanced (auto)
Note
Copilot is running an experiment and ran this review at Balanced.
Ti-Tai Wang (titaiwangms)
approved these changes
Sep 15, 2026
kunal-vaishnavi
added a commit
that referenced
this pull request
Sep 15, 2026
### Description This PR expands `com.microsoft` contrib-op support needed by the Qwen4-Exp / Qwen3.8-Flash-Next text architecture, focused on Engram gating and n-gram hash mapping. The `GatedRMSNorm` activation-mode changes were removed from this PR and are now covered separately by #32512. Changes include: - `EngramGate`: add optional `conv_norm_scale` input and optional `gated_value_normed` output for the normalized gated-value path. - `NGramHashMapping`: add autoregressive decode and packed-sequence support with optional `past_ids`, `present_ids`, `head_offsets`, `eos_token_id`, `segment_ids`, and `reset_on_eos` behavior. - CPU, CUDA, and WebGPU implementations for the retained EngramGate and NGramHashMapping behavior. - Generated contrib operator/kernel documentation for the retained schema and kernel changes. - Extended contrib-op tests covering CPU/CUDA/WebGPU behavior, in-place state handling, packed sequences, EOS reset behavior, and EngramGate normalized output. ### Motivation and Context Qwen4-Exp requires n-gram embeddings and Engram-style gating variants that were not fully covered by the existing contrib operators. This PR extends the relevant operators incrementally while preserving prior behavior by default. `GatedRMSNorm` sigmoid/activation support is intentionally excluded here so that it can be reviewed and merged via #32512. --------- Co-authored-by: copilot-swe-agent[bot] <198982749+Copilot@users.noreply.github.com> Co-authored-by: kunal-vaishnavi <115581922+kunal-vaishnavi@users.noreply.github.com>
kunal-vaishnavi
enabled auto-merge (squash)
September 16, 2026 18:59
kunal-vaishnavi
approved these changes
Sep 16, 2026
Ti-Tai Wang (titaiwangms)
approved these changes
Sep 16, 2026
Akshay Sonawane (apsonawane)
approved these changes
Sep 18, 2026
kunal-vaishnavi
deleted the
copilot/extend-gatedrmsnorm-contrib-operator
branch
September 18, 2026 23:24
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.
Description
com.microsoft::GatedRMSNormpreviously hardcoded SiLU gating; this PR keeps backward-compatible default behavior (silu) and adds explicit activation selection across CPU, CUDA, and native WebGPU.Schema + docs
activationtoGatedRMSNormschema with default"silu"."silu","swish"(alias),"sigmoid".CPU kernel
activationduring kernel construction.z * sigmoid(z)sigmoid(z)CUDA kernel
activationin host wrapper.LaunchGatedRMSNormKernel(no device-side string handling).WebGPU kernel
activation.CacheHintto avoid shader-cache collisions.normalized * stable_sigmoid(z)(sigmoid)normalized * (z * stable_sigmoid(z))(silu/swish)Cross-EP tests (
linear_attention_gates_op_test.cc)GatedRMSNormtest helper to take activation mode and activation attribute."silu""swish"alias parity with SiLU"sigmoid"reference parityMotivation and Context
Models can require sigmoid output gating while existing ORT
GatedRMSNormwas SiLU-only. This change enables both gating modes under the same operator ABI and keeps existing models behavior-identical by default.