From f03b21ae6982e6cb9a6240532f3f721c7d80a8fb Mon Sep 17 00:00:00 2001 From: Caio Marcelo de Oliveira Filho Date: Sun, 9 Jun 2019 10:25:07 -0700 Subject: [PATCH] st/glsl: Perform some var optimizations MIME-Version: 1.0 Content-Type: text/plain; charset=utf8 Content-Transfer-Encoding: 8bit Perform those before some derefs are gone when we lower the buffers after the st_nir_opts() call. Intel SKL shader-db results: total instructions in shared programs: 15593685 -> 15590708 (-0.02%) instructions in affected programs: 378078 -> 375101 (-0.79%) helped: 777 HURT: 44 helped stats (abs) min: 1 max: 68 x̄: 4.07 x̃: 4 helped stats (rel) min: 0.04% max: 31.58% x̄: 2.88% x̃: 1.37% HURT stats (abs) min: 1 max: 24 x̄: 4.20 x̃: 2 HURT stats (rel) min: 0.17% max: 8.00% x̄: 1.60% x̃: 1.27% 95% mean confidence interval for instructions value: -4.02 -3.23 95% mean confidence interval for instructions %-change: -2.93% -2.35% Instructions are helped. total loops in shared programs: 4815 -> 4815 (0.00%) loops in affected programs: 0 -> 0 helped: 0 HURT: 0 total cycles in shared programs: 371965528 -> 371788566 (-0.05%) cycles in affected programs: 184190307 -> 184013345 (-0.10%) helped: 3650 HURT: 2855 helped stats (abs) min: 1 max: 59400 x̄: 99.45 x̃: 15 helped stats (rel) min: <.01% max: 43.18% x̄: 2.60% x̃: 1.02% HURT stats (abs) min: 1 max: 16362 x̄: 65.16 x̃: 10 HURT stats (rel) min: <.01% max: 66.22% x̄: 2.78% x̃: 0.81% 95% mean confidence interval for cycles value: -53.73 -0.68 95% mean confidence interval for cycles %-change: -0.39% -0.08% Cycles are helped. total spills in shared programs: 11936 -> 11956 (0.17%) spills in affected programs: 443 -> 463 (4.51%) helped: 0 HURT: 8 total fills in shared programs: 25644 -> 25619 (-0.10%) fills in affected programs: 2306 -> 2281 (-1.08%) helped: 24 HURT: 2 LOST: 7 GAINED: 16 Total CPU time (seconds): 1679.04 -> 1695.69 (0.99%) shader-db results radeonsi (VEGA64): Totals from affected shaders: SGPRS: 180160 -> 179552 (-0.34 %) VGPRS: 115368 -> 114544 (-0.71 %) Spilled SGPRs: 5627 -> 5603 (-0.43 %) Spilled VGPRs: 0 -> 0 (0.00 %) Private memory VGPRs: 0 -> 0 (0.00 %) Scratch size: 0 -> 0 (0.00 %) dwords per thread Code Size: 7808364 -> 7803268 (-0.07 %) bytes LDS: 192 -> 192 (0.00 %) blocks Max Waves: 19202 -> 19340 (0.72 %) Wait states: 0 -> 0 (0.00 %) Radeonsi results provided by Timothy. Reviewed-by: Timothy Arceri Reviewed-by: Kenneth Graunke --- src/mesa/state_tracker/st_glsl_to_nir.cpp | 3 +++ 1 file changed, 3 insertions(+) diff --git a/src/mesa/state_tracker/st_glsl_to_nir.cpp b/src/mesa/state_tracker/st_glsl_to_nir.cpp index b40cb9223df..e4303b0250c 100644 --- a/src/mesa/state_tracker/st_glsl_to_nir.cpp +++ b/src/mesa/state_tracker/st_glsl_to_nir.cpp @@ -314,6 +314,9 @@ st_nir_opts(nir_shader *nir, bool scalar) NIR_PASS_V(nir, nir_lower_vars_to_ssa); + NIR_PASS(progress, nir, nir_opt_copy_prop_vars); + NIR_PASS(progress, nir, nir_opt_dead_write_vars); + if (scalar) { NIR_PASS_V(nir, nir_lower_alu_to_scalar, NULL); NIR_PASS_V(nir, nir_lower_phis_to_scalar); -- 2.30.2