Repository navigation
Conversation
On the fused qk-norm/rope path (gfx95/gfx1250), _forward_prepare already quantizes the normed q_lora to fp8 group-128 for the attention wq_b. The C4 indexer's wq_b takes the same q_lora and quantized it again. Pass the existing quant through C4Indexer.forward -> forward_c4_indexer -> compute_q instead, saving one quant launch per C4 layer per step. It is dropped when the indexer trims q_lora; the multi-stream path is unchanged.
AMD-yanfeiwang
marked this pull request as ready for review
October 3, 2026 11:16
AMD-yanfeiwang
requested review from
Fridge003,
HaiShaw,
Qiaolin-Yu,
hebiao064,
ispobock and
merrymercy
as code owners
October 3, 2026 11:16
5 tasks
HaiShaw
approved these changes
Oct 16, 2026
HaiShaw
left a comment
Collaborator
There was a problem hiding this comment.
None none q_lora_quant is only set at HIP/gfx95/gfx1250
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.
Motivation
On the fused qk-norm/rope path (gfx95/gfx1250),
MQALayer._forward_preparealready quantizes the normedq_lorato fp8 group-128 (_fused_rmsnorm_fp8_quant) for the attentionwq_b. The C4 indexer'swq_btakes the sameq_loraand quantizes it again with a standalonedynamic_per_group_scaled_quant. For DeepSeek-V4-Pro that adds 30 extra launches per decode/verify step.Modifications
_forward_preparepasses the existing quant (q_lora_quant) throughC4Indexer.forward->forward_c4_indexer->compute_q, and the indexerwq_bconsumes it directly.None) when the indexer trimsq_lorato fewer queries. The non-fused path, the multi-stream path, NPU and the low-ratio arms are unchanged.forward_c4_indexeronly receives the kwarg when it is set.Accuracy Tests
wq_balready uses, so the indexerwq_binput is identical to its own quant ofq_lora.lmsysorg/sglang-rocm:v0.5.20-rocm724-mi35x-20260927+ this PR only: gsm8k 200q 0.965. A capture-time print confirmed that the reuse path runs on all 8 ranks.Speed Tests and Profiling
Kernel: each removed
dynamic_per_group_scaled_quantlaunch shows as 4.3 us in the graph-mode trace (about 3.8 us after subtracting profiler overhead). With 30 launches per step, the trace estimate was about 0.11-0.13 ms per step. The measured E2E saving is 0.06-0.09 ms per step, which is about 2-3 us per launch.E2E, DeepSeek-V4-Pro fp8, TP8 MI355X, image
lmsysorg/sglang-rocm:v0.5.20-rocm724-mi35x-20260927, 8k in / 1k out. Measured on our DSv4 decode stack: #41383 (FlyDSL fused decode, with ROCm/aiter#5882 and the aiter fp32-out HGEMM fix), the DSpark verify ring write, #38919 + #38920 (env on), the MoE small-batch sort and the fp32 GEMM aiter route. Before = that stack; after = stack + this PR. It was developed there; the diff on main is the same minus the #38920kv_score_inputplumbing. 2 boots x 3 reps, paired:All 24 two-boot pairs are faster.
Checklist
CI States
Latest PR Test (Base): ❌ Run #38719443823
Latest PR Test (Extra): ❌ Run #38719443685
Latest PR Test (AMD ROCm 10): ❌ Run #38719443733