Skip to content

feat: add movmatrix in-register matrix transpose - #310

Merged
nihalpasham merged 2 commits into
NVIDIA:mainfrom
honeyspoon:add-movmatrix-v2
Jul 1, 2026
Merged

nihalpasham merged 2 commits into
NVIDIA:mainfrom
honeyspoon:add-movmatrix-v2

Conversation

@honeyspoon

Copy link
Copy Markdown
Contributor

Summary

Add movmatrix.sync.aligned.m8n8.trans.b16 across all four compiler
layers (cuda-device, dialect-nvvm, mir-importer, mir-lower).

The instruction transposes an 8x8 matrix of b16 elements distributed
across a warp's registers without a shared-memory round-trip. Each
thread provides one u32 (2 packed b16 elements); the hardware
collectively transposes the tile and returns the result to each lane.

This is useful for switching fragment layouts between chained MMA
operations (e.g., row-major to column-major) without going through
shared memory.

Requires sm_90+ (Hopper).

Ref #274 (Phase 2: Matrix operations)

Test plan

  • 1 new lowering test verifying convergent inline PTX output
  • cargo clippy -- -D warnings clean across all 4 crates
  • cargo fmt --check clean
  • All existing tests pass

@honeyspoon
honeyspoon force-pushed the add-movmatrix-v2 branch 4 times, most recently from 9d9a2e7 to 0ea1f8d Compare June 30, 2026 04:14
@nihalpasham nihalpasham added enhancement New feature or request intrinsics Device intrinsics and libdevice math mappings 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) tests Adds or improves test coverage labels Jul 1, 2026
@nihalpasham

Copy link
Copy Markdown
Collaborator

Thanks for the PR. LGTM.

I kept the hardware floor at sm_75, added exact packed-i32 verification, and covered mixed target requirements. Runtime lane values were not tested on a GPU.

Reviewer note: This work partially addresses #274, which remains open.

@nihalpasham
nihalpasham merged commit f4017a6 into NVIDIA:main Jul 1, 2026
28 checks passed
@honeyspoon
honeyspoon deleted the add-movmatrix-v2 branch July 23, 2026 13:53
meefs pushed a commit to meefs/cuda-oxide that referenced this pull request Sep 30, 2026
…er's tokens (NVIDIA#310)

The token copy-back added for set_token carried any same-identity
binding's token across inlining and block boundaries, including the
completion token a load installs on its own view inside the inlined
Partition::load. For an immutable Partition that update used to stay in
the callee frame; carrying it out made every read-only partition's second
load depend on its first, serializing loads that need no ordering among
themselves. grout's fused norm+RoPE prefill kernel went from 20 to 27 us
per call (+4.4% on short prefill) with identical Tile IR text apart from
the load token operands; its SASS grew from 5408 to 5520 instructions.

Only explicit set_token / set_tensor_token installs now cross a boundary
for immutable bindings (the compiler already records them in
explicit_token_updates). Mutable bindings keep the full metadata copy.
With the fix both kernels compile to Tile IR identical to fce7e4c and to
the same SASS (5408 / 4312 instructions, 181 / 189 registers).

Signed-off-by: Melih Elibol <[email protected]>
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) enhancement New feature or request intrinsics Device intrinsics and libdevice math mappings IR-lowering Lowering between dialects (dialect-mir to LLVM dialect) tests Adds or improves test coverage

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants