From 72a03bcafae8903339329ee74ba4cdd0c75b2814 Mon Sep 17 00:00:00 2001 From: Alyssa Rosenzweig Date: Sun, 22 Sep 2019 09:01:07 -0400 Subject: [PATCH] pan/midgard: Add mir_choose_bundle helper 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 --- 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.30.2