aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorAlyssa Rosenzweig <[email protected]>2019-08-31 11:56:58 -0700
committerAlyssa Rosenzweig <[email protected]>2019-09-30 08:40:13 -0400
commitf48038b588df726cd34f5d15e999498310da7432 (patch)
treeab9f3f5650e4870169c94775c4302dc9b519b244
parenta3b46c0db67360442b648d5fd08e421a97f720f6 (diff)
pan/midgard: Initialize worklist
This flows naturally from the dependency graph Signed-off-by: Alyssa Rosenzweig <[email protected]>
-rw-r--r--src/panfrost/midgard/midgard_schedule.c17
1 files changed, 17 insertions, 0 deletions
diff --git a/src/panfrost/midgard/midgard_schedule.c b/src/panfrost/midgard/midgard_schedule.c
index 70fa030390c..aff93399a80 100644
--- a/src/panfrost/midgard/midgard_schedule.c
+++ b/src/panfrost/midgard/midgard_schedule.c
@@ -755,6 +755,18 @@ flatten_mir(midgard_block *block, unsigned *len)
return instructions;
}
+/* The worklist is the set of instructions that can be scheduled now; that is,
+ * the set of instructions with no remaining dependencies */
+
+static void
+mir_initialize_worklist(BITSET_WORD *worklist, midgard_instruction **instructions, unsigned count)
+{
+ for (unsigned i = 0; i < count; ++i) {
+ if (instructions[i]->nr_dependencies == 0)
+ BITSET_SET(worklist, i);
+ }
+}
+
/* Schedule a single block by iterating its instruction to create bundles.
* While we go, tally about the bundle sizes to compute the block size. */
@@ -769,6 +781,11 @@ schedule_block(compiler_context *ctx, midgard_block *block)
unsigned node_count = ctx->temp_count + 1;
mir_create_dependency_graph(instructions, len, node_count);
+ /* Allocate the worklist */
+ size_t sz = BITSET_WORDS(len) * sizeof(BITSET_WORD);
+ BITSET_WORD *worklist = calloc(sz, 1);
+ mir_initialize_worklist(worklist, instructions, len);
+
util_dynarray_init(&block->bundles, NULL);
block->quadword_count = 0;