radeonsi: cleanly communicate whether si_shader_dump should check R600_DEBUG
Tested-by: Edmondo Tommasina <edmondo.tommasina@gmail.com> Acked-by: Edward O'Callaghan <funfunctor@folklore1984.net> Reviewed-by: Nicolai Hähnle <nicolai.haehnle@amd.com>
This commit is contained in:
@@ -170,7 +170,7 @@ static void *si_create_compute_state(
|
|||||||
&program->shader.config, 0);
|
&program->shader.config, 0);
|
||||||
}
|
}
|
||||||
si_shader_dump(sctx->screen, &program->shader, &sctx->b.debug,
|
si_shader_dump(sctx->screen, &program->shader, &sctx->b.debug,
|
||||||
PIPE_SHADER_COMPUTE, stderr);
|
PIPE_SHADER_COMPUTE, stderr, true);
|
||||||
if (si_shader_binary_upload(sctx->screen, &program->shader) < 0) {
|
if (si_shader_binary_upload(sctx->screen, &program->shader) < 0) {
|
||||||
fprintf(stderr, "LLVM failed to upload shader\n");
|
fprintf(stderr, "LLVM failed to upload shader\n");
|
||||||
FREE(program);
|
FREE(program);
|
||||||
|
@@ -45,7 +45,7 @@ static void si_dump_shader(struct si_screen *sscreen,
|
|||||||
fwrite(current->shader_log, current->shader_log_size, 1, f);
|
fwrite(current->shader_log, current->shader_log_size, 1, f);
|
||||||
else
|
else
|
||||||
si_shader_dump(sscreen, state->current, NULL,
|
si_shader_dump(sscreen, state->current, NULL,
|
||||||
state->cso->info.processor, f);
|
state->cso->info.processor, f, false);
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
@@ -6169,7 +6169,8 @@ static void si_shader_dump_stats(struct si_screen *sscreen,
|
|||||||
struct si_shader *shader,
|
struct si_shader *shader,
|
||||||
struct pipe_debug_callback *debug,
|
struct pipe_debug_callback *debug,
|
||||||
unsigned processor,
|
unsigned processor,
|
||||||
FILE *file)
|
FILE *file,
|
||||||
|
bool check_debug_option)
|
||||||
{
|
{
|
||||||
struct si_shader_config *conf = &shader->config;
|
struct si_shader_config *conf = &shader->config;
|
||||||
unsigned num_inputs = shader->selector ? shader->selector->info.num_inputs : 0;
|
unsigned num_inputs = shader->selector ? shader->selector->info.num_inputs : 0;
|
||||||
@@ -6220,7 +6221,7 @@ static void si_shader_dump_stats(struct si_screen *sscreen,
|
|||||||
if (lds_per_wave)
|
if (lds_per_wave)
|
||||||
max_simd_waves = MIN2(max_simd_waves, 16384 / lds_per_wave);
|
max_simd_waves = MIN2(max_simd_waves, 16384 / lds_per_wave);
|
||||||
|
|
||||||
if (file != stderr ||
|
if (!check_debug_option ||
|
||||||
r600_can_dump_shader(&sscreen->b, processor)) {
|
r600_can_dump_shader(&sscreen->b, processor)) {
|
||||||
if (processor == PIPE_SHADER_FRAGMENT) {
|
if (processor == PIPE_SHADER_FRAGMENT) {
|
||||||
fprintf(file, "*** SHADER CONFIG ***\n"
|
fprintf(file, "*** SHADER CONFIG ***\n"
|
||||||
@@ -6291,19 +6292,19 @@ static const char *si_get_shader_name(struct si_shader *shader,
|
|||||||
|
|
||||||
void si_shader_dump(struct si_screen *sscreen, struct si_shader *shader,
|
void si_shader_dump(struct si_screen *sscreen, struct si_shader *shader,
|
||||||
struct pipe_debug_callback *debug, unsigned processor,
|
struct pipe_debug_callback *debug, unsigned processor,
|
||||||
FILE *file)
|
FILE *file, bool check_debug_option)
|
||||||
{
|
{
|
||||||
if (file != stderr ||
|
if (!check_debug_option ||
|
||||||
r600_can_dump_shader(&sscreen->b, processor))
|
r600_can_dump_shader(&sscreen->b, processor))
|
||||||
si_dump_shader_key(processor, &shader->key, file);
|
si_dump_shader_key(processor, &shader->key, file);
|
||||||
|
|
||||||
if (file != stderr && shader->binary.llvm_ir_string) {
|
if (!check_debug_option && shader->binary.llvm_ir_string) {
|
||||||
fprintf(file, "\n%s - main shader part - LLVM IR:\n\n",
|
fprintf(file, "\n%s - main shader part - LLVM IR:\n\n",
|
||||||
si_get_shader_name(shader, processor));
|
si_get_shader_name(shader, processor));
|
||||||
fprintf(file, "%s\n", shader->binary.llvm_ir_string);
|
fprintf(file, "%s\n", shader->binary.llvm_ir_string);
|
||||||
}
|
}
|
||||||
|
|
||||||
if (file != stderr ||
|
if (!check_debug_option ||
|
||||||
(r600_can_dump_shader(&sscreen->b, processor) &&
|
(r600_can_dump_shader(&sscreen->b, processor) &&
|
||||||
!(sscreen->b.debug_flags & DBG_NO_ASM))) {
|
!(sscreen->b.debug_flags & DBG_NO_ASM))) {
|
||||||
fprintf(file, "\n%s:\n", si_get_shader_name(shader, processor));
|
fprintf(file, "\n%s:\n", si_get_shader_name(shader, processor));
|
||||||
@@ -6320,7 +6321,8 @@ void si_shader_dump(struct si_screen *sscreen, struct si_shader *shader,
|
|||||||
fprintf(file, "\n");
|
fprintf(file, "\n");
|
||||||
}
|
}
|
||||||
|
|
||||||
si_shader_dump_stats(sscreen, shader, debug, processor, file);
|
si_shader_dump_stats(sscreen, shader, debug, processor, file,
|
||||||
|
check_debug_option);
|
||||||
}
|
}
|
||||||
|
|
||||||
int si_compile_llvm(struct si_screen *sscreen,
|
int si_compile_llvm(struct si_screen *sscreen,
|
||||||
@@ -6553,7 +6555,7 @@ si_generate_gs_copy_shader(struct si_screen *sscreen,
|
|||||||
if (r600_can_dump_shader(&sscreen->b, PIPE_SHADER_GEOMETRY))
|
if (r600_can_dump_shader(&sscreen->b, PIPE_SHADER_GEOMETRY))
|
||||||
fprintf(stderr, "GS Copy Shader:\n");
|
fprintf(stderr, "GS Copy Shader:\n");
|
||||||
si_shader_dump(sscreen, ctx.shader, debug,
|
si_shader_dump(sscreen, ctx.shader, debug,
|
||||||
PIPE_SHADER_GEOMETRY, stderr);
|
PIPE_SHADER_GEOMETRY, stderr, true);
|
||||||
r = si_shader_binary_upload(sscreen, ctx.shader);
|
r = si_shader_binary_upload(sscreen, ctx.shader);
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -8611,7 +8613,7 @@ int si_shader_create(struct si_screen *sscreen, LLVMTargetMachineRef tm,
|
|||||||
|
|
||||||
si_fix_resource_usage(sscreen, shader);
|
si_fix_resource_usage(sscreen, shader);
|
||||||
si_shader_dump(sscreen, shader, debug, sel->info.processor,
|
si_shader_dump(sscreen, shader, debug, sel->info.processor,
|
||||||
stderr);
|
stderr, true);
|
||||||
|
|
||||||
/* Upload. */
|
/* Upload. */
|
||||||
r = si_shader_binary_upload(sscreen, shader);
|
r = si_shader_binary_upload(sscreen, shader);
|
||||||
|
@@ -546,7 +546,7 @@ unsigned si_shader_io_get_unique_index2(unsigned name, unsigned index);
|
|||||||
int si_shader_binary_upload(struct si_screen *sscreen, struct si_shader *shader);
|
int si_shader_binary_upload(struct si_screen *sscreen, struct si_shader *shader);
|
||||||
void si_shader_dump(struct si_screen *sscreen, struct si_shader *shader,
|
void si_shader_dump(struct si_screen *sscreen, struct si_shader *shader,
|
||||||
struct pipe_debug_callback *debug, unsigned processor,
|
struct pipe_debug_callback *debug, unsigned processor,
|
||||||
FILE *f);
|
FILE *f, bool check_debug_option);
|
||||||
void si_multiwave_lds_size_workaround(struct si_screen *sscreen,
|
void si_multiwave_lds_size_workaround(struct si_screen *sscreen,
|
||||||
unsigned *lds_size);
|
unsigned *lds_size);
|
||||||
void si_shader_apply_scratch_relocs(struct si_context *sctx,
|
void si_shader_apply_scratch_relocs(struct si_context *sctx,
|
||||||
|
@@ -1110,7 +1110,7 @@ static void si_build_shader_variant(void *job, int thread_index)
|
|||||||
FILE *f = open_memstream(&shader->shader_log,
|
FILE *f = open_memstream(&shader->shader_log,
|
||||||
&shader->shader_log_size);
|
&shader->shader_log_size);
|
||||||
if (f) {
|
if (f) {
|
||||||
si_shader_dump(sscreen, shader, NULL, sel->type, f);
|
si_shader_dump(sscreen, shader, NULL, sel->type, f, false);
|
||||||
fclose(f);
|
fclose(f);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
Reference in New Issue
Block a user