Unit 3 of 10 · about 5 hours · implement, measure

Register tiles, vectorized tile copies and resource limits

Shared-memory tiling still issues many shared loads. Register tiles reuse those operands, but the extra live state can reduce residency or spill.

You'll be able to

  • Implement per-thread accumulator tiles and coalesced vectorized input copies with a scalar tail path.
  • Derive accumulator and shared-memory storage for a proposed tile hierarchy.
  • Compare tile choices using event timing, compiler resource reports and generated instructions.

Covers

Register tiles, thread coarsening and accumulator ownershipCoalesced and vectorized matrix tile copiesRegisters, shared memory, occupancy and tile-size constraints
1

Read

In this order, only the parts listed

0 of 3 done

  1. Microtiles and resource tradeoffsAI Systems Performance Engineering - Chapters 9 and 10

    Chapter 9, Multilevel Microtiling and Software Prefetching, including Figure 9-2

    Read the global, shared and register hierarchy. Skip unified-memory prefetching and Blackwell TMEM claims for this implementation. In a 32 by 32 product tile, each input element participates in 32 multiplies, not the section's stated 1024.

  2. Register blocking and wide copiesHow to Optimize a CUDA Matmul Kernel for cuBLAS-like Performance: a Worklog

    Kernels 4, 5 and 6: 1D Blocktiling, 2D Blocktiling and Vectorizing SMEM and GMEM Accesses

    Keep your own edge predicates. Read the SASS examples as evidence for that build, not guarantees about your compiler.

  3. Registers, vectorization and occupancyMIT 6.S894 Accelerated Computing (Fall 2025) - Lectures 6 and 8 and Labs 4 to 6

    Lab 5 Part 0: Understanding Occupancy; Part 1 suggestions Hiding Memory Access Latency and Vectorized Loads

    Recompute occupancy from your GPU and compiled kernel. Do not carry over the RTX 4000 Ada clock, bandwidth or timing targets.

2

Focus on

  • A per-thread outer-product update loads shared operands per reduction step for multiplies. Accumulator storage alone is values.
  • One shared stage uses bytes before padding. Registers also hold addresses, operands and temporaries; source-level accumulator counts are only a lower bound.
  • A float4 copy needs a 16-byte-aligned address and four valid elements. Row strides and subview offsets can break alignment even when the allocation base is aligned.
  • Inspect ptxas -v and SASS for registers, spills and wide loads. Query active blocks for the actual launch; lower occupancy can coexist with faster register reuse.
Common mistakes · 3
  • Casting an unaligned row or a partial tail to float4*. Masking only the starting element does not validate the whole vector.
  • Counting just accumulators as the kernel's register demand, or treating a local array as guaranteed register storage.
  • Claiming register tiling always reduces DRAM bytes. At fixed block tiling it mainly changes shared-to-register reuse and instruction mix.
3

Try it yourself

Closed-book, before checking anything

Derive a 64 by 64 output tile with reduction width 8 and a 4 by 4 per-thread accumulator tile. It uses 256 threads, 16 accumulator values per thread and 4096 shared-memory bytes for one FP32 stage, excluding padding. Implement that mapping in kernellab; check odd shapes with scalar copies before adding aligned vector copies. Compare both variants with interleaved event trials and save their compiler resource reports.
4

Quiz yourself

Answer first, then mark it. Missed ones go to Review.

0 got · 0 missed

  1. 1.For a 4 by 4 per-thread update, how many shared operand values feed how many multiplies?Answer

    Eight values feed 16 multiplies per reduction step, if each operand is loaded once and reused across the outer product.

  2. 2.Why can a larger accumulator tile lose?Answer

    It increases live registers and may cause spills or reduce active blocks. Fewer output blocks and more edge waste can also reduce useful parallelism.

  3. 3.Does a wide load prove coalescing?Answer

    No. Width describes one thread's instruction. Coalescing depends on the addresses requested by all active lanes and their alignment.

You're done when

Both copy paths pass edge tests, and your tile comparison explains the observed result using reuse and compiled resources rather than occupancy alone.

Only when you can do this without notes.

Leads to

Notes

Resources · 3 for this unit, 9 more in the section

Also in this section

  • AI Systems Performance Engineering companion code - Chapters 9 and 10Chris Fregly · required

    Inspect and run compatible baseline and optimized paths from code/ch09 and code/ch10. Verify whether each path is a custom kernel, compiler selection or library dispatch, then add an independent correctness and timing wrapper.

  • CuTe GEMM TutorialNVIDIA CUTLASS · required

    Work through tiling, layouts, copy atoms and MMA atoms. Draw the logical and physical ownership for one tile, then modify a shape or layout and verify both generated mapping and numerical output.

  • OCP 8-bit Floating Point SpecificationOpen Compute Project · required

    Study E4M3 and E5M2 encodings, exceptional values and conversion behavior. Build value-boundary tests and separate format correctness from the scaling policy chosen by a framework or kernel.

  • LeetGPU - GEMM and Quantized Matmul ChallengesAlphaGPU · required

    Solve 2 Matrix Multiplication and 22 GEMM, then choose 30 Batched Matrix Multiplication or 57 FP16 Batched Matmul. Attempt 32 INT8 Quantized Matmul or 81 INT4 Matmul only after scale and accumulator tests pass. Preserve local baselines and shape matrices.

  • GPU MODE - CUTLASS, Tensor Cores and CuTeGPU MODE · support

    Use Lectures 15, 23, 36, 57, 86, 103 and 114 selectively. Pair each chosen lecture with one implemented layout, instruction or pipeline change and compare it against a vendor-library baseline.

  • DeepGEMMDeepSeek · depth

    After the portable GEMM passes, reconstruct one Hopper FP8 path from source, identify its hardware, layout and scaling assumptions, and test a bounded modification only on supported hardware. Do not generalize repository benchmarks to other shapes or GPUs.

  • Modern GPU Programming for MLSysMLC · depth

    Read the performance, data-layout, tensor-core, TMA, tensor-memory, barrier and GEMM chapters for a Blackwell-depth route. Execute only with sm_100a and the pinned TIRx toolchain; otherwise use it for derivation and code reading.

  • CUDA 13.0 matrix programming and PTX referencesNVIDIA · reference

    Coverage and correctness gap: the pool lacks a precise WMMA contract, and Lab 6 relies on TF32 conversion and register behavior the PTX ISA leaves unspecified. Use Programming Guide 10.24 and PTX ISA 9.0 mma.m16n8k8 fragments, mma and cvt, archived with CUDA 13.0.0; also consult cp.async completion semantics.

  • TensorRT quantization schemes and workflowsNVIDIA · reference

    Coverage gap: the existing pool does not derive scale granularity and reconstruction conventions precisely. Read INT8/FP8 equations, per-tensor/per-channel/block quantization and dynamic quantization in documentation dated October 5, 2026. Skip engine building and replace the block pseudocode's floor-divided scale count with ceiling division.