[Mesa-dev] [PATCH] radv: call constant folding before opt algebraic

Samuel Pitoiset samuel.pitoiset at gmail.com
Tue May 7 06:39:35 UTC 2019


Seems fine to,

Reviewed-by: Samuel Pitoiset <samuel.pitoiset at gmail.com>

Bas, any comments?

On 5/7/19 7:14 AM, Timothy Arceri wrote:
> ping!
>
> On 2/5/19 1:38 pm, Timothy Arceri wrote:
>> The pattern of calling opt algebraic first seems to have originated
>> in i965. The order in OpenGL drivers generally doesn't matter
>> because the GLSL IR optimisations do constant folding before
>> opt algebraic.
>>
>> However in Vulkan drivers calling opt algebraic first can result
>> in missed constant folding opportunities.
>>
>> vkpipeline-db results (VEGA64):
>>
>> Totals from affected shaders:
>> SGPRS: 3160 -> 3176 (0.51 %)
>> VGPRS: 3588 -> 3580 (-0.22 %)
>> Spilled SGPRs: 52 -> 44 (-15.38 %)
>> Spilled VGPRs: 0 -> 0 (0.00 %)
>> Private memory VGPRs: 0 -> 0 (0.00 %)
>> Scratch size: 12 -> 12 (0.00 %) dwords per thread
>> Code Size: 261812 -> 261036 (-0.30 %) bytes
>> LDS: 7 -> 7 (0.00 %) blocks
>> Max Waves: 346 -> 348 (0.58 %)
>> Wait states: 0 -> 0 (0.00 %)
>> ---
>>   src/amd/vulkan/radv_shader.c | 2 +-
>>   1 file changed, 1 insertion(+), 1 deletion(-)
>>
>> diff --git a/src/amd/vulkan/radv_shader.c b/src/amd/vulkan/radv_shader.c
>> index cd5a9f2afb4..ad7b2439735 100644
>> --- a/src/amd/vulkan/radv_shader.c
>> +++ b/src/amd/vulkan/radv_shader.c
>> @@ -162,8 +162,8 @@ radv_optimize_nir(struct nir_shader *shader, bool 
>> optimize_conservatively,
>>                   NIR_PASS(progress, shader, nir_opt_dead_cf);
>>                   NIR_PASS(progress, shader, nir_opt_cse);
>>                   NIR_PASS(progress, shader, nir_opt_peephole_select, 
>> 8, true, true);
>> -                NIR_PASS(progress, shader, nir_opt_algebraic);
>>                   NIR_PASS(progress, shader, nir_opt_constant_folding);
>> +                NIR_PASS(progress, shader, nir_opt_algebraic);
>>                   NIR_PASS(progress, shader, nir_opt_undef);
>>                   NIR_PASS(progress, shader, 
>> nir_opt_conditional_discard);
>>                   if (shader->options->max_unroll_iterations) {
>>
> _______________________________________________
> 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