Repository navigation
[AMD] Quantize AITER unified prefill queries to FP8 - #39998
Open
vorapolsiloai wants to merge 1 commit into
Open
vorapolsiloai wants to merge 1 commit into
vorapolsiloai wants to merge 1 commit into
Conversation
This was referenced Sep 20, 2026
vorapolsiloai
marked this pull request as ready for review
September 21, 2026 10:16
vorapolsiloai
requested review from
Fridge003,
HaiShaw,
Qiaolin-Yu,
hebiao064,
ispobock and
merrymercy
as code owners
September 21, 2026 10:16
Unified prefill currently leaves Q in BF16 when the KV cache is FP8, so AITER's FP8 Q/KV configurations and Gluon capability gate do not match. Mirror the established unified-decode conversion while preserving BF16 KV. - Quantize flattened prefill Q with the layer K scale - Pass the matching Q descale into unified attention - Cover FP8 conversion, cu-seqlens, output shape, and BF16 passthrough
vorapolsiloai
force-pushed
the
perf/aiter-fp8q-unified-prefill
branch
from
October 8, 2026 19:59
83b1080 to
c4cb7d9
Compare
3 of 5 tasks
This branch has not been deployed
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
#38757 routes AITER extend/prefill through
unified_attention. When the KV cache is FP8, it still passes Q in BF16. AITER then sees a BF16-Q / FP8-KV call, which has two effects:The unified decode path already quantizes Q to FP8 with
scaled_fp8_quant()and passes the matchingq_descale. This PR makes prefill do the same.Modifications
In
_forward_extend_unified(), whenkv_cache_dtypeis FP8:layer.k_scale, or the backend default), as decode does.q_descaletounified_attention.With a BF16 KV cache, nothing changes.
When this code runs:
_forward_extend_unified()is used whenSGLANG_USE_AITER_UNIFIED_ATTN=1is set, and also, automatically, for models with a sliding-window KV pool. In both cases decode already uses FP8 Q, so this change gives prefill the same Q precision as decode. Routing does not change.Kernel selection check
MI355X, Qwen3.8-27B (24 Q heads, 4 KV heads,
head_dim=256), FP8 KV:D_GEQ_256(BLOCK_M=16, tile 32)D_GEQ_256.Q_GEQ_256.DT_fp8_fp8(BLOCK_M=128, tile 64)Accuracy Tests
test_aiter_fp8_q_unified_attention.py:q_descaleis passed,cu_seqlens_qis correct, and the output shape and dtype are unchanged.q_descaleisNone.test/registered/attention/test_aiter_fp8_q_unified_attention.pypass cleanly.Speed Tests and Profiling
These numbers are for this PR together with ROCm/aiter#5598. This PR is what lets AITER pick the FP8 config, but the speedup comes from the AITER kernel.
MI355X, TP1, Qwen3.8-27B MXFP4, FP8 KV,
--chunked-prefill-size 16384. Same request count and token count in every run.The baseline is the same setup without this PR or aiter#5598. With prefill-heavy requests (output length 8), median TTFT was 52% lower at 60K input and 65% lower at 128K input than the same stack with BF16 Q.
Checklist
CI States
Latest PR Test (Base): ❌ Run #37836096134
Latest PR Test (Extra): ❌ Run #37836095849
Latest PR Test (AMD ROCm 10): ❌ Run #37836096212