[Mesa-dev] [PATCH] i965/fs: New peephole optimization to flatten IF/BREAK/ENDIF.
Kenneth Graunke
kenneth at whitecape.org
Sat Nov 9 09:22:39 PST 2013
On 11/05/2013 02:58 PM, Paul Berry wrote:
[snip]
> Instead of this special-purpose peephole optimization, I'm wondering if
> it would be more useful to create a more general optimization pass that
> just converts the entire IF block to predicated instructions, assuming
> certain conditions hold. Those conditions would be something like:
> - If any instruction but the last writes to the flag register, then
> don't do the optimization.
> - If there's nested control flow, then don't do the optimization.
> - If any instruction inside the IF block is incompatible with
> predication (are there any such instructions? I don't know) then don't
> do the optimization.
> - If the block is larger than a certain heuristically-determined size,
> then don't do the optimization.
>
> Such an optimization could in principle even handle IF/ELSE blocks, by
> inverting the predicate in the ELSE section.
Eric and I actually wrote such a pass...it's sitting on a branch
somewhere. At the time, it helped some things massively, but caused a
few shaders to explode into spilling. Maybe with the newer scheduling
changes, that problem's been solved...
--Ken
More information about the mesa-dev
mailing list