Mesa (master): util/ra: Improve ra_set_finalize() performance.

GitLab Mirror gitlab-mirror at kemper.freedesktop.org
Wed Apr 29 20:07:06 UTC 2020


Module: Mesa
Branch: master
Commit: 05e6f763e7683c13a59e14f12ce3231d892921c2
URL:    http://cgit.freedesktop.org/mesa/mesa/commit/?id=05e6f763e7683c13a59e14f12ce3231d892921c2

Author: Eric Anholt <eric at anholt.net>
Date:   Mon Apr 13 11:14:23 2020 -0700

util/ra: Improve ra_set_finalize() performance.

BITSET_FOR_EACH_SET can walk a sparse set (such as a register class's set
of registers) much faster than just iterating over individual bits.

Improves freedreno startup time (as measured by shader-db ./run
shaders/closed/gputest/triangle on my x86 system) by -4.12679% +/-
1.99006% (n=151)

Reviewed-by: Kenneth Graunke <kenneth at whitecape.org>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/4537>

---

 src/util/register_allocate.c | 5 +----
 1 file changed, 1 insertion(+), 4 deletions(-)

diff --git a/src/util/register_allocate.c b/src/util/register_allocate.c
index 091500710a9..c0cd879c9ca 100644
--- a/src/util/register_allocate.c
+++ b/src/util/register_allocate.c
@@ -400,12 +400,9 @@ ra_set_finalize(struct ra_regs *regs, unsigned int **q_values)
             unsigned int rc;
             int max_conflicts = 0;
 
-            for (rc = 0; rc < regs->count; rc++) {
+            BITSET_FOREACH_SET(rc, regs->classes[c]->regs, regs->count) {
                int conflicts = 0;
 
-               if (!reg_belongs_to_class(rc, regs->classes[c]))
-                  continue;
-
                util_dynarray_foreach(&regs->regs[rc].conflict_list,
                                      unsigned int, rbp) {
                   unsigned int rb = *rbp;



More information about the mesa-commit mailing list