From 24c30844119b0b8cdd88b025ff25ae01bc6dea1b Mon Sep 17 00:00:00 2001 From: Alyssa Rosenzweig Date: Tue, 2 Aug 2022 20:59:21 -0400 Subject: [PATCH] agx: Add AGX_MESA_DEBUG=noopt option To disable the optimizer. Trying to root cause a Neverball bug, this gives one less thing to worry. Signed-off-by: Alyssa Rosenzweig Part-of: --- src/asahi/compiler/agx_compile.c | 13 ++++++++----- src/asahi/compiler/agx_compiler.h | 1 + 2 files changed, 9 insertions(+), 5 deletions(-) diff --git a/src/asahi/compiler/agx_compile.c b/src/asahi/compiler/agx_compile.c index 01541e04314..d61d12e83cf 100644 --- a/src/asahi/compiler/agx_compile.c +++ b/src/asahi/compiler/agx_compile.c @@ -39,6 +39,7 @@ static const struct debug_named_value agx_debug_options[] = { {"verbose", AGX_DBG_VERBOSE, "Disassemble verbosely"}, {"internal", AGX_DBG_INTERNAL, "Dump even internal shaders"}, {"novalidate",AGX_DBG_NOVALIDATE,"Skip IR validation in debug builds"}, + {"noopt", AGX_DBG_NOOPT, "Disable backend optimizations"}, DEBUG_NAMED_VALUE_END }; @@ -1743,12 +1744,14 @@ agx_compile_shader_nir(nir_shader *nir, if (agx_debug & AGX_DBG_SHADERS && !skip_internal) agx_print_shader(ctx, stdout); - agx_optimizer(ctx); - agx_dce(ctx); - agx_validate(ctx, "Optimization"); + if (likely(!(agx_debug & AGX_DBG_NOOPT))) { + agx_optimizer(ctx); + agx_dce(ctx); + agx_validate(ctx, "Optimization"); - if (agx_debug & AGX_DBG_SHADERS && !skip_internal) - agx_print_shader(ctx, stdout); + if (agx_debug & AGX_DBG_SHADERS && !skip_internal) + agx_print_shader(ctx, stdout); + } agx_ra(ctx); diff --git a/src/asahi/compiler/agx_compiler.h b/src/asahi/compiler/agx_compiler.h index b5a2c0fecde..7dc732c23e8 100644 --- a/src/asahi/compiler/agx_compiler.h +++ b/src/asahi/compiler/agx_compiler.h @@ -45,6 +45,7 @@ enum agx_dbg { AGX_DBG_VERBOSE = BITFIELD_BIT(3), AGX_DBG_INTERNAL = BITFIELD_BIT(4), AGX_DBG_NOVALIDATE = BITFIELD_BIT(5), + AGX_DBG_NOOPT = BITFIELD_BIT(6), }; extern int agx_debug;