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>
This commit is contained in:
Icecream95 2020-12-29 01:02:27 +13:00 committed by Marge Bot
parent 24fcc032ef
commit b5d6e5049f
1 changed files with 30 additions and 0 deletions

View File

@ -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);