[Hot Fix] Fix OOB read in Triton MXFP8 GEMM kernel causing SIGABRT on gfx950 - #728
Merged
Conversation
mxfp8_matmul_kernel loaded the A/B FP8 operands without masking against M/N. offs_am/offs_bn lacked the % M / % N wrap that the sibling matmul_kernel uses, and the EVEN_K fast path (always taken for MXFP8, since K is a multiple of 32) loaded with no mask at all. MXFP8 only guarantees M/K/N are multiples of VEC_SIZE=32, but the autotune block sizes are 64/128/256, so any shape where M % BLOCK_M != 0 or N % BLOCK_N != 0 reads rows >= M / cols >= N out of bounds. The over-read usually lands in caching-allocator slack (silent), so a single GEMM passes; after many MXFP8 GEMMs the pool fragments and the fringe address eventually crosses an unmapped page, faulting at the next synchronize() inside the Triton autotuner do_bench as a bare SIGABRT with no HIP fault banner. Reproduced via `NVTE_ROCM_ENABLE_MXFP8=1 NVTE_USE_GEMM_TRITON=1 pytest tests/pytorch/test_numerics.py -k MXFP8` (ci/pytorch.sh gemm-triton section): aborts without the fix, 77 passed / 0 aborts with it. Scale loads, bias, and the store were already M/N-masked; only the data loads are changed. Introduced by #667 (Experimental Triton GEMM backend). Present on dev tip. Co-Authored-By: Claude <noreply@anthropic.com>
aris134
marked this pull request as ready for review
September 2, 2026 18:16
aris134
requested review from
ipanfilo,
wangye805 and
wenchenvincent
as code owners
September 2, 2026 18:16
ipanfilo
approved these changes
Sep 2, 2026
aris134
added a commit
that referenced
this pull request
Sep 3, 2026
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.
Fixes bug introduced by #667. mxfp8_matmul_kernel loaded the A/B FP8 operands without masking against M/N (the EVEN_K fast path had no mask; offs_am/offs_bn lacked the % M/% N wrap the sibling matmul_kernel uses). MXFP8 only guarantees M/K/N are multiples of 32, but block sizes are 64/128/256, so any non-dividing shape reads out of bounds. Issue manifested as failing sGPU tests on gfx950. Fix masks the data loads (scales/bias/store were already masked).
Description
Please include a brief summary of the changes, relevant motivation and context.
Fixes # (issue)
Type of change
Changes
Please list the changes introduced in this PR:
Checklist: