TECHNOLOGY

Triton launch grids: derive coverage from the block size actually selected by tuning

In this article
THE QUICK TAKE

A launch grid and a per-program block extent jointly define coverage; tuning one while freezing the other can change the task instead of merely its speed.

Treat coverage as a joint contract

The vector-add tutorial computes a program’s starting offset from its ID and block size. It also constructs a callable launch grid from the meta-parameter block size. These are linked operations. A kernel can have correct internal indexing while the host launches too few program instances to cover the requested vector under another selected block extent.

Understand what a configuration can change

The Config interface stores kernel meta-parameters as well as compiler settings. The autotune interface evaluates supplied configurations for an argument key. If a candidate changes the amount of logical data processed by each program, the launch construction must follow that candidate. A grid calculated once using an unrelated assumed block size is not automatically correct for all candidate configurations or the later cached selection.

Keep masking in its proper role

A store mask protects addresses for extra lanes of programs that were actually launched. It cannot execute a program that the host omitted. This distinction explains why a too-large grid can sometimes waste work safely while a too-small grid leaves untouched output even if every existing program has excellent boundary checks. Do not treat masking as a substitute for deriving the total coverage from the effective program-level work extent.

Diagnose an intermittent tail failure

Imagine initial tests use the largest candidate block size and a fixed grid built for it. Another candidate with a smaller block size needs more programs and can leave a tail uncomputed. Preinitialize output with a distinguishable sentinel, test every candidate directly on a nondivisible problem size, and inspect all expected positions. This catches missing coverage instead of hiding it behind uninitialized memory that occasionally resembles a reasonable numeric result. Then verify final numerical equivalence under the selected configuration.

Record grid and candidate together

Keep input extent, chosen block meta-parameters, callable grid formula, actual launch dimensions, and tested candidate set. Guides to kernel launch granularity and GPU acceptance evidence provide context. Evaluate correctness before accepting a tuning result. A fast candidate that computed less output is a different task, and a cached configuration remains valid only when the wrapper constructs coverage consistent with the configuration’s actual work assignment.

Earn rental income from GPUs

Have idle GPUs or looking to fund AI infrastructure? Retrivium finds a rental platform, sets up the server and helps you assess income and costs with a pilot.

Explore GPU hosting
← All articles