From fde8bf7b7f57a20f7355f67f840f7c3a2a9eb49f Mon Sep 17 00:00:00 2001 From: Caio Oliveira Date: Tue, 20 Jun 2023 14:42:02 -0700 Subject: [PATCH] intel/compiler: Respect NIR_DEBUG_PRINT_INTERNAL flag If flag is not set, don't print debugging information for internal shaders. Reviewed-by: Kenneth Graunke Part-of: --- src/intel/compiler/brw_fs.cpp | 13 +++++++++---- src/intel/compiler/brw_mesh.cpp | 4 ++-- src/intel/compiler/brw_private.h | 2 ++ src/intel/compiler/brw_shader.cpp | 3 ++- src/intel/compiler/brw_vec4.cpp | 3 ++- src/intel/compiler/brw_vec4_gs_visitor.cpp | 3 ++- src/intel/compiler/brw_vec4_tcs.cpp | 3 ++- 7 files changed, 21 insertions(+), 10 deletions(-) diff --git a/src/intel/compiler/brw_fs.cpp b/src/intel/compiler/brw_fs.cpp index ca68614..fd2514b 100644 --- a/src/intel/compiler/brw_fs.cpp +++ b/src/intel/compiler/brw_fs.cpp @@ -7460,7 +7460,7 @@ brw_compile_fs(const struct brw_compiler *compiler, struct brw_wm_prog_data *prog_data = params->prog_data; bool allow_spilling = params->allow_spilling; const bool debug_enabled = - INTEL_DEBUG(params->debug_flag ? params->debug_flag : DEBUG_WM); + brw_should_print_shader(nir, params->debug_flag ? params->debug_flag : DEBUG_WM); prog_data->base.stage = MESA_SHADER_FRAGMENT; prog_data->base.ray_queries = nir->info.ray_queries; @@ -7817,7 +7817,7 @@ brw_compile_cs(const struct brw_compiler *compiler, struct brw_cs_prog_data *prog_data = params->prog_data; const bool debug_enabled = - INTEL_DEBUG(params->debug_flag ? params->debug_flag : DEBUG_CS); + brw_should_print_shader(nir, params->debug_flag ? params->debug_flag : DEBUG_CS); prog_data->base.stage = MESA_SHADER_COMPUTE; prog_data->base.total_shared = nir->info.shared_size; @@ -7966,7 +7966,7 @@ compile_single_bs(const struct brw_compiler *compiler, void *log_data, int *prog_offset, char **error_str) { - const bool debug_enabled = INTEL_DEBUG(DEBUG_RT); + const bool debug_enabled = brw_should_print_shader(shader, DEBUG_RT); prog_data->base.stage = shader->info.stage; prog_data->max_stack_size = MAX2(prog_data->max_stack_size, @@ -8060,7 +8060,7 @@ brw_compile_bs(const struct brw_compiler *compiler, struct brw_bs_prog_data *prog_data = params->prog_data; unsigned num_resume_shaders = params->num_resume_shaders; nir_shader **resume_shaders = params->resume_shaders; - const bool debug_enabled = INTEL_DEBUG(DEBUG_RT); + const bool debug_enabled = brw_should_print_shader(shader, DEBUG_RT); prog_data->base.stage = shader->info.stage; prog_data->base.ray_queries = shader->info.ray_queries; @@ -8167,3 +8167,8 @@ fs_visitor::workgroup_size() const const struct brw_cs_prog_data *cs = brw_cs_prog_data(prog_data); return cs->local_size[0] * cs->local_size[1] * cs->local_size[2]; } + +bool brw_should_print_shader(const nir_shader *shader, uint64_t debug_flag) +{ + return INTEL_DEBUG(debug_flag) && (!shader->info.internal || NIR_DEBUG(PRINT_INTERNAL)); +} \ No newline at end of file diff --git a/src/intel/compiler/brw_mesh.cpp b/src/intel/compiler/brw_mesh.cpp index 6d5cf8f..d558bc9 100644 --- a/src/intel/compiler/brw_mesh.cpp +++ b/src/intel/compiler/brw_mesh.cpp @@ -277,7 +277,7 @@ brw_compile_task(const struct brw_compiler *compiler, struct nir_shader *nir = params->nir; const struct brw_task_prog_key *key = params->key; struct brw_task_prog_data *prog_data = params->prog_data; - const bool debug_enabled = INTEL_DEBUG(DEBUG_TASK); + const bool debug_enabled = brw_should_print_shader(nir, DEBUG_TASK); brw_nir_lower_tue_outputs(nir, &prog_data->map); @@ -969,7 +969,7 @@ brw_compile_mesh(const struct brw_compiler *compiler, struct nir_shader *nir = params->nir; const struct brw_mesh_prog_key *key = params->key; struct brw_mesh_prog_data *prog_data = params->prog_data; - const bool debug_enabled = INTEL_DEBUG(DEBUG_MESH); + const bool debug_enabled = brw_should_print_shader(nir, DEBUG_MESH); prog_data->base.base.stage = MESA_SHADER_MESH; prog_data->base.base.total_shared = nir->info.shared_size; diff --git a/src/intel/compiler/brw_private.h b/src/intel/compiler/brw_private.h index a2753e4..a7ebb88 100644 --- a/src/intel/compiler/brw_private.h +++ b/src/intel/compiler/brw_private.h @@ -72,4 +72,6 @@ int brw_simd_select_for_workgroup_size(const struct intel_device_info *devinfo, const struct brw_cs_prog_data *prog_data, const unsigned *sizes); +bool brw_should_print_shader(const nir_shader *shader, uint64_t debug_flag); + #endif // BRW_PRIVATE_H diff --git a/src/intel/compiler/brw_shader.cpp b/src/intel/compiler/brw_shader.cpp index 8523c22..ac81797 100644 --- a/src/intel/compiler/brw_shader.cpp +++ b/src/intel/compiler/brw_shader.cpp @@ -25,6 +25,7 @@ #include "brw_eu.h" #include "brw_fs.h" #include "brw_nir.h" +#include "brw_private.h" #include "brw_vec4_tes.h" #include "dev/intel_debug.h" #include "main/uniforms.h" @@ -1305,7 +1306,7 @@ brw_compile_tes(const struct brw_compiler *compiler, struct brw_tes_prog_data *prog_data = params->prog_data; const bool is_scalar = compiler->scalar_stage[MESA_SHADER_TESS_EVAL]; - const bool debug_enabled = INTEL_DEBUG(DEBUG_TES); + const bool debug_enabled = brw_should_print_shader(nir, DEBUG_TES); const unsigned *assembly; prog_data->base.base.stage = MESA_SHADER_TESS_EVAL; diff --git a/src/intel/compiler/brw_vec4.cpp b/src/intel/compiler/brw_vec4.cpp index 990c7e2..44129b6 100644 --- a/src/intel/compiler/brw_vec4.cpp +++ b/src/intel/compiler/brw_vec4.cpp @@ -28,6 +28,7 @@ #include "brw_vec4_builder.h" #include "brw_vec4_vs.h" #include "brw_dead_control_flow.h" +#include "brw_private.h" #include "dev/intel_debug.h" #include "program/prog_parameter.h" #include "util/u_math.h" @@ -2539,7 +2540,7 @@ brw_compile_vs(const struct brw_compiler *compiler, const struct brw_vs_prog_key *key = params->key; struct brw_vs_prog_data *prog_data = params->prog_data; const bool debug_enabled = - INTEL_DEBUG(params->debug_flag ? params->debug_flag : DEBUG_VS); + brw_should_print_shader(nir, params->debug_flag ? params->debug_flag : DEBUG_VS); prog_data->base.base.stage = MESA_SHADER_VERTEX; prog_data->base.base.ray_queries = nir->info.ray_queries; diff --git a/src/intel/compiler/brw_vec4_gs_visitor.cpp b/src/intel/compiler/brw_vec4_gs_visitor.cpp index 322e011..3d7f3d0 100644 --- a/src/intel/compiler/brw_vec4_gs_visitor.cpp +++ b/src/intel/compiler/brw_vec4_gs_visitor.cpp @@ -33,6 +33,7 @@ #include "brw_fs.h" #include "brw_nir.h" #include "brw_prim.h" +#include "brw_private.h" #include "dev/intel_debug.h" namespace brw { @@ -594,7 +595,7 @@ brw_compile_gs(const struct brw_compiler *compiler, c.key = *key; const bool is_scalar = compiler->scalar_stage[MESA_SHADER_GEOMETRY]; - const bool debug_enabled = INTEL_DEBUG(DEBUG_GS); + const bool debug_enabled = brw_should_print_shader(nir, DEBUG_GS); prog_data->base.base.stage = MESA_SHADER_GEOMETRY; prog_data->base.base.ray_queries = nir->info.ray_queries; diff --git a/src/intel/compiler/brw_vec4_tcs.cpp b/src/intel/compiler/brw_vec4_tcs.cpp index 3a8e188..08ce1ca 100644 --- a/src/intel/compiler/brw_vec4_tcs.cpp +++ b/src/intel/compiler/brw_vec4_tcs.cpp @@ -30,6 +30,7 @@ #include "brw_nir.h" #include "brw_vec4_tcs.h" #include "brw_fs.h" +#include "brw_private.h" #include "dev/intel_debug.h" namespace brw { @@ -362,7 +363,7 @@ brw_compile_tcs(const struct brw_compiler *compiler, struct brw_vue_prog_data *vue_prog_data = &prog_data->base; const bool is_scalar = compiler->scalar_stage[MESA_SHADER_TESS_CTRL]; - const bool debug_enabled = INTEL_DEBUG(DEBUG_TCS); + const bool debug_enabled = brw_should_print_shader(nir, DEBUG_TCS); const unsigned *assembly; vue_prog_data->base.stage = MESA_SHADER_TESS_CTRL; -- 2.7.4