Repository navigation
[Triton/Gluon] [Bugfix] batched_gemm_a8w8: keep scale loads in bounds - #6082
Conversation
🏷️ CI GuideRuns automatically on every PR:
Extended tests (opt-in via labels):
One backend per PR: PR title tags & labels: |
`%` binds tighter than `+`, so the scale offsets wrapped only the arange and the last M/N tile read past the end of x_scale/w_scale. This faults when the next page is unmapped (intermittent MI300X CI failure in test_batched_gemm_a8w8). Wrap the full offset, as offs_am/offs_bn do. Signed-off-by: Aakif Nawaz <aakif.nawaz@amd.com>
fe9d485 to
f3ad57b
Compare
|
The shard 5 failure was just a runner network issue while downloading some packages, re-ran |
There was a problem hiding this comment.
Copilot review overview
🟢 Approval recommended
The localized indexing fix bounds scale accesses without changing valid output lanes, and no unresolved issues remain.
Review effort: Balanced
Findings: None
What changed in this PR
Fixes out-of-bounds scale loads in the Triton batched A8W8 GEMM kernel for partial tiles.
Changes:
- Applies modulo to the full row and column scale offsets.
- Preserves indexing for valid output elements.
| File | Description |
|---|---|
aiter/ops/triton/_triton_kernels/gemm/batched/batched_gemm_a8w8.py |
Corrects scale-offset wrapping for both inputs. |
💡 Add a code-review agent skill or configure MCP servers for context-aware, tailored reviews. Learn more in the docs.
Motivation
test_batched_gemm_a8w8intermittently hits a GPU memory access fault on the MI300X Triton CI (shard 7 onmain).Technical Details
%binds tighter than+, so the scale offsets wrapped only thearange:When
M % BLOCK_SIZE_M != 0, the last tile reads past the end ofx_scale. The same happens forNandw_scale. The store is masked, so results are correct, but the load faults if the next page is unmapped. The fix wraps the full offset, asoffs_am/offs_bnalready do.Test Plan
MI300X, B=16, M=320, N=1280, K=8192. The test places
x_scaleat the end of ahipMallocwith no mapping after it (PYTORCH_NO_HIP_MEMORY_CACHING=1):x_scaleat end of allocationx_scalemid-allocationTest Result
test_batched_gemm_a8w8.py: 196 passedtest_fused_bmm_rope_kv_cache.py: 64 passed, 64 skippedSubmission Checklist