[Mesa-dev] [PATCH 3/4] i965/fs: Optimize (gl_FrontFacing ? x : y) where x and y are ±1.0.

Matt Turner mattst88 at gmail.com
Wed Jan 14 13:52:26 PST 2015


On Wed, Jan 14, 2015 at 1:29 PM, Matt Turner <mattst88 at gmail.com> wrote:
> glsl: Optimize certain if-statements to just casts from the condition

Cherry-picked to master, the shader-db results are

total instructions in shared programs: 5965630 -> 5952789 (-0.22%)
instructions in affected programs:     737228 -> 724387 (-1.74%)
GAINED:                                5
LOST:                                  16

and we hurt 20 programs: 12 vec4 programs significantly (>68%) and 8
SIMD8/16 programs by 1 instruction.

This, and seemingly every other work-in-progress branch I have really
highlights the improvements we need to make to instruction scheduling.
It feels fitting that one of the last significant changes Eric made to
scheduling has a commit message that says "This is madness, [...]"

> i965/fs: Emit smarter code for b2f

I wouldn't expect this one to change instruction counts, except on gen
<= 5 where maybe we get to skip the true/false resolve (apparently I
did it wrong in my merge -- it caused a bunch of failures on G45 and
ILK according to Jenkins). On Haswell,

total instructions in shared programs: 5954954 -> 5955030 (0.00%)
instructions in affected programs:     4212 -> 4288 (1.80%)

with three programs helped (that I just added to shader-db on Monday,
yay!) and 19 hurt, 12 significantly. I'm surprised.

I'll investigate.


More information about the mesa-dev mailing list