[Mesa-dev] [PATCH 13/15] i965/fs: Optimize OR with identical sources into a MOV.

Matt Turner mattst88 at gmail.com
Tue Oct 29 22:26:06 CET 2013

On Tue, Oct 29, 2013 at 12:36 PM, Eric Anholt <eric at anholt.net> wrote:
> Matt Turner <mattst88 at gmail.com> writes:
>> Helps a lot of Steam games.
>> total instructions in shared programs: 1287432 -> 1287130 (-0.02%)
>> instructions in affected programs:     21447 -> 21145 (-1.41%)
> 13-15 are also:
> Reviewed-by: Eric Anholt <eric at anholt.net>
> I'm spending a while thinking about the if->sel passes.  Having 2 seems
> ridiculous, but I haven't come up with a good alternative.

I planned to remove the other at the conclusion of this series, but
the other operates (for better or worse, unknown) before pull
constants are lowered so it handles a lot of things that it wouldn't
be able to handle later if it happened later.

I'll test your "i965/fs: Drop our dead push constants ..." later today
with the hope that it drops all of the pull constants in the relevant
shaders, allowing my pass to handle all of the things the existing one
does. Reminder (and for everyone else): currently the shaders that the
old pass handles that mine doesn't, do things like

MOV dst src0
MOV dst src1

where src0 is a uniform that winds up being a pull constant, so after
pull constants are lowered it looks like:

SEND tmp
MOV dst tmp
MOV dst src1

Possibly badly, the existing pass causes the final code to be an
unpredicated SEND and a SEL between tmp and src1.

Longer term, I think a pass that converts if blocks to predicated
instructions might help. The difficulty I see is that predicating
instructions that may be skipped entirely by an IF instruction (if all
of the channels go the same way) may be worse, especially if we know
that the comparison is uniformly constant.

But hopefully your patch just avoids this problem entirely. I'll
provide an update later.

More information about the mesa-dev mailing list