From 8a2c1d337ec717fd49ac12939d2b5aaf92ad0149 Mon Sep 17 00:00:00 2001 From: Alyssa Rosenzweig Date: Sat, 27 Jan 2024 14:23:24 -0400 Subject: [PATCH] agx: add =spill debug option to force spilling so we can exercise the new code. Signed-off-by: Alyssa Rosenzweig Part-of: --- src/asahi/compiler/agx_compile.c | 1 + src/asahi/compiler/agx_debug.h | 1 + src/asahi/compiler/agx_register_allocate.c | 1 + 3 files changed, 3 insertions(+) diff --git a/src/asahi/compiler/agx_compile.c b/src/asahi/compiler/agx_compile.c index 6a5938df982..d99d09678ae 100644 --- a/src/asahi/compiler/agx_compile.c +++ b/src/asahi/compiler/agx_compile.c @@ -36,6 +36,7 @@ static const struct debug_named_value agx_debug_options[] = { {"nopreamble",AGX_DBG_NOPREAMBLE,"Do not use shader preambles"}, {"demand", AGX_DBG_DEMAND, "Bound tightly to register demand"}, {"nosched", AGX_DBG_NOSCHED, "Do not schedule the shader"}, + {"spill", AGX_DBG_SPILL, "Spill (almost) everything"}, DEBUG_NAMED_VALUE_END }; /* clang-format on */ diff --git a/src/asahi/compiler/agx_debug.h b/src/asahi/compiler/agx_debug.h index a9f0c07f485..eecd445db82 100644 --- a/src/asahi/compiler/agx_debug.h +++ b/src/asahi/compiler/agx_debug.h @@ -26,6 +26,7 @@ enum agx_compiler_dbg { AGX_DBG_NOPREAMBLE = BITFIELD_BIT(8), AGX_DBG_DEMAND = BITFIELD_BIT(9), AGX_DBG_NOSCHED = BITFIELD_BIT(10), + AGX_DBG_SPILL = BITFIELD_BIT(11), }; /* clang-format on */ diff --git a/src/asahi/compiler/agx_register_allocate.c b/src/asahi/compiler/agx_register_allocate.c index 15858eab730..2cdf2ca13df 100644 --- a/src/asahi/compiler/agx_register_allocate.c +++ b/src/asahi/compiler/agx_register_allocate.c @@ -1148,6 +1148,7 @@ agx_ra(agx_context *ctx) agx_compute_liveness(ctx); unsigned effective_demand = agx_calc_register_demand(ctx); bool spilling = (effective_demand > max_possible_regs); + spilling |= ((agx_compiler_debug & AGX_DBG_SPILL) && ctx->key->has_scratch); if (spilling) { assert(ctx->key->has_scratch && "internal shaders are unspillable");