Skip to content

[HIP] Optional sigmoid on gated_rmsnorm_fp8_per_token_quant - #5392

Merged
junhaha666 merged 4 commits into
ROCm:mainfrom
rebklee:rebklee/hip/gated-rmsnorm-fp8-per-token-sigmoid
Oct 9, 2026
Merged

junhaha666 merged 4 commits into
ROCm:mainfrom
rebklee:rebklee/hip/gated-rmsnorm-fp8-per-token-sigmoid

Conversation

@rebklee

@rebklee rebklee commented Sep 10, 2026

Copy link
Copy Markdown
Contributor

Summary

gated_rmsnorm_fp8_per_token_quant is SiLU-only today (norm(x) * silu(z)), from #3844. Qwen GDN / SGLang #28655 need that default. Kimi-K3 o_norm is FusedRMSNormGated(activation="sigmoid"): norm(x) * sigmoid(z).

This PR adds use_sigmoid=False on the existing API (last arg, default false). Host if instantiates USE_SIGMOID on the kernel, same pattern as TRANSPOSE_SCALE on the group kernel in this file. RMSNorm, token-wide amax, FP8 store, and the 0x80 flush are unchanged.

gated_rmsnorm_fp8_group_quant is not touched.

Testing

op_tests/test_gated_rmsnorm_fp8_quant.py checks the HIP kernel against a PyTorch reference (dequantized values + per-token scales) for both gates:

  • default SiLU (use_sigmoid=False) vs a SiLU ref
  • use_sigmoid=True vs a sigmoid ref
  • bf16 and fp16 (--dtype bf16 / --dtype fp16)
python3 op_tests/test_gated_rmsnorm_fp8_quant.py --dtype bf16
python3 op_tests/test_gated_rmsnorm_fp8_quant.py --dtype fp16

gfx950 MI355X, image rocm/pytorch:rocm7.2.4_ubuntu24.04_py3.12_pytorch_release_2.10.0.
Dequant checkAllclose atol=rtol=0.01 (fail if mismatch fraction > 5%); scales atol=rtol=0.001.
This run: 112/112 Test PASSED, 0 failed!. 65 dequant warning! (34 bf16, 31 fp16) are FP8 tails at 0.0% mismatch; they also show up on the unchanged group kernel.

Latency

Same launch and shapes. Sigmoid is the same kernel minus the extra z multiply. HIP times stay in the same band across gates and across bf16/fp16.

HIP times (us):

num_tokens num_heads bf16 SiLU bf16 sigmoid fp16 SiLU fp16 sigmoid
1 32 3.37 3.19 3.37 3.21
3 32 3.91 3.91 3.90 3.83
128 32 5.11 5.22 5.16 5.18
256 32 5.86 5.89 5.74 5.79
512 32 7.67 7.56 7.58 7.62
1024 1 5.33 5.32 5.32 5.31
1024 12 6.65 6.72 6.70 6.64
1024 16 7.48 7.43 7.50 7.46
1024 32 10.81 10.61 10.79 10.87
1024 40 12.98 12.92 12.98 12.90
1024 64 17.14 17.06 17.44 17.05
2048 16 10.51 10.37 10.51 10.51
2048 32 17.18 17.42 17.38 17.51
2048 64 31.71 30.38 30.97 30.57
2048 128 59.41 58.50 58.73 59.45
4096 32 29.97 30.37 30.12 30.29
8192 32 55.15 56.02 55.30 56.46

Default stays SiLU (norm(x) * silu(z)). use_sigmoid=True uses sigmoid(z) instead, compiled via a USE_SIGMOID kernel template. Group-quant is unchanged.
@rebklee
rebklee requested a review from a team September 10, 2026 02:53
@github-actions

Copy link
Copy Markdown
Contributor

🏷️ CI Guide

Runs automatically on every PR:

  • ✅ Pre-checks (submodule verification, code formatting)
  • ✅ Aiter op tests (gfx942 + gfx950)
  • ✅ Triton tests on MI35X (only when aiter/ops/triton/** or related paths are changed)

Extended tests (opt-in via labels):

Label Tests
ci:gfx1250-ffm-triton Run the five-shard gfx1250 FFM Triton test suite
ci:triton-300x Run an additional Triton test job on MI300X in PRs; main branch always runs both MI35X and MI300X
multigpu Aiter multi-GPU tests on the 8-GPU runner
ci:sglang SGLang integration tests: DeepSeek-R1-MXFP4 accuracy, Qwen 3.5 accuracy
ci:atom ATOM benchmark: DeepSeek-R1-0528, GPT-OSS-120B
ci:atom_full ATOM accuracy suite for PR and main models from ATOM models_accuracy.json
ci:vllm vLLM benchmark: GPT-OSS-120B, DeepSeek-R1-0528, Kimi-K2.5
ci:all All standard extended tests (excludes ci:atom_full)

Only add ci:atom_full for FlyDSL or Triton upgrades.
Add labels via the sidebar or gh pr edit 5392 --add-label <label>

PR title tags & labels:
Component tags ([Triton/Gluon], [HIP], [CK], [ASM], ...) are added to the PR title and as PR labels automatically from the changed files and re-synced on every push — change-type tags like [fix]/[Perf], op tags like [MLA], and human labels (ci:*) are left untouched. Add the no-auto-title label to opt this PR out.

@github-actions github-actions Bot added the HIP label Sep 10, 2026
@zufayu
zufayu requested a review from junhaha666 September 11, 2026 01:54
@rebklee

rebklee commented Sep 24, 2026

Copy link
Copy Markdown
Contributor Author

@junhaha666 could you please help review? Thanks!

@junhaha666
junhaha666 merged commit 30ac225 into ROCm:main Oct 9, 2026
55 checks passed
yuychang added a commit to yuychang/sglang that referenced this pull request Oct 16, 2026
…rm FP8 fusion

- Pass use_sigmoid=True to gated_rmsnorm_fp8_per_token_quant, matching ROCm/aiter#5392.
- Update the comment: the kernel no longer rounds the gated value through bf16 before quantizing.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants