From cb8c47b15e4acecd0cacda8a3d9d20b578f1b4f2 Mon Sep 17 00:00:00 2001 From: Icecream95 Date: Mon, 14 Feb 2022 16:26:59 +1300 Subject: [PATCH] pan/bi: Check dependencies of both destinations of instructions TEXC can have two destinations; the value for neither of them can be used in the same bundle, so extend the code to check for this to iterate over both destinations. Fixes artefacts in the game "LIMBO". Fixes: a303076c1ab ("pan/bi: Add bi_instr_schedulable predicate") Part-of: --- src/panfrost/bifrost/bi_schedule.c | 23 ++++++++++++++--------- 1 file changed, 14 insertions(+), 9 deletions(-) diff --git a/src/panfrost/bifrost/bi_schedule.c b/src/panfrost/bifrost/bi_schedule.c index c0901eb840c..63eb0ae431f 100644 --- a/src/panfrost/bifrost/bi_schedule.c +++ b/src/panfrost/bifrost/bi_schedule.c @@ -1060,16 +1060,21 @@ bi_instr_schedulable(bi_instr *instr, * same clause (most likely they will not), so if a later instruction * in the clause accesses the destination, the message-passing * instruction can't be scheduled */ - if (bi_opcode_props[instr->op].sr_write && !bi_is_null(instr->dest[0])) { - unsigned nr = bi_count_write_registers(instr, 0); - assert(instr->dest[0].type == BI_INDEX_REGISTER); - unsigned reg = instr->dest[0].value; + if (bi_opcode_props[instr->op].sr_write) { + bi_foreach_dest(instr, d) { + if (bi_is_null(instr->dest[d])) + continue; - for (unsigned i = 0; i < clause->access_count; ++i) { - bi_index idx = clause->accesses[i]; - for (unsigned d = 0; d < nr; ++d) { - if (bi_is_equiv(bi_register(reg + d), idx)) - return false; + unsigned nr = bi_count_write_registers(instr, d); + assert(instr->dest[d].type == BI_INDEX_REGISTER); + unsigned reg = instr->dest[d].value; + + for (unsigned i = 0; i < clause->access_count; ++i) { + bi_index idx = clause->accesses[i]; + for (unsigned d = 0; d < nr; ++d) { + if (bi_is_equiv(bi_register(reg + d), idx)) + return false; + } } } }