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 <kenneth@whitecape.org>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/23756>
This commit is contained in:
Caio Oliveira
2023-06-20 14:42:02 -07:00
committed by Marge Bot
parent af9be8c024
commit fde8bf7b7f
7 changed files with 21 additions and 10 deletions

View File

@@ -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));
}

View File

@@ -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;

View File

@@ -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

View File

@@ -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;

View File

@@ -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;

View File

@@ -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;

View File

@@ -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;