Skip to content

fix(ck-tile): guard TE GEMM against numerically-wrong CShuffle configs (#9684)#9686

Draft
ozturkosu wants to merge 1 commit into
developfrom
users/muozturk/ck/tileengine_issuefix9684
Draft

fix(ck-tile): guard TE GEMM against numerically-wrong CShuffle configs (#9684)#9686
ozturkosu wants to merge 1 commit into
developfrom
users/muozturk/ck/tileengine_issuefix9684

Conversation

@ozturkosu

@ozturkosu ozturkosu commented Jul 22, 2026

Copy link
Copy Markdown
Contributor

Summary

Fixes the numerically-incorrect CShuffle batched/standard GEMM kernels tracked in #9684. The Tile Engine GEMM instance builder emitted cshuffle kernels whose per-wave repeat is odd (>1) and paired with a 32-wide warp tile in that dimension. They compile and pass the epilogue's divisibility static_asserts, but the CShuffle LDS store is mis-raked and the kernels return numerically wrong results at runtime.

Fixes #9684

Motivation

Found during the batched-GEMM TE→dispatcher bridge parity audit (#9306). GPU verification on gfx942 built all 116 non-power-of-2-repeat cshuffle/192 configs and ran the op's built-in CPU validation (verify=1):

  • 26 fail — all matching tile_m=192 + waves 2x2x1 + warp_tile 32x32x{8,16} (MRepeat = 192/(2*32) = 3), across compv3/compv4/mem and intra/interwave.
  • 90 pass — every other non-power-of-2 repeat is correct, including MRepeat=3 with warp_tile_m=16 and even repeats like 6 and 12.

So the failure is specific to odd repeat (>1) + 32-wide warp tile, not "non-power-of-2 repeat" in general.

Design note

The guard is applied once, during instance enumeration in _get_sampled_kernel_list(), via a small _cshuffle_store_ok(m_repeat, n_repeat, warp_tile_m, warp_tile_n) helper. Only the cshuffle epilogue is gated; the default epilogue stores directly and is unaffected. This is the minimal, precise signature — it stops emitting exactly the 26 broken configs and keeps all correct ones.

Changes

  • tile_engine/ops/gemm/gemm_instance_builder.py: add _cshuffle_store_ok helper + guard in the enumeration loop.
  • tile_engine/ops/gemm/test_gemm_instance_builder.py: unit tests for the gate.

Test plan

  • python3 -m pytest tile_engine/ops/gemm/test_gemm_instance_builder.py (4 passed)
  • GPU verification on gfx942 (26 broken configs fail verify=1; the 90 kept configs pass)
  • CI

Related

#9684)

The Tile Engine GEMM instance builder emitted cshuffle kernels whose per-wave
repeat is odd (>1) and paired with a 32-wide warp tile (e.g. tile_m=192 /
warp_m=2 / warp_tile_m=32, MRepeat=3). These compile and pass the epilogue's
divisibility static_asserts but the CShuffle LDS store is mis-raked, so they
return numerically WRONG results at runtime -- GPU-verified on gfx942 via the
op's built-in CPU validation (26 such configs fail; all other non-power-of-two
repeats, incl. MRepeat=3 with warp_tile_m=16 and even repeats 6/12, pass).

Skip exactly that signature during instance enumeration so the TE stops shipping
broken kernels. Add a unit test for the gate.

Refs #9684
@therock-pr-bot

therock-pr-bot Bot commented Jul 22, 2026

Copy link
Copy Markdown

✅ All Checks Passed — Ready for Review

Check Status Details
🌿 Branch Name ✅ Pass
📝 PR Title/Description ✅ Pass
Forbidden Files ✅ Pass
🧪 Unit Test ✅ Pass
🔎 pre-commit ✅ Pass
🚫 Draft PR 🔜 To Be Enabled
🚩 Feature Flag 🔜 To Be Enabled
📊 Code Coverage 🔜 To Be Enabled
🤖 therock-pr-bot ✅ Pass

🎉 All checks passed! This PR is ready for review.

📖 Need help? See the Policy FAQ for details on every check and how to fix failures.

@therock-pr-bot

Copy link
Copy Markdown

🎉 All checks passed! This PR is ready for review.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Tile Engine ships numerically-incorrect cshuffle batched-GEMM kernels: tile_m=192 + waves 2x2x1 + warp_tile 32x32 (26 configs, gfx942-verified)

1 participant