[Mesa-dev] RFC - Simple loop unrolling in NIR
Timothy Arceri
timothy.arceri at collabora.com
Sat Aug 27 06:03:22 UTC 2016
This series does the equivalent of the simple unroll in GLSL IR. The
main difference is that currently it unrolls everything with an
iteration count < 32, the GLSL IR pass also tries to limit unrolling
based on the number of nodes it contains but this seemed a little simplistic
so I have left this out for now.
I'm still working on the complex unroll equivalent but hacking the cf in
NIR is not much fun so I thought I'd send the series as is for now to get
some feedback. I guess it also my be useful for Vulkan as is.
This series works on ssa defs so for now it's only enabled for Gen8+.
Shader-db results for BDW:
total instructions in shared programs: 8527200 -> 8526827 (-0.00%)
instructions in affected programs: 50339 -> 49966 (-0.74%)
helped: 103
HURT: 89
total cycles in shared programs: 70789034 -> 70756662 (-0.05%)
cycles in affected programs: 3273418 -> 3241046 (-0.99%)
helped: 1027
HURT: 864
total loops in shared programs: 2069 -> 1819 (-12.08%)
loops in affected programs: 568 -> 318 (-44.01%)
helped: 522
HURT: 280
total spills in shared programs: 2212 -> 2212 (0.00%)
spills in affected programs: 0 -> 0
helped: 0
HURT: 0
total fills in shared programs: 1894 -> 1894 (0.00%)
fills in affected programs: 0 -> 0
helped: 0
HURT: 0
LOST: 9
GAINED: 0
Almost all of the HURT programs with increased loop counts are from
planeshift and basically contain an if () break; a equivalent of complex
unroll should fix this up.
As for the helped loop counts I'm not entirely sure (haven't checked) why
the GLSL IR pass is not unrolling them as the ones I've looked at do not
seem like they should be skipped and seem to produce acceptable output in
NIR.
More information about the mesa-dev
mailing list