From c96003305ee7b9014e129ddd63ba02d33ed4011f Mon Sep 17 00:00:00 2001 From: Karol Herbst Date: Fri, 11 Jul 2025 15:28:18 +0200 Subject: [PATCH] nak: keep phis vectorized if they fit into a register Totals: CodeSize: 936990448 -> 936472720 (-0.06%); split: -0.07%, +0.01% Number of GPRs: 3539184 -> 3539100 (-0.00%); split: -0.00%, +0.00% SLM Size: 870756 -> 864200 (-0.75%); split: -0.82%, +0.07% Static cycle count: 224606486 -> 224173176 (-0.19%); split: -0.21%, +0.02% Spills to memory: 66542 -> 60425 (-9.19%); split: -9.90%, +0.71% Fills from memory: 66542 -> 60425 (-9.19%); split: -9.90%, +0.71% Spills to reg: 68126 -> 68173 (+0.07%) Fills from reg: 80583 -> 80659 (+0.09%) Max warps/SM: 3666280 -> 3666276 (-0.00%); split: +0.00%, -0.00% Totals from 200 (0.23% of 87622) affected shaders: CodeSize: 5705936 -> 5188208 (-9.07%); split: -10.75%, +1.67% Number of GPRs: 8160 -> 8076 (-1.03%); split: -1.78%, +0.75% SLM Size: 40432 -> 33876 (-16.21%); split: -17.76%, +1.54% Static cycle count: 2163142 -> 1729832 (-20.03%); split: -21.97%, +1.94% Spills to memory: 30113 -> 23996 (-20.31%); split: -21.88%, +1.57% Fills from memory: 30113 -> 23996 (-20.31%); split: -21.88%, +1.57% Spills to reg: 3438 -> 3485 (+1.37%) Fills from reg: 3836 -> 3912 (+1.98%) Max warps/SM: 9064 -> 9060 (-0.04%); split: +0.26%, -0.31% Reviewed-by: Mel Henning Part-of: --- src/nouveau/compiler/nak_nir.c | 7 +++++++ 1 file changed, 7 insertions(+) diff --git a/src/nouveau/compiler/nak_nir.c b/src/nouveau/compiler/nak_nir.c index 476413e1fbf..49f15eed098 100644 --- a/src/nouveau/compiler/nak_nir.c +++ b/src/nouveau/compiler/nak_nir.c @@ -91,6 +91,13 @@ vectorize_filter_cb(const nir_instr *instr, const void *_data) static uint8_t phi_vectorize_cb(const nir_instr *instr, const void *data) { + nir_phi_instr *phi = nir_instr_as_phi(instr); + unsigned bit_size = phi->def.bit_size; + + if (bit_size == 16) + return 2; + if (bit_size == 8) + return 4; return 1; }