[Mesa-dev] [PATCH] radeonsi/nir: remove dead local variables

Timothy Arceri tarceri at itsqueeze.com
Thu Jan 31 23:08:21 UTC 2019



On 1/2/19 5:04 am, Emil Velikov wrote:
> On Thu, 31 Jan 2019 at 01:01, Timothy Arceri <tarceri at itsqueeze.com> wrote:
>>
>> Without this we do not end up with a deterministic NIR. NIR must
>> be deterministic here because we use it to produce a sha for the
>> radeonsi backends disk cache.
>>
>> This fixes the shader cache for a bunch of shaders.
> 
> I guess we'll need this for all branches since radeonsi started using
> the nir lowerings and optimisations?

It's not a big deal as it just means the cache doesn't work as well as 
it should rather than breaking anything and since NIR is disabled by 
default I didn't bother with the fixes tag.

Also I've sent a V2 of this patch that moves this to the state tracker. 
Moving it there also reduces the size of the NIR that gets compressed 
and stored to disk.

> 
> Fixes: 41d4016e061 ("radeonsi/nir: perform radeonsi-specific lowering
> and optimization passes")
> 
>> ---
>>   src/gallium/drivers/radeonsi/si_shader_nir.c | 3 +++
>>   1 file changed, 3 insertions(+)
>>
>> diff --git a/src/gallium/drivers/radeonsi/si_shader_nir.c b/src/gallium/drivers/radeonsi/si_shader_nir.c
>> index 7554f5b9f8b..96096abe4ea 100644
>> --- a/src/gallium/drivers/radeonsi/si_shader_nir.c
>> +++ b/src/gallium/drivers/radeonsi/si_shader_nir.c
>> @@ -848,6 +848,9 @@ si_lower_nir(struct si_shader_selector* sel)
>>          } while (progress);
>>
>>          NIR_PASS_V(sel->nir, nir_lower_bool_to_int32);
>> +
>> +       nir_variable_mode mask = nir_var_function_temp;
>> +       nir_remove_dead_variables(sel->nir, mask);
> Nit: I'd drop the temporary variable mask.
> 
> Regardless of the nit
> Reviewed-by: Emil Velikov <emil.velikov at collabora.com>
> 
> -Emil
> 


More information about the mesa-dev mailing list