liveBook · Manning

Tile

As explained in GPU Programming with Triton

A tile is a portion of a tensor processed by one Triton program instance.

A tile, or block, is a portion of a tensor processed by one Triton program instance. Instead of coordinating individual GPU threads, a kernel operates on the whole tile; the compiler maps those operations to the hardware. A grid launches many instances, allowing independent tiles to be processed in parallel. section 1.1.1 section 2.4

For a one-dimensional workload, each instance uses its program ID to find its block start, then adds local indices to form global offsets. Loads and stores use these offsets to address the elements. If the final tile extends past the input, a mask marks valid positions so invalid loads and stores are skipped. section 2.4

Tiled matrix multiplication

For C = A × B, each program owns a BLOCK_M × BLOCK_N output tile and initializes an accumulator of that shape. It advances through K in BLOCK_K-sized slices, loading a BLOCK_M × BLOCK_K tile of A and a BLOCK_K × BLOCK_N tile of B. Each tl.dot result is added to the accumulator, which is stored after the last slice. Reusing loaded values across output elements raises arithmetic intensity. section 5.5.4 section 5.5.5

Figure 5.12 Tiled matrix multiplication for the 4 × 4 numerical example. Program (0, 0) owns C 00. It multiplies A 00 by B 00 for the first K slice, carries the resulting accumulator into the second slice, and adds A 01B 10 before storing C 00. Programs (0, 1), (1, 0), and (1, 1) perform the same K-loop pattern independently for the other output tiles.
CH05 F12 Fartale

Follow the K-slice updates within one output tile alongside the independent programs computing the other tiles. section 5.5.4

Tile shape affects reuse and performance. Square output tiles balance reuse and minimize the combined size of the input tiles for a fixed number of output elements, though rectangular tiles can be faster for a particular matrix shape or GPU. The first tiled kernel uses an FP32 accumulator to reduce rounding error and assumes dimensions divide evenly by the block sizes; it does not yet handle boundaries or a K remainder. section 5.5.4 section 5.5.5

How GPU Programming with Triton covers it

How deep it goes
Develops tile addressing, masking, data reuse, and a tiled matrix-multiplication kernel, initially without boundary or remainder handling.
Examples
Uses vector addition and a 4 × 4 matrix product distributed across four tiled programs.
What you can do after
Apply it via Triton to address tensor blocks and construct a tiled matrix-multiplication kernel.
How it connects
Connects tiles to program IDs, launch grids, masking, matrix multiplication, and arithmetic intensity.

Also explained in

Compare how 3 books explain tile →

Related concepts

This explainer was generated by Manning's knowledge graph from the text of GPU Programming with Triton. The section links point to the parts of the book it draws on.