diff options
author | Nicolai Hähnle <[email protected]> | 2015-12-14 20:41:15 -0500 |
---|---|---|
committer | Nicolai Hähnle <[email protected]> | 2015-12-29 09:07:04 -0500 |
commit | 7b8db37abb1b7f08c43f20380a370766ae7923ae (patch) | |
tree | fd88dccd8777486aa8536914999689164872ab2e /src/gallium/drivers/radeonsi/si_shader.c | |
parent | 7d1fc2cf51438a649eecbe4f8e858eebd93c1757 (diff) |
radeonsi: add RADEON_REPLACE_SHADERS debug option
This option allows replacing a single shader by a pre-compiled ELF object
as generated by LLVM's llc, for example. This can be useful for debugging a
deterministically occuring error in shaders (and has in fact helped find
the causes of https://bugs.freedesktop.org/show_bug.cgi?id=93264).
v2: drop the debug flag, use DEBUG_GET_ONCE_OPTION instead
Reviewed-by: Marek Olšák <[email protected]>
Diffstat (limited to 'src/gallium/drivers/radeonsi/si_shader.c')
-rw-r--r-- | src/gallium/drivers/radeonsi/si_shader.c | 14 |
1 files changed, 9 insertions, 5 deletions
diff --git a/src/gallium/drivers/radeonsi/si_shader.c b/src/gallium/drivers/radeonsi/si_shader.c index 511ed8829c6..0e98784d51b 100644 --- a/src/gallium/drivers/radeonsi/si_shader.c +++ b/src/gallium/drivers/radeonsi/si_shader.c @@ -3884,13 +3884,17 @@ int si_compile_llvm(struct si_screen *sscreen, struct si_shader *shader, bool dump_asm = r600_can_dump_shader(&sscreen->b, shader->selector ? shader->selector->tokens : NULL); bool dump_ir = dump_asm && !(sscreen->b.debug_flags & DBG_NO_IR); + unsigned count = p_atomic_inc_return(&sscreen->b.num_compilations); - p_atomic_inc(&sscreen->b.num_compilations); + if (dump_ir || dump_asm) + fprintf(stderr, "radeonsi: Compiling shader %d\n", count); - r = radeon_llvm_compile(mod, &shader->binary, - r600_get_llvm_processor_name(sscreen->b.family), dump_ir, dump_asm, tm); - if (r) - return r; + if (!si_replace_shader(count, &shader->binary)) { + r = radeon_llvm_compile(mod, &shader->binary, + r600_get_llvm_processor_name(sscreen->b.family), dump_ir, dump_asm, tm); + if (r) + return r; + } r = si_shader_binary_read(sscreen, shader); |