From 502b9daa7aaee27f63cc1fa8f755fdf0a0fedcfa Mon Sep 17 00:00:00 2001 From: Samuel Pitoiset Date: Wed, 26 Aug 2020 14:24:45 +0200 Subject: [PATCH] aco: add ACO_DEBUG=novn,noopt,nosched for debugging purposes To disable value numbering, optimizations and scheduling. Signed-off-by: Samuel Pitoiset Reviewed-by: Rhys Perry Part-of: --- docs/envvars.rst | 6 ++++++ src/amd/compiler/aco_interface.cpp | 9 ++++++--- src/amd/compiler/aco_ir.cpp | 3 +++ src/amd/compiler/aco_ir.h | 3 +++ 4 files changed, 18 insertions(+), 3 deletions(-) diff --git a/docs/envvars.rst b/docs/envvars.rst index cee45fb306d..6337a789559 100644 --- a/docs/envvars.rst +++ b/docs/envvars.rst @@ -614,6 +614,12 @@ RADV driver environment variables abort on some suboptimal code generation ``force-waitcnt`` force emitting waitcnt states if there is something to wait for + ``novn`` + disable value numbering + ``noopt`` + disable various optimizations + ``noscheduling`` + disable instructions scheduling radeonsi driver environment variables ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ diff --git a/src/amd/compiler/aco_interface.cpp b/src/amd/compiler/aco_interface.cpp index 49379cb3169..4b0ea2ff5d0 100644 --- a/src/amd/compiler/aco_interface.cpp +++ b/src/amd/compiler/aco_interface.cpp @@ -89,8 +89,10 @@ void aco_compile_shader(unsigned shader_count, validate(program.get()); /* Optimization */ - aco::value_numbering(program.get()); - aco::optimize(program.get()); + if (!(aco::debug_flags & aco::DEBUG_NO_VN)) + aco::value_numbering(program.get()); + if (!(aco::debug_flags & aco::DEBUG_NO_OPT)) + aco::optimize(program.get()); /* cleanup and exec mask handling */ aco::setup_reduce_temp(program.get()); @@ -121,7 +123,8 @@ void aco_compile_shader(unsigned shader_count, aco::collect_presched_stats(program.get()); if (!args->is_trap_handler_shader) { - aco::schedule_program(program.get(), live_vars); + if (!(aco::debug_flags & aco::DEBUG_NO_SCHED)) + aco::schedule_program(program.get(), live_vars); validate(program.get()); /* Register Allocation */ diff --git a/src/amd/compiler/aco_ir.cpp b/src/amd/compiler/aco_ir.cpp index b594b2824e9..c24356079f8 100644 --- a/src/amd/compiler/aco_ir.cpp +++ b/src/amd/compiler/aco_ir.cpp @@ -35,6 +35,9 @@ static const struct debug_control aco_debug_options[] = { {"validatera", DEBUG_VALIDATE_RA}, {"perfwarn", DEBUG_PERFWARN}, {"force-waitcnt", DEBUG_FORCE_WAITCNT}, + {"novn", DEBUG_NO_VN}, + {"noopt", DEBUG_NO_OPT}, + {"nosched", DEBUG_NO_SCHED}, {NULL, 0} }; diff --git a/src/amd/compiler/aco_ir.h b/src/amd/compiler/aco_ir.h index 18bc9bdd844..d27726d7f73 100644 --- a/src/amd/compiler/aco_ir.h +++ b/src/amd/compiler/aco_ir.h @@ -52,6 +52,9 @@ enum { DEBUG_VALIDATE_RA = 0x2, DEBUG_PERFWARN = 0x4, DEBUG_FORCE_WAITCNT = 0x8, + DEBUG_NO_VN = 0x10, + DEBUG_NO_OPT = 0x20, + DEBUG_NO_SCHED = 0x40, }; /** -- 2.30.2