radv: use nir_opt_access
authorRhys Perry <pendingchaos02@gmail.com>
Tue, 25 Aug 2020 16:23:36 +0000 (17:23 +0100)
committerMarge Bot <eric+marge@anholt.net>
Thu, 21 Jan 2021 18:07:03 +0000 (18:07 +0000)
fossil-db (GFX10.3):
Totals from 3231 (2.32% of 139391) affected shaders:
SGPRs: 168654 -> 167454 (-0.71%); split: -0.72%, +0.00%
VGPRs: 152352 -> 152416 (+0.04%)
CodeSize: 13872836 -> 13806376 (-0.48%); split: -0.50%, +0.02%
MaxWaves: 36640 -> 36634 (-0.02%)
Instrs: 2639959 -> 2626852 (-0.50%); split: -0.52%, +0.03%
Cycles: 77706000 -> 77496792 (-0.27%); split: -0.28%, +0.01%
VMEM: 809496 -> 790847 (-2.30%); split: +2.06%, -4.36%
SMEM: 267843 -> 253187 (-5.47%); split: +0.76%, -6.23%
VClause: 61353 -> 60426 (-1.51%); split: -1.86%, +0.35%
SClause: 95409 -> 92355 (-3.20%); split: -3.24%, +0.04%
Copies: 194951 -> 196702 (+0.90%); split: -0.53%, +1.43%
Branches: 84320 -> 84331 (+0.01%); split: -0.00%, +0.02%
PreSGPRs: 110162 -> 110203 (+0.04%); split: -0.04%, +0.07%
PreVGPRs: 127021 -> 127037 (+0.01%)

Signed-off-by: Rhys Perry <pendingchaos02@gmail.com>
Reviewed-by: Daniel Schürmann <daniel@schuermann.dev>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/6490>

src/amd/vulkan/radv_shader.c

index 973e2a3..cfe6c6a 100644 (file)
@@ -662,6 +662,12 @@ radv_shader_compile_to_nir(struct radv_device *device,
         */
        nir_lower_var_copies(nir);
 
+       const nir_opt_access_options opt_access_options = {
+               .is_vulkan = true,
+               .infer_non_readable = true,
+       };
+       NIR_PASS_V(nir, nir_opt_access, &opt_access_options);
+
        NIR_PASS_V(nir, nir_lower_explicit_io, nir_var_mem_push_const,
                   nir_address_format_32bit_offset);