radeonsi: fail to create pipe_screen if LLVM doesn't support the GPU

Reviewed-by: Pierre-Eric Pelloux-Prayer <pierre-eric.pelloux-prayer@amd.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/16112>
This commit is contained in:
Marek Olšák 2022-04-22 14:10:03 -04:00 committed by Marge Bot
parent 12ab3e6853
commit fe4ec76115
2 changed files with 17 additions and 4 deletions

View file

@ -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. */

View file

@ -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 */