summaryrefslogtreecommitdiff
path: root/src/panfrost/midgard
diff options
context:
space:
mode:
authorIcecream95 <ixn@disroot.org>2020-12-29 01:02:27 +1300
committerMarge Bot <eric+marge@anholt.net>2021-01-18 20:49:45 +0000
commitb5d6e5049fbe2247f6e92bf42dec9a024b9bd5ab (patch)
treee917913158f23f6a4033607214d2590854c68000 /src/panfrost/midgard
parent24fcc032efc85cdf25ea23895de3858729b7b0b8 (diff)
pan/mdg: Don't reorder loads/stores past each other
Fixes Piglit test local-memory.cl. Reviewed-by: Alyssa Rosenzweig <alyssa.rosenzweig@collabora.com> Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/8358>
Diffstat (limited to 'src/panfrost/midgard')
-rw-r--r--src/panfrost/midgard/midgard_schedule.c30
1 files changed, 30 insertions, 0 deletions
diff --git a/src/panfrost/midgard/midgard_schedule.c b/src/panfrost/midgard/midgard_schedule.c
index 9b0f276f30b..7bd8229fe33 100644
--- a/src/panfrost/midgard/midgard_schedule.c
+++ b/src/panfrost/midgard/midgard_schedule.c
@@ -116,6 +116,8 @@ mir_create_dependency_graph(midgard_instruction **instructions, unsigned count,
instructions[i]->nr_dependencies = 0;
}
+ unsigned prev_ldst[3] = {~0, ~0, ~0};
+
/* Populate dependency graph */
for (signed i = count - 1; i >= 0; --i) {
if (instructions[i]->compact_branch)
@@ -133,6 +135,34 @@ mir_create_dependency_graph(midgard_instruction **instructions, unsigned count,
}
}
+ /* Create a list of dependencies for each type of load/store
+ * instruction to prevent reordering. */
+ if (instructions[i]->type == TAG_LOAD_STORE_4 &&
+ load_store_opcode_props[instructions[i]->op].props & LDST_ADDRESS) {
+
+ unsigned type;
+ switch (instructions[i]->load_store.arg_1 & 0x3E) {
+ case LDST_SHARED: type = 0; break;
+ case LDST_SCRATCH: type = 1; break;
+ default: type = 2; break;
+ }
+
+ unsigned prev = prev_ldst[type];
+
+ if (prev != ~0) {
+ BITSET_WORD *dependents = instructions[prev]->dependents;
+
+ /* Already have the dependency */
+ if (BITSET_TEST(dependents, i))
+ continue;
+
+ BITSET_SET(dependents, i);
+ instructions[i]->nr_dependencies++;
+ }
+
+ prev_ldst[type] = i;
+ }
+
if (dest < node_count) {
add_dependency(last_read, dest, mask, instructions, i);
add_dependency(last_write, dest, mask, instructions, i);