pan/mdg: Fix out-of-order execution

We can go up to 15 instructions out of order (performance fix) but we
can't go past a branch (bug fix).

Fixes: 30a393f458 ("pan/mdg: Enable out-of-order execution after texture ops")
Signed-off-by: Alyssa Rosenzweig <alyssa@collabora.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/19762>
This commit is contained in:
Alyssa Rosenzweig 2022-10-29 15:45:03 -04:00 committed by Marge Bot
parent af79e631ee
commit 044428211c
2 changed files with 12 additions and 8 deletions

View file

@ -937,8 +937,8 @@ __attribute__((__packed__))
* be any dependency (the blob appears to forbid even accessing other
* channels of a given texture register). */
unsigned out_of_order : 2;
unsigned unknown4 : 10;
unsigned out_of_order : 4;
unsigned unknown4 : 8;
/* In immediate mode, each offset field is an immediate range [0, 7].
*

View file

@ -416,10 +416,11 @@ mir_pack_swizzle_tex(midgard_instruction *ins)
/* TODO: bias component */
}
/* Up to 3 { ALU, LDST } bundles can execute in parallel with a texture op.
/*
* Up to 15 { ALU, LDST } bundles can execute in parallel with a texture op.
* Given a texture op, lookahead to see how many such bundles we can flag for
* OoO execution */
* OoO execution
*/
static bool
mir_can_run_ooo(midgard_block *block, midgard_bundle *bundle,
unsigned dependency)
@ -432,11 +433,14 @@ mir_can_run_ooo(midgard_block *block, midgard_bundle *bundle,
if (!IS_ALU(bundle->tag) && bundle->tag != TAG_LOAD_STORE_4)
return false;
/* Ensure there is no read-after-write dependency */
for (unsigned i = 0; i < bundle->instruction_count; ++i) {
midgard_instruction *ins = bundle->instructions[i];
/* No branches, jumps, or discards */
if (ins->compact_branch)
return false;
/* No read-after-write data dependencies */
mir_foreach_src(ins, s) {
if (ins->src[s] == dependency)
return false;
@ -452,7 +456,7 @@ mir_pack_tex_ooo(midgard_block *block, midgard_bundle *bundle, midgard_instructi
{
unsigned count = 0;
for (count = 0; count < 3; ++count) {
for (count = 0; count < 15; ++count) {
if (!mir_can_run_ooo(block, bundle + count + 1, ins->dest))
break;
}