[naga msl-out] Use iteration limits to avoid unbounded loops #6546
Labels
area: naga back-end
Outputs of naga shader conversion
area: performance
How fast things go
backend: metal
Issues with Metal
lang: Metal
Metal Shading Language
naga
Shader Translator
platform: macos
Issues with integration with macos
type: enhancement
New feature or request
Rather than injecting branches on volatile bools, Naga's backend for Metal Shading Language should avoid undefined behavior simply by imposing an iteration limit on every loop. Unlike the volatile bools, the optimizer will be able to reason about these limits and eliminate them when possible. Optimizations like unrolling are defeated by the volatile bool, but not by the iteration limit.
See a full description of the idea, with godbolt experiments, here: #6528 (comment)
The text was updated successfully, but these errors were encountered: