[ROCm][Bugfix] Use BF16 MLA prefill for short prompts - #51380
Closed
LiuYinfeng01 wants to merge 1 commit into
Closed
[ROCm][Bugfix] Use BF16 MLA prefill for short prompts#51380LiuYinfeng01 wants to merge 1 commit into
LiuYinfeng01 wants to merge 1 commit into
Conversation
LiuYinfeng01
force-pushed
the
fix/rocm-mla-short-prefill-accuracy
branch
3 times, most recently
from
August 7, 2026 09:12
8f4c127 to
3b01495
Compare
Avoid FP8 rounding perturbations on short greedy-decoding requests while preserving the optimized AITER path for long-context prefill.
LiuYinfeng01
force-pushed
the
fix/rocm-mla-short-prefill-accuracy
branch
from
August 7, 2026 09:18
3b01495 to
4229af5
Compare
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
Route ROCm MLA prefill requests shorter than 1024 tokens through the BF16 FlashAttention implementation. Keep the optimized AITER FP8 MLA prefill path for long, context-free requests.
Problem
AiterMLAImpl.forward_mha()previously selected AITER FP8 prefill for every request without chunked context, including short greedy-decoding prompts. On Kimi-K3 PP8, the GSM8K-100 5-shot prompts were 603–698 tokens. FP8 prefill changed borderline logits and produced run-dependent wrong answers; rerunning an individual failed prompt could return the correct answer.The 1024-token threshold covers the observed short-prompt range while leaving long-context prefill on AITER FP8. The controlled A/B below reports the measured short-request cost rather than assuming it is negligible.
Scope
This is only the short-prompt MLA prefill fix. It does not change FlyDSL MoE stage-2. The remaining MoE accuracy work is tracked separately in ROCm/AITER#4502.
Validation environment
gfx950)beca88e59ea75a7aa1af72a5ae50188fa91d4e3d026eac044851de98f05d1fd6d90a10fd8be8fe84max_model_len=102400,max_num_batched_tokens=4096,max_num_seqs=1TRITON_MLAdecode and automatic MLA prefill selectionRelevant environment:
Serve configuration:
Accuracy reproduction
Use vLLM's in-tree GSM8K evaluator against the running endpoint:
Observed on the same image and launch configuration:
Performance validation
Checks
python -m py_compile vllm/v1/attention/backends/mla/rocm_aiter_mla.pyControlled A/B
The two images used the same hardware, model, vLLM base, AITER commit, 96×128 reducer, environment variables, launch parameters, evaluator, prompts, seed, and concurrency. The only image difference was:
Run the serve command and in-tree evaluator above once with A and once with B after server readiness.
A — original FP8 short prefill:
B — BF16 prefill below 1024 tokens:
Delta (B versus A):
The end-to-end latency includes autoregressive generation and differing output-token counts; it is not an isolated prefill latency measurement. Because the remaining FlyDSL MoE path is nondeterministic, this single-run A/B demonstrates the observed improvement but does not establish a deterministic accuracy guarantee. A repeated-run confidence interval is still required before claiming a stable expected accuracy gain.