From 61d9911bbaec663e86461538b8409caf65af05d6 Mon Sep 17 00:00:00 2001 From: Mel Henning Date: Tue, 6 May 2025 12:24:21 -0400 Subject: [PATCH] nak: Bias RA to find clear spaces for vector dests Try to find a space where the entire vec will fit when allocating one of its components. Totals: CodeSize: 5750619392 -> 5654953920 (-1.66%); split: -1.75%, +0.09% Static cycle count: 1497053946 -> 1493196467 (-0.26%); split: -0.43%, +0.18% Totals from 163626 (83.27% of 196502) affected shaders: CodeSize: 5498993328 -> 5403327856 (-1.74%); split: -1.83%, +0.09% Static cycle count: 1423951803 -> 1420094324 (-0.27%); split: -0.46%, +0.19% Part-of: --- src/nouveau/compiler/nak/assign_regs.rs | 8 +++++--- 1 file changed, 5 insertions(+), 3 deletions(-) diff --git a/src/nouveau/compiler/nak/assign_regs.rs b/src/nouveau/compiler/nak/assign_regs.rs index 591bdc159b2..7dbfb72ae9a 100644 --- a/src/nouveau/compiler/nak/assign_regs.rs +++ b/src/nouveau/compiler/nak/assign_regs.rs @@ -459,10 +459,12 @@ impl RegAllocator { } // We weren't able to pair it with an already allocated - // register but maybe we can at least find an aligned one. - if let Some(reg) = - self.try_find_unused_reg_range(0, 1, align, 0) + // register but maybe we can at least find a place the vec + // would fit + if let Some(base_reg) = + self.try_find_unused_reg_range(0, vec.comps(), align, 0) { + let reg = base_reg + u32::from(comp); self.assign_reg(ssa, reg); return reg; }