From 411f69b9c5b884f6802758347e72a10ec5564df1 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Timur=20Krist=C3=B3f?= Date: Wed, 22 Mar 2023 13:55:50 +0100 Subject: [PATCH] ac/nir/ngg: Follow intrinsic sources when analyzing before culling. MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Helps find more possible reusable uniforms variables. Also prepares the code for more improvements to the analysis. Fossil DB stats on GFX10.3: Totals from 54578 (40.45% of 134913) affected shaders: VGPRs: 1950536 -> 1950328 (-0.01%); split: -0.02%, +0.01% SpillSGPRs: 483 -> 1324 (+174.12%); split: -8.90%, +183.02% CodeSize: 148017620 -> 146549576 (-0.99%); split: -1.10%, +0.11% MaxWaves: 1533710 -> 1533716 (+0.00%); split: +0.00%, -0.00% Instrs: 28137479 -> 27909113 (-0.81%); split: -0.94%, +0.13% Latency: 134454624 -> 130909188 (-2.64%); split: -2.72%, +0.09% InvThroughput: 20664192 -> 20646525 (-0.09%); split: -0.15%, +0.06% VClause: 540374 -> 540986 (+0.11%); split: -0.76%, +0.88% SClause: 720823 -> 636209 (-11.74%); split: -12.46%, +0.72% Copies: 2287330 -> 2326140 (+1.70%); split: -1.71%, +3.41% Branches: 844769 -> 844848 (+0.01%); split: -0.00%, +0.01% PreSGPRs: 1987505 -> 2416965 (+21.61%); split: -0.12%, +21.73% PreVGPRs: 1582704 -> 1581579 (-0.07%); split: -0.07%, +0.00% Signed-off-by: Timur Kristóf Reviewed-by: Qiang Yu Reviewed-by: Rhys Perry Part-of: --- src/amd/common/ac_nir_lower_ngg.c | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/src/amd/common/ac_nir_lower_ngg.c b/src/amd/common/ac_nir_lower_ngg.c index 16e780d80c8..07b461a4f40 100644 --- a/src/amd/common/ac_nir_lower_ngg.c +++ b/src/amd/common/ac_nir_lower_ngg.c @@ -1075,6 +1075,11 @@ analyze_shader_before_culling_walk(nir_ssa_def *ssa, break; } + const unsigned num_srcs = nir_intrinsic_infos[intrin->intrinsic].num_srcs; + for (unsigned i = 0; i < num_srcs; ++i) { + analyze_shader_before_culling_walk(intrin->src[i].ssa, flag, s); + } + break; } case nir_instr_type_alu: {