Conversation
…llapse Keeps FP32 variance through rsqrt and the gamma multiply for SimplifiedLayerNorm and SkipSimplifiedLayerNorm so the router logits stay FP32 -- fp16 rounding here collapses MoE top-k routing on GPT-OSS. Adds find_skip_simplified_layer_norm to isolate the SLN subgraph (fuse_attention.cpp) and compiles it as an MLIR group (fuse_mlir.cpp) + a skip_simplified_layer_norm kernel. Co-Authored-By: Claude <noreply@anthropic.com>
pfultz2
requested changes
Sep 14, 2026
| float result = (x_val + sk_val) * inv_std * g_val; | ||
| output[token_idx * hidden_size + i] = __float2half(result); | ||
| } | ||
| } |
Collaborator
There was a problem hiding this comment.
We already provide a layernorm kernel through the reduction kernels
| // Each thread applies normalization in FP32 and writes fp16 output | ||
| for(index_int i = thread_idx; i < hidden_size; i += BLOCK_SIZE) | ||
| { | ||
| float x_val = __half2float(input[token_idx * hidden_size + i]); |
Collaborator
There was a problem hiding this comment.
This loads the input twice. The reduction kernel already handles this in an efficient manner,.
rlegithub
marked this pull request as ready for review
September 14, 2026 21:21
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.
Summary
Keeps FP32 variance through rsqrt and the gamma multiply for
SimplifiedLayerNormalization/SkipSimplifiedLayerNormalization, so the router logits feeding the MoE stay FP32. fp16 rounding at this point collapses top-k expert routing on GPT-OSS-20B (wrong experts → garbage decode).parse_simplified_layer_normalization.cpp,parse_skip_simplified_layer_normalization.cppfind_skip_simplified_layer_normisolates the SLN subgraph (fuse_attention.cpp) and compiles it as an MLIR group (fuse_mlir.cpp) preserving the FP32 gamma multiplyskip_simplified_layer_normkernel2 of 3 PRs enabling GPT-OSS-20B (with the fused MoE op and GQA-attention-sink PRs).
Test plan