Triton’s Layout-Cost Heuristic Overstates Conversion Costs, but Fixes Barely Change Performance
Key point
Triton’s heuristic overestimates layout-conversion costs versus an elementwise add by about 4x for fp32 and 19x for fp16, yet model updates barely changed performance.
Details
- Experiments found that Triton’s
RemoveLayoutConversionscost heuristic is inaccurate, but using a more accurate model barely changed kernel performance. - Compared with an elementwise add, the heuristic overestimates conversion costs by about 4x for fp32 and 19x for fp16, and sometimes more for fp8.
- With the updated cost model, no tutorial kernels shifted; 8 tested kernels were slower, 4 were faster, and 9 were unchanged.
- Amazon’s paper finds layout selection is NP-hard; on ResNet-50, its exact solver’s proven optimum took 63.9M cycles under its cost model, versus 20.9M cycles with the heuristic rules. The authors attribute the gap to a wonky cost model.
Why the cost model had limited impact
- Rematerialization often avoids conversions by recomputing or loading data in the needed format; most kernels required no layout choice, and the default choice was usually right when one was needed.
- The paper’s graph-wide search covers graphs of 10k+ operators, while a specific kernel generally has only a few places where a conversion could go.
Where performance mismatches came from
- In one case, changing instruction ordering made a matmul 15–26x faster;
ptxashandles register allocation, and insufficient registers can cause memory spills. - Moving one
local_load6 ops earlier ledptxasto drop from 255 registers to 40.
This summary was generated automatically by AI. Check the original for the author's claims and context. Copyright belongs to the original author.
Our guide explains how the AI works. Report summary errors, attribution issues, or removal requests via Contact.