[Mesa-dev] [PATCH 3/4] nir: support to flatten_all in peephole-select

Jason Ekstrand jason at jlekstrand.net
Thu Apr 2 10:24:58 PDT 2015


On Thu, Apr 2, 2015 at 1:20 AM, Kenneth Graunke <kenneth at whitecape.org> wrote:
> On Wednesday, April 01, 2015 07:22:40 PM Connor Abbott wrote:
>> I think it might be better here if we had a callback that backends can
>> fill in that tells you when an instruction can be pulled out by the
>> sel peephole. As Jason noted, you won't be able to do this for
>> everything (notably, output writes and variable writes) and we'll
>> probably need special handling for predicating discards if we want to
>> be able to flatten everything. There are also a few cases where on
>> i965 we aren't activating it when we could. Even then, I didn't think
>> we'd need something this general, but with different backends with
>> such varying needs I guess it makes more sense to go with the more
>> general solution.
>
> NIR does have nir_intrinsic_discard_if, which performs a conditional
> discard.  Assignments can be handled by conditional selects.  In the
> absence of other memory writes (atomics, images, etc), that's probably
> sufficient, no?

Yes, that should be sufficient assuming array accesses can be
flattened etc.  However, the NIR pass shouldn't flatten things that
can't be flattened so we don't generate wrong NIR.  Instead, in those
cases, we should just let the backend die on control-flow.
--Jason


More information about the mesa-dev mailing list