[Mesa-dev] [PATCH] glsl: Optimize certain if-statements to just casts from the condition
Kenneth Graunke
kenneth at whitecape.org
Fri Jan 16 17:59:38 PST 2015
On Friday, January 16, 2015 05:53:09 PM Ian Romanick wrote:
> On 01/16/2015 08:15 AM, Matt Turner wrote:
> > From: Ian Romanick <ian.d.romanick at intel.com>
> >
> > Some shaders end up with code that looks something like:
> >
> > if (some_condition)
> > result = 1.0;
> > else
> > result = 0.0;
> >
> > This pass converts those if-statements to
> >
> > result = float(some_condition);
> >
> > total instructions in shared programs: 5934568 -> 5921818 (-0.21%)
> > instructions in affected programs: 723433 -> 710683 (-1.76%)
> > GAINED: 26
> > LOST: 7
>
> Arg. I'm going to have to investigate why the old patch and the new
> patch are so different. :( On the current patch I get
>
> LOST: shaders/closed/steam/brutal-legend/326.shader_test SIMD16
> LOST: shaders/closed/steam/costume-quest/1339.shader_test SIMD16
> LOST: shaders/closed/steam/portal-2/high/5143.shader_test SIMD16
> LOST: shaders/closed/steam/portal-2/very-high/2700.shader_test SIMD16
> LOST: shaders/closed/steam/the-cave/2429.shader_test SIMD16
> LOST: shaders/closed/steam/the-cave/2492.shader_test SIMD16
> LOST: shaders/closed/steam/the-cave/2661.shader_test SIMD16
> LOST: shaders/closed/steam/the-cave/3089.shader_test SIMD16
> LOST: shaders/closed/steam/the-cave/3362.shader_test SIMD16
>
> GAINED: shaders/closed/steam/portal-2/high/2677.shader_test SIMD16
> GAINED: shaders/closed/steam/portal-2/high/902.shader_test SIMD16
> GAINED: shaders/closed/steam/portal-2/low/2337.shader_test SIMD16
> GAINED: shaders/closed/steam/portal-2/low/902.shader_test SIMD16
>
> total instructions in shared programs: 4663189 -> 4652744 (-0.22%)
> instructions in affected programs: 749395 -> 738950 (-1.39%)
> GAINED: 4
> LOST: 9
> total helped: 3159
> total HURT: 8
>
> You don't think IVB vs HSW makes a difference here?
>
> I also notice that the 12 vertex shaders no longer appear in the hurt
> list or the helped list. Ugh.
>
> And OMG... I need to update to a distro that has render nodes so that I
> can use the updated runner. :(
You just need to boot with "drm.rnodes=1", they've been around forever.
--Ken
-------------- next part --------------
A non-text attachment was scrubbed...
Name: signature.asc
Type: application/pgp-signature
Size: 819 bytes
Desc: This is a digitally signed message part.
URL: <http://lists.freedesktop.org/archives/mesa-dev/attachments/20150116/14d9b161/attachment.sig>
More information about the mesa-dev
mailing list