From 80ec8227cdf085c1a731ba53946be375a1b264e8 Mon Sep 17 00:00:00 2001 From: Micah Williamson Date: Thu, 29 Oct 2026 19:50:56 +0000 Subject: [PATCH 1/2] [ROCm][Bugfix] Skip AITER tuned GEMM when M*N >= 2^31 on gfx950 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 --- vllm/model_executor/layers/utils.py | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/vllm/model_executor/layers/utils.py b/vllm/model_executor/layers/utils.py index fa1b598967d9..2e644a2d94fa 100644 --- a/vllm/model_executor/layers/utils.py +++ b/vllm/model_executor/layers/utils.py @@ -519,7 +519,9 @@ def rocm_unquantized_gemm_impl( out = ops.LLMM1(weight, x_view, 4) return out.reshape(*x.shape[:-1], weight.shape[0]) - if rocm_aiter_ops.is_tgemm_enabled(): + # AITER's gfx950 FlyDSL A16W16 kernel addresses C with int32 offsets and + # faults once M * N >= 2^31 (ROCm/aiter#6853). + if rocm_aiter_ops.is_tgemm_enabled() and not (on_gfx950() and n * m >= 1 << 31): from aiter.tuned_gemm import tgemm return tgemm.mm(x, weight, bias) From 8c66c693648473ea3fbb87c2f608b2ee8dacba2b Mon Sep 17 00:00:00 2001 From: Micah Williamson Date: Thu, 29 Oct 2026 20:45:52 +0000 Subject: [PATCH 2/2] [ROCm][Bugfix] Also skip AITER tuned GEMM when A or B spans >= 4 GiB 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 --- vllm/model_executor/layers/utils.py | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/vllm/model_executor/layers/utils.py b/vllm/model_executor/layers/utils.py index 2e644a2d94fa..a9d68fcfe8d0 100644 --- a/vllm/model_executor/layers/utils.py +++ b/vllm/model_executor/layers/utils.py @@ -520,8 +520,9 @@ def rocm_unquantized_gemm_impl( return out.reshape(*x.shape[:-1], weight.shape[0]) # AITER's gfx950 FlyDSL A16W16 kernel addresses C with int32 offsets and - # faults once M * N >= 2^31 (ROCm/aiter#6853). - if rocm_aiter_ops.is_tgemm_enabled() and not (on_gfx950() and n * m >= 1 << 31): + # reads A/B through 4 GiB buffer descriptors (ROCm/aiter#6853). + aiter_hgemm_unsafe = n * m >= 1 << 31 or max(n, m) * k * x.element_size() >= 1 << 32 + if rocm_aiter_ops.is_tgemm_enabled() and not aiter_hgemm_unsafe: from aiter.tuned_gemm import tgemm return tgemm.mm(x, weight, bias)