From 004e527fbfa331418dcf8da4e3f9ac3f6b3986ef Mon Sep 17 00:00:00 2001 From: Timothy Arceri Date: Tue, 20 Jun 2023 13:21:00 +1000 Subject: [PATCH] glsl: call nir_opt_find_array_copies() when linking MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit shader-db results IRIS (BDW): total instructions in shared programs: 17883388 -> 17859658 (-0.13%) instructions in affected programs: 48100 -> 24370 (-49.33%) helped: 6 HURT: 0 helped stats (abs) min: 1450 max: 7028 x̄: 3955.00 x̃: 3387 helped stats (rel) min: 40.31% max: 51.92% x̄: 47.07% x̃: 48.96% 95% mean confidence interval for instructions value: -6613.28 -1296.72 95% mean confidence interval for instructions %-change: -52.73% -41.40% Instructions are helped. total cycles in shared programs: 866961809 -> 863521521 (-0.40%) cycles in affected programs: 9179396 -> 5739108 (-37.48%) helped: 6 HURT: 0 helped stats (abs) min: 252584 max: 972430 x̄: 573381.33 x̃: 495130 helped stats (rel) min: 21.80% max: 48.65% x̄: 35.01% x̃: 34.58% 95% mean confidence interval for cycles value: -917157.00 -229605.67 95% mean confidence interval for cycles %-change: -47.61% -22.40% Cycles are helped. total spills in shared programs: 20417 -> 15521 (-23.98%) spills in affected programs: 6966 -> 2070 (-70.28%) helped: 6 HURT: 0 total fills in shared programs: 25151 -> 21005 (-16.48%) fills in affected programs: 4374 -> 228 (-94.79%) helped: 6 HURT: 0 Closes: https://gitlab.freedesktop.org/mesa/mesa/-/issues/9055 Fixes: d75a36a9eeb1 ("glsl: remove do_copy_propagation_elements() optimisation pass") Reviewed-by: Marek Olšák Reviewed-by: Kenneth Graunke Part-of: (cherry picked from commit d336bc39260efc1e47bd3e96061d78bd4d0ed8e8) --- .pick_status.json | 2 +- src/compiler/glsl/gl_nir_linker.c | 3 +++ 2 files changed, 4 insertions(+), 1 deletion(-) diff --git a/.pick_status.json b/.pick_status.json index cd9aa3ef15d..f42c3283756 100644 --- a/.pick_status.json +++ b/.pick_status.json @@ -1120,7 +1120,7 @@ "description": "glsl: call nir_opt_find_array_copies() when linking", "nominated": true, "nomination_type": 1, - "resolution": 0, + "resolution": 1, "main_sha": null, "because_sha": "d75a36a9eeb1606fab19362746f9b5d94b98bd3a" }, diff --git a/src/compiler/glsl/gl_nir_linker.c b/src/compiler/glsl/gl_nir_linker.c index 0066a878210..40cb08b2bdc 100644 --- a/src/compiler/glsl/gl_nir_linker.c +++ b/src/compiler/glsl/gl_nir_linker.c @@ -56,6 +56,7 @@ gl_nir_opts(nir_shader *nir) nir_var_mem_shared, NULL); + NIR_PASS(progress, nir, nir_opt_find_array_copies); NIR_PASS(progress, nir, nir_opt_copy_prop_vars); NIR_PASS(progress, nir, nir_opt_dead_write_vars); @@ -117,6 +118,8 @@ gl_nir_opts(nir_shader *nir) NIR_PASS(progress, nir, nir_opt_loop_unroll); } } while (progress); + + NIR_PASS_V(nir, nir_lower_var_copies); } static void