[Mesa-dev] [PATCH 2/2] radeonsi: use re-Z

Grigori Goronzy greg at chown.ath.cx
Wed Feb 24 12:07:06 UTC 2016


On 2016-02-24 12:47, Marek Olšák wrote:
> On Wed, Feb 24, 2016 at 12:22 PM, Grigori Goronzy <greg at chown.ath.cx> 
> wrote:
>>> S_00B32C_SCRATCH_EN(shader->config.scratch_bytes_per_wave > 0));
>>> +
>>> +       /* Prefer RE_Z if the shader is complex enough. */
>>> +       if (info->num_memory_instructions >= 2 ||
>>> +           shader->binary.code_size > 100*4)
>>> +               shader->z_order = V_02880C_EARLY_Z_THEN_RE_Z;
>>> +       else
>>> +               shader->z_order = V_02880C_EARLY_Z_THEN_LATE_Z;
>>>  }
>>> 
>> 
>> Are these thresholds for switching to re-Z based on measurements, 
>> feedback
>> by the HW team or are they just a shot in the dark?
>> Either way, the magic numbers don't look particularly nice. Maybe
>> preprocessor constants should be introduced for them?
> 
> They are not so magic. The meaning is 2 memory instructions or
> instruction count between 50 and 100. They are based on my estimates
> and expectations.
> 

Of course the semantics are easy to understand, but what the reasoning 
behind the constant's values is, that is not clear.
I think it's always useful to assign names to such tunables and to put 
them into a central place (e.g. at the top of a file, together with 
other #defines).
It's just a suggestion, though, I don't want to bikeshed this any 
further. :)

Grigori

> No benchmarking has been done, but there is a potential to gain some
> performance with shaders killing pixels.
> 
> Marek


More information about the mesa-dev mailing list