[Mesa-dev] V7 Loop unrolling in NIR
Timothy Arceri
t_arceri at yahoo.com.au
Mon Dec 19 08:57:04 UTC 2016
On Mon, 2016-12-19 at 17:38 +1100, Timothy Arceri wrote:
> On Sun, 2016-12-18 at 21:58 -0800, Jason Ekstrand wrote:
> > On Dec 18, 2016 9:48 PM, "Timothy Arceri" <timothy.arceri at collabora
> > .c
> > om> wrote:
> > V7:
> > - paritally out of ssa in unrolling pass to avoid phis
> > - lots of simplification/tidy ups in the analysis pass
> > - if_uses bug fix (missing functionality) in lcssa fixed
> > - better support for non trivial loop terminators
> > - fixed all loop HURT except 1 that is too big to unroll.
> >
> > total instructions in shared programs: 12584624 -> 12584621 (-
> > 0.00%)
> > instructions in affected programs: 68507 -> 68504 (-0.00%)
> > helped: 70
> > HURT: 170
> >
> > total cycles in shared programs: 241499996 -> 241476226 (-0.01%)
> > cycles in affected programs: 4060722 -> 4036952 (-0.59%)
> > helped: 1241
> > HURT: 1278
> >
> > total loops in shared programs: 4245 -> 2948 (-30.55%)
> > loops in affected programs: 1535 -> 238 (-84.50%)
> > helped: 1142
> > HURT: 1
> >
> > That is a *lot* of loops that we were leaving intact for no good
> > reason. Any idea how many of those were because the glsl pass
> > didn't
> > know what to do weight them vs. the heuristic subtly changing?
>
Oh whoops I need to learn how to read. Doing things the other way
around if I remove the instruction and iterations limit from the GLSL
IR pass I get ... a frozen PC for a few minutes processing various
shaders and eventually it crashes processing a deus ex shader.
Looking at the history is seems the heuristics might have more to do
with GLSL IR being slow than the actual output being too large.
commit be5f27a84d0d4efb57071d9d7ecda061223d03ef
Author: Eric Anholt <eric at anholt.net>
Date: Tue Feb 21 13:37:49 2012 -0800
glsl: Refine the loop instruction counting.
Before, we were only counting top-level instructions. But if we
have
an assignment of a giant expression tree (such as the ones
eventually
generated by glsl-fs-unroll), we were counting the same as an
assignment of a variable deref.
glsl-fs-unroll-explosion now fails in a reasonable amount of time
on
i965 because the unrolling didn't go ridiculously far.
Reviewed-by: Kenneth Graunke <kenneth at whitecape.org>
commit 67007080b716c7e51039a381f407ababd68230f7
Author: Mathias Fröhlich <Mathias.Froehlich at gmx.net>
Date: Wed Jan 25 17:35:01 2012 +0100
glsl: Avoid excessive loop unrolling.
Avoid unrollong loops that are either nested loops or
where the loop body times the unroll count is huge.
The change is far from being perfect but it extends the
loop unrolling decision heuristic by some additional
safeguard. In particular this cuts down compilation of
a shader precomputing atmospheric scattering integral
tables containing two nesting levels in a loop from
something way beyond some minutes (I never waited for
it to finish) to some fractions of a second.
This fixes piglit tests glsl-fs-unroll-explosion and
glsl-vs-unroll-explosion on r600g.
Reviewed-by: Eric Anholt <eric at anholt.net>
Signed-off-by: Mathias Fröhlich <Mathias.Froehlich at web.de>
> Are you sending html emails lately? Your comments have been
> indistinguishable from the original email in a number of emails
> lately.
>
> I disable instruction/iteration unrolling restrictions and it helped
> on
> ly 13 loops.
>
> For the record V7 unrolls around 500 more loops than V6. I think
> handling phis as a conditional might give us another good jump. I
> would
> need to dig a bit deeper to be sure why so many loops remain.
>
> I'm happy to work on improving things further once we land the
> initial
> version.
>
> >
> >
> > LOST: 26
> > GAINED: 16
> > _______________________________________________
> > mesa-dev mailing list
> > mesa-dev at lists.freedesktop.org
> > https://lists.freedesktop.org/mailman/listinfo/mesa-dev
> >
> > _______________________________________________
> > mesa-dev mailing list
> > mesa-dev at lists.freedesktop.org
> > https://lists.freedesktop.org/mailman/listinfo/mesa-dev
>
> _______________________________________________
> mesa-dev mailing list
> mesa-dev at lists.freedesktop.org
> https://lists.freedesktop.org/mailman/listinfo/mesa-dev
More information about the mesa-dev
mailing list