r600/sfn: dump the lowered shader when translation fails

So far we printed the variant before the final lowering was done,
this is usually not that helpful. For this the code to dump the
shader has to go into r600_shader_from_nir.

Signed-off-by: Gert Wollny <gert.wollny@collabora.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/34999>
This commit is contained in:
Gert Wollny
2025-05-15 15:00:24 +02:00
committed by Marge Bot
parent 2ce2c1f835
commit 58d8dc9543
2 changed files with 14 additions and 15 deletions
+13 -2
View File
@@ -15,6 +15,7 @@
#include "sfn/sfn_shader.h"
#include "r600_asm.h"
#include "r600_pipe.h"
#include "tgsi/tgsi_dump.h"
#include "util/macros.h"
#include "util/ralloc.h"
@@ -90,9 +91,19 @@ r600_shader_from_nir(struct r600_context *rctx,
r600::Shader::translate_from_nir(sh, &sel->so, gs_shader, *key,
rctx->isa->hw_class, rscreen->b.family);
assert(shader);
if (!shader)
if (!shader) {
R600_ERR("translation from NIR failed !\n");
fprintf(stderr, "--Failed shader--------------------------------------------------\n");
if (sel->ir_type == PIPE_SHADER_IR_TGSI) {
fprintf(stderr, "--TGSI--------------------------------------------------------\n");
tgsi_dump(sel->tokens, 0);
}
fprintf(stderr, "--NIR --------------------------------------------------------\n");
nir_print_shader(sh, stderr);
// Crash in Debug mode
assert(0);
return -2;
}
pipeshader->enabled_stream_buffers_mask = shader->enabled_stream_buffers_mask();
pipeshader->selector->info.file_count[TGSI_FILE_HW_ATOMIC] +=
+1 -13
View File
@@ -182,20 +182,8 @@ int r600_pipe_shader_create(struct pipe_context *ctx,
glsl_type_singleton_decref();
if (r) {
fprintf(stderr, "--Failed shader--------------------------------------------------\n");
if (sel->ir_type == PIPE_SHADER_IR_TGSI) {
fprintf(stderr, "--TGSI--------------------------------------------------------\n");
tgsi_dump(sel->tokens, 0);
}
fprintf(stderr, "--NIR --------------------------------------------------------\n");
nir_print_shader(sel->nir, stderr);
R600_ERR("translation from NIR failed !\n");
if (r)
goto error;
}
}
if (dump) {