From 29fb897c0a01cba9082eff88687b70febee2fea2 Mon Sep 17 00:00:00 2001 From: Emma Anholt Date: Fri, 22 Aug 2025 18:54:45 -0700 Subject: [PATCH] ir3: Enable nir_opt_shrink_shrink_vec_array_vars. The effect is surprisingly big, though it does seem to be concentrated in just a few apps (Batman: Arkham Origins, Metro 2033 Redux, Shadow Warrior): Totals: MaxWaves: 19680240 -> 19788620 (+0.55%); split: +0.55%, -0.00% Instrs: 369291159 -> 367831500 (-0.40%); split: -0.40%, +0.01% CodeSize: 936669580 -> 933798912 (-0.31%); split: -0.31%, +0.00% ... Totals from 16918 (1.21% of 1402199) affected shaders: MaxWaves: 125724 -> 234104 (+86.20%); split: +86.83%, -0.63% Instrs: 11328230 -> 9868571 (-12.89%); split: -13.13%, +0.25% CodeSize: 23684238 -> 20813570 (-12.12%); split: -12.24%, +0.12% NOPs: 1633346 -> 1640119 (+0.41%); split: -2.09%, +2.50% MOVs: 1940036 -> 510016 (-73.71%); split: -75.07%, +1.36% COVs: 188107 -> 188546 (+0.23%); split: -0.32%, +0.56% Full: 454239 -> 263078 (-42.08%); split: -42.80%, +0.71% (ss): 251004 -> 231443 (-7.79%); split: -9.81%, +2.01% (sy): 116086 -> 115153 (-0.80%); split: -2.38%, +1.58% (ss)-stall: 738920 -> 794215 (+7.48%); split: -7.13%, +14.62% (sy)-stall: 3321071 -> 3193717 (-3.83%); split: -5.58%, +1.74% STPs: 101880 -> 71523 (-29.80%) LDPs: 17406 -> 14411 (-17.21%) Preamble Instrs: 2519390 -> 2548205 (+1.14%); split: -0.31%, +1.46% Subgroup size: 1097472 -> 1097920 (+0.04%) Cat0: 1833041 -> 1839613 (+0.36%); split: -1.91%, +2.27% Cat1: 2128393 -> 698894 (-67.16%); split: -68.42%, +1.26% Cat2: 3602449 -> 3595086 (-0.20%); split: -0.24%, +0.03% Cat3: 2817384 -> 2815410 (-0.07%); split: -0.08%, +0.01% Cat4: 273682 -> 273655 (-0.01%) Cat5: 304630 -> 304398 (-0.08%) Cat6: 207434 -> 179648 (-13.40%); split: -13.70%, +0.31% Cat7: 161217 -> 161867 (+0.40%); split: -1.25%, +1.65% Part-of: --- src/freedreno/ir3/ir3_nir.c | 1 + 1 file changed, 1 insertion(+) diff --git a/src/freedreno/ir3/ir3_nir.c b/src/freedreno/ir3/ir3_nir.c index b1ff6e8f01b..5e61b4f142d 100644 --- a/src/freedreno/ir3/ir3_nir.c +++ b/src/freedreno/ir3/ir3_nir.c @@ -339,6 +339,7 @@ ir3_optimize_loop(struct ir3_compiler *compiler, progress |= OPT(s, nir_opt_dead_write_vars); progress |= OPT(s, nir_split_struct_vars, nir_var_function_temp); progress |= OPT(s, nir_opt_shrink_stores, true); + progress |= OPT(s, nir_shrink_vec_array_vars, nir_var_function_temp | nir_var_mem_shared); static int gcm = -1; if (gcm == -1)