ac/nir/ngg: Follow tex sources when analyzing before culling.

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 6745 (5.00% of 134913) affected shaders:
VGPRs: 304824 -> 304632 (-0.06%)
SpillSGPRs: 228 -> 231 (+1.32%)
CodeSize: 24975152 -> 24863684 (-0.45%); split: -0.56%, +0.11%
Instrs: 4774357 -> 4760913 (-0.28%); split: -0.42%, +0.13%
Latency: 22381084 -> 22218421 (-0.73%); split: -0.88%, +0.15%
InvThroughput: 3984765 -> 3981677 (-0.08%); split: -0.10%, +0.02%
VClause: 110036 -> 110265 (+0.21%); split: -0.67%, +0.88%
SClause: 116296 -> 104576 (-10.08%); split: -10.89%, +0.81%
Copies: 366923 -> 377370 (+2.85%); split: -0.78%, +3.63%
Branches: 119882 -> 119891 (+0.01%); split: -0.00%, +0.01%
PreSGPRs: 314591 -> 350697 (+11.48%); split: -0.36%, +11.83%
PreVGPRs: 252279 -> 252267 (-0.00%); split: -0.02%, +0.01%

Signed-off-by: Timur Kristóf <timur.kristof@gmail.com>
Reviewed-by: Qiang Yu <yuq825@gmail.com>
Reviewed-by: Rhys Perry <pendingchaos02@gmail.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/23946>
This commit is contained in:
Timur Kristóf
2023-04-01 02:19:55 +02:00
committed by Marge Bot
parent 411f69b9c5
commit d63549a642
+10
View File
@@ -1092,6 +1092,16 @@ analyze_shader_before_culling_walk(nir_ssa_def *ssa,
break;
}
case nir_instr_type_tex: {
nir_tex_instr *tex = nir_instr_as_tex(instr);
unsigned num_srcs = tex->num_srcs;
for (unsigned i = 0; i < num_srcs; ++i) {
analyze_shader_before_culling_walk(tex->src[i].src.ssa, flag, s);
}
break;
}
case nir_instr_type_phi: {
nir_phi_instr *phi = nir_instr_as_phi(instr);
nir_foreach_phi_src_safe(phi_src, phi) {