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

Timothy Arceri tarceri at itsqueeze.com
Tue May 7 23:27:18 UTC 2019


On 8/5/19 1:51 am, Samuel Pitoiset wrote:
> What games are affected btw?

  PERCENTAGE DELTAS    Shaders     SGPRs     VGPRs SpillSGPR CodeSize 
MaxWaves
  batman-arkham-city   2581     .         .         .        .         . 

  dawn-of-war-3         244     .         .         .        .         . 

  f1-2017              5627     .         .         .        .         . 

  fallout4-vr           196     .         .         .        .         . 

  nier                 1905     .         .         .        .         . 

  no-mans-sky          4054     .         .         .        .         . 

  prey                 2182     .         .         .        .         . 

  rot-tomb-raider      8391     .         .         .        .         . 

  skyrim-vr             494     .         .         .        .         . 

  sot-tomb-raider       613     .         .         .       0.01 %     . 

  the_witcher_3-medium  803     .         .         .        .         . 

  the_wither_3-ultra   1040    0.05 %   -0.03 %     .        .     0.02 %
  valve-vr-pref-trace  323     .         .         .        .         .
  wolfenstein-2       1056     .         .       -0.20 %  -0.02 %     .
 
------------------------------------------------------------------------------
  All affected          69    0.50 %   -0.22 %   -7.69 %  -0.28   %0.57 %
------------------------------------------------------------------------------
  Total              29509     .         .       -0.03 %     .         .

> 
> Can you please double check before pushing because of the flrp changes 
> that landed around?

No change.

> 
> 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