feat(sm120): add tileN = 8,16 for the dense F8F6F4 GEMM - #3441
Open
sunnypatell wants to merge 1 commit into
Open
feat(sm120): add tileN = 8,16 for the dense F8F6F4 GEMM#3441sunnypatell wants to merge 1 commit into
sunnypatell wants to merge 1 commit into
Conversation
There was a problem hiding this comment.
Pull request overview
This PR fixes SM120 dense (non-blockscaled) F8F6F4 GEMM mainloop construction for narrow-N tiles by forwarding the actual tile-N (size<1>(TileShape_MNK{})) into sm120_rr_smem_copy_selector_B, allowing correct selection of x1/x2/x4 ldmatrix atoms for N=8/16.
Changes:
- Forward
TileShapeNtodetail::sm120_rr_smem_copy_selector_Bin the SM120 dense MMA builder so narrow-N tiles can compile. - Add unit tests covering tile shapes 128x32x64, 128x16x64, and 128x8x64 (including a pingpong schedule case) for the dense F8 path.
Reviewed changes
Copilot reviewed 2 out of 2 changed files in this pull request and generated no comments.
| File | Description |
|---|---|
| include/cutlass/gemm/collective/builders/sm120_mma_builder.inl | Passes tile-N into the shared-memory copy atom selector for operand B to enable narrow-N tile support. |
| test/unit/gemm/device/sm120_tensorop_gemm/sm120_gemm_f8_f8_f32_tensor_op.cu | Adds regression tests ensuring 128x16 and 128x8 dense F8 tiles compile and produce correct results (plus coverage for pingpong schedule). |
💡 Add a code-review agent skill or configure MCP servers for context-aware, tailored reviews. Learn more in the docs.
- sm120_rr_smem_copy_selector_B has taken a TileShapeN parameter since NVIDIA#3292, but only the block-scaled builder passes it; the dense builder leaves it at the default 32 and so always selects the 4-matrix ldmatrix atom, which makes any tile narrower than 32 fail to build with "TiledCopy uses too few vals for selected CopyAtom" out of copy_atom.hpp - forward size<1>(TileShape_MNK{}) the same way the block-scaled builder does; for N >= 32 the selector returns the identical atom, so no configuration that compiles today changes - add 128x32x64, 128x16x64 and 128x8x64 tests, plus a pingpong variant at N=8 since that is the shape that produced reference failures on the block-scaled path in NVIDIA#3292 - verified on rtx 5070 ti (sm_120a, cuda 13.0.3): 128x16x64 and 128x8x64 go from compile failure to passing reference checks; full sm120 tensorop suite 35/35 green across f32, f16 and grouped
sunnypatell
force-pushed
the
feat/sm120-narrow-tile-n
branch
from
August 9, 2026 06:13
7e6aaef to
5537c3b
Compare
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.
sm120_rr_smem_copy_selector_Bhas taken aTileShapeNparameter since #3292, and uses it to pick between the 1-, 2- and 4-matrixldmatrixatoms. The block-scaled builder passes the real tile width. The dense F8F6F4 builder never does, so it always resolves to the default of 32 and takes the 4-matrix atom no matter how narrow the tile is.The result is that any tile narrower than 32 fails to build, and it fails with a message that never names the tile as the cause:
This forwards
size<1>(TileShape_MNK{})exactly the way the block-scaled builder already does. 128x16 and 128x8 go from not building to building and computing correctly. It's the same narrow-tile capability #3176 and #3292 added on the block-scaled side, which the dense path never picked up.why this cannot change an existing kernel
Every branch of the selector is
TileShapeN < 16→ x1,< 32→ x2, else x4, and the default is 32. Any tile with N >= 32 therefore resolves to the identical atom it resolves to today. The only configurations whose behaviour changes are ones that currently fail to compile, so there is no kernel in the library or the profiler that this can move.verified
RTX 5070 Ti (sm_120a), CUDA 13.0.3, driver 610.74, reference checks via
TestSmall:Beyond what's in the test file, I ran a wider matrix while narrowing this down:
e4m3ande5m2, cooperative and pingpong, N = 64/32/16/8, all passing. Pingpong at N=8 is covered in the committed tests specifically because that's the shape that produced reference failures on the block-scaled path during #3292 review.Non-regression: full SM120 tensorop suite green, 35/35 across
tensorop_f32_sm120(15),tensorop_f16_sm120(14) andsm120_grouped_gemm_device_tensorop(6).Tests go into the existing
sm120_gemm_f8_f8_f32_tensor_op.cualongside the 128x64x64 case, matching the one-test-per-tile-shape layout the block-scaled narrow-N tests already use, so there's no new file and no CMakeLists change.deliberately not included
The array, sparse and blockwise SM120 builders have the same omission. I left them alone because each needs its own verification matrix and I've only proven the dense F8F6F4 path on hardware I have. Happy to extend in a follow-up if you want them, or to fold them in here if you'd rather it land as one change.
Two things I checked and they are pre-existing, not affected by this: sub-8-bit operands (
e2m1) don't build on this builder at N=64 or N=32 either, so that's a separate constraint; andcutlass_libraryemits 128x16 and 128x8 only for the block-scaled generators, so nothing currently shipped was broken by the missing forward.@depaulmillz you're the closest thing to an owner I can identify from blame here, since #3176 is where small tile N started and this is the sibling builder that didn't get it. Point me at someone else if that's not right.