Skip to content

test(codegen): validate spill-free 32-value WGMMA carrier - #679

Merged
nihalpasham merged 1 commit into
NVIDIA:mainfrom
uurl:feat/605-wgmma-value-carrier
Aug 7, 2026
Merged

nihalpasham merged 1 commit into
NVIDIA:mainfrom
uurl:feat/605-wgmma-value-carrier

Conversation

@uurl

@uurl uurl commented Aug 6, 2026

Copy link
Copy Markdown
Contributor

This PR is the first of six planned PRs that incrementally implement #605.

Summary

Add feasibility coverage for carrying the 32 per-thread f32 accumulator
values of BF16 m64n64k16 WGMMA through one convergent inline-PTX region.

The tests verify that:

  • nvvm.inline_ptx accepts 32 tied f32 inputs and 32 f32 results;
  • MIR lowering represents the outputs as an LLVM aggregate followed by
    32 extractvalue operations;
  • a real wgmma.mma_async.sync.aligned.m64n64k16.f32.bf16.bf16
    sequence compiles for sm_90a;
  • all 32 results remain observable after wait_group 0;
  • PTX contains no local-memory materialization;
  • ptxas -v reports zero stack frame, zero spill stores, and zero spill
    loads.

Observed locally:

Used 58 registers
0 bytes stack frame
0 bytes spill stores
0 bytes spill loads

Motivation

This isolates the primary backend feasibility question for #605 before
introducing a production value-form WGMMA operation or changing the
existing pointer-based deferred fallback.

Scope

This PR adds tests only. It does not:

  • change the public WGMMA API;
  • change the existing deferred accumulator lowering;
  • implement K-loop fusion;
  • implement partial waits;
  • claim runtime numerical validation on Hopper hardware.

@uurl
uurl force-pushed the feat/605-wgmma-value-carrier branch from c8141f0 to 75d83e7 Compare August 6, 2026 11:20
@uurl
uurl force-pushed the feat/605-wgmma-value-carrier branch from 75d83e7 to 8343c23 Compare August 6, 2026 11:20
@nihalpasham nihalpasham added tests Adds or improves test coverage codegen Device code-generation pipeline (Rust MIR to IR to PTX) IR-lowering Lowering between dialects (dialect-mir to LLVM dialect) cuda-feature A CUDA hardware/toolkit feature (TMA, tcgen05, WGMMA) wgmma-value-path PR series threading WGMMA accumulators through registers (#605) labels Aug 7, 2026
@nihalpasham

Copy link
Copy Markdown
Collaborator

Step 1 of the #605 plan lands what it promised:

  • proof, before any production code, that the backend can carry 32 tied f32 accumulator values through one convergent asm region without spilling.
  • Reproduced the ptxas evidence independently here: 58 registers, 0 bytes stack frame, 0 spill stores/loads for sm_90a (ptxas 13.3, llc-21).
  • The lowering test rides the same struct-return + extractvalue machinery feat(wgmma): add deferred BF16 accumulator lowering #598's fused path already uses; the 32-output constraint accounting checks out against the InlinePtxOp verifier.
  • Scope read correctly: this proves the single-region carrier, not cross-statement liveness — that stays with steps 4-5, as the plan says.

Merging.

@nihalpasham
nihalpasham merged commit 84649fc into NVIDIA:main Aug 7, 2026
34 checks passed
nihalpasham added a commit to uurl/cuda-rust that referenced this pull request Aug 8, 2026
… ptxas

The carrier probe from NVIDIA#679 only ever assembled a single wgmma.mma_async
under one fence/commit/wait. The value-form lowering template chains
multiple MMAs inside the same asm region, so the feasibility claim needs
a chained probe too.

Parametrize the carrier harness on mma_count (kernel builder, template,
constraints, and assertions) and add a second test that builds the
mma_count = 2 shape: two chained wgmma.mma_async instructions under one
fence/commit/wait, one descriptor pair per MMA. ptxas must assemble the
sm_90a PTX with zero spill bytes while keeping all 32 accumulators live.
nihalpasham added a commit that referenced this pull request Aug 8, 2026
* feat(wgmma): add 32-value SSA accumulator carrier

Signed-off-by: Raul Estrada <[email protected]>

* test(codegen): probe a chained two-MMA value-form WGMMA group through ptxas

The carrier probe from #679 only ever assembled a single wgmma.mma_async
under one fence/commit/wait. The value-form lowering template chains
multiple MMAs inside the same asm region, so the feasibility claim needs
a chained probe too.

Parametrize the carrier harness on mma_count (kernel builder, template,
constraints, and assertions) and add a second test that builds the
mma_count = 2 shape: two chained wgmma.mma_async instructions under one
fence/commit/wait, one descriptor pair per MMA. ptxas must assemble the
sm_90a PTX with zero spill bytes while keeping all 32 accumulators live.

---------

Signed-off-by: Raul Estrada <[email protected]>
Co-authored-by: nihalpasham <[email protected]>
@uurl
uurl deleted the feat/605-wgmma-value-carrier branch August 10, 2026 06:28
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

codegen Device code-generation pipeline (Rust MIR to IR to PTX) cuda-feature A CUDA hardware/toolkit feature (TMA, tcgen05, WGMMA) IR-lowering Lowering between dialects (dialect-mir to LLVM dialect) tests Adds or improves test coverage wgmma-value-path PR series threading WGMMA accumulators through registers (#605)

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants