Part II: GPU execution, measurement, and optimization

When included, the optional GPU lab collection is in the Optional Labs appendix. Its longer tools and experiments are separate from the explanations, examples and checks needed for the core reading path.

Five scenes connect GPU work to its execution and measurement. Host streams submit copies and kernels beside a grid, an SM, warps and contiguous tensor cells. Triton tiles use masks and address offsets, while tiled attention keeps softmax state on chip. A roofline compares bandwidth and compute limits. Separate host and GPU timelines show completed-work timing and fair baseline comparisons. Framework compilation uses guarded variants; CUDA Graphs replay captured launches with stable buffers.
Figure 1: CUDA and Triton define GPU work. Performance models bound it, completed measurements expose delays, and compilation or replay can change the work or its submission.

Chapters in this part