Mesa (main): pan/bi: Update ins->link after scheduling

GitLab Mirror gitlab-mirror at kemper.freedesktop.org
Mon Jul 12 23:44:38 UTC 2021


Module: Mesa
Branch: main
Commit: 0515c6a3fb6383e3d85641e884bb703cbdf1444f
URL:    http://cgit.freedesktop.org/mesa/mesa/commit/?id=0515c6a3fb6383e3d85641e884bb703cbdf1444f

Author: Alyssa Rosenzweig <alyssa at collabora.com>
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 <alyssa at collabora.com>
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



More information about the mesa-commit mailing list