diff --git a/src/gallium/drivers/radeonsi/si_pipe.c b/src/gallium/drivers/radeonsi/si_pipe.c index a849ef4b705..a55fe2de5d1 100644 --- a/src/gallium/drivers/radeonsi/si_pipe.c +++ b/src/gallium/drivers/radeonsi/si_pipe.c @@ -134,7 +134,7 @@ static const struct debug_named_value test_options[] = { DEBUG_NAMED_VALUE_END /* must be last */ }; -void si_init_compiler(struct si_screen *sscreen, struct ac_llvm_compiler *compiler) +bool si_init_compiler(struct si_screen *sscreen, struct ac_llvm_compiler *compiler) { /* Only create the less-optimizing version of the compiler on APUs * predating Ryzen (Raven). */ @@ -146,11 +146,15 @@ void si_init_compiler(struct si_screen *sscreen, struct ac_llvm_compiler *compil (create_low_opt_compiler ? AC_TM_CREATE_LOW_OPT : 0); ac_init_llvm_once(); - ac_init_llvm_compiler(compiler, sscreen->info.family, tm_options); - compiler->passes = ac_create_llvm_passes(compiler->tm); + if (!ac_init_llvm_compiler(compiler, sscreen->info.family, tm_options)) + return false; + + compiler->passes = ac_create_llvm_passes(compiler->tm); if (compiler->low_opt_tm) compiler->low_opt_passes = ac_create_llvm_passes(compiler->low_opt_tm); + + return true; } void si_init_aux_async_compute_ctx(struct si_screen *sscreen) @@ -1077,6 +1081,15 @@ static struct pipe_screen *radeonsi_screen_create_impl(struct radeon_winsys *ws, return NULL; } + /* Initialize just one compiler instance to check for errors. The other compiler instances are + * initialized on demand. + */ + if (!si_init_compiler(sscreen, &sscreen->compiler[0])) { + /* The callee prints the error message. */ + FREE(sscreen); + return NULL; + } + util_idalloc_mt_init_tc(&sscreen->buffer_ids); /* Set functions first. */ diff --git a/src/gallium/drivers/radeonsi/si_pipe.h b/src/gallium/drivers/radeonsi/si_pipe.h index fe5f9d81a1c..66779e1cba3 100644 --- a/src/gallium/drivers/radeonsi/si_pipe.h +++ b/src/gallium/drivers/radeonsi/si_pipe.h @@ -1501,7 +1501,7 @@ void si_emit_initial_compute_regs(struct si_context *sctx, struct radeon_cmdbuf void si_init_compute_functions(struct si_context *sctx); /* si_pipe.c */ -void si_init_compiler(struct si_screen *sscreen, struct ac_llvm_compiler *compiler); +bool si_init_compiler(struct si_screen *sscreen, struct ac_llvm_compiler *compiler); void si_init_aux_async_compute_ctx(struct si_screen *sscreen); /* si_perfcounters.c */