mirror of
https://gitlab.freedesktop.org/mesa/mesa.git
synced 2026-05-06 20:18:12 +02:00
jay/register_allocate: don't depend on indexing
this can get messed up by optimizations. Totals: Instrs: 2768612 -> 2764317 (-0.16%); split: -0.29%, +0.13% CodeSize: 44367648 -> 44300352 (-0.15%); split: -0.28%, +0.13% Totals from 867 (32.75% of 2647) affected shaders: Instrs: 1694745 -> 1690450 (-0.25%); split: -0.47%, +0.22% CodeSize: 27387648 -> 27320352 (-0.25%); split: -0.46%, +0.21% Signed-off-by: Alyssa Rosenzweig <alyssa.rosenzweig@intel.com> Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/41064>
This commit is contained in:
parent
a964f321a5
commit
d85eb51e17
1 changed files with 14 additions and 7 deletions
|
|
@ -1623,21 +1623,28 @@ jay_register_allocate_function(jay_function *f)
|
|||
*/
|
||||
construct_phi_webs(ra.phi_web, f);
|
||||
|
||||
/* We track the order of instructions in the program to inform coalescing */
|
||||
uint32_t *order = linear_alloc_array(lin_ctx, uint32_t, f->ssa_alloc);
|
||||
uint32_t order_counter = 0;
|
||||
|
||||
jay_foreach_inst_in_func(f, block, I) {
|
||||
jay_foreach_dst_index(I, _, index) {
|
||||
order[index] = order_counter++;
|
||||
}
|
||||
|
||||
jay_foreach_src_index(I, s, c, index) {
|
||||
/* 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;
|
||||
uint32_t repr = UINT_MAX, repr_c = 0, best_order = UINT_MAX;
|
||||
|
||||
/* Pick the representative with the smallest index, as it most
|
||||
* likely dominates the other components.
|
||||
*/
|
||||
jay_foreach_comp(I->src[s], j) {
|
||||
if (jay_channel(I->src[s], j) < repr) {
|
||||
repr = jay_channel(I->src[s], j);
|
||||
/* Pick the earliest representative to maximize freedom */
|
||||
jay_foreach_index(I->src[s], j, index) {
|
||||
if (order[index] < best_order) {
|
||||
repr = index;
|
||||
repr_c = j;
|
||||
best_order = order[index];
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
|||
Loading…
Add table
Reference in a new issue