From 6c4b97011b209fb9c034208b2b2f7e261feaf17c Mon Sep 17 00:00:00 2001 From: Alyssa Rosenzweig Date: Thu, 17 Oct 2019 16:37:11 -0400 Subject: [PATCH] pan/midgard: Create dependency graph bytewise This allows for vec16 dependencies in the scheduler, not that we have any yet (thankfully). Signed-off-by: Alyssa Rosenzweig --- src/panfrost/midgard/midgard_schedule.c | 24 ++++++++++++------------ 1 file changed, 12 insertions(+), 12 deletions(-) diff --git a/src/panfrost/midgard/midgard_schedule.c b/src/panfrost/midgard/midgard_schedule.c index 341a746a8f4..e2ee39a111a 100644 --- a/src/panfrost/midgard/midgard_schedule.c +++ b/src/panfrost/midgard/midgard_schedule.c @@ -55,18 +55,18 @@ * */ -/* We create the dependency graph with per-component granularity */ +/* We create the dependency graph with per-byte granularity */ -#define COMPONENT_COUNT 8 +#define BYTE_COUNT 16 static void -add_dependency(struct util_dynarray *table, unsigned index, unsigned mask, midgard_instruction **instructions, unsigned child) +add_dependency(struct util_dynarray *table, unsigned index, uint16_t mask, midgard_instruction **instructions, unsigned child) { - for (unsigned i = 0; i < COMPONENT_COUNT; ++i) { + for (unsigned i = 0; i < BYTE_COUNT; ++i) { if (!(mask & (1 << i))) continue; - struct util_dynarray *parents = &table[(COMPONENT_COUNT * index) + i]; + struct util_dynarray *parents = &table[(BYTE_COUNT * index) + i]; util_dynarray_foreach(parents, unsigned, parent) { BITSET_WORD *dependents = instructions[*parent]->dependents; @@ -82,20 +82,20 @@ add_dependency(struct util_dynarray *table, unsigned index, unsigned mask, midga } static void -mark_access(struct util_dynarray *table, unsigned index, unsigned mask, unsigned parent) +mark_access(struct util_dynarray *table, unsigned index, uint16_t mask, unsigned parent) { - for (unsigned i = 0; i < COMPONENT_COUNT; ++i) { + for (unsigned i = 0; i < BYTE_COUNT; ++i) { if (!(mask & (1 << i))) continue; - util_dynarray_append(&table[(COMPONENT_COUNT * index) + i], unsigned, parent); + util_dynarray_append(&table[(BYTE_COUNT * index) + i], unsigned, parent); } } static void mir_create_dependency_graph(midgard_instruction **instructions, unsigned count, unsigned node_count) { - size_t sz = node_count * COMPONENT_COUNT; + size_t sz = node_count * BYTE_COUNT; struct util_dynarray *last_read = calloc(sizeof(struct util_dynarray), sz); struct util_dynarray *last_write = calloc(sizeof(struct util_dynarray), sz); @@ -119,13 +119,13 @@ mir_create_dependency_graph(midgard_instruction **instructions, unsigned count, continue; unsigned dest = instructions[i]->dest; - unsigned mask = instructions[i]->mask; + unsigned mask = mir_bytemask(instructions[i]); mir_foreach_src((*instructions), s) { unsigned src = instructions[i]->src[s]; if (src < node_count) { - unsigned readmask = mir_from_bytemask(mir_bytemask_of_read_components(instructions[i], src), midgard_reg_mode_32); + unsigned readmask = mir_bytemask_of_read_components(instructions[i], src); add_dependency(last_write, src, readmask, instructions, i); } } @@ -140,7 +140,7 @@ mir_create_dependency_graph(midgard_instruction **instructions, unsigned count, unsigned src = instructions[i]->src[s]; if (src < node_count) { - unsigned readmask = mir_from_bytemask(mir_bytemask_of_read_components(instructions[i], src), midgard_reg_mode_32); + unsigned readmask = mir_bytemask_of_read_components(instructions[i], src); mark_access(last_read, src, readmask, i); } } -- 2.30.2