From ca9f95f78330f6e56c9b167ec4bd39daaafc0bdd Mon Sep 17 00:00:00 2001 From: Adam Jackson Date: Thu, 7 May 2026 14:51:48 -0400 Subject: [PATCH] i915/corm: add shrink_vectors to reduce cross-register vec construction nir_opt_shrink_vectors narrows vector widths when only a subset of components are consumed, which eliminates unnecessary cross-register vec constructions. Follow with copy_prop + dce to clean up. shader-db (I915_FS=nir): 272/403 compiled, 4388 alu shader-db (I915_FS=both): nir won 272 (26 identical, 1 tied, 239 better, 6 only), 18 TGSI, 113 neither Assisted-by: Claude --- src/gallium/drivers/i915/i915_state.c | 3 +++ 1 file changed, 3 insertions(+) diff --git a/src/gallium/drivers/i915/i915_state.c b/src/gallium/drivers/i915/i915_state.c index 88c65eee1c3..24adc396241 100644 --- a/src/gallium/drivers/i915/i915_state.c +++ b/src/gallium/drivers/i915/i915_state.c @@ -765,6 +765,9 @@ i915_create_fs_state(struct pipe_context *pipe, NIR_PASS(_, nir_s, nir_opt_algebraic); NIR_PASS(_, nir_s, nir_opt_algebraic_late); NIR_PASS(_, nir_s, nir_opt_dce); + NIR_PASS(_, nir_s, nir_opt_shrink_vectors, false); + NIR_PASS(_, nir_s, nir_opt_copy_prop); + NIR_PASS(_, nir_s, nir_opt_dce); nir_index_ssa_defs(nir_shader_get_entrypoint(nir_s)); for (unsigned v = 0; v < ARRAY_SIZE(corm_variants); v++) {