[Mesa-dev] FYI: Pull-through optimization for NIR

Thomas Helland thomashelland90 at gmail.com
Wed Oct 28 15:42:15 PDT 2015

Hi all,

Just thought I'd inform you of my experiments and findings this weekend.

This summer I discussed a possible optimization pass with Connor that
I've simply named "pull-through" for the lack of a better name.
This tries to reorder operations of the type

min(sqrt(a), sqrt(b)) into sqrt(min(a, b)),

where the outer function can be min, max or csel, and the inner
operations can be any similar strictly increasing or decreasing operation.
(Things like sqrt, rsq, log, exp, etc).
I gave a shot at implementing this this weekend, and I'm quite confident
that my implementation was sound (I didn't actually rewrite anything,
just checked if I found an optimization opportunity). It gave no results
on my shader-db collection. Just thought I'd share, in case someone
else was considering a similar optimization; it's probably not worthwhile.
If there's interest I can clean up the code some and send it to the list,
if not I'll just archive it for now.

While I haven't been very active the last months, I've not completely fallen
of the mesa development wagon, school's just killing me with work atm.
I was thinking I'd rebase my LCSSA pass one of these days, so that it's in
good condition if someone decides to do some loop-stuff where it's needed.


More information about the mesa-dev mailing list