From 7070178dfd0d36e94a7061fe2eccd0ac0c6ca7ee Mon Sep 17 00:00:00 2001 From: Pierre-Eric Pelloux-Prayer Date: Thu, 17 Feb 2022 14:46:06 +0100 Subject: [PATCH] radeonsi: use 1 shader compilation thread if NIR_PRINT is used This avoids getting multiple shaders NIR code being printed at the same time making the log unusable. Part-of: --- src/gallium/drivers/radeonsi/si_pipe.c | 13 +++++++++++++ 1 file changed, 13 insertions(+) diff --git a/src/gallium/drivers/radeonsi/si_pipe.c b/src/gallium/drivers/radeonsi/si_pipe.c index c0a90a36331..66e829c83f1 100644 --- a/src/gallium/drivers/radeonsi/si_pipe.c +++ b/src/gallium/drivers/radeonsi/si_pipe.c @@ -34,6 +34,7 @@ #include "si_shader_internal.h" #include "sid.h" #include "ac_shadowed_regs.h" +#include "compiler/nir/nir.h" #include "util/disk_cache.h" #include "util/u_cpu_detect.h" #include "util/u_log.h" @@ -1163,6 +1164,18 @@ static struct pipe_screen *radeonsi_screen_create_impl(struct radeon_winsys *ws, num_comp_lo_threads = 1; } +#ifndef NDEBUG + nir_process_debug_variable(); + + /* Use a single compilation thread if NIR printing is enabled to avoid + * multiple shaders being printed at the same time. + */ + if (NIR_DEBUG(PRINT)) { + num_comp_hi_threads = 1; + num_comp_lo_threads = 1; + } +#endif + num_comp_hi_threads = MIN2(num_comp_hi_threads, ARRAY_SIZE(sscreen->compiler)); num_comp_lo_threads = MIN2(num_comp_lo_threads, ARRAY_SIZE(sscreen->compiler_lowp));