pan/bi: Add interference between destinations
authorIcecream95 <ixn@disroot.org>
Mon, 14 Feb 2022 03:20:47 +0000 (16:20 +1300)
committerAlyssa Rosenzweig <alyssa@collabora.com>
Sat, 5 Mar 2022 19:50:09 +0000 (14:50 -0500)
Trying to write to overlapping register ranges from a single
instruction is undefined behaviour, so add interference between the
nodes to avoid this.

Hit in a dual-texture instruction in LIMBO.

Fixes: 9146bafbb42 ("pan/bi: Add dual texture fusing pass")
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/15250>

src/panfrost/bifrost/bi_ra.c

index 689b0c1..604f361 100644 (file)
@@ -246,6 +246,12 @@ bi_mark_interference(bi_block *block, struct lcra_state *l, uint8_t *live, uint6
                                                         bi_writemask(ins, d), i, live[i]);
                                 }
                         }
+
+                        unsigned node_first = bi_get_node(ins->dest[0]);
+                        if (d == 1 && node_first < node_count) {
+                                lcra_add_node_interference(l, node, bi_writemask(ins, 1),
+                                                           node_first, bi_writemask(ins, 0));
+                        }
                 }
 
                 /* Valhall needs >= 64-bit staging reads to be pair-aligned */