Mesa (main): radeonsi: dump shaders after si_shader_binary_upload to fix printed LDS stat
GitLab Mirror
gitlab-mirror at kemper.freedesktop.org
Fri Apr 22 21:24:19 UTC 2022
Module: Mesa
Branch: main
Commit: ef52d803a933d7bc20b852bb31e41f6323f1b68e
URL: http://cgit.freedesktop.org/mesa/mesa/commit/?id=ef52d803a933d7bc20b852bb31e41f6323f1b68e
Author: Marek Olšák <marek.olsak at amd.com>
Date: Sun Apr 10 21:12:37 2022 -0400
radeonsi: dump shaders after si_shader_binary_upload to fix printed LDS stat
lds_size is set by si_shader_binary_upload, so it always printed zero.
Reviewed-by: Pierre-Eric Pelloux-Prayer <pierre-eric.pelloux-prayer at amd.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/15965>
---
src/gallium/drivers/radeonsi/si_compute.c | 10 ++++++----
src/gallium/drivers/radeonsi/si_shader.c | 11 +++++------
src/gallium/drivers/radeonsi/si_shader_llvm_gs.c | 8 ++++----
3 files changed, 15 insertions(+), 14 deletions(-)
diff --git a/src/gallium/drivers/radeonsi/si_compute.c b/src/gallium/drivers/radeonsi/si_compute.c
index 72ef90fbdce..0d4e4985a97 100644
--- a/src/gallium/drivers/radeonsi/si_compute.c
+++ b/src/gallium/drivers/radeonsi/si_compute.c
@@ -177,11 +177,11 @@ static void si_create_compute_state_async(void *job, void *gdata, int thread_ind
if (si_shader_cache_load_shader(sscreen, ir_sha1_cache_key, shader)) {
simple_mtx_unlock(&sscreen->shader_cache_mutex);
- si_shader_dump_stats_for_shader_db(sscreen, shader, debug);
- si_shader_dump(sscreen, shader, debug, stderr, true);
-
if (!si_shader_binary_upload(sscreen, shader, 0))
program->shader.compilation_failed = true;
+
+ si_shader_dump_stats_for_shader_db(sscreen, shader, debug);
+ si_shader_dump(sscreen, shader, debug, stderr, true);
} else {
simple_mtx_unlock(&sscreen->shader_cache_mutex);
@@ -274,8 +274,10 @@ static void *si_create_compute_state(struct pipe_context *ctx, const struct pipe
const amd_kernel_code_t *code_object = si_compute_get_code_object(program, 0);
code_object_to_config(code_object, &program->shader.config);
+ bool ok = si_shader_binary_upload(sctx->screen, &program->shader, 0);
si_shader_dump(sctx->screen, &program->shader, &sctx->debug, stderr, true);
- if (!si_shader_binary_upload(sctx->screen, &program->shader, 0)) {
+
+ if (!ok) {
fprintf(stderr, "LLVM failed to upload shader\n");
free((void *)program->shader.binary.elf_buffer);
FREE(program);
diff --git a/src/gallium/drivers/radeonsi/si_shader.c b/src/gallium/drivers/radeonsi/si_shader.c
index 30042633f62..cab47793228 100644
--- a/src/gallium/drivers/radeonsi/si_shader.c
+++ b/src/gallium/drivers/radeonsi/si_shader.c
@@ -2246,15 +2246,14 @@ bool si_create_shader_variant(struct si_screen *sscreen, struct ac_llvm_compiler
}
si_fix_resource_usage(sscreen, shader);
- si_shader_dump(sscreen, shader, debug, stderr, true);
/* Upload. */
- if (!si_shader_binary_upload(sscreen, shader, 0)) {
- fprintf(stderr, "LLVM failed to upload shader\n");
- return false;
- }
+ bool ok = si_shader_binary_upload(sscreen, shader, 0);
+ si_shader_dump(sscreen, shader, debug, stderr, true);
- return true;
+ if (!ok)
+ fprintf(stderr, "LLVM failed to upload shader\n");
+ return ok;
}
void si_shader_binary_clean(struct si_shader_binary *binary)
diff --git a/src/gallium/drivers/radeonsi/si_shader_llvm_gs.c b/src/gallium/drivers/radeonsi/si_shader_llvm_gs.c
index fb105bf0857..ec77d2fc65d 100644
--- a/src/gallium/drivers/radeonsi/si_shader_llvm_gs.c
+++ b/src/gallium/drivers/radeonsi/si_shader_llvm_gs.c
@@ -533,13 +533,13 @@ struct si_shader *si_generate_gs_copy_shader(struct si_screen *sscreen,
bool ok = false;
if (si_compile_llvm(sscreen, &ctx.shader->binary, &ctx.shader->config, ctx.compiler, &ctx.ac,
debug, MESA_SHADER_GEOMETRY, "GS Copy Shader", false)) {
- if (si_can_dump_shader(sscreen, MESA_SHADER_GEOMETRY))
- fprintf(stderr, "GS Copy Shader:\n");
- si_shader_dump(sscreen, ctx.shader, debug, stderr, true);
-
assert(!ctx.shader->config.scratch_bytes_per_wave);
if (!ctx.shader->config.scratch_bytes_per_wave)
ok = si_shader_binary_upload(sscreen, ctx.shader, 0);
+
+ if (si_can_dump_shader(sscreen, MESA_SHADER_GEOMETRY))
+ fprintf(stderr, "GS Copy Shader:\n");
+ si_shader_dump(sscreen, ctx.shader, debug, stderr, true);
}
si_llvm_dispose(&ctx);
More information about the mesa-commit
mailing list