[Mesa-dev] RFC - Simple loop unrolling in NIR

Jason Ekstrand jason at jlekstrand.net
Sat Aug 27 14:52:24 UTC 2016


Hey Timothy,

Thanks for working on this!  Looks like you're making pretty good
progress.  I'm going to try and give the series a hard look some time next
week.

On Aug 26, 2016 11:03 PM, "Timothy Arceri" <timothy.arceri at collabora.com>
wrote:

> 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.
>
> _______________________________________________
> mesa-dev mailing list
> mesa-dev at lists.freedesktop.org
> https://lists.freedesktop.org/mailman/listinfo/mesa-dev
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <https://lists.freedesktop.org/archives/mesa-dev/attachments/20160827/53bf504b/attachment.html>


More information about the mesa-dev mailing list