Mesa (main): pan/bi: Reverse linear constraint bits

GitLab Mirror gitlab-mirror at kemper.freedesktop.org
Thu Jun 2 17:30:01 UTC 2022


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

Author: Icecream95 <ixn at disroot.org>
Date:   Mon Jan  3 11:57:24 2022 +1300

pan/bi: Reverse linear constraint bits

This will make it simpler to implement parallel RA where multiple
possible registers for a node are tested at once.

Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/16780>

---

 src/panfrost/bifrost/bi_ra.c | 14 +++++++++-----
 1 file changed, 9 insertions(+), 5 deletions(-)

diff --git a/src/panfrost/bifrost/bi_ra.c b/src/panfrost/bifrost/bi_ra.c
index 87f5ab1b35f..7bd8c9fc912 100644
--- a/src/panfrost/bifrost/bi_ra.c
+++ b/src/panfrost/bifrost/bi_ra.c
@@ -90,15 +90,19 @@ lcra_add_node_interference(struct lcra_state *l, unsigned i, unsigned cmask_i, u
         uint8_t constraint_fw = 0;
         uint8_t constraint_bw = 0;
 
+        /* The constraint bits are reversed from lcra.c so that register
+         * allocation can be done in parallel for every possible solution,
+         * with lower-order bits representing smaller registers. */
+
         for (unsigned D = 0; D < 4; ++D) {
                 if (cmask_i & (cmask_j << D)) {
-                        constraint_bw |= (1 << (3 + D));
-                        constraint_fw |= (1 << (3 - D));
+                        constraint_fw |= (1 << (3 + D));
+                        constraint_bw |= (1 << (3 - D));
                 }
 
                 if (cmask_i & (cmask_j >> D)) {
-                        constraint_fw |= (1 << (3 + D));
-                        constraint_bw |= (1 << (3 - D));
+                        constraint_bw |= (1 << (3 + D));
+                        constraint_fw |= (1 << (3 - D));
                 }
         }
 
@@ -115,7 +119,7 @@ lcra_test_linear(struct lcra_state *l, unsigned *solutions, unsigned i)
         for (unsigned j = 0; j < l->node_count; ++j) {
                 if (solutions[j] == ~0) continue;
 
-                signed lhs = solutions[j] - constant;
+                signed lhs = constant - solutions[j];
 
                 if (lhs < -3 || lhs > 3)
                         continue;



More information about the mesa-commit mailing list