Repository navigation
Description
Summary
Using MmaAtomSM80Type.get() with FP8 types (Float8E4M3FN, shape (16, 8, 32)) causes a segfault during MLIR→PTX compilation when targeting SM120 (RTX 5090, GB10/DGX Spark, sm_121a). The MLIR backend appears to lack lowering support for SM120's mma.sync.aligned.kind::f8f6f4.m16n8k32 instruction variant.
Background
SM120 has an FP8 MMA instruction defined in C++ CuTe:
// cute/arch/mma_sm120.hpp lines 668-697
template <>
struct SM120_16x8x32_TN<float_e4m3_t, float_e4m3_t, float> {
// PTX: mma.sync.aligned.kind::f8f6f4.m16n8k32.row.col.f32.e4m3.e4m3.f32
};This is a different instruction from SM89's FP8 MMA (mma.sync.aligned.m16n8k32.row.col.f32.e4m3.e4m3.f32 — no kind:: prefix). SM120 has CUTE_ARCH_F8F6F4_MMA_ENABLED but not CUTE_ARCH_MMA_F32_SM89_ENABLED (per cute/arch/config.hpp).
The CuTe Python DSL currently only exposes:
MmaF16BF16Op→MmaAtomSM80Typewith F16/BF16 (works on SM120)MmaSM120BlockScaledOp→MmaAtomSM120BlockScaledTypewith FP4 block-scaled (works on SM120)
There is no exposed path for SM120's non-block-scaled FP8 MMA.
Reproducer
Bypassing MmaF16BF16Op's Python-level validation and calling MmaAtomSM80Type.get() directly with FP8 types:
import cutlass
from cutlass import cute
from cutlass.cute.nvgpu.warp.mma import WarpMmaOp, MmaF16BF16Trait, make_atom, _pack_shape
from cutlass.cute.typing import Float8E4M3FN, Float32
import cutlass._mlir.dialects.cute_nvgpu as _cute_nvgpu_ir
from dataclasses import dataclass
from typing import Type
@dataclass(frozen=True)
class MmaFP8Op(WarpMmaOp):
ab_dtype: Type[cutlass.Numeric] = Float8E4M3FN
acc_dtype: Type[cutlass.Numeric] = Float32
shape_mnk: tuple = (16, 8, 32)
def _make_trait(self, *, loc=None, ip=None, **kwargs):
shape_mnk = _pack_shape(self.shape_mnk, loc=loc, ip=ip)
ty = _cute_nvgpu_ir.MmaAtomSM80Type.get(
shape_mnk.type.attribute,
self.ab_dtype.mlir_type,
self.ab_dtype.mlir_type,
self.acc_dtype.mlir_type,
)
return MmaF16BF16Trait(make_atom(ty, loc=loc, ip=ip))
def _verify_fragment_A(self, input, *, loc=None, ip=None): pass
def _verify_fragment_B(self, input, *, loc=None, ip=None): passThe MLIR type creation succeeds — a kernel that creates the atom without using it compiles fine. However, when the MMA is actually used in a compute path (cute.gemm), the MLIR→PTX lowering segfaults:
!!!!!!! Segfault encountered !!!!!!!
File "./nptl/pthread_once.c", line 116, in __pthread_once_slow
Behavior
| Step | Result |
|---|---|
MmaAtomSM80Type.get(shape=(16,8,32), aType=f8E4M3FN, bType=f8E4M3FN, cType=f32) |
Success (MLIR type created) |
Create tiled_mma from the atom |
Success |
cute.gemm(tiled_mma, acc, fragA, fragB, acc) in kernel body |
Segfault during cute.compile() |
Expected Behavior
MmaAtomSM80Type.get() with FP8 types should either:
- Lower to SM120's
mma.sync.aligned.kind::f8f6f4.m16n8k32PTX instruction when targetingsm_120a/sm_121a - Or raise a clear error (not segfault) indicating FP8 MMA is unsupported for the target arch
Environment
- Device: NVIDIA GB10 (DGX Spark), SM121a
- CUDA: 13.0
- nvidia-cutlass-dsl: 4.3.5 (pip)
- Target arch:
CUTE_DSL_ARCH=sm_121a - Python: 3.13.3
Impact
SM120's non-block-scaled FP8 MMA (m16n8k32 kind::f8f6f4) offers 2x theoretical throughput over BF16 (m16n8k16) for attention kernels. This is the highest-impact optimization available for SM120 flash attention, and it's currently blocked by this lowering gap.
The C++ CuTe headers already define the instruction (SM120_16x8x32_TN with 77 specializations for different FP8/FP6/FP4 type combinations). The Python DSL just needs the MLIR lowering to be connected.
Contributed by Second Nature Computing — tested on DGX Spark hardware
Activity
blake-snc commentedon Feb 21, 2026
Update: Inline PTX Workaround Validated
While investigating the segfault, we found that
llvm.inline_asm()in the CuTe DSL can be used to emit thekind::f8f6f4instruction directly, bypassing the brokenMmaAtomSM80Typelowering:Validated on GB10 (SM121a): Compilation succeeds, execution produces correct results (32.0 for K=32 all-ones inputs).
This confirms the instruction itself works fine on SM120 — the issue is specifically in the
MmaAtomSM80TypeMLIR lowering path, which doesn't know how to emitkind::f8f6f4when targeting SM120.We'll use this inline PTX approach to build an FP8 flash attention kernel for SM120 in PR #3030 while the proper MLIR lowering fix is pending.
Contributed by Second Nature Computing
Add FP8 Flash Attention kernel and benchmark for SM120
shubaoyu2 commentedon Mar 4, 2026
did you try MmaAtomSM89Type instead of MmaAtomSM80Type? F8 is not invented in sm80
blake-snc commentedon Mar 4, 2026
Good question — I tried this. Unfortunately
MmaAtomSM89Typedoesn't exist in the CuTe DSL. The only available MLIR MMA types are:MmaAtomSM80Type(warp-level F16/BF16, m16n8k8/m16n8k16)MmaAtomSM90Type(warpgroup WGMMA)MmaAtomSM100UMMAType/MmaAtomSM100UMMABlockScaledType(tcgen05)MmaAtomSM120BlockScaledType(block-scaled FP4/FP8)The C++ SM89 atoms exist in
cute/arch/mma_sm89.hpp(SM89_16x8x32_F32E4M3E4M3F32_TNetc.) but they're not exposed in the Python DSL layer.Also worth noting: the SM89 atoms emit
mma.sync.aligned.m16n8k32.row.col.f32.e4m3.e4m3.f32, which is a different instruction from SM120'smma.sync.aligned.kind::f8f6f4.m16n8k32— so even if they were exposed, they wouldn't test thekind::f8f6f4lowering path. The inline PTX workaround from the earlier comment remains the only way to access this instruction from the DSL today.Contributed by Second Nature Computing
shubaoyu2 commentedon Mar 4, 2026
Got it, thanks. We need to make some change to our close sourced code of cutedsl, and maybe bring it out with 4.5 version. And you're right, mixed precision f8 dense mma is a SM120 thing not SM89
shubaoyu2 commentedon Mar 4, 2026
Hi @blake-snc , I want to make sure that you do need kind::f8f6f4, right? SM89 can support things like e4m3xe5m2, the kind::f8f6f4 on SM120 is for things like f4xf8 / f6xf8 / f8xf8 mma.
blake-snc commentedon Mar 4, 2026
You're right — I should correct my earlier claim. For e4m3×e4m3 specifically, SM120 does support the SM89-style instruction via backward compatibility. I validated both instructions side-by-side on GB10 (SM121a):
Both produce identical results across all warp threads with both uniform and varied data.
For our use cases (FP8 flash attention, MLA decode), e4m3×e4m3 is what we need — so an
MmaAtomSM89Typein the DSL would fully unblock us on SM120. The mixed-precision combinations unique tokind::f8f6f4(f8×f6, f4×f8, etc.) would still be locked out of the DSL ecosystem, but SM120's block-scaled path (MmaSM120BlockScaledOp) already covers FP4/FP8 GEMM workloads, so the gap is narrow in practice.Thanks for pushing on this — happy to test anything else on our GB10 hardware.
Contributed by Second Nature Computing
Alimadcorp commentedon Mar 12, 2026
❤️
blake-snc commentedon Mar 24, 2026
Closing out the status on this issue: SM89-style FP8 MMA instructions (
SM89_16x8x32_F32E4M3E4M3F32_TNetc.) work correctly on SM120/SM121 via backward compatibility — validated side-by-side againstkind::f8f6f4on GB10 (SM121a), both produce identical results.The original segfault was from calling
MmaAtomSM80Typewith FP8 types, which is the wrong API — SM80 atoms only cover F16/BF16. Thekind::f8f6f4instruction itself works via inline PTX (llvm.inline_asm()), also validated.For CuTe DSL usage:
MmaAtomSM89Typedoesn't exist in the Python DSL layer (no entry incute_nvgpudialect), so either inline PTX or the C++ SM89 atoms (via thecute.nvgpuC++ path) are the current options for FP8 MMA on SM120.github-actions commentedon Apr 23, 2026
This issue has been labeled
inactive-30ddue to no recent activity in the past 30 days. Please close this issue if no further response or action is needed. Otherwise, please respond with a comment indicating any updates or changes to the original issue and/or confirm this issue still needs to be addressed. This issue will be labeledinactive-90dif there is no activity in the next 60 days.blake-snc commentedon Apr 25, 2026
Reproduced on cutlass-dsl 4.4.2 (current latest)
Re-validated this issue end-to-end on cutlass-dsl 4.4.2 / CUTLASS main
f74fea9con NVIDIA GB10 (DGX Spark, sm_121a) with three distinct reproducers. All three confirm the segfault is still present.Reproducer 1 — Realistic FP8 attention path
Took the upstream
examples/python/CuTeDSL/ampere/flash_attention_v2.pyexample, substitutedMmaFP8Op(per the issue body) forMmaF16BF16Op, relaxed the dtype gates, and widened the SMEM swizzle from M=3 to M=4 to satisfy 128-bit cp.async alignment for FP8 elements. Same kernel structure as the stock F16 example, dtype is the only meaningful change.Reproducer 2 — Minimal isolated MMA repro (clearest evidence)
Same per-thread register-only kernel structure for F16 and FP8, identical fragment shape construction, only the MMA atom differs (
MmaF16BF16OpvsMmaFP8Op). F16 reaches thecute.gemmrank verification and reports a clean MLIR error; FP8 segfaults before any verification message is printed.This is the strongest signal: identical code path, only the dtype + atom differ, F16 reaches frontend verification while FP8 crashes earlier in the backend.
Reproducer 3 — Diff of cutlass-dsl 4.3.5 → 4.4.2
python/CuTeDSL/cutlass/cute/nvgpu/warp/mma.pyshows:MmaAtomSM80Type. The bypass technique from this issue's reproducer still constructs successfully.MmaSM120BlockScaledOpfor block-scaled FP4/FP8 MMA (mma.sync.aligned.block_scaleinstructions). This is a separate code path from non-block-scaled FP8 (mma.sync.aligned.kind::f8f6f4.m16n8k32)._mlir/_mlir_libs/_cutlass_ir.cpython-313-aarch64-linux-gnu.sodiffers but does not appear to fix the FP8 lowering segfault forMmaAtomSM80Typebased on the reproducer behavior above.Adjacent context
CUTLASS PR #3030 demonstrates that the underlying PTX instruction (
mma.sync.aligned.kind::f8f6f4.m16n8k32) works correctly on SM120 hardware end-to-end, accessed via inline PTX in C++ CuTe rather than the Python DSL. That confirms the bug is specifically in the Python DSL's MLIR lowering, not in the hardware or the instruction itself, and bounds the scope of the fix.Net
The lowering gap reported in this issue persists in 4.4.2. Adding
MmaSM120BlockScaledOpcovers the block-scaled FP8/FP4 path but the non-block-scaled FP8 path throughMmaAtomSM80Typestill segfaults. SM120'smma.sync.aligned.kind::f8f6f4.m16n8k32instruction (the highest-impact optimization for SM120 attention at 2x BF16 throughput) remains inaccessible from the Python DSL.The two reproducers are minimal Python files (~60 and ~100 lines respectively), happy to share if helpful for triage.
Re-tested by Second Nature Computing on DGX Spark hardware, 2026-04-25.
brandon-yujie-sun commentedon Jul 2, 2026
@blake-snc this is now fixed in 4.6 release.