Amazon proved layout selection in ML compilers is NP-hard. Its exact solver found the optimum for ResNet-50 took 63.9M cycles. Triton’s heuristic took 20.9M cycles but used a flawed cost model. Tests showed the heuristic overestimated costs by 4x for fp32 and 19x for fp16. Updating the model changed little in practice. Rematerialization often avoids conversions entirely. Performance mismatches traced to instruction ordering in ptxas. A matmul saw 15–26x speedup from reordering. Register use dropped from 255 to 40 in one case. The paper highlights the complexity of layout optimization. Heuristics still work well for most kernels. The real challenge is modeling downstream compiler and hardware behavior.
What changed
Triton used a simple cost model for layout conversions: 0 or 32xbytes.
What it unlocks
Using a more accurate cost model for layout conversions in ML compilers.
- 63.9M cycles for proven optimum on ResNet-50
- 20.9M cycles for heuristic on ResNet-50
- 4x overestimate for fp32
- 19x overestimate for fp16
What you need to act on it
- a Triton compiler environment
- matmul-heavy workloads
Sources