radeonsi: enable ACO by default for pre-GFX10 GPUs

User can set AMD_DEBUG=usellvm to switch back to LLVM.

Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/32742>
This commit is contained in:
Qiang Yu
2024-12-20 16:51:59 +08:00
parent 8dbec20a56
commit aaa28be0e8
2 changed files with 8 additions and 2 deletions

View File

@@ -66,6 +66,7 @@ static const struct debug_named_value radeonsi_debug_options[] = {
{"mono", DBG(MONOLITHIC_SHADERS), "Use old-style monolithic shaders compiled on demand"},
{"nooptvariant", DBG(NO_OPT_VARIANT), "Disable compiling optimized shader variants."},
{"useaco", DBG(USE_ACO), "Use ACO as shader compiler when possible"},
{"usellvm", DBG(USE_LLVM), "Use LLVM as shader compiler when possible"},
/* Information logging options: */
{"info", DBG(INFO), "Print driver information"},
@@ -1189,19 +1190,23 @@ static struct pipe_screen *radeonsi_screen_create_impl(struct radeon_winsys *ws,
if (sscreen->debug_flags & DBG(SHADOW_REGS))
sscreen->info.register_shadowing_required = true;
bool support_aco = aco_is_gpu_supported(&sscreen->info);
#if AMD_LLVM_AVAILABLE
/* For GFX11.5, LLVM < 19 is missing a workaround that can cause GPU hangs. ACO is the only
* alternative that has the workaround and is always available.
*/
if (sscreen->info.gfx_level == GFX11_5 && LLVM_VERSION_MAJOR < 19)
sscreen->use_aco = true;
else
else if (sscreen->info.gfx_level >= GFX10)
sscreen->use_aco = (sscreen->debug_flags & DBG(USE_ACO));
else
sscreen->use_aco = support_aco && sscreen->info.has_image_opcodes &&
!(sscreen->debug_flags & DBG(USE_LLVM));
#else
sscreen->use_aco = true;
#endif
bool support_aco = aco_is_gpu_supported(&sscreen->info);
if (sscreen->use_aco && !support_aco) {
fprintf(stderr, "radeonsi: ACO does not support this chip yet\n");
FREE(sscreen);

View File

@@ -239,6 +239,7 @@ enum
DBG_TMZ,
DBG_SQTT,
DBG_USE_ACO,
DBG_USE_LLVM,
DBG_COUNT
};