From 10fbfe1f65b5aab497273a84838a152cda50dff6 Mon Sep 17 00:00:00 2001 From: Alyssa Rosenzweig Date: Mon, 13 Apr 2026 15:25:43 -0400 Subject: [PATCH] jay: improve vector affinities Totals: Instrs: 2807558 -> 2805545 (-0.07%); split: -0.10%, +0.02% CodeSize: 45051504 -> 45015888 (-0.08%); split: -0.11%, +0.03% Totals from 631 (23.84% of 2647) affected shaders: Instrs: 736113 -> 734100 (-0.27%); split: -0.37%, +0.10% CodeSize: 11666608 -> 11630992 (-0.31%); split: -0.42%, +0.12% Signed-off-by: Alyssa Rosenzweig Part-of: --- src/intel/compiler/jay/jay_register_allocate.c | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/src/intel/compiler/jay/jay_register_allocate.c b/src/intel/compiler/jay/jay_register_allocate.c index 7e463b16583..ae99ec8778f 100644 --- a/src/intel/compiler/jay/jay_register_allocate.c +++ b/src/intel/compiler/jay/jay_register_allocate.c @@ -1615,7 +1615,10 @@ jay_register_allocate_function(jay_function *f) jay_foreach_inst_in_func(f, block, I) { jay_foreach_src_index(I, s, c, index) { - if (jay_num_values(I->src[s]) > 1) { + /* We check repr==0 to try to coalesce with the first vector use, as + * the closest to the definition. This heuristic reduces shuffling. + */ + if (jay_num_values(I->src[s]) > 1 && !ra.affinities[index].repr) { uint32_t repr = UINT_MAX, repr_c = 0; /* Pick the representative with the smallest index, as it most