Skip to content

feat(intrinsics): add Blackwell data-path and execution-control intrinsics - #721

Merged
nihalpasham merged 4 commits into
NVIDIA:mainfrom
lucifer1004:feat/intrinsics-blackwell-execution-control
Aug 10, 2026
Merged

nihalpasham merged 4 commits into
NVIDIA:mainfrom
lucifer1004:feat/intrinsics-blackwell-execution-control

Conversation

@lucifer1004

Copy link
Copy Markdown
Contributor

Summary

Extend the reviewed intrinsic catalog and lowering pipeline with 65 ABI-stable entries covering Blackwell mixed-format register MMA, counted CTA barriers, TMA descriptor and prefetch control, programmatic dependent launch, and warpgroup register-allocation control.

Changes

  • Add 25 mma.m16n8k32.mxf8f6f4.f32 register-MMA variants for the supported SM120/SM121 targets.
  • Add counted CTA barrier sync and arrive variants, including aligned forms.
  • Extend TMA support with:
    • tensor-map and tile prefetch;
    • gather4 prefetch;
    • tensor-map descriptor replacement operations;
    • tensor-map proxy acquire/release fences; and
    • L2 cache-hint prefetch variants.
  • Add programmatic dependent-launch launch_dependents and wait operations.
  • Add warpgroup setmaxnreg increment and decrement operations.
  • Extend the generated dialect and MIR lowering for the new execution-control and TMA forms.
  • Extend the reviewed Blackwell ldmatrix variants and their target gating.
  • Record portable evidence tool identifiers and resolve bare ptxas names through PATH during PTX-assembly validation.
  • Regenerate the catalog, ABI registry, reference documentation, dialect bindings, lowering tables, and probe corpus from the reviewed overlays and evidence.

Target policy

  • Treat SM110 according to the SM100/SM103 capability policy where the instruction family permits it.
  • Keep Blackwell cluster/CTA-group TMA capabilities disabled for SM120 and SM121.
  • Gate SM12x-specific register MMA and other instruction families independently according to their documented target support.

Generated artifacts

This change adds 65 new probe files, corresponding to the 65 new ABI entries.

The remaining modified probe files are deterministic regeneration caused by portable evidence metadata and tool-name normalization; they do not represent additional public intrinsic entries.

Testing

  • cargo fmt --all --check
  • cargo clippy -p cuda-intrinsics-gen --all-targets -- -D warnings
  • cargo test -p cuda-intrinsics-gen — 289 passed
  • cargo run -p cuda-intrinsics-gen -- check
  • cargo run -p cuda-intrinsics-gen -- check-abi-history --base-ref upstream/main
    • preserves all 857 existing ABI entries
    • contains 922 entries after this change
  • cargo check -p cuda-intrinsics -p dialect-nvvm -p mir-lower
  • Hardware runtime validation of the newly added instruction families was not performed; the checked-in evidence covers compilation, lowering, linking, and expected PTX instruction forms.

Checklist

  • All commits signed off (git commit -s)
  • SPDX headers on new source files

setmaxnreg.{inc,dec}.sync.aligned.u32 reconfigures the register file for
the whole warpgroup, so every warp must execute it together; the exported
declaration now carries the convergent attribute like the other warp- and
warpgroup-collective nvvm intrinsics. The counted CTA barrier family
(llvm.nvvm.barrier.cta.{sync,arrive}[.aligned].count) is already covered
by the existing llvm.nvvm.barrier prefix; a test now checks that coverage
against the exact names the generated lowerings produce.

Signed-off-by: nihalpasham <[email protected]>
counted_barrier (standard category) proves the counted numbered-barrier
intrinsics with data, not just completion: warps 0 and 1 hand values
across barrier.sync 1, 64 and across a split barrier.arrive/barrier.sync
pair on barrier 2, while warps 2 and 3 never participate; the host
verifies the produced values and the untouched bystander slots.

mma_mxf8f6f4 runs the block-scaled Blackwell register MMA
(mma.sync.aligned.m16n8k32.row.col.kind::mxf8f6f4.block_scale
.f32.e4m3.e4m3.f32.ue8m0) on one warp and compares the full 16x8 D
matrix bitwise against a CPU reference, with fragments packed on the
host per the PTX ISA m16n8k32 8-bit layout. kind::mxf8f6f4 exists only
on sm_120/sm_121, so the new blackwell-mma smoketest category always
compiles with --arch=sm_120a (the generated target gating rejects every
other architecture at compile time); on an sm_120/121 host the example
must execute and verify, elsewhere it checks that the generated PTX
contains the instruction and exits 0, mirroring the wgmma category.

check-example-smoketest-contract.sh learns the new category array so
its members are not mistaken for standard examples.

Signed-off-by: nihalpasham <[email protected]>
@nihalpasham nihalpasham added enhancement New feature or request intrinsics Device intrinsics and libdevice math mappings cuda-feature A CUDA hardware/toolkit feature (TMA, tcgen05, WGMMA) codegen Device code-generation pipeline (Rust MIR to IR to PTX) IR-lowering Lowering between dialects (dialect-mir to LLVM dialect) build-related Build scripts, toolchain discovery, or compilation setup labels Aug 10, 2026
@nihalpasham

nihalpasham commented Aug 10, 2026 •

Copy link
Copy Markdown
Collaborator

Gist:

  • the 60k-line diff is regeneration, not 60k lines of new logic, and we verified that mechanically: regenerating from the committed overlays reproduces every generated file byte for byte,
  • the ABI ledger is append-only against current main (857 preserved, 922 total); zero existing target contracts changed,
  • the hand-written generator and lowering code is principled throughout.

I pushed two commits:

  • the exporter now marks llvm.nvvm.setmaxnreg.* convergent like its barrier siblings,
  • two permanent examples: mma_mxf8f6f4 (new blackwell-mma smoketest category) and counted_barrier.

Verified here on RTX 5090s (sm_120a, the prime target of the new MMA family), CUDA 13.3:

  • full numeric check of one mxf8f6f4 block-scale MMA variant, bitwise-identical to a CPU reference,
  • counted CTA barriers verified with data crossing the barrier while bystander warps run free,
  • setmaxnreg runs correctly, and setmaxnreg_dec::<41>() is rejected at compile time,
  • tensormap prefetch/replace/fence verified against a real cuTensorMapEncodeTiled descriptor; griddepcontrol smoke-tested.

Before merge: This need to rebase (about 30 commits behind; main never regenerated the factory outputs, so one generate run reconciles) and have CI approved. I'll take care of it.

Related to #660, #604, #774; closes none of them.

Follow-ups we'll file separately: a #[kernel] maxnreg knob (without a launch-time register bound, PTX says setmaxnreg may have no effect), and a note on #604 that this family also freezes its ABI block by list position.

@nihalpasham
nihalpasham merged commit 9eaaa20 into NVIDIA:main Aug 10, 2026
38 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

build-related Build scripts, toolchain discovery, or compilation setup codegen Device code-generation pipeline (Rust MIR to IR to PTX) cuda-feature A CUDA hardware/toolkit feature (TMA, tcgen05, WGMMA) enhancement New feature or request intrinsics Device intrinsics and libdevice math mappings IR-lowering Lowering between dialects (dialect-mir to LLVM dialect)

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants