From 4f4bb72745ca1fa507749843d32f320f879cf1b7 Mon Sep 17 00:00:00 2001 From: Alyssa Rosenzweig Date: Wed, 20 Jan 2021 17:36:03 -0500 Subject: [PATCH] pan/bi: Add nosched debug option 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 Reviewed-by: Boris Brezillon Part-of: --- src/panfrost/bifrost/bi_schedule.c | 12 ++++++++++++ src/panfrost/bifrost/bifrost.h | 1 + src/panfrost/bifrost/bifrost_compile.c | 1 + 3 files changed, 14 insertions(+) diff --git a/src/panfrost/bifrost/bi_schedule.c b/src/panfrost/bifrost/bi_schedule.c index 46e31646134..df0eff3804e 100644 --- a/src/panfrost/bifrost/bi_schedule.c +++ b/src/panfrost/bifrost/bi_schedule.c @@ -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)); diff --git a/src/panfrost/bifrost/bifrost.h b/src/panfrost/bifrost/bifrost.h index 0f0afb3b473..c675206dd21 100644 --- a/src/panfrost/bifrost/bifrost.h +++ b/src/panfrost/bifrost/bifrost.h @@ -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; diff --git a/src/panfrost/bifrost/bifrost_compile.c b/src/panfrost/bifrost/bifrost_compile.c index 0a8f299f983..1a90d947c99 100644 --- a/src/panfrost/bifrost/bifrost_compile.c +++ b/src/panfrost/bifrost/bifrost_compile.c @@ -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 };