intel/compiler: Don't store stage name and abbrev

Those are used in the failure paths and are easily retriavable from the
stage itself, so no need to store them.

Reviewed-by: Lionel Landwerlin <lionel.g.landwerlin@intel.com>
Reviewed-by: Sagar Ghuge <sagar.ghuge@intel.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/25367>
This commit is contained in:
Caio Oliveira 2023-09-24 21:38:47 -07:00
parent 8791aab20f
commit c487ba26ca
6 changed files with 18 additions and 15 deletions

View file

@ -36,6 +36,7 @@
#include "brw_cfg.h"
#include "brw_dead_control_flow.h"
#include "brw_private.h"
#include "shader_enums.h"
#include "dev/intel_debug.h"
#include "dev/intel_wa.h"
#include "compiler/glsl_types.h"
@ -591,7 +592,7 @@ fs_visitor::vfail(const char *format, va_list va)
msg = ralloc_vasprintf(mem_ctx, format, va);
msg = ralloc_asprintf(mem_ctx, "SIMD%d %s compile failed: %s\n",
dispatch_width, stage_abbrev, msg);
dispatch_width, _mesa_shader_stage_to_abbrev(stage), msg);
this->fail_msg = msg;
@ -6259,7 +6260,7 @@ fs_visitor::debug_optimizer(const nir_shader *nir,
char *filename;
int ret = asprintf(&filename, "%s/%s%d-%s-%02d-%02d-%s",
debug_get_option("INTEL_SHADER_OPTIMIZER_PATH", "./"),
stage_abbrev, dispatch_width, nir->info.name,
_mesa_shader_stage_to_abbrev(stage), dispatch_width, nir->info.name,
iteration, pass_num, pass_name);
if (ret == -1)
return;
@ -6922,7 +6923,7 @@ fs_visitor::allocate_registers(bool allow_spilling)
"%s shader triggered register spilling. "
"Try reducing the number of live scalar "
"values to improve performance.\n",
stage_name);
_mesa_shader_stage_to_string(stage));
}
/* This must come after all optimization and register allocation, since

View file

@ -33,7 +33,8 @@
#define fsv_assert(assertion) \
{ \
if (!(assertion)) { \
fprintf(stderr, "ASSERT: Scalar %s validation failed!\n", stage_abbrev); \
fprintf(stderr, "ASSERT: Scalar %s validation failed!\n", \
_mesa_shader_stage_to_abbrev(stage)); \
dump_instruction(inst, stderr); \
fprintf(stderr, "%s:%d: '%s' failed\n", __FILE__, __LINE__, #assertion); \
abort(); \
@ -45,7 +46,8 @@
unsigned f = (first); \
unsigned s = (second); \
if (f != s) { \
fprintf(stderr, "ASSERT: Scalar %s validation failed!\n", stage_abbrev); \
fprintf(stderr, "ASSERT: Scalar %s validation failed!\n", \
_mesa_shader_stage_to_abbrev(stage)); \
dump_instruction(inst, stderr); \
fprintf(stderr, "%s:%d: A == B failed\n", __FILE__, __LINE__); \
fprintf(stderr, " A = %s = %u\n", #first, f); \
@ -59,7 +61,8 @@
unsigned f = (first); \
unsigned s = (second); \
if (f == s) { \
fprintf(stderr, "ASSERT: Scalar %s validation failed!\n", stage_abbrev); \
fprintf(stderr, "ASSERT: Scalar %s validation failed!\n", \
_mesa_shader_stage_to_abbrev(stage)); \
dump_instruction(inst, stderr); \
fprintf(stderr, "%s:%d: A != B failed\n", __FILE__, __LINE__); \
fprintf(stderr, " A = %s = %u\n", #first, f); \
@ -73,7 +76,8 @@
unsigned f = (first); \
unsigned s = (second); \
if (f > s) { \
fprintf(stderr, "ASSERT: Scalar %s validation failed!\n", stage_abbrev); \
fprintf(stderr, "ASSERT: Scalar %s validation failed!\n", \
_mesa_shader_stage_to_abbrev(stage)); \
dump_instruction(inst, stderr); \
fprintf(stderr, "%s:%d: A <= B failed\n", __FILE__, __LINE__); \
fprintf(stderr, " A = %s = %u\n", #first, f); \

View file

@ -697,8 +697,6 @@ backend_shader::backend_shader(const struct brw_compiler *compiler,
stage(shader->info.stage),
debug_enabled(debug_enabled)
{
stage_name = _mesa_shader_stage_to_string(stage);
stage_abbrev = _mesa_shader_stage_to_abbrev(stage);
}
backend_shader::~backend_shader()

View file

@ -76,8 +76,6 @@ public:
gl_shader_stage stage;
bool debug_enabled;
const char *stage_name;
const char *stage_abbrev;
brw::simple_allocator alloc;

View file

@ -2398,7 +2398,8 @@ vec4_visitor::run()
if (INTEL_DEBUG(DEBUG_OPTIMIZER) && this_progress) { \
char filename[64]; \
snprintf(filename, 64, "%s-%s-%02d-%02d-" #pass, \
stage_abbrev, nir->info.name, iteration, pass_num); \
_mesa_shader_stage_to_abbrev(stage), \
nir->info.name, iteration, pass_num); \
\
backend_shader::dump_instructions(filename); \
} \
@ -2411,7 +2412,7 @@ vec4_visitor::run()
if (INTEL_DEBUG(DEBUG_OPTIMIZER)) {
char filename[64];
snprintf(filename, 64, "%s-%s-00-00-start",
stage_abbrev, nir->info.name);
_mesa_shader_stage_to_abbrev(stage), nir->info.name);
backend_shader::dump_instructions(filename);
}
@ -2499,7 +2500,7 @@ vec4_visitor::run()
"%s shader triggered register spilling. "
"Try reducing the number of live vec4 values "
"to improve performance.\n",
stage_name);
_mesa_shader_stage_to_string(stage));
while (!reg_allocate()) {
if (failed)

View file

@ -1415,7 +1415,8 @@ vec4_visitor::fail(const char *format, ...)
va_start(va, format);
msg = ralloc_vasprintf(mem_ctx, format, va);
va_end(va);
msg = ralloc_asprintf(mem_ctx, "%s compile failed: %s\n", stage_abbrev, msg);
msg = ralloc_asprintf(mem_ctx, "%s compile failed: %s\n",
_mesa_shader_stage_to_abbrev(stage), msg);
this->fail_msg = msg;