pan/bi: Add option to test spilling
authorAlyssa Rosenzweig <alyssa@collabora.com>
Tue, 3 May 2022 21:05:57 +0000 (17:05 -0400)
committerMarge Bot <emma+marge@anholt.net>
Wed, 4 May 2022 12:48:27 +0000 (12:48 +0000)
BIFROST_MESA_DEBUG=spill now restricts the register file to 1/4 its usual size,
useful for testing register spilling (e.g. running CTS) as well as debugging
spilling on small shaders.

Note blend shaders are exempt, as we don't allow blend shaders to spill.

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

src/panfrost/bifrost/bi_ra.c
src/panfrost/bifrost/bifrost.h
src/panfrost/bifrost/bifrost_compile.c

index 8a7fa63..4a15b56 100644 (file)
@@ -314,6 +314,10 @@ bi_allocate_registers(bi_context *ctx, bool *success, bool full_regs)
                 full_regs ? BITFIELD64_MASK(64) :
                 (BITFIELD64_MASK(16) | (BITFIELD64_MASK(16) << 48));
 
+        /* To test spilling, mimic a small register file */
+        if (bifrost_debug & BIFROST_DBG_SPILL && !ctx->inputs->is_blend)
+                default_affinity &= BITFIELD64_MASK(48) << 8;
+
         bi_foreach_instr_global(ctx, ins) {
                 bi_foreach_dest(ins, d) {
                         unsigned dest = bi_get_node(ins->dest[d]);
index 6dce0c5..d80844e 100644 (file)
@@ -47,6 +47,7 @@ extern "C" {
 #define BIFROST_DBG_NOIDVS      0x0200
 #define BIFROST_DBG_NOSB        0x0400
 #define BIFROST_DBG_NOPRELOAD   0x0800
+#define BIFROST_DBG_SPILL       0x1000
 
 extern int bifrost_debug;
 
index 5464e58..12c09a6 100644 (file)
@@ -52,6 +52,7 @@ static const struct debug_named_value bifrost_debug_options[] = {
         {"noidvs",    BIFROST_DBG_NOIDVS,       "Disable IDVS"},
         {"nosb",      BIFROST_DBG_NOSB,         "Disable scoreboarding"},
         {"nopreload", BIFROST_DBG_NOPRELOAD,    "Disable message preloading"},
+        {"spill",     BIFROST_DBG_SPILL,        "Test register spilling"},
         DEBUG_NAMED_VALUE_END
 };