pan/bi: Fix off-by-one in scoreboarding packing
authorAlyssa Rosenzweig <alyssa.rosenzweig@collabora.com>
Thu, 26 Mar 2020 14:10:33 +0000 (10:10 -0400)
committerMarge Bot <eric+marge@anholt.net>
Tue, 31 Mar 2020 01:12:26 +0000 (01:12 +0000)
Clauses actually encode the *next* clauses' dependencies.

Signed-off-by: Alyssa Rosenzweig <alyssa.rosenzweig@collabora.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/4382>

src/panfrost/bifrost/bi_pack.c
src/panfrost/bifrost/bi_schedule.c

index aab59f724d08a11ad3b35ed316d348d6a4815e87..9e83a56e1e782dfd3bc2c08ac853a783ab4c22a7 100644 (file)
@@ -43,7 +43,7 @@ bi_pack_header(bi_clause *clause, bi_clause *next, bool is_fragment)
                 .branch_cond = clause->branch_conditional,
                 .datareg_writebarrier = clause->data_register_write_barrier,
                 .datareg = clause->data_register,
-                .scoreboard_deps = clause->dependencies,
+                .scoreboard_deps = next ? next->dependencies : 0,
                 .scoreboard_index = clause->scoreboard_id,
                 .clause_type = clause->clause_type,
                 .next_clause_type = next ? next->clause_type : 0,
index 589c84897ac6a5ec9c1e20456d96e3538063610c..f112553c05a1065434d9f7a1437e89bfd1ed28d9 100644 (file)
@@ -104,17 +104,16 @@ bi_schedule(bi_context *ctx)
 
                         if (is_first)
                                 is_first = false;
-                        else
+                        else {
+                                /* Rule: first instructions cannot have write barriers */
                                 u->dependencies |= (1 << last_id);
+                                u->data_register_write_barrier = true;
+                        }
 
                         ids = ids & 1;
                         last_id = u->scoreboard_id;
                         u->back_to_back = true;
 
-                        /* Rule: first instructions cannot have write barriers */
-                        if (!is_first)
-                                u->data_register_write_barrier = true;
-
                         u->constant_count = 1;
                         u->constants[0] = ins->constant.u64;