mirror of
https://github.com/deepseek-ai/DeepGEMM.git
synced 2026-11-05 00:47:26 +00:00
[PR #455] [Fix] SM90 heuristic offers block M 16/32 to the FP8 1D1D kernel (JIT failure for M <= 32) #459
Labels
No labels
pull-request
No milestone
No project
No assignees
1 participant
Notifications
Due date
No due date set.
Dependencies
No dependencies set.
Reference
deepseek-ai/DeepGEMM#459
Loading…
Add table
Add a link
Reference in a new issue
No description provided.
Delete branch "%!s()"
Deleting a branch is permanent. Although the deleted branch may continue to exist for a short time before it actually gets removed, it CANNOT be undone in most cases. Continue?
📋 Pull Request Information
Original PR: https://github.com/deepseek-ai/DeepGEMM/pull/455
Author: @LiRunGuo
Created: 9/22/2026
Status: 🔄 Open
Base:
main← Head:fix-sm90-1d1d-small-m📝 Commits (2)
f84c92aFix SM90 heuristic offering block M 16/32 to the FP8 1D1D kernel95880a3Address review: name small-M wgrad shape, add SM90 small-M k-grouped case📊 Changes
2 files changed (+25 additions, -11 deletions)
View changed files
📝
csrc/jit_kernels/heuristics/sm90.hpp(+6 -2)📝
tests/generators.py(+19 -9)📄 Description
Problem
On SM90, the layout heuristic (
csrc/jit_kernels/heuristics/sm90.hpp) adds block M candidates of 16 and 32 whenm <= 32forNormal,BatchedandKGroupedContiguousGEMMs. The SM90 FP8 1D2D and BF16 kernels support these small tiles, but the SM90 FP8 1D1D kernel (used for FP32-output / weight-gradient GEMMs and for the k-grouped GEMM) only supportsBLOCK_Mof 64 or 128:For
m <= 32the cost model always prefers the smaller tile (e.g. it picksblock_m=32, block_n=56form=27, n=5744, k=7936), so JIT compilation fails and the call raises. This affects, on Hopper:fp8_gemm_nt(a, b, d, c=d)with an FP32d(the 1D1D wgrad path) wheneverm <= 32k_grouped_fp8_gemm_nt_contiguouswheneverm <= 32Neither shape was covered by the tests (the wgrad shapes only use
mfromnk_list, all>= 576, and the k-grouped shapes all havem >= 768). Found with a randomized shape fuzzer on an H200.Fix
Only offer the 16/32 candidates to kernels that support them (
kernel_type != Kernel1D1D). With the fix, the heuristic picksblock_m=64for these shapes. Shapes withm > 32are unaffected, since the candidate list only changes whenm <= 32.Tests (
tests/generators.py):m in {16, 32},n=4096, k=7168, FP32 accumulate) inenumerate_normal. On SM90 they use the FP8 1D1D kernel and the BF16 kernel. On SM100 they should go through swap-AB.num_groups=8, m=16, n=2048) inenumerate_k_grouped_contiguous, enabled on SM90 only. 8 groups keep TMA multicast disabled, so this shape does not depend on the separate k-grouped multicast fix in #415 / #429.Testing (H200, CUDA 13.0, PyTorch 2.11.0+cu130, at the PR head)
tests/test_fp8_fp4.pytests/test_bf16.pytests/test_layout.pytests/test_einsum.pytests/test_legacy.pytests/test_attention.pyNew test lines:
Before the fix, the same shapes fail at JIT compile time with the static assertions quoted above.
I could only test on SM90. The k-grouped shape is gated to SM90 because I could not check whether the SM100 k-grouped kernel accepts the swap-AB layout its heuristic picks for small M. It could be enabled there if it does.
🔄 This issue represents a GitHub Pull Request. It cannot be merged through Gitea due to API limitations.