Repository navigation
Add mma.sync.aligned.m16n8k16 bf16 tensor core intrinsic - #321
Merged
Merged
Conversation
honeyspoon
force-pushed
the
add-mma-bf16
branch
2 times, most recently
from
July 1, 2026 15:55
3aee669 to
04d59fd
Compare
Signed-off-by: nihalp <[email protected]>
Signed-off-by: nihalp <[email protected]>
- Replace no-op `impl Verify` with real validation (3 MirPtrType operands, 0 results) matching ldmatrix/stmatrix verifier patterns. - Align safety docs with movmatrix style (divergent-flow UB, ISA floor). - Strengthen lowering test to assert constraints, AsmKind::Convergent, operand count, and result count (not just template substring). - Run cargo fmt to fix import block wrapping in interface_impls.rs. Signed-off-by: nihalp <[email protected]>
Signed-off-by: nihalp <[email protected]>
Collaborator
|
Thanks for the PR. I layered on the maintainer-side finishing work:
Big picture: the before-after looks like this now - This partially addresses #274 by adding the BF16 |
49 tasks done
nihalpasham
added a commit
that referenced
this pull request
Jul 3, 2026
* Add mma.sync.aligned.m16n8k16 f16 tensor core intrinsic Adds the FP16 variant of the Ampere mma.sync instruction, following the same register-only 4-layer pattern established by the BF16 (#321) and F64 (#323) MMA variants: cuda-device stub → dialect-nvvm op → mir-importer emit → mir-lower convert The F16 variant has identical register geometry to BF16 (4 f32 C/D, 4 i32 packed A, 2 i32 packed B = 10 operands, 4 results) and uses the same inline-asm constraints (=f,=f,=f,=f,f,f,f,f,r,r,r,r,r,r). Pipeline detection, lowering tests, and near-miss rejection tests are included. * fix: harden f16 warp MMA contract Signed-off-by: nihalp <[email protected]> * style: format standalone MMA example Signed-off-by: nihalp <[email protected]> --------- Signed-off-by: nihalp <[email protected]> Co-authored-by: nihalp <[email protected]>
2 of 3 tasks
10 tasks done
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.
Summary
Adds the Ampere BF16
mma.sync.aligned.m16n8k16tensor-core operation as anunsafe, register-valued cuda-device intrinsic.
The API consumes the calling lane's C, A, and B fragments as scalar register
arrays and returns the four D registers. It does not hide pointer loads,
stores, a local stack frame, or memory ordering inside the MMA operation.
Partially addresses #274. Related to #289; this PR does not close either issue.
What changed
Device API and safety
mma_m16n8k16_f32_bf16([f32; 4], [u32; 4], [u32; 2]) -> [f32; 4].sm_80+requirements.
unsafeand#[must_use].Compiler pipeline
results in the NVVM dialect.
transport.
constraints and no memory clobber.
Target selection
sm_80.Regression coverage
temporary names.
Testing
cargo fmt --all -- --checkcargo check -p cuda-device -p dialect-nvvm -p mir-importer -p mir-lower --all-targetscargo test -p dialect-nvvm -p mir-importer -p mir-lowersm_80ptxasaccepts both kernelsHMMA.16816.F32.BF16instructions with zero stackbytes and no local loads/stores
sm_75is rejected before PTX generationsm_80+GPUChecklist
crates/cuda-bindings/files changed