broadcom/compiler: disallow unifa overlap with thread switch/end
authorIago Toral Quiroga <itoral@igalia.com>
Thu, 11 Feb 2021 11:09:28 +0000 (12:09 +0100)
committerMarge Bot <eric+marge@anholt.net>
Fri, 12 Feb 2021 08:24:21 +0000 (08:24 +0000)
Reviewed-by: Alejandro PiƱeiro <apinheiro@igalia.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/8980>

src/broadcom/compiler/qpu_schedule.c

index 2d563d0..af864b8 100644 (file)
@@ -1217,6 +1217,23 @@ valid_thrsw_sequence(struct v3d_compile *c, struct choose_scoreboard *scoreboard
                         return false;
                 }
 
+                /* unifa and the following 3 instructions can't overlap a
+                 * thread switch/end. The docs further clarify that this means
+                 * the cycle at which the actual thread switch/end happens
+                 * and not when the thrsw instruction is processed, which would
+                 * be after the 2 delay slots following the thrsw instruction.
+                 * This means that we can move up a thrsw up to the instruction
+                 * right after unifa:
+                 *
+                 * unifa, r5
+                 * thrsw
+                 * delay slot 1
+                 * delay slot 2
+                 * Thread switch happens here, 4 instructions away from unifa
+                 */
+                if (v3d_qpu_writes_unifa(c->devinfo, &qinst->qpu))
+                        return false;
+
                 /* Note that the list is circular, so we can only do this up
                  * to instructions_in_sequence.
                  */