Variables make the propagation more conservative than it needs to be.
fossil-db (GFX10.3, based on !8056):
Totals from 22102 (15.86% of 139391) affected shaders:
SGPRs: 1103833 -> 1104265 (+0.04%); split: -0.06%, +0.10%
VGPRs: 851316 -> 849396 (-0.23%); split: -0.58%, +0.35%
CodeSize:
34422452 ->
34206052 (-0.63%); split: -0.72%, +0.09%
MaxWaves: 291050 -> 291186 (+0.05%); split: +0.23%, -0.18%
Instrs: 6749188 -> 6662804 (-1.28%); split: -1.37%, +0.09%
Cycles:
63456312 ->
62995828 (-0.73%); split: -0.92%, +0.20%
fossil-db (GFX10.3):
Totals from 841 (0.60% of 139391) affected shaders:
VGPRs: 44444 -> 44500 (+0.13%)
CodeSize: 3985604 -> 3987188 (+0.04%); split: -0.11%, +0.15%
Instrs: 748847 -> 749174 (+0.04%); split: -0.13%, +0.18%
Cycles:
35801628 ->
35825676 (+0.07%); split: -0.23%, +0.30%
Signed-off-by: Rhys Perry <pendingchaos02@gmail.com>
Reviewed-by: Timur Kristóf <timur.kristof@gmail.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/8493>
nir_var_shader_in | nir_var_shader_out | nir_var_system_value | nir_var_mem_shared,
NULL);
+ /* Variables can make nir_propagate_invariant more conservative
+ * than it needs to be.
+ */
+ NIR_PASS_V(nir, nir_lower_global_vars_to_local);
+ NIR_PASS_V(nir, nir_lower_vars_to_ssa);
+
if (device->instance->debug_flags & RADV_DEBUG_INVARIANT_GEOM &&
stage != MESA_SHADER_FRAGMENT) {
mark_geom_invariant(nir);