[FEATURE][TIRx][CUDA] Support TMEM datapath B - #20075
Open
jinhongyii wants to merge 1 commit into
Open
Conversation
Add first-class allocation and register layouts for cta_group=2 accumulators with per-CTA M=64. Route tcgen05 load/store through the physical .32x32b image, share the mapping with GEMM lowering, and document and test the public APIs. Update cta_group=2 expected IR to preserve shared pointer storage scopes after the pointer-type fix landed on main.
Contributor
|
Caution The consumer version of Gemini Code Assist on GitHub has been sunset. All code review activity has officially ceased. |
This was referenced Jul 29, 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.
Motivation and context
tcgen05.mma.cta_group::2describes an M=128 operation across a pair of CTAs, but each CTA owns a logical(64, N)accumulator tile. That per-CTA tile uses TMEM datapath B: its lowN/2columns occupy physical lanes 0–63 and its highN/2columns occupy lanes 64–127:(r, c)(TLane = r + 64 * floor(c / (N/2)), TCol = c mod (N/2))The resulting logical
(64, N)tile has the same physical footprint as a conventional(128, N/2)Layout D tile.Before this PR, the
cta_group=2GEMM lowering constructed this mapping locally for the accumulator write, but the public TMEM allocation andtcgen05.ld/stpaths understood only datapaths D and F. Code could produce a datapath-B accumulator, but could not describe, validate, and read or write it through the normal TIRx layout and fragment APIs. Treating it as an ordinary M=64.16x*bfragment accesses the wrong lanes, while exposing a(128, N/2)alias loses the logical per-CTA shape.This PR makes datapath B a first-class layout shared by allocation, GEMM lowering, and register transfer. A logical
(64, N)fp32 fragment is transferred as the physical.32x32b.x{N/2}image over all 128 lanes.Changes
tmem_datapath_layout("B", 64, N)andtmem_pool.alloc(..., datapath="B").cta_group=2GEMM accumulator mapping through that public layout factory.T.alloc_tcgen05_ldst_frag("32x32b", (64, N), "float32")as the register image of datapath B.tcgen05.{ld,st}.32x32b.x{N/2}operation.N, a PTX-supportedN/2, fp32 cells, matching layouts, and a full logical(64, N)transfer. Partial logical-column slices are rejected because they are not physically contiguous after the lane split.cta_group=2expected IR to retain thesharedstorage scope required by the pointer-type fix that is now onmain.Testing
(row, col) -> (lane, register)mappings..32x32binstruction.N = 32, 64, 128, 256at base-column offsets 0 and 32.cta_group=2GEMM and read the Layout B accumulator back through the public fragment API.194 passedacross:tests/python/tirx/operator/tile_primitive/cuda/copy_async/test_tmem_16xnb.pytests/python/tirx/operator/tile_primitive/cuda/gemm_async/test_gemm_async.pyDependencies
The tcgen05 fragment-layout foundation from #20068 is already merged. This PR is based directly on current
apache/main.