Skip to content

refactor(05-09): unify MMA tile to (2,4,1)x(1,1,2) and tighten copy ops - #18

Merged
ArthurinRUC merged 1 commit into
mainfrom
feat/align-07-09-mma-tile-with-05-06
May 20, 2026
Merged

ArthurinRUC merged 1 commit into
mainfrom
feat/align-07-09-mma-tile-with-05-06

Conversation

@ArthurinRUC

@ArthurinRUC ArthurinRUC commented May 20, 2026 •

Copy link
Copy Markdown
Owner

Summary

Unify 07/08/09 MMA tile to match 05/06's ATOM_LAYOUT_MNK=(2,4,1) / VAL_EXPAND_MNK=(1,1,2) (32x32x32 MMA tile, 256 threads), and bring the cutedsl ports closer to their C++ siblings.

  • C++ (07/08/09): downgrade C-side SM75_U32x4_LDSM_N -> SM75_U32x2_LDSM_N and SM90 STSM_N x4 -> x2. The C/O fragment has no K val-expand, so each thread owns 2 32-bit packets, and the x4 variant fails its static_assert; A/B keep x4 because VAL_EXPAND_K=2 gives them enough vals/thread.
  • cutedsl (07/08/09): arch-gated R2S - SM90 + 16-bit output uses StMatrix8x8x16bOp(False, 2), else CopyUniversalOp, mirroring the C++ SM90 STSM branch. Predicate wrapped in cutlass.const_expr so the trace picks one branch statically.
  • cutedsl (07/08/09): add swizzled sC layout (Swizzle<3,3,3> o (8 x min(64, N))) to mirror C++ SmemLayoutC. 07 also pulls partition_S/D into named tensors before cute.copy to match the C++ style.
  • cutedsl (06): refactor G2S TV layouts from hardcoded (32,8)/(1,8) and (1,4) to the parametric block_k_copy = min(64,K)//(16//elt_bytes) + val=(1, 16//elt_bytes) formula used by 07-09, matching the C++ kBlockK_Copy / kBlockN_Copy template.

* 07/08/09 examples now use the same MMA atom layout (2,4,1) and val
  expand (1,1,2) as 05/06, giving a uniform 32x32x32 MMA tile with 256
  threads per block.

* C++: downgrade C-side LDSM/STSM from x4 to x2 (SM75_U32x2_LDSM_N /
  SM90_U32x2_STSM_N). The C/O fragment has no K val-expand, so each
  thread owns only 2 32-bit packets and the x4 variant fails its
  static_assert; A/B keep x4 (VAL_EXPAND_K=2 gives them enough vals).

* cutedsl: arch-gated R2S — SM90 with a 16-bit output uses
  StMatrix8x8x16bOp(False, 2), else CopyUniversalOp, mirroring the C++
  SM90 STSM branch. Predicate wrapped in cutlass.const_expr so the
  trace picks one branch statically.

* 07/08/09 cutedsl: add swizzled sC layout
  (Swizzle<3,3,3> o (8 x min(64, N))) to mirror C++ SmemLayoutC.
  07 also pulls partition_S/D into named tensors before cute.copy to
  match the C++ style.

* 06 cutedsl: refactor G2S TV layouts from hardcoded (32,8)/(1,8) and
  (1,4) to the parametric block_k_copy = min(64,K)//(16//elt_bytes)
  + val=(1, 16//elt_bytes) formula used by 07-09, matching the C++
  kBlockK_Copy / kBlockN_Copy template.

Verified on G2 (H200, SM90): all six C++ launchers and four cutedsl
ports pass — 6852 sub-tests total, 0 failed.

Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
@ArthurinRUC
ArthurinRUC merged commit 0e53f64 into main May 20, 2026
5 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant