[Mesa-dev] [PATCH 19/30] pan/midgard: Add distance metric to choose_instruction
Alyssa Rosenzweig
alyssa.rosenzweig at collabora.com
Sat Sep 28 19:02:24 UTC 2019
We require chosen instructions to be "close", to avoid ballooning
register pressure. This is a kludge that will go away once we have
proper liveness tracking in the scheduler, but for now it prevents a lot
of needless spilling.
Signed-off-by: Alyssa Rosenzweig <alyssa.rosenzweig at collabora.com>
---
src/panfrost/midgard/midgard_schedule.c | 14 ++++++++++++++
1 file changed, 14 insertions(+)
diff --git a/src/panfrost/midgard/midgard_schedule.c b/src/panfrost/midgard/midgard_schedule.c
index dea8b023e9d..6177d0072f7 100644
--- a/src/panfrost/midgard/midgard_schedule.c
+++ b/src/panfrost/midgard/midgard_schedule.c
@@ -898,7 +898,21 @@ mir_choose_instruction(
signed best_index = -1;
+ /* Enforce a simple metric limiting distance to keep down register
+ * pressure. TOOD: replace with liveness tracking for much better
+ * results */
+
+ unsigned max_active = 0;
+ unsigned max_distance = 8;
+
BITSET_FOREACH_SET(i, tmp, worklist, count) {
+ max_active = MAX2(max_active, i);
+ }
+
+ BITSET_FOREACH_SET(i, tmp, worklist, count) {
+ if ((max_active - i) >= max_distance)
+ continue;
+
if (tag != ~0 && instructions[i]->type != tag)
continue;
--
2.23.0
More information about the mesa-dev
mailing list