[Mesa-dev] [PATCH] radv: use nir_opt_copy_prop_vars and nir_opt_dead_write_vars

Timothy Arceri tarceri at itsqueeze.com
Wed Oct 17 23:05:37 UTC 2018


On 18/10/18 9:51 am, Bas Nieuwenhuizen wrote:
> On Thu, Oct 18, 2018 at 12:04 AM Timothy Arceri <tarceri at itsqueeze.com> wrote:
>>
>> Totals from affected shaders:
>> SGPRS: 2856 -> 2856 (0.00 %)
>> VGPRS: 3236 -> 3248 (0.37 %)
>> Spilled SGPRs: 0 -> 0 (0.00 %)
>> Spilled VGPRs: 0 -> 0 (0.00 %)
>> Private memory VGPRs: 0 -> 0 (0.00 %)
>> Scratch size: 0 -> 0 (0.00 %) dwords per thread
>> Code Size: 236560 -> 233548 (-1.27 %) bytes
>> LDS: 0 -> 0 (0.00 %) blocks
>> Max Waves: 277 -> 283 (2.17 %)
>> Wait states: 0 -> 0 (0.00 %)
> 
> Interesting that both max waves and VGPRs increased.

Yeah it was just one of those changes where the new NIR increased VGPR 
use in a larger number of shaders compared to the number that reduced
enough to bump the max waves. However as I tried to indicate below the 
increase of VGPRs is something that could likely be improved on the LLVM 
side, the NIR itself looks much better.

> 
> Reviewed-by: Bas Nieuwenhuizen <bas at basnieuwenhuizen.nl>
> 
>>
>> Even in the cases were we have increased VGPR use it appears
>> the NIR is improved significantly.
>> ---
>>   src/amd/vulkan/radv_shader.c | 4 ++++
>>   1 file changed, 4 insertions(+)
>>
>> diff --git a/src/amd/vulkan/radv_shader.c b/src/amd/vulkan/radv_shader.c
>> index 3e3eb96a531..3b3422c8da6 100644
>> --- a/src/amd/vulkan/radv_shader.c
>> +++ b/src/amd/vulkan/radv_shader.c
>> @@ -127,6 +127,10 @@ radv_optimize_nir(struct nir_shader *shader, bool optimize_conservatively)
>>
>>                   NIR_PASS_V(shader, nir_lower_vars_to_ssa);
>>                  NIR_PASS_V(shader, nir_lower_pack);
>> +
>> +               NIR_PASS(progress, shader, nir_opt_copy_prop_vars);
>> +               NIR_PASS(progress, shader, nir_opt_dead_write_vars);
>> +
>>                   NIR_PASS_V(shader, nir_lower_alu_to_scalar);
>>                   NIR_PASS_V(shader, nir_lower_phis_to_scalar);
>>
>> --
>> 2.17.1
>>
>> _______________________________________________
>> mesa-dev mailing list
>> mesa-dev at lists.freedesktop.org
>> https://lists.freedesktop.org/mailman/listinfo/mesa-dev


More information about the mesa-dev mailing list