Code specialization compiles a GPU kernel for compile-time argument values and selected properties of other arguments. Triton’s @triton.jit delays compilation until launch, then caches the compiled binary for reuse. section 2.2.1 section 2.2.10
The key distinction is whether an argument is known at compile time. A runtime argument such as n_elements can vary without requiring another binary; marking it tl.constexpr would instead specialize for each distinct length. By contrast, changing BLOCK_SIZE triggers a fresh compile. section 2.2.10
This affects both compile overhead and benchmarking: the first launch pays for compilation, while later calls can reuse the cached binary. A size sweep at fixed block size compiles once; a block-size sweep compiles at each value. Warmup with triton.testing.do_bench keeps first-call compilation out of timed measurements. section 2.2.1 section 2.2.10
