Skip to content

Build sm_107a with CUTLASS 4.8.1 and restore the >160-split sparse decode combine - #20

Merged
zcnrex merged 4 commits into
sgl-project:sglfrom
zcnrex:sm107a-build
Oct 22, 2026
Merged

zcnrex merged 4 commits into
sgl-project:sglfrom
zcnrex:sm107a-build

Conversation

@zcnrex

@zcnrex zcnrex commented Oct 22, 2026 •

Copy link
Copy Markdown
Collaborator

Motivation

Two problems block FlashMLA on CC 10.7 devices.

  1. No runnable binary. The wheel carries only the arch-specific sm_100a / sm_103a (plus sm_90a for the legacy set), which a 10.7 device cannot run. The pinned CUTLASS (4.3.5) has no SM107 support either. CUTLASS v4.8.0+ supports SM107 natively, but building sm_107a against older CUTLASS compiles and silently loses the SM100 MMA/TMA paths, setmaxnreg and PDL.
  2. The sparse decode combine asserts above 160 splits. The combine synced from upstream csrc/ stops its NUM_SPLITS switch at 160 (combine.cu:213, KU_ASSERT(false)). So sparse decode fails on any GPU whose num_sm_parts exceeds 160, whatever arch it was built for. csrc_legacy still has the 192/224/256 cases.

Modifications

  • CUTLASS submodule → v4.8.1 (2c85f49). Two source updates come with it, both following upstream CUTLASS:

    • kerutils' TMEM allocator assert uses TMEM::TargetTmemCapacityBits, as CuTe's own allocator now does. TMEM::MAX_CAPACITY_BITS is gone because SM107's TMEM capacity differs from SM100's.
    • fmha_common.hpp (csrc/ and csrc_legacy/): the F8F6F4 to_tiled_mma_sm100_ts overload uses the op template directly as the MMA_Atom op. This matches upstream examples/77_blackwell_fmha/collective/fmha_common.hpp at v4.8.1.

    For CUTLASS headers, v4.8.0 and v4.8.1 differ only in version.h.

  • setup.py: when nvcc --list-gpu-arch reports compute_107, sm_107a is added to CUDA_ARCHS and LEGACY_CUDA_ARCHS. The sglang release build (scripts/build_sgl_flash_mla.sh, CUDA 13.4) picks it up with no further change. Builds with an nvcc that lacks compute_107 are unchanged.

  • combine.cu: restores the 192/224/256 cases. smem_buf is BLOCK_SIZE_M x MAX_SPLITS floats, so 8 KB at 256.

Tests

On a CC 10.7 device, wheel built from this branch with FLASH_MLA_BUILD_DENSE_PREFILL=1 pip wheel --no-build-isolation:

  • Spill check: passes; the 59 exempt kernels are all the upstream CUTLASS FMHA ones.
  • SASS: sm_100a / sm_103a / sm_107a binaries, with the same USETMAXREG count (208) in each.
  • tests/test-sparse-decode.py: 1534/1534 pass. Before the combine fix it asserted at combine.cu:213.
  • tests/test-sparse-prefill.py: all 316 pass.
  • tests/test_fmha_sm100.py: passes.
  • tests/test-fused-norm-rope-attn-rope-cast.py: not run; it needs tile_kernels.

Not yet tested: SM100 / SM103 hardware with the CUTLASS bump. The sm_100a / sm_103a binaries were compiled and their SASS inspected, but not run.

Native sm_107a beats the sm_100f binary on the fused core_attn decode and prefill kernels, measured with per-kernel serving profiles. Numbers are available on request.

Related: sgl-project/sglang#45635 moves DSv4.1's FlashMLA kernels to the sgl-flash-mla wheel. sgl-project/sglang#45884 will bump the wheel version once this lands. sgl-project/DeepGEMM#113 makes the same CUTLASS bump for DeepGEMM.

🤖 Generated with Claude Code

zcnrex and others added 2 commits October 22, 2026 12:32
The wheel only carries sm_100a/sm_103a, which 10.7 devices cannot run.
Add sm_107a to both kernel sets when nvcc lists compute_107, and patch
the CUTLASS arch lists (arch/config.h, arch/reg_reconfig.h,
arch/grid_dependency_control.h) that do not know SM107 yet; without
the patch sm_107a compiles but loses the SM100 MMA/TMA paths,
setmaxnreg and PDL.

Co-Authored-By: Claude Opus 5.5 <[email protected]>
The combine kernel synced from upstream csrc/ stops at 160 splits and
asserts beyond it, so sparse decode fails on GPUs whose num_sm_parts
exceeds 160. csrc_legacy still carries these cases.

Co-Authored-By: Claude Opus 5.5 <[email protected]>
zcnrex and others added 2 commits October 22, 2026 12:53
CUTLASS v4.8.0+ supports SM107 natively (arch/config.h SM107A/F,
reg_reconfig.h, grid_dependency_control.h), so drop the header patch.

Co-Authored-By: Claude Opus 5.5 <[email protected]>
CUTLASS 4.8 replaced TMEM::MAX_CAPACITY_BITS with per-arch
TMEM::TargetTmemCapacityBits (SM107 has 576 TMEM columns), and the
SM100 F8F6F4 UMMA op is now a class template used directly as the
MMA_Atom op. Follow CuTe's own allocator assert and upstream's
examples/77_blackwell_fmha/collective/fmha_common.hpp.

Co-Authored-By: Claude Opus 5.5 <[email protected]>
@zcnrex zcnrex changed the title Build sm_107a and restore the >160-split sparse decode combine Build sm_107a with CUTLASS 4.8.1 and restore the >160-split sparse decode combine Oct 22, 2026
@zcnrex
zcnrex marked this pull request as ready for review October 22, 2026 20:33
@zcnrex
zcnrex merged commit 5ddc685 into sgl-project:sgl Oct 22, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant