Mesa (main): pan/bi: Add option to test spilling

GitLab Mirror gitlab-mirror at kemper.freedesktop.org
Wed May 4 13:07:02 UTC 2022


Module: Mesa
Branch: main
Commit: 6b6ace5199c2ed5dfd851435450f0c5ca353ffb5
URL:    http://cgit.freedesktop.org/mesa/mesa/commit/?id=6b6ace5199c2ed5dfd851435450f0c5ca353ffb5

Author: Alyssa Rosenzweig <alyssa at collabora.com>
Date:   Tue May  3 17:05:57 2022 -0400

pan/bi: Add option to test spilling

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 at collabora.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/16314>

---

 src/panfrost/bifrost/bi_ra.c           | 4 ++++
 src/panfrost/bifrost/bifrost.h         | 1 +
 src/panfrost/bifrost/bifrost_compile.c | 1 +
 3 files changed, 6 insertions(+)

diff --git a/src/panfrost/bifrost/bi_ra.c b/src/panfrost/bifrost/bi_ra.c
index 8a7fa6309d9..4a15b560abf 100644
--- a/src/panfrost/bifrost/bi_ra.c
+++ b/src/panfrost/bifrost/bi_ra.c
@@ -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]);
diff --git a/src/panfrost/bifrost/bifrost.h b/src/panfrost/bifrost/bifrost.h
index 6dce0c53b38..d80844e012f 100644
--- a/src/panfrost/bifrost/bifrost.h
+++ b/src/panfrost/bifrost/bifrost.h
@@ -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;
 
diff --git a/src/panfrost/bifrost/bifrost_compile.c b/src/panfrost/bifrost/bifrost_compile.c
index 5464e581024..12c09a68282 100644
--- a/src/panfrost/bifrost/bifrost_compile.c
+++ b/src/panfrost/bifrost/bifrost_compile.c
@@ -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
 };
 



More information about the mesa-commit mailing list