radeonsi: make si_compile_llvm return bool

Reviewed-by: Timothy Arceri <tarceri@itsqueeze.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/merge_requests/3421>
This commit is contained in:
Marek Olšák 2020-01-15 18:54:39 -05:00 committed by Marge Bot
parent bd19d144a1
commit be772182e0
4 changed files with 32 additions and 32 deletions

View file

@ -1723,7 +1723,6 @@ int si_compile_shader(struct si_screen *sscreen,
struct si_shader_context ctx;
bool free_nir;
struct nir_shader *nir = get_nir_shader(sel, &free_nir);
int r = -1;
/* Dump NIR before doing NIR->LLVM conversion in case the
* conversion fails. */
@ -1973,15 +1972,16 @@ int si_compile_shader(struct si_screen *sscreen,
LLVMPointerTypeKind);
/* Compile to bytecode. */
r = si_compile_llvm(sscreen, &shader->binary, &shader->config, compiler,
&ctx.ac, debug, ctx.type, si_get_shader_name(shader),
si_should_optimize_less(compiler, shader->selector));
si_llvm_dispose(&ctx);
if (r) {
if (!si_compile_llvm(sscreen, &shader->binary, &shader->config, compiler,
&ctx.ac, debug, ctx.type, si_get_shader_name(shader),
si_should_optimize_less(compiler, shader->selector))) {
si_llvm_dispose(&ctx);
fprintf(stderr, "LLVM failed to compile shader\n");
return r;
return -1;
}
si_llvm_dispose(&ctx);
/* Validate SGPR and VGPR usage for compute to detect compiler bugs.
* LLVM 3.9svn has this bug.
*/
@ -2110,8 +2110,8 @@ si_get_shader_part(struct si_screen *sscreen,
/* Compile. */
si_llvm_optimize_module(&ctx);
if (si_compile_llvm(sscreen, &result->binary, &result->config, compiler,
&ctx.ac, debug, ctx.type, name, false)) {
if (!si_compile_llvm(sscreen, &result->binary, &result->config, compiler,
&ctx.ac, debug, ctx.type, name, false)) {
FREE(result);
result = NULL;
goto out;

View file

@ -232,15 +232,15 @@ void gfx10_ngg_gs_emit_epilogue(struct si_shader_context *ctx);
void gfx10_ngg_calculate_subgroup_info(struct si_shader *shader);
/* si_shader_llvm.c */
int si_compile_llvm(struct si_screen *sscreen,
struct si_shader_binary *binary,
struct ac_shader_config *conf,
struct ac_llvm_compiler *compiler,
struct ac_llvm_context *ac,
struct pipe_debug_callback *debug,
enum pipe_shader_type shader_type,
const char *name,
bool less_optimized);
bool si_compile_llvm(struct si_screen *sscreen,
struct si_shader_binary *binary,
struct ac_shader_config *conf,
struct ac_llvm_compiler *compiler,
struct ac_llvm_context *ac,
struct pipe_debug_callback *debug,
enum pipe_shader_type shader_type,
const char *name,
bool less_optimized);
void si_llvm_context_init(struct si_shader_context *ctx,
struct si_screen *sscreen,
struct ac_llvm_compiler *compiler,

View file

@ -68,15 +68,15 @@ static void si_diagnostic_handler(LLVMDiagnosticInfoRef di, void *context)
LLVMDisposeMessage(description);
}
int si_compile_llvm(struct si_screen *sscreen,
struct si_shader_binary *binary,
struct ac_shader_config *conf,
struct ac_llvm_compiler *compiler,
struct ac_llvm_context *ac,
struct pipe_debug_callback *debug,
enum pipe_shader_type shader_type,
const char *name,
bool less_optimized)
bool si_compile_llvm(struct si_screen *sscreen,
struct si_shader_binary *binary,
struct ac_shader_config *conf,
struct ac_llvm_compiler *compiler,
struct ac_llvm_context *ac,
struct pipe_debug_callback *debug,
enum pipe_shader_type shader_type,
const char *name,
bool less_optimized)
{
unsigned count = p_atomic_inc_return(&sscreen->num_compilations);
@ -114,7 +114,7 @@ int si_compile_llvm(struct si_screen *sscreen,
if (diag.retval != 0) {
pipe_debug_message(debug, SHADER_INFO, "LLVM compilation failed");
return diag.retval;
return false;
}
}
@ -126,12 +126,12 @@ int si_compile_llvm(struct si_screen *sscreen,
.num_parts = 1,
.elf_ptrs = &binary->elf_buffer,
.elf_sizes = &binary->elf_size }))
return -1;
return false;
bool ok = ac_rtld_read_config(&rtld, conf);
ac_rtld_close(&rtld);
if (!ok)
return -1;
return false;
/* Enable 64-bit and 16-bit denormals, because there is no performance
* cost.
@ -147,7 +147,7 @@ int si_compile_llvm(struct si_screen *sscreen,
*/
conf->float_mode |= V_00B028_FP_64_DENORMS;
return 0;
return true;
}
void si_llvm_context_init(struct si_shader_context *ctx,

View file

@ -625,7 +625,7 @@ si_generate_gs_copy_shader(struct si_screen *sscreen,
if (si_compile_llvm(sscreen, &ctx.shader->binary,
&ctx.shader->config, ctx.compiler, &ctx.ac,
debug, PIPE_SHADER_GEOMETRY,
"GS Copy Shader", false) == 0) {
"GS Copy Shader", false)) {
if (si_can_dump_shader(sscreen, PIPE_SHADER_GEOMETRY))
fprintf(stderr, "GS Copy Shader:\n");
si_shader_dump(sscreen, ctx.shader, debug, stderr, true);