broadcom/compiler: start allocating from RF 4 in V7.x
authorIago Toral Quiroga <itoral@igalia.com>
Fri, 26 Nov 2021 09:37:05 +0000 (10:37 +0100)
committerMarge Bot <emma+marge@anholt.net>
Fri, 13 Oct 2023 22:37:42 +0000 (22:37 +0000)
In V3D 4.x we start at RF3 so that we allocate RF0-2 only if there
aren't any other RFs available. This is useful with small shaders to
ensure that our TLB writes don't use these registers because these are
the last instructions we emit in fragment shaders and the last
instructions in a program can't write to these registers, so if we do,
we need to emit NOPs.

In V3D 7.x the registers affected by this restriction are RF2-3, so we
choose to start at RF4.

Reviewed-by: Alejandro PiƱeiro <apinheiro@igalia.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/25450>

src/broadcom/compiler/vir_register_allocate.c

index 6f7b1ca..440b093 100644 (file)
@@ -1234,9 +1234,10 @@ v3d_register_allocate(struct v3d_compile *c)
                 .phys_index = phys_index,
                 .next_acc = 0,
                 /* Start at RF3, to try to keep the TLB writes from using
-                 * RF0-2.
+                 * RF0-2. Start at RF4 in 7.x to prevent TLB writes from
+                 * using RF2-3.
                  */
-                .next_phys = 3,
+                .next_phys = c->devinfo->ver <= 42 ? 3 : 4,
                 .nodes = &c->nodes,
                 .devinfo = c->devinfo,
         };