Repository navigation
feat(wgmma): adapt linear pointer accumulators to SSA values - #686
Merged
Merged
Conversation
Signed-off-by: Raul Estrada <[email protected]>
Signed-off-by: Raul Estrada <[email protected]>
Signed-off-by: Raul Estrada <[email protected]>
This was referenced Aug 7, 2026
Two mechanical rewrites (question-mark operator, redundant into_iter) and the house-style too_many_arguments allow on apply_value_plan, which threads nine pieces of one rewrite plan and is not worth a struct.
Collaborator
|
Gist: Step 3: kernels using the standard accumulator shape now load its 32 values once, run the whole WGMMA region on values, and store once at the end, instead of bouncing the accumulator through memory inside the region. Anything nonstandard keeps the old fallback path. I pushed one commit on top:
Verified here:
Merging after #685. |
nihalpasham
approved these changes
Aug 8, 2026
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
This PR is the third of six planned PRs for #605 and builds on the 32-value SSA carrier introduced by #685.
Summary
Adapt canonical pointer-form BF16 WGMMA accumulator sequences to the
32-value SSA carrier introduced in the previous PR.
For a canonical
*mut [[f32; 8]; 4]accumulator, the lowering now:f32accumulator elements;WgmmaMmaGroupValuesM64N64K16F32Bf16Op;wait_group<0>.Unsupported accumulator pointer shapes continue to use the existing deferred
pointer-form WGMMA group.
Motivation
The previous PR introduced a value-form WGMMA group capable of carrying all
32 accumulator values explicitly through SSA and lowering them to tied PTX
register operands/results.
The existing public WGMMA API still exposes the accumulator through a pointer,
however. Without an adapter, straight-line pointer-form sequences continue to
use the deferred pointer group and materialize accumulator memory inside that
inline-PTX region.
This PR connects the public pointer-form sequence to the new SSA carrier while
preserving the existing deferred path as a fallback.
Implementation
The WGMMA deferred-accumulator preparation pass now recognizes the canonical
public accumulator shape:
and rewrites a closed linear sequence:
into:
The 32 accumulator addresses are produced with typed
MirArrayElementAddrOpoperations across the4 x 8nested array layout.For non-canonical accumulator shapes, the pass retains the existing
WgmmaMmaGroupM64N64K16F32Bf16Opdeferred pointer-form fallback.Register-lifetime property
For a linear sequence containing multiple MMA instructions, accumulator
memory traffic occurs once at the boundaries of the complete WGMMA region.
For example, a sequence containing two MMAs lowers conceptually as:
rather than performing 32 loads and 32 stores for every individual MMA.
The convergent inline-PTX region itself contains no accumulator:
materialization.
Fallback behavior
The existing deferred pointer-form lowering remains intact.
A supported pointer-form WGMMA sequence whose accumulator does not match the
canonical
[[f32; 8]; 4]shape continues to lower through the deferredpointer group rather than being rejected or silently changed.
Tests
The new coverage verifies that:
[[f32; 8]; 4]accumulator selects the SSA value adapter;extractvalue;ld.f32,st.f32, or.reg .f32;Validation
The spill-free WGMMA carrier backend test also remains green:
WGMMA smoketests:
git diff --checkis clean.Scope
This PR does not yet:
wait_group<N>;Those are left to subsequent PRs.