[AMD] Use aiter CK layernorm2d for LayerNorm to reduce NSA indexer kernel launches#22424
Merged
HaiShaw merged 4 commits intosgl-project:mainfrom Apr 9, 2026
Merged
Conversation
Contributor
|
Warning You have reached your daily quota limit. Please wait up to 24 hours and I will start processing your requests again! |
HaiShaw
approved these changes
Apr 9, 2026
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.
cc @Jacob0226
Motivation
The current
LayerNormon HIP uses the torch implementation and triggers an extra dtype cast at both entry and exit. This results in 3 kernels perLayerNormcall (cast -> layernorm -> cast), hurting the performance of operations likek_norm()in the GLM-5-FP8 NSA indexer.Modifications
LayerNorm.forward_hip(), use the aiter CK kernellayernorm2d_fwd()when the dtype isbf16orfp16. For other dtypes, fall back to the original torch code path.k_normdtype in the NSA indexer fromfp32tobf16when aiter is enabled, so it can take the CK kernel path.Accuracy Tests
LayerNorm unit test:
python -m pytest python/sglang/test/test_layernorm.py::TestLayerNorm -vModel test:
Speed Tests and Profiling
GLM-5-FP8 server command on MI355:
Benchmark on MI355X TP8, concurrency 4/8/16/32/64 averaged (baseline: sglang PR #22258 + aiter PR #2575):
Per-layer profiling:
Checklist
Review and Merge Process
/tag-and-rerun-ci,/tag-run-ci-label,/rerun-failed-ci