[Mesa-dev] Seeking advice speeding up glsl optimisation passes for AoA

Connor Abbott cwabbott0 at gmail.com
Wed Jul 15 12:09:54 PDT 2015


On Wed, Jul 15, 2015 at 11:53 AM, Eric Anholt <eric at anholt.net> wrote:
> Timothy Arceri <t_arceri at yahoo.com.au> writes:
>
>> Hi guys,
>>
>> As I've mentioned a couple of times in previous patches some of the cts AoA
>> tests are taking very long time to compile. This is due to excessive
>> optimisation passes mainly in the glsl optimisations (there are some slowdowns
>> in the intel backend too but these seemed to go away when I tried the new nir
>> vec4 backend).
>>
>> I fixed part of the problem with this patch to do the dead code elimination in
>> a single pass [1].
>> These excessive passes exist in normal shaders but its generally not an issue
>> as the number of passes is generally quite low, and inexpensive. However when
>> you have an 8 dimensional array constantly walking this becomes quite
>> expensive.
>>
>> The remaining issue I'm seeking some advice for is with constant
>> propagation/folding.
>>
>> It seems for interators used in loops you can get into a situation where an
>> optimisation pass is needed for each loop iteration in order to make all
>> values of the iterator constant.
>>
>> I didn't have look too find some real world examples of this in the public
>> shader-db. For example here is it happening for a Unity shader:
>
> How about if we just disable the GLSL IR constant prop pass when NIR is
> enabled?

Unfortunately, we're not quite at the point where we can do that yet.
NIR doesn't have the ability to clean up stuff like if (true) { ... },
so turning off GLSL IR constant propagation will prevent that from
happening in a lot of cases when the condition isn't simple enough. I
have some patches on the list from a long time ago to do it, but Jason
never got around to reviewing them and we thought we might want to
re-work the approach -- there are a bunch of other places where we
want to modify control flow in NIR, but doing it while preserving the
structure and preserving SSA is a tricky problem that I only touched a
tiny part of in that series.

>
> _______________________________________________
> mesa-dev mailing list
> mesa-dev at lists.freedesktop.org
> http://lists.freedesktop.org/mailman/listinfo/mesa-dev
>


More information about the mesa-dev mailing list