aco: add ACO_DEBUG=novn,noopt,nosched for debugging purposes
authorSamuel Pitoiset <samuel.pitoiset@gmail.com>
Wed, 26 Aug 2020 12:24:45 +0000 (14:24 +0200)
committerMarge Bot <eric+marge@anholt.net>
Thu, 27 Aug 2020 10:23:51 +0000 (10:23 +0000)
To disable value numbering, optimizations and scheduling.

Signed-off-by: Samuel Pitoiset <samuel.pitoiset@gmail.com>
Reviewed-by: Rhys Perry <pendingchaos02@gmail.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/6470>

docs/envvars.rst
src/amd/compiler/aco_interface.cpp
src/amd/compiler/aco_ir.cpp
src/amd/compiler/aco_ir.h

index cee45fb306d3791ed434bb8a4617334a1420c592..6337a789559cc5954f96af42f32eb516df48e122 100644 (file)
@@ -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
 ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
index 49379cb3169b585c10a0e6c19752d8f14f4ec921..4b0ea2ff5d042c888415b9b6349dfbff28d7725c 100644 (file)
@@ -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 */
index b594b2824e9a1ed4f02b2824df07ba49a3fc81aa..c24356079f8f112dab51542f02a3ad91cc584a52 100644 (file)
@@ -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}
 };
 
index 18bc9bdd844f76aedd3b5244c3a3f5d0dd6f0025..d27726d7f73ceec2a7a33e757b78b8f98a4db3bf 100644 (file)
@@ -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,
 };
 
 /**