Repository navigation
[ROCm][Bugfix] Skip AITER tuned GEMM when M*N >= 2^31 on gfx950 - #64567
Merged
Merged
Conversation
AITER's gfx950 FlyDSL A16W16 kernel addresses C with int32 offsets and faults once M * N >= 2^31 (ROCm/aiter#6853). With --mm-encoder-tp-mode data, the MiniMax-M3 ViT profile run issues an M=768000, N=6144, K=1280 GEMM that AITER 0.1.26 routes to that kernel, crashing engine startup with a memory access fault. Fall back to torch (hipBLASLt) for those shapes. They are compute-bound and hipBLASLt matches the FlyDSL kernel's throughput there. Signed-off-by: Micah Williamson <micah.williamson@amd.com>
Collaborator
Author
|
/ci run |
|
✅ Triggered Buildkite CI #98431 for commit |
AITER's gfx950 FlyDSL A16W16 kernel reads A and B through flat buffer descriptors with i32 offsets, so an operand of 4 GiB or more is read out of bounds and the kernel silently returns wrong rows. For example, Llama-405B's TP8 gate_up GEMM (N=13312, K=16384) maps to a FlyDSL row and returns wrong output at 147456 tokens, while C is still under the 2^31 limit. Route these shapes to torch as well, matching the limit ROCm/aiter#6853 enforces. Drop the on_gfx950() check, which is_tgemm_enabled() already implies. Signed-off-by: Micah Williamson <micah.williamson@amd.com>
Collaborator
Author
|
/ci run |
|
✅ Triggered Buildkite CI #98439 for commit |
AndreasKaratzas
approved these changes
Oct 29, 2026
AndreasKaratzas
enabled auto-merge (squash)
October 29, 2026 22:03
Member
|
/ci retry |
|
✅ Triggered Buildkite CI #98540 for commit |
Contributor
|
Hi @micah-wil, the pre-commit checks have failed. Please run: uv pip install pre-commit>=4.5.1
pre-commit install
pre-commit run --all-filesThen, commit the changes and push to your branch. For future commits, |
micah-wil
force-pushed
the
mm3-dp-gemm-overflow
branch
from
October 30, 2026 04:12
b50b65f to
bd01b0b
Compare
Collaborator
Author
|
/ci run |
|
✅ Triggered Buildkite CI #98553 for commit |
khluu
pushed a commit
that referenced
this pull request
Oct 30, 2026
Signed-off-by: Micah Williamson <micah.williamson@amd.com> (cherry picked from commit 6d01893)
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.
Overview
Skip AITER's tuned GEMM (
tgemm.mm) on gfx950 when M·N ≥ 2^31 (Also skip AITER tuned GEMM when A or B spans >= 4 GiB) and fall back toF.linear(hipBLASLt). This works around an int32 output-offset overflow in AITER's gfx950 FlyDSL A16W16 kernel (fix pending in ROCm/aiter#6853). Since AITER v0.1.26, that overflow crashesamd/MiniMax-M3-MXFP4at startup with--mm-encoder-tp-mode data.Claims
Memory access fault ... Write access to a read-only pagecrash during the encoder-cache profile run of MiniMax-M3-MXFP4 on MI355X (TP4) with--mm-encoder-tp-mode data.Validation
Environment: MI355X,
vllm/vllm-openai-rocm:nightly, AITER 0.1.26.Kernel-level repro (
tgemm.mmvsF.linear, N=6144, K=1280, bf16, with bias; this matches the tunedminimax_m3_mxfp4_bf16_tuned_gemm.csvrows):tgemm.mm(AITER)F.linear(hipBLASLt)End-to-end with this patch:
Before: crashes at startup with the memory access fault. After: startup completes (178 GiB KV cache on TP0), and three chat requests with a 2016×2016 image return 200 with no faults. Confirmed there is no accuracy change.
No unit test is added: reproducing the bug needs gfx950 hardware plus AITER's model-specific tuned CSV, and a mocked test would only restate the condition.
Details
Root cause. With
--mm-encoder-tp-mode data, each rank runs the ViT unsharded, so the profile run issues an M=768000, N=6144, K=1280 GEMM with bias. In AITER v0.1.26,getPaddedMmaps it to the8192,6144,1280FlyDSL row inminimax_m3_mxfp4_bf16_tuned_gemm.csv. That kernel computesglobal_row * n + global_colin int32, which wraps once M·N ≥ 2^31 and writes out of bounds. In TP mode N is sharded 4 ways, so M·N stays under the limit.Why route around it here.
rocm_unquantized_gemm_implis the only vLLM call site oftgemm.mm. The guard is limited to gfx950 and to the exact overflow condition, so all other shapes keep AITER's tuned dispatch. Skipping FlyDSL for this call also avoids the FlyDSL 0.4.0from_dlpackleak described in ROCm/aiter#6853, which pinned about 10.6 GiB after the ViT profile run.The guard can be removed once vLLM's minimum AITER includes ROCm/aiter#6853.
Pull Request Checklist
I used vLLM's
/pr-checklistskill. (Mandatory for agents, optional for humans).AI assistance was used during the creation of this PR.
Design Fit: Minimizes impact on core components, reuses existing functionality, and justifies added complexity.
Testing and Validation: Validates the change and ensures any added tests are meaningful and reliable, with CI coverage or documented CI resource constraints and validation performed outside CI.
Code Quality and Style: Keeps code and comments clear and concise, and updates relevant documentation and examples.
Pull Request Contents: Includes a brief summary and relevant links, supports claims with evidence, explains root causes and implementation trade-offs, and follows the contributing guide.