liveBook · Manning

Tl.advance

As explained in GPU Programming with Triton

tl.advance is a Triton operation that returns a block-pointer descriptor with its offsets advanced while preserving its other fields.

tl.advance returns a new block-pointer descriptor with its offsets changed and its base address, shape, strides, and block shape preserved. Supply one element-offset value per dimension; tuple positions correspond to tensor dimensions. It changes coordinates only—it neither loads data nor checks bounds. section 5.6.3

Advance through the shared K dimension

In tiled matrix multiplication, advance A by (0, BLOCK_K) across its columns and B by (BLOCK_K, 0) down its rows. The descriptors then select matching K slices for the next loads and tl.dot. Reassign each returned descriptor to continue the loop; a negative offset can move a descriptor backward. section 5.6.3

Figure 5.14 Block-pointer movement through the K loop. The A descriptor advances by (0, BLOCK_K) across columns, while the B descriptor advances by (BLOCK_K, 0) down rows. Each pair of descriptors selects matching K slices for the next load and tl.dot call.
CH05 F14 Fartale

The diagram shows how the two descriptors move to matching slices between K-loop iterations. section 5.6.3

How GPU Programming with Triton covers it

How deep it goes
Defines offset updates and their limits, stopping short of loading data or checking bounds.
Examples
Uses (0, BLOCK_K) for A and (BLOCK_K, 0) for B to select matching K slices.
What it assumes
Assumes a block-pointer descriptor and explains that its offset tuple has one value per dimension.
What you can do after
Apply it to advance descriptors by dimension-ordered element offsets, including backward movement.
How it connects
Connects block pointers with tl.load and tl.dot in tiled matrix multiplication.

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.