Skip to content

[Hot Fix] Fix OOB read in Triton MXFP8 GEMM kernel causing SIGABRT on gfx950 - #728

Merged
aris134 merged 1 commit into
devfrom
amartin_mxfp8_triton_gemm_oob_fix
Sep 2, 2026
Merged

[Hot Fix] Fix OOB read in Triton MXFP8 GEMM kernel causing SIGABRT on gfx950#728
aris134 merged 1 commit into
devfrom
amartin_mxfp8_triton_gemm_oob_fix

Conversation

@aris134

@aris134 aris134 commented Sep 2, 2026

Copy link
Copy Markdown
Contributor

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

  • Documentation change (change only to the documentation, either a fix or a new content)
  • Bug fix (non-breaking change which fixes an issue)
  • New feature (non-breaking change which adds functionality)
  • Breaking change (fix or feature that would cause existing functionality to not work as expected)
  • Infra/Build change
  • Code refactoring

Changes

Please list the changes introduced in this PR:

  • Change A
  • Change B

Checklist:

  • I have read and followed the contributing guidelines
  • The functionality is complete
  • I have commented my code, particularly in hard-to-understand areas
  • I have made corresponding changes to the documentation
  • My changes generate no new warnings
  • I have added tests that prove my fix is effective or that my feature works
  • New and existing unit tests pass locally with my changes

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
aris134 marked this pull request as ready for review September 2, 2026 18:16
@aris134 aris134 self-assigned this Sep 2, 2026
@aris134 aris134 added ci-level 1 CI test level 1 ci-level 3 CI test level 3 and removed ci-level 1 CI test level 1 labels Sep 2, 2026
@aris134
aris134 merged commit 941f291 into dev Sep 2, 2026
15 of 20 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

ci-level 3 CI test level 3

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants