B200 TMA Pipeline Designer
R — Source evidence (Reading, paraphrased)
- [S6] TMA is issued by a single thread; the hardware asynchronously moves a regular rectangular tile; the descriptor describes the global shape/stride, tile coordinates, and SMEM swizzle.
- [S6] TMA loads complete through an mbarrier carrying a byte count; TMA stores drain through commit group / wait group.
- [S12] Double buffering gives the next K tile a landing slot; full load/compute overlap additionally requires role separation or an equivalent concurrency structure.
Source: distilled from "Modern GPU Programming for MLSys" (https://mlc.ai/modern-gpu-programming-for-mlsys/) and the NVIDIA Blackwell tuning/compatibility guides. Short paraphrases only; no long passages are reproduced.
I — Methodology skeleton (Interpretation)
TMA is not "the copy API under a new name"; it restructures a synchronous thread path into an asynchronous producer. The design counts as complete only when all of the following are given together:
- the descriptor and the SMEM layout;
- a unique issuer;
- the ready/free protocol for each stage;
- the distinct completion mechanisms for load vs store;
- the prologue, the steady-state loop, and the drain;
- the trade-off between stage count and SMEM/occupancy.
If you have only written copy_async without a lifecycle protocol, the TMA design is not finished yet.
A1 — Applications in the source (Past Application)
Case 1: GEMM operand double buffering
- While stage 0 is being consumed by the MMA, TMA writes the next K tile into stage 1.
- The consumer first waits on
tma2mma[stage]; the producer waits on mma2tma[stage] before overwriting.
Case 2: TMA store of results
- After the epilogue writes the result to
Dsmem, a single thread issues the TMA store.
commit_group must be followed by wait_group, confirming the store has drained before Dsmem may be reused or the associated lifetime may end.
A2 — Trigger scenarios (Future Trigger) ★
In what situations will the user need this skill?
- "Convert this GMEM→SMEM load to B200 TMA double buffering."
- "What should a TMA load and a TMA store each wait on?"
- "Help me design the stage ring and barriers for PIPE_DEPTH=2/3."
Language signals
- "Convert this GMEM→SMEM load to B200 TMA double buffering."
- "What should a TMA load and a TMA store each wait on?"
- "Help me design the stage ring and barriers for PIPE_DEPTH=2/3."
Distinction from adjacent skills
Versus b200-mbarrier-protocol-auditor: this skill designs a TMA pipeline from scratch; the latter checks existing barriers item by item for bugs. Compose with b200-layout-contract-auditor to cross-check the swizzle.
E — Executable steps (Execution)
Once the skill is activated, the agent must execute the following procedure:
- Assess TMA suitability
- Is the tile regular, rectangular, and describable by fixed strides?
- Is the copy volume large enough to amortize the descriptor and synchronization overhead?
- If not, keep the vectorized thread copy.
- Define the tensor-map descriptor
- Global shape/stride, element size, tile shape, coordinates, boundary policy, swizzle.
- Completion criterion: the source address and the destination SMEM layout can be uniquely derived from the logical tile coordinates.
- Choose the issuer
- Designate one lane/thread to issue; do not let every thread redundantly issue the TMA.
- Write the issue scope and the CTA consumption scope separately.
- Define the load protocol
- Initialize a barrier for each stage.
arrive.expect_tx(bytes) sets the expected bytes and completes the issuing thread's arrival.
- Consumers read SMEM only after waiting on the correct phase.
- Define the store protocol
- After
commit_group, use wait_group to guarantee outgoing stores have drained.
- Do not mistakenly substitute the load-side byte-count protocol for store drain.
- Design the stage ring
- Give
PIPE_DEPTH, per-stage A/B/temporary SMEM, the ready/free barriers, and the initial phase values.
- Compute total SMEM; check whether it pushes residency to an unacceptable level.
- Write the three-phase timeline
- Prologue: fill the initial batch of stages.
- Steady state: overlap load k+1 / compute k / store k-1.
- Epilogue: stop issuing new loads, finish the remaining compute/store, drain the groups.
- Validate
- Correctness: asymmetric small matrices, boundary tiles, different K_TILES.
- Protocol: each stage's ready and free each have a unique producer and consumer.
- Performance: confirm the copy instructions genuinely overlap with Tensor Core work, rather than code that looks asynchronous but is still issued serially by the same role.
Required outputs
- Conclusion: the current choice/diagnosis, without vague "could be any of them" hedging.
- Evidence or assumptions: which come from user data, and which are hypotheses awaiting verification.
- Contract/table/timeline: the auditable intermediate artifacts corresponding to this skill.
- Minimal validation: correctness tests, boundary tests, and one falsifiable experiment.
- Risks and fallback: alternative paths when hardware, version, or resource conditions are not met.
B — Boundaries (Boundary) ★
Do not use when
- Highly sparse, irregular gather/scatter that a descriptor cannot express.
- A one-off, tiny copy where the TMA setup and synchronization cost may exceed the benefit.
Failure modes
- TMA swizzle inconsistent with the MMA layout.
- Consuming right after the load is issued, missing the barrier wait.
- Reusing SMEM before the store has drained.
- Increasing pipeline depth without accounting for SMEM resources and occupancy.
Limitations
- The best pipeline depth must be measured on real shapes, clock frequencies, and compiled output; it cannot be derived from a fixed rule.
Related skills
- depends-on:
b200-scope-layout-dispatch, b200-layout-contract-auditor
- contrasts-with: none
- composes-with:
b200-mbarrier-protocol-auditor, b200-gemm-optimization-ladder, b200-flash-attention4-planner
Audit info
- Validation passed: V1 ✓ / V2 ✓ / V3 ✓
- Test definitions: 6 (3 should_trigger / 2 should_not_trigger / 1 edge_case)
- Hardware validation: not performed; must be verified on a target B200
- Distilled: 2026-06-25
1---2name: b200-tma-pipeline-designer3description: Use when the user wants to convert regular GMEM↔SMEM tile copies to TMA on B200/Blackwell, design double-buffered/multi-stage pipelines, choose a swizzle, or distinguish the TMA load vs store completion protocols. Produces descriptor, stage ring, barrier, and prologue/steady-state/epilogue plans. Not for highly irregular gather/scatter or copies too small to be worth setting up a TMA descriptor.4---56<!-- Distilled from "Modern GPU Programming for MLSys" — https://mlc.ai/modern-gpu-programming-for-mlsys/ -->78# B200 TMA Pipeline Designer910## R — Source evidence (Reading, paraphrased)1112- [S6] TMA is issued by a single thread; the hardware asynchronously moves a regular rectangular tile; the descriptor describes the global shape/stride, tile coordinates, and SMEM swizzle.13- [S6] TMA loads complete through an mbarrier carrying a byte count; TMA stores drain through commit group / wait group.14- [S12] Double buffering gives the next K tile a landing slot; full load/compute overlap additionally requires role separation or an equivalent concurrency structure.1516> Source: distilled from "Modern GPU Programming for MLSys" (https://mlc.ai/modern-gpu-programming-for-mlsys/) and the NVIDIA Blackwell tuning/compatibility guides. Short paraphrases only; no long passages are reproduced.1718---1920## I — Methodology skeleton (Interpretation)2122TMA is not "the copy API under a new name"; it restructures a synchronous thread path into an asynchronous producer. The design counts as complete only when all of the following are given together:2324- the descriptor and the SMEM layout;25- a unique issuer;26- the ready/free protocol for each stage;27- the distinct completion mechanisms for load vs store;28- the prologue, the steady-state loop, and the drain;29- the trade-off between stage count and SMEM/occupancy.3031If you have only written `copy_async` without a lifecycle protocol, the TMA design is not finished yet.3233---3435## A1 — Applications in the source (Past Application)3637### Case 1: GEMM operand double buffering38- While stage 0 is being consumed by the MMA, TMA writes the next K tile into stage 1.39- The consumer first waits on `tma2mma[stage]`; the producer waits on `mma2tma[stage]` before overwriting.4041### Case 2: TMA store of results42- After the epilogue writes the result to `Dsmem`, a single thread issues the TMA store.43- `commit_group` must be followed by `wait_group`, confirming the store has drained before `Dsmem` may be reused or the associated lifetime may end.4445---4647## A2 — Trigger scenarios (Future Trigger) ★4849### In what situations will the user need this skill?50511. "Convert this GMEM→SMEM load to B200 TMA double buffering."522. "What should a TMA load and a TMA store each wait on?"533. "Help me design the stage ring and barriers for PIPE_DEPTH=2/3."5455### Language signals5657- "Convert this GMEM→SMEM load to B200 TMA double buffering."58- "What should a TMA load and a TMA store each wait on?"59- "Help me design the stage ring and barriers for PIPE_DEPTH=2/3."6061### Distinction from adjacent skills6263Versus `b200-mbarrier-protocol-auditor`: this skill designs a TMA pipeline from scratch; the latter checks existing barriers item by item for bugs. Compose with `b200-layout-contract-auditor` to cross-check the swizzle.6465---6667## E — Executable steps (Execution)6869Once the skill is activated, the agent must execute the following procedure:70711. **Assess TMA suitability**72 - Is the tile regular, rectangular, and describable by fixed strides?73 - Is the copy volume large enough to amortize the descriptor and synchronization overhead?74 - If not, keep the vectorized thread copy.752. **Define the tensor-map descriptor**76 - Global shape/stride, element size, tile shape, coordinates, boundary policy, swizzle.77 - Completion criterion: the source address and the destination SMEM layout can be uniquely derived from the logical tile coordinates.783. **Choose the issuer**79 - Designate one lane/thread to issue; do not let every thread redundantly issue the TMA.80 - Write the issue scope and the CTA consumption scope separately.814. **Define the load protocol**82 - Initialize a barrier for each stage.83 - `arrive.expect_tx(bytes)` sets the expected bytes and completes the issuing thread's arrival.84 - Consumers read SMEM only after waiting on the correct phase.855. **Define the store protocol**86 - After `commit_group`, use `wait_group` to guarantee outgoing stores have drained.87 - Do not mistakenly substitute the load-side byte-count protocol for store drain.886. **Design the stage ring**89 - Give `PIPE_DEPTH`, per-stage A/B/temporary SMEM, the ready/free barriers, and the initial phase values.90 - Compute total SMEM; check whether it pushes residency to an unacceptable level.917. **Write the three-phase timeline**92 - Prologue: fill the initial batch of stages.93 - Steady state: overlap load k+1 / compute k / store k-1.94 - Epilogue: stop issuing new loads, finish the remaining compute/store, drain the groups.958. **Validate**96 - Correctness: asymmetric small matrices, boundary tiles, different K_TILES.97 - Protocol: each stage's ready and free each have a unique producer and consumer.98 - Performance: confirm the copy instructions genuinely overlap with Tensor Core work, rather than code that looks asynchronous but is still issued serially by the same role.99100### Required outputs1011021. **Conclusion**: the current choice/diagnosis, without vague "could be any of them" hedging.1032. **Evidence or assumptions**: which come from user data, and which are hypotheses awaiting verification.1043. **Contract/table/timeline**: the auditable intermediate artifacts corresponding to this skill.1054. **Minimal validation**: correctness tests, boundary tests, and one falsifiable experiment.1065. **Risks and fallback**: alternative paths when hardware, version, or resource conditions are not met.107108---109110## B — Boundaries (Boundary) ★111112### Do not use when113- Highly sparse, irregular gather/scatter that a descriptor cannot express.114- A one-off, tiny copy where the TMA setup and synchronization cost may exceed the benefit.115116### Failure modes117- TMA swizzle inconsistent with the MMA layout.118- Consuming right after the load is issued, missing the barrier wait.119- Reusing SMEM before the store has drained.120- Increasing pipeline depth without accounting for SMEM resources and occupancy.121122### Limitations123- The best pipeline depth must be measured on real shapes, clock frequencies, and compiled output; it cannot be derived from a fixed rule.124125---126127## Related skills128129- **depends-on**: `b200-scope-layout-dispatch`, `b200-layout-contract-auditor`130- **contrasts-with**: none131- **composes-with**: `b200-mbarrier-protocol-auditor`, `b200-gemm-optimization-ladder`, `b200-flash-attention4-planner`132133---134135## Audit info136137- **Validation passed**: V1 ✓ / V2 ✓ / V3 ✓138- **Test definitions**: 6 (3 should_trigger / 2 should_not_trigger / 1 edge_case)139- **Hardware validation**: not performed; must be verified on a target B200140- **Distilled**: 2026-06-25