Mesa (main): ra: Document that class index is allocated in order, use that in r300.

GitLab Mirror gitlab-mirror at kemper.freedesktop.org
Fri Jun 4 19:32:16 UTC 2021


Module: Mesa
Branch: main
Commit: 7e0127fb3e039f935fa7dbb8c1863aeb1fbd7bf5
URL:    http://cgit.freedesktop.org/mesa/mesa/commit/?id=7e0127fb3e039f935fa7dbb8c1863aeb1fbd7bf5

Author: Eric Anholt <eric at anholt.net>
Date:   Thu Mar  4 15:17:39 2021 -0800

ra: Document that class index is allocated in order, use that in r300.

etnaviv also relies on this being the case, just drop the remapping.

Acked-by: Jason Ekstrand <jason at jlekstrand.net>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/9437>

---

 src/gallium/drivers/r300/compiler/radeon_pair_regalloc.c | 3 +--
 src/util/register_allocate.c                             | 1 +
 2 files changed, 2 insertions(+), 2 deletions(-)

diff --git a/src/gallium/drivers/r300/compiler/radeon_pair_regalloc.c b/src/gallium/drivers/r300/compiler/radeon_pair_regalloc.c
index e8f4087cbc4..7f9d8cb7f4f 100644
--- a/src/gallium/drivers/r300/compiler/radeon_pair_regalloc.c
+++ b/src/gallium/drivers/r300/compiler/radeon_pair_regalloc.c
@@ -722,8 +722,7 @@ void rc_init_regalloc_state(struct rc_regalloc_state *s)
 	for (i = 0; i < RC_REG_CLASS_COUNT; i++) {
 		ra_q_values[i] = MALLOC(RC_REG_CLASS_COUNT * sizeof(unsigned));
 		for (j = 0; j < RC_REG_CLASS_COUNT; j++) {
-			ra_q_values[s->class_ids[i]][s->class_ids[j]] =
-							q_values[i][j];
+			ra_q_values[i][j] = q_values[i][j];
 		}
 	}
 
diff --git a/src/util/register_allocate.c b/src/util/register_allocate.c
index 802b20a3704..efffbd627d3 100644
--- a/src/util/register_allocate.c
+++ b/src/util/register_allocate.c
@@ -227,6 +227,7 @@ ra_alloc_reg_class(struct ra_regs *regs)
 
    class->regs = rzalloc_array(class, BITSET_WORD, BITSET_WORDS(regs->count));
 
+   /* Users may rely on the class index being allocated in order starting from 0. */
    return regs->class_count++;
 }
 



More information about the mesa-commit mailing list