[Mesa-dev] Call i965 GLSL IR backend optimisation from the common linker

Timothy Arceri timothy.arceri at collabora.com
Thu Jul 28 02:22:14 UTC 2016


On Tue, 2016-07-26 at 22:56 -0700, Matt Turner wrote:
> On Tue, Jul 26, 2016 at 10:20 PM, Timothy Arceri
> <timothy.arceri at collabora.com> wrote:
> > The ultimate goal is to be able to convert to NIR and make use of
> > its
> > optimisations before assigning varying and uniform locations. This
> > should allow us to start removing some of the GLSL IR optimisation
> > passes.
> 
> I'm very excited about this!
> 
> > This series falls short of making use of NIR because
> > lower_packed_varyings()
> > modifies the IR after we assign varying locations. I can see two
> > ways
> > around this, listing them in increasing difficultly level they
> > would be:
> > 
> > - replacing the current packing pass with one that follows the
> > packing
> > rules of ARB_enhanced_layouts this would mean we can no longer pack
> > across slots and matrix and array packing effectivness would be
> > slightly
> > decreased.
> > - write a NIR packing pass.
> 
> Specifically a NIR implementation of lower_packed_varyings(), right?
> 
> > 
> > Even without converting to NIR this series solves a number of the
> > other
> > problems with converting to NIR earlier and provides a nice shader-
> > db
> > improvement on its own.
> > 
> > Broadwell shader-db results:
> > 
> > total instructions in shared programs: 8651650 -> 8644415 (-0.08%)
> > instructions in affected programs:     38754 -> 31519 (-18.67%)
> > total loops in shared programs:        2085 -> 2085 (0.00%)
> > helped:                                320
> > HURT:                                  0
> > GAINED:                                0
> 
> Impressive.

So I disabled varying packing to see what would happen. It seems a
whole bunch of shaders increase by 1-2 instructions and a smaller
number decrease by up to hundreds of instructions, it looks like most
of these shaders are the same one helped by this series.

total instructions in shared programs: 8645989 -> 8650948 (0.06%)
instructions in affected programs:     333069 -> 338028 (1.49%)
total loops in shared programs:        2085 -> 2085 (0.00%)
helped:                                364
HURT:                                  1673

It also seems just about all packing is done on either vec3's or
different types e.g uint with vec2 so a packing pass that only follows
the ARB_enhanced_layouts rules doesn't seem like it would be very
useful.

> 
> > Ivybridge reported no difference.
> 
> I suspect that's because Ivybridge's vertex shader is vec4, and we
> don't dead code eliminate individual *components* of varyings,
> whereas
> on Broadwell with scalar vertex shaders we're able to eliminate those
> dead components.
> 
> Thanks so much for working on this!
> _______________________________________________
> 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