the.ai

Compilers / Regimes

verified

Shape Specialization

A kernel compiled for a batch of thirty-two is not the kernel you want for a batch of one. Compilers specialise on shapes to generate good code, and every distinct shape then triggers a recompile — which is fine in training, where shapes repeat, and painful in serving, where sequence lengths vary with every request.

Viz primitive · budget-splitpadding-waste = 4

padding-waste holds 25% of the budget; rest holds the remaining 75%.

Compute spent on padding against compute on real tokens, in tokens. Drag the bucket coarseness up to watch the waste grow — and note this is what buys a compile cache that always hits.

4

Reviewed by opendroid · 2026-08-18

Origin · not linkable

  • Ansel et al. 2024 — PyTorch 2: Faster Machine Learning Through Dynamic Python Bytecode Transformation and Graph Compilation · ASPLOS 2024 · doi:10.1145/3620665.3640366