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. */
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.
*/
/* 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;
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,
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);
if (diag.retval != 0) {
pipe_debug_message(debug, SHADER_INFO, "LLVM compilation failed");
- return diag.retval;
+ return false;
}
}
.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.
*/
conf->float_mode |= V_00B028_FP_64_DENORMS;
- return 0;
+ return true;
}
void si_llvm_context_init(struct si_shader_context *ctx,
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);