pan/bi: Add nosched debug option
authorAlyssa Rosenzweig <alyssa.rosenzweig@collabora.com>
Wed, 20 Jan 2021 22:36:03 +0000 (17:36 -0500)
committerMarge Bot <eric+marge@anholt.net>
Mon, 8 Feb 2021 14:07:30 +0000 (14:07 +0000)
Forces a trivial schedule to replicate the old behaviour (for debugging
or benchmarking). Actually the new scheduler is still used, just highly
constrained; the net result should still do what's expected.

Signed-off-by: Alyssa Rosenzweig <alyssa.rosenzweig@collabora.com>
Reviewed-by: Boris Brezillon <boris.brezillon@collabora.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/8354>

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

index 46e3164..df0eff3 100644 (file)
@@ -761,6 +761,12 @@ bi_take_instr(bi_context *ctx, struct bi_worklist st,
                 struct bi_tuple_state *tuple,
                 bool fma)
 {
+#ifndef NDEBUG
+        /* Don't pair instructions if debugging */
+        if ((bifrost_debug & BIFROST_DBG_NOSCHED) && tuple->add)
+                return NULL;
+#endif
+
         if (tuple->add && tuple->add->op == BI_OPCODE_CUBEFACE)
                 return bi_lower_cubeface(ctx, clause, tuple);
 
@@ -1229,6 +1235,12 @@ bi_schedule_clause(bi_context *ctx, bi_block *block, struct bi_worklist st)
                 if (!bi_space_for_more_constants(&clause_state))
                         break;
 
+#ifndef NDEBUG
+                /* Don't schedule more than 1 tuple if debugging */
+                if (bifrost_debug & BIFROST_DBG_NOSCHED)
+                        break;
+#endif
+
                 /* Link through the register state */
                 STATIC_ASSERT(sizeof(prev_reads) == sizeof(tuple_state.reg.reads));
                 memcpy(prev_reads, tuple_state.reg.reads, sizeof(prev_reads));
index 0f0afb3..c675206 100644 (file)
@@ -35,6 +35,7 @@
 #define BIFROST_DBG_SHADERDB    0x0004
 #define BIFROST_DBG_VERBOSE     0x0008
 #define BIFROST_DBG_INTERNAL    0x0010
+#define BIFROST_DBG_NOSCHED     0x0020
 
 extern int bifrost_debug;
 
index 0a8f299..1a90d94 100644 (file)
@@ -43,6 +43,7 @@ static const struct debug_named_value bifrost_debug_options[] = {
         {"shaderdb",  BIFROST_DBG_SHADERDB,    "Print statistics"},
         {"verbose",   BIFROST_DBG_VERBOSE,     "Disassemble verbosely"},
         {"internal",  BIFROST_DBG_INTERNAL,    "Dump even internal shaders"},
+        {"nosched",   BIFROST_DBG_NOSCHED,     "Force trivial scheduling"},
         DEBUG_NAMED_VALUE_END
 };