[Mesa-dev] [PATCH 09/30] pan/midgard: Add mir_choose_bundle helper

Alyssa Rosenzweig alyssa.rosenzweig at collabora.com
Sat Sep 28 19:02:14 UTC 2019


It's not always obvious what the optimal bundle type should be. Let's
break out the logic to decide.

Currently set for purely in-order operation.

Signed-off-by: Alyssa Rosenzweig <alyssa.rosenzweig at collabora.com>
---
 src/panfrost/midgard/midgard_schedule.c | 25 +++++++++++++++++++++++++
 1 file changed, 25 insertions(+)

diff --git a/src/panfrost/midgard/midgard_schedule.c b/src/panfrost/midgard/midgard_schedule.c
index 8f324805cdb..969460235d1 100644
--- a/src/panfrost/midgard/midgard_schedule.c
+++ b/src/panfrost/midgard/midgard_schedule.c
@@ -861,6 +861,31 @@ mir_choose_instruction(
         return instructions[best_index];
 }
 
+/* Still, we don't choose instructions in a vacuum. We need a way to choose the
+ * best bundle type (ALU, load/store, texture). Nondestructive. */
+
+static unsigned
+mir_choose_bundle(
+                midgard_instruction **instructions,
+                BITSET_WORD *worklist, unsigned count)
+{
+        /* At the moment, our algorithm is very simple - use the bundle of the
+         * best instruction, regardless of what else could be scheduled
+         * alongside it. This is not optimal but it works okay for in-order */
+
+        struct midgard_predicate predicate = {
+                .tag = ~0,
+                .destructive = false
+        };
+
+        midgard_instruction *chosen = mir_choose_instruction(instructions, worklist, count, &predicate);
+
+        if (chosen)
+                return chosen->type;
+        else
+                return ~0;
+}
+
 /* Schedule a single block by iterating its instruction to create bundles.
  * While we go, tally about the bundle sizes to compute the block size. */
 
-- 
2.23.0



More information about the mesa-dev mailing list