B200 Layout Contract Auditor
R — Source evidence (Reading, paraphrased)
- [S4] A layout is the mapping from logical index to physical location; it directly determines coalescing, bank conflicts, and whether the hardware can read the tile at all.
- [S5] The two constraints invariant across generations are global coalescing and shared-memory bank conflicts; Tensor Cores add specific operand layout contracts on top.
- [S6] The TMA descriptor, the target SMEM swizzle, and the downstream MMA's interpretation of the layout must agree exactly.
- [S8] TMEM is a two-dimensional
TLane × TCol address space; it must not be understood as an ordinary SMEM byte array.
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)
A layout audit must proceed hop by hop along the data path:
logical tensor → GMEM access → SMEM tile/swizzle → Tensor Core operand → TMEM accumulator/scale → register fragment → output store
Each hop answers four things: the index formula, the physical stride, the owner, and the consumer's expectation. If any one of them disagrees, it can show up as degraded performance or a silent error. In particular, distinguish a "view/stride rewrite" from an "ownership change": the latter usually requires a real data movement.
A1 — Applications in the source (Past Application)
Case 1: TMA writes a 128B swizzle, but the MMA reads a different layout
- The logical tile's values are unchanged, but the physical bank arrangement disagrees.
- The hardware does not report a "layout mismatch"; it interprets the addresses it receives and computes on the wrong elements.
Case 2: a transpose mistakenly assumed to be free
- A view over a single linear storage can change only the strides.
- If the transpose also changes lane/register ownership or the SMEM swizzle, then a load/store/shuffle/specialized instruction must occur.
A2 — Trigger scenarios (Future Trigger) ★
In what situations will the user need this skill?
- "This TMA + tcgen05 kernel is numerically wrong, but no address goes out of bounds."
- "Help me find shared memory bank conflicts and swizzle problems."
- "How does this TMEM accumulator map back to each lane's register fragment?"
Language signals
- "This TMA + tcgen05 kernel is numerically wrong, but no address goes out of bounds."
- "Help me find shared memory bank conflicts and swizzle problems."
- "How does this TMEM accumulator map back to each lane's register fragment?"
Distinction from adjacent skills
Versus b200-mbarrier-protocol-auditor: this skill checks "where the bytes are and who owns them"; the barrier auditor checks "when they may be read and when they may be reused". Wrong results often require invoking both in combination.
E — Executable steps (Execution)
Once the skill is activated, the agent must follow this procedure:
- Freeze the logical semantics
- Write down each tensor/tile's logical shape, axis meanings, transpose relationships, and the expected element formula.
- Audit GMEM coalescing
- List lane→address for one warp; check contiguity, alignment, transaction count, and boundary tiles.
- Audit the SMEM bank mapping
- Compute banks for the consuming instruction's access pattern; identify same-bank different-address conflicts.
- When choosing a swizzle, prefer the largest atom that the tile's contiguous dimension can fill; drop to a smaller atom when it cannot.
- Check the three-way contract
- The TMA tensor-map descriptor's shape/stride/tile/swizzle.
- The SMEM layout declared by the DSL/code.
- The MMA/specialized load's interpretation of the operand.
- All three must agree item by item.
- Audit TMEM
- Pin down the
TLane, TCol mapping and the column base.
- Distinguish the accumulator layout from the block-scale layout; both live in TMEM but usually differ.
- Audit the register fragment
- Write down which elements each lane holds; confirm the
tcgen05.ld shape/repeat matches the epilogue's expectation.
- Identify the real data-movement points
- Label views that change only shape/stride separately from rearrangements that change owner/swizzle.
- Output fix recommendations and validation vectors
- Use small, non-symmetric matrices (so transpose errors are not masked by symmetric data).
- Design an observable sentinel pattern for each hop.
Required outputs
- Conclusion: the current choice/diagnosis, never a vague "we may need to look at everything".
- Evidence or assumptions: which items come from user data and which are assumptions pending verification.
- Contract/table/timeline: the auditable intermediate artifacts corresponding to this skill.
- Minimal validation: a correctness test, a boundary test, and one falsifiable experiment.
- Risks and fallback: the alternative path when hardware, version, or resource requirements are not met.
B — Boundaries (Boundary) ★
Do not use when
- A pure barrier deadlock with no sign of a data-layout issue.
- Merely a Python API rename or a link failure.
Failure modes
- Validating with all-0, all-1, or symmetric inputs, which masks misplacement.
- Looking only at logical shapes without tracking lane/warp/CTA ownership.
- Assuming every transpose/view is zero-copy.
Limitations
- Some layout contracts depend on the exact PTX instruction forms and the compiler lowering; they must be verified against the generated CUDA/PTX.
Related skills
- depends-on:
b200-scope-layout-dispatch
- contrasts-with:
b200-mbarrier-protocol-auditor
- composes-with:
b200-tma-pipeline-designer, b200-tmem-lifecycle-planner, b200-tcgen05-mma-contract-builder, b200-warp-specialized-debugger
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-layout-contract-auditor3description: Use when a B200/Blackwell kernel shows wrong results, uncoalesced global memory access, SMEM bank conflicts, a TMA swizzle that mismatches the Tensor Core read, or confused TMEM/register ownership. Audits shape–stride, thread distribution, swizzle, and the hardware operand contract layer by layer. Not for pure synchronization deadlocks or compile errors unrelated to memory layout.4---56<!-- Distilled from "Modern GPU Programming for MLSys" — https://mlc.ai/modern-gpu-programming-for-mlsys/ -->78# B200 Layout Contract Auditor910## R — Source evidence (Reading, paraphrased)1112- [S4] A layout is the mapping from logical index to physical location; it directly determines coalescing, bank conflicts, and whether the hardware can read the tile at all.13- [S5] The two constraints invariant across generations are global coalescing and shared-memory bank conflicts; Tensor Cores add specific operand layout contracts on top.14- [S6] The TMA descriptor, the target SMEM swizzle, and the downstream MMA's interpretation of the layout must agree exactly.15- [S8] TMEM is a two-dimensional `TLane × TCol` address space; it must not be understood as an ordinary SMEM byte array.1617> 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.1819---2021## I — Methodology skeleton (Interpretation)2223A layout audit must proceed hop by hop along the data path:2425`logical tensor → GMEM access → SMEM tile/swizzle → Tensor Core operand → TMEM accumulator/scale → register fragment → output store`2627Each hop answers four things: the index formula, the physical stride, the owner, and the consumer's expectation. If any one of them disagrees, it can show up as degraded performance or a silent error. In particular, distinguish a "view/stride rewrite" from an "ownership change": the latter usually requires a real data movement.2829---3031## A1 — Applications in the source (Past Application)3233### Case 1: TMA writes a 128B swizzle, but the MMA reads a different layout34- The logical tile's values are unchanged, but the physical bank arrangement disagrees.35- The hardware does not report a "layout mismatch"; it interprets the addresses it receives and computes on the wrong elements.3637### Case 2: a transpose mistakenly assumed to be free38- A view over a single linear storage can change only the strides.39- If the transpose also changes lane/register ownership or the SMEM swizzle, then a load/store/shuffle/specialized instruction must occur.4041---4243## A2 — Trigger scenarios (Future Trigger) ★4445### In what situations will the user need this skill?46471. "This TMA + tcgen05 kernel is numerically wrong, but no address goes out of bounds."482. "Help me find shared memory bank conflicts and swizzle problems."493. "How does this TMEM accumulator map back to each lane's register fragment?"5051### Language signals5253- "This TMA + tcgen05 kernel is numerically wrong, but no address goes out of bounds."54- "Help me find shared memory bank conflicts and swizzle problems."55- "How does this TMEM accumulator map back to each lane's register fragment?"5657### Distinction from adjacent skills5859Versus `b200-mbarrier-protocol-auditor`: this skill checks "where the bytes are and who owns them"; the barrier auditor checks "when they may be read and when they may be reused". Wrong results often require invoking both in combination.6061---6263## E — Executable steps (Execution)6465Once the skill is activated, the agent must follow this procedure:66671. **Freeze the logical semantics**68 - Write down each tensor/tile's logical shape, axis meanings, transpose relationships, and the expected element formula.692. **Audit GMEM coalescing**70 - List lane→address for one warp; check contiguity, alignment, transaction count, and boundary tiles.713. **Audit the SMEM bank mapping**72 - Compute banks for the consuming instruction's access pattern; identify same-bank different-address conflicts.73 - When choosing a swizzle, prefer the largest atom that the tile's contiguous dimension can fill; drop to a smaller atom when it cannot.744. **Check the three-way contract**75 - The TMA tensor-map descriptor's shape/stride/tile/swizzle.76 - The SMEM layout declared by the DSL/code.77 - The MMA/specialized load's interpretation of the operand.78 - All three must agree item by item.795. **Audit TMEM**80 - Pin down the `TLane`, `TCol` mapping and the column base.81 - Distinguish the accumulator layout from the block-scale layout; both live in TMEM but usually differ.826. **Audit the register fragment**83 - Write down which elements each lane holds; confirm the `tcgen05.ld` shape/repeat matches the epilogue's expectation.847. **Identify the real data-movement points**85 - Label views that change only shape/stride separately from rearrangements that change owner/swizzle.868. **Output fix recommendations and validation vectors**87 - Use small, non-symmetric matrices (so transpose errors are not masked by symmetric data).88 - Design an observable sentinel pattern for each hop.8990### Required outputs91921. **Conclusion**: the current choice/diagnosis, never a vague "we may need to look at everything".932. **Evidence or assumptions**: which items come from user data and which are assumptions pending verification.943. **Contract/table/timeline**: the auditable intermediate artifacts corresponding to this skill.954. **Minimal validation**: a correctness test, a boundary test, and one falsifiable experiment.965. **Risks and fallback**: the alternative path when hardware, version, or resource requirements are not met.9798---99100## B — Boundaries (Boundary) ★101102### Do not use when103- A pure barrier deadlock with no sign of a data-layout issue.104- Merely a Python API rename or a link failure.105106### Failure modes107- Validating with all-0, all-1, or symmetric inputs, which masks misplacement.108- Looking only at logical shapes without tracking lane/warp/CTA ownership.109- Assuming every transpose/view is zero-copy.110111### Limitations112- Some layout contracts depend on the exact PTX instruction forms and the compiler lowering; they must be verified against the generated CUDA/PTX.113114---115116## Related skills117118- **depends-on**: `b200-scope-layout-dispatch`119- **contrasts-with**: `b200-mbarrier-protocol-auditor`120- **composes-with**: `b200-tma-pipeline-designer`, `b200-tmem-lifecycle-planner`, `b200-tcgen05-mma-contract-builder`, `b200-warp-specialized-debugger`121122---123124## Audit info125126- **Validation passed**: V1 ✓ / V2 ✓ / V3 ✓127- **Test definitions**: 6 (3 should_trigger / 2 should_not_trigger / 1 edge_case)128- **Hardware validation**: not performed; must be verified on a target B200129- **Distilled**: 2026-06-25