[Bugfix][MLA] Gate gfx942 native qh64 fp8 decode to page_size=64 (fix page_size=1 GPU fault)#4365
Open
MohitAMD wants to merge 1 commit into
Open
Conversation
… page_size=1 GPU fault) The native QH64 fp8 persistent MLA-decode kernel added in ROCm#3188 (mla_a8w8_qh64_qseqlen1_gqaratio64_v3_ps.co) was validated only at page_size=64. At page_size=1 -- the KV layout vLLM MLA serves with (block_size=1) -- it performs an out-of-bounds GPU access and faults on the first decode forward: Memory access fault by GPU node-N ... on address 0x7f...000. Reason: Unknown. -> worker aborts (exit 134) Reproduced on aiter v0.1.18 and origin/main tip on the GLM-5.1-FP8 (GlmMoeDsaForCausalLM) 1P1D disaggregated workload, where the per-rank head grouping is gqa_ratio=64 (DP8/TP1). Fix: restrict the gfx942 native-qh64 dispatch clause in mla_decode_fwd to the validated page_size==64. Other page sizes (page_size=1) fall through to the pre-ROCm#3188 qh16 fold, which runs without fault. gfx950 behavior is unchanged. Adds op_tests/test_mla_qh64_gfx942_pagesize1.py which deterministically triggers the shape: it aborts on stock ROCm#3188 and passes with this fix. Co-authored-by: Cursor <cursoragent@cursor.com>
Contributor
🏷️ CI GuideRuns automatically on every PR:
Extended tests (opt-in via labels):
|
Contributor
There was a problem hiding this comment.
Pull request overview
This PR prevents a known gfx942 (MI300X) GPU memory-access fault by tightening MLA decode dispatch so the native QH64 FP8 persistent decode kernel is only selected for the validated page_size==64, while page_size==1 falls back to the pre-existing folded QH16 path.
Changes:
- Update
aiter/mla.pydispatch logic to gate gfx942 native QH64 FP8 persistent decode topage_size==64(gfx950 behavior unchanged). - Add a targeted regression repro under
op_tests/that exercises the failinggfx942 + nhead=64 + fp8/fp8 + qlen=1 + page_size=1decode shape.
Reviewed changes
Copilot reviewed 2 out of 2 changed files in this pull request and generated 1 comment.
| File | Description |
|---|---|
aiter/mla.py |
Tightens gfx942 dispatch to avoid selecting the known-faulting native QH64 FP8 persistent decode kernel at page_size=1. |
op_tests/test_mla_qh64_gfx942_pagesize1.py |
Adds a standalone repro/regression script for the gfx942 page_size=1 faulting shape. |
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
Comment on lines
+44
to
+50
| import sys | ||
| import torch | ||
|
|
||
| import aiter | ||
| from aiter import dtypes, get_mla_metadata_info_v1, get_mla_metadata_v1 | ||
| from aiter.mla import mla_decode_fwd | ||
| from aiter.jit.utils.chip_info import get_gfx |
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
The native QH64 fp8 persistent MLA-decode kernel added in #3188
(
hsa/gfx942/mla/mla_a8w8_qh64_qseqlen1_gqaratio64_v3_ps.co) GPUmemory-access-faults on gfx942 (MI300X) for the
page_size=1decode shape.aiter/mla.pyroutesgfx942 + nhead==64 + fp8/fp8 + max_seqlen_q==1to thiskernel. #3188 validated correctness only at
page_size=64. Production vLLM MLAserves with
page_size=1(block_size=1), which the kernel never exercised — itdoes an out-of-bounds access there, killing the worker on the first decode forward.
Surfaced on GLM-5.1-FP8 (
GlmMoeDsaForCausalLM, MLA + DSA) 1P1D/2P2Ddisaggregated serving, where per-rank head grouping is
gqa_ratio=64(
data_parallel_size=8,tensor_parallel_size=1).Closes #4363.
Reproduction
op_tests/test_mla_qh64_gfx942_pagesize1.py(added here) triggers the exact shape ona single MI300X. On stock aiter (#3188 present, e.g. v0.1.18):
Confirmed on 3 independent aiter builds carrying #3188 (
e03fa6040+04427a5d8,ac90d5c89,origin/maintip) and on multiple MI300X nodes; the.coblob isbyte-identical from #3188 through tip, so the OOB is in the kernel binary.
Fix
Restrict the gfx942 native-qh64 dispatch clause in
mla_decode_fwdto the validatedpage_size==64. Other page sizes (page_size=1) fall through to the pre-#3188 qh16fold (
mla_a8w8_qh16_qseqlen1_gqaratio16_ps), which runs without fault.gfx950isunchanged.
With the fix the repro folds to the qh16 kernel and completes (exit 0).
Alternatives considered
gfx942from the clause entirely — simplest, but discards Add native MLA QH64 fp8 persistent decode kernel for gfx942 #3188's benefitfor the validated
page_size=64path.page_size=1OOB (preferred long-term) — the real root cause isan addressing/bounds bug in
mla_a8w8_qh64_qseqlen1_gqaratio64_v3_psatpage_size=1. This dispatch guard is a safe stopgap; happy to re-enable the nativepath for
page_size=1once a fixed.colands.Test plan
op_tests/test_mla_qh64_gfx942_pagesize1.py: aborts on stock Add native MLA QH64 fp8 persistent decode kernel for gfx942 #3188, passes withthis fix (MI300X / gfx942).
op_tests/test_mla_persistent.py -n 64,1 -d fp8 -kvd fp8 -blk 64 -b 1 -c 512—no regression on the retained native
page_size==64path (MI300X / gfx942). Sincethis PR only removes
page_size=1from the gfx942 clause,page_size==64dispatchis unchanged; verified on stock aiter (identical dispatch) that it loads the native
mla_a8w8_qh64_qseqlen1_gqaratio64_v3_pskernel, runs without fault, and passesthe fp8 golden reference:
[aiter] LoadKernel: _ZN5aiter39mla_a8w8_qh64_qseqlen1_gqaratio64_v3_psE ... .../gfx942/mla/mla_a8w8_qh64_qseqlen1_gqaratio64_v3_ps.co mla_decode-absorb_fp8 [golden fp8 vs aiter_asm] ... passed~ mla_decode-absorb_fp8 [golden fp8 split_out_ref vs aiter_asm] ... passed~i.e. the same kernel that OOB-faults at
page_size=1runs correctly atpage_size=64— the fault is page-size-specific, exactly as this guard assumes.page_size=1path validated end-to-end: GLM-5.1-FP8 DSA NIAH long-contextretrieval to 96k on 1P1D EP8 and 2P2D EP16 (MI300X) with the fold in place — no
fault, high retrieval accuracy.
Notes
This is the opposite head-count regime from #2821 (missing
gqa=8kernels at TP=8):here the
gqa=64kernel exists but is broken atpage_size=1.