From e9571b53e1b2d7dfa8cff5281890d6111c28fb74 Mon Sep 17 00:00:00 2001 From: Alyssa Rosenzweig Date: Fri, 27 Sep 2019 08:18:54 -0400 Subject: [PATCH] pan/midgard: Add mir_choose_alu helper Based on a given unit. Signed-off-by: Alyssa Rosenzweig --- src/panfrost/midgard/midgard_schedule.c | 24 ++++++++++++++++++++++++ 1 file changed, 24 insertions(+) diff --git a/src/panfrost/midgard/midgard_schedule.c b/src/panfrost/midgard/midgard_schedule.c index e2641ea0180..dea8b023e9d 100644 --- a/src/panfrost/midgard/midgard_schedule.c +++ b/src/panfrost/midgard/midgard_schedule.c @@ -818,6 +818,9 @@ struct midgard_predicate { /* True if we want to pop off the chosen instruction */ bool destructive; + /* For ALU, choose only this unit */ + unsigned unit; + /* State for bundle constants. constants is the actual constants * for the bundle. constant_count is the number of bytes (up to * 16) currently in use for constants. When picking in destructive @@ -957,6 +960,27 @@ mir_choose_bundle( return ~0; } +/* We want to choose an ALU instruction filling a given unit */ +static void +mir_choose_alu(midgard_instruction **slot, + midgard_instruction **instructions, + BITSET_WORD *worklist, unsigned len, + struct midgard_predicate *predicate, + unsigned unit) +{ + /* Did we already schedule to this slot? */ + if ((*slot) != NULL) + return; + + /* Try to schedule something, if not */ + predicate->unit = unit; + *slot = mir_choose_instruction(instructions, worklist, len, predicate); + + /* Store unit upon scheduling */ + if (*slot && !((*slot)->compact_branch)) + (*slot)->unit = unit; +} + /* When we are scheduling a branch/csel, we need the consumed condition in the * same block as a pipeline register. There are two options to enable this: * -- 2.30.2