Skip to content

Bump CUTLASS to v4.8.1 and use native sm_107a JIT codegen - #113

Merged
zcnrex merged 2 commits into
sgl-project:devfrom
zcnrex:sm107-native-jit
Oct 22, 2026
Merged

zcnrex merged 2 commits into
sgl-project:devfrom
zcnrex:sm107-native-jit

Conversation

@zcnrex

@zcnrex zcnrex commented Oct 22, 2026 •

Copy link
Copy Markdown
Collaborator

Motivation

init_jit pins every 10.x device except 10.1 to the sm_100f family target. On CC 10.7, native sm_107a codegen is slightly faster for the kernels DeepSeek-V4.1 uses (mqa_logits, the fp8_fp4 GEMM, tf32_hc_prenorm), measured with per-kernel serving profiles. Numbers are available on request.

The pinned CUTLASS (f3fde58, 4.2.1) has no SM107 support. JIT-ing for sm_107a against it compiles but silently drops the SM100 MMA/TMA enables, setmaxnreg and PDL. For example, sm100_paged_mqa_logits lost every USETMAXREG and ran far slower. CUTLASS v4.8.0+ supports SM107 natively.

Modifications

  • CUTLASS submodule → v4.8.1 (2c85f49). For the C++ headers, v4.8.0 and v4.8.1 differ only in version.h. The bump also changes the JIT cache key (cutlass-<version>), so existing caches recompile once.
  • csrc/runtime/jit.hpp: on 10.7, uses 107a when nvcc is 13.4+ (CUTLASS's SM107 support needs it); otherwise keeps 100f. Other architectures are unchanged.

Tests

On a CC 10.7 device, with a wheel built by build_sgl_deep_gemm.sh from this branch:

  • The JIT emits sm_107a with no override.
  • tests/test_hyperconnection.py passes, with no spills.
  • test_fp8_fp4.py and test_attention.py are running; I'll update here.

The same jit.hpp change plus the CUTLASS bump on top of v0.2.3 also builds. That is the variant sglang consumes today.

Not yet tested: SM100 / SM103 hardware with the CUTLASS bump.

Related: sgl-project/FlashMLA#20 makes the same CUTLASS bump for FlashMLA.

🤖 Generated with Claude Code

The pinned CUTLASS lists no SM107 in arch/config.h, arch/reg_reconfig.h
or arch/grid_dependency_control.h, so 10.7 devices JIT for the sm_100f
family target. Patch those headers in the wheel staging step, and pick
sm_107a at runtime when the shipped reg_reconfig.h knows 1070. Source
checkouts with unpatched headers keep sm_100f.

Co-Authored-By: Claude Opus 5.5 <[email protected]>
CUTLASS v4.8.0+ supports SM107 natively (arch/config.h SM107A/F,
reg_reconfig.h, grid_dependency_control.h), so drop the header patch.
Its SM107 support needs nvcc 13.4+, so gate the sm_107a JIT target on
the nvcc version instead of on the shipped headers.

Co-Authored-By: Claude Opus 5.5 <[email protected]>
@zcnrex zcnrex changed the title Use native sm_107a JIT codegen when the bundled CUTLASS supports it Bump CUTLASS to v4.8.1 and use native sm_107a JIT codegen Oct 22, 2026
@zcnrex
zcnrex marked this pull request as ready for review October 22, 2026 20:33
@zcnrex
zcnrex merged commit d0a3af7 into sgl-project:dev Oct 22, 2026
@zcnrex

zcnrex commented Oct 22, 2026

Copy link
Copy Markdown
Collaborator Author

Update: on a CC 10.7 device with this branch's wheel (CUTLASS 4.8.1), tests/test_fp8_fp4.py and tests/test_attention.py both pass. Every JIT kernel compiled for sm_107a (none for sm_100f). test_fp8_fp4 has no spills. test_attention has small spills (≤ 52 bytes) in some sm100_mqa_logits prefill instantiations only.

🤖 Generated with Claude Code

@zcnrex

zcnrex commented Oct 22, 2026

Copy link
Copy Markdown
Collaborator Author

Correction to the description: the "v0.2.3 + this change + CUTLASS bump also builds" check was wrong. In that build, build_sgl_deep_gemm.sh runs git submodule update, which reset my uncommitted CUTLASS checkout to 4.2.1. The wheel therefore shipped 4.2.1 headers, and sm_107a kernels compiled with TMA disabled; tf32_hc_prenorm_gemm asserted at runtime. With the submodule pointer committed first, the v0.2.3 variant ships CUTLASS 4.8.1, and test_hyperconnection.py passes at sm_107a. This PR's own branch was not affected, because it commits the submodule bump.

🤖 Generated with Claude Code

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