Module: Mesa Branch: main Commit: 0515c6a3fb6383e3d85641e884bb703cbdf1444f URL: http://cgit.freedesktop.org/mesa/mesa/commit/?id=0515c6a3fb6383e3d85641e884bb703cbdf1444f
Author: Alyssa Rosenzweig <[email protected]> Date: Mon Jul 12 12:05:28 2021 -0400 pan/bi: Update ins->link after scheduling Otherwise foreach_instr and friends will be subtly wrong. None of our current passes rely on this but it's a footgun. Signed-off-by: Alyssa Rosenzweig <[email protected]> Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/10961> --- src/panfrost/bifrost/bi_schedule.c | 15 +++++++++++++++ 1 file changed, 15 insertions(+) diff --git a/src/panfrost/bifrost/bi_schedule.c b/src/panfrost/bifrost/bi_schedule.c index 2735941353a..83c93c1c959 100644 --- a/src/panfrost/bifrost/bi_schedule.c +++ b/src/panfrost/bifrost/bi_schedule.c @@ -1565,6 +1565,21 @@ bi_schedule_block(bi_context *ctx, bi_block *block) last_clause->flow_control = BIFROST_FLOW_NBTB_UNCONDITIONAL; } + /* Reorder instructions to match the new schedule. First remove + * existing instructions and then recreate the list */ + + bi_foreach_instr_in_block_safe(block, ins) { + list_del(&ins->link); + } + + bi_foreach_clause_in_block(block, clause) { + for (unsigned i = 0; i < clause->tuple_count; ++i) { + bi_foreach_instr_in_tuple(&clause->tuples[i], ins) { + list_addtail(&ins->link, &block->base.instructions); + } + } + } + block->scheduled = true; #ifndef NDEBUG _______________________________________________ mesa-commit mailing list [email protected] https://lists.freedesktop.org/mailman/listinfo/mesa-commit
