From e26c28f311cc5416f6c7f5b09a53ca2b14dfb955 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Marek=20Ol=C5=A1=C3=A1k?= Date: Mon, 27 Oct 2025 01:19:04 -0400 Subject: [PATCH] radeonsi: enable ACO by default NIR+ACO is the best SSA-based shader compiler for AMD GPUs that exists. There are many reasons why NIR+ACO is better than LLVM, and I have a long list that I've collected over the years, but the major ones are better GPU performance (faster GPU memory access thanks to better clauses and scheduling, a lot less SGPR/VGPR spilling, better loop support, slightly smaller shader binaries), 8x lower shader compile times, and smaller memory footprint of the IR. It also shows that NIR is a mature SSA-based shader compiler that helps drivers generate optimized code very quickly. And most importantly, radeonsi has slightly better Viewperf performance with NIR+ACO than LLVM, and that's difficult to ignore. Reviewed-by: Qiang Yu Reviewed-by: Pierre-Eric Pelloux-Prayer Part-of: --- docs/envvars.rst | 4 ++-- .../drivers/radeonsi/ci/gfx11-navi31-fail.csv | 11 ----------- src/gallium/drivers/radeonsi/si_pipe.c | 14 ++------------ src/gallium/drivers/radeonsi/si_pipe.h | 1 - 4 files changed, 4 insertions(+), 26 deletions(-) diff --git a/docs/envvars.rst b/docs/envvars.rst index b94c23f4517..377d667f0a2 100644 --- a/docs/envvars.rst +++ b/docs/envvars.rst @@ -1784,8 +1784,8 @@ RadeonSI driver environment variables Use old-style monolithic shaders compiled on demand ``nooptvariant`` Disable compiling optimized shader variants. - ``useaco`` - Use ACO as shader compiler when possible + ``usellvm`` + Use LLVM as shader compiler when possible ``nowc`` Disable GTT write combining ``check_vm`` diff --git a/src/gallium/drivers/radeonsi/ci/gfx11-navi31-fail.csv b/src/gallium/drivers/radeonsi/ci/gfx11-navi31-fail.csv index e03bd2bdf37..114963fa289 100644 --- a/src/gallium/drivers/radeonsi/ci/gfx11-navi31-fail.csv +++ b/src/gallium/drivers/radeonsi/ci/gfx11-navi31-fail.csv @@ -27,8 +27,6 @@ spec@!opengl 1.0@rasterpos@glsl_vs_tes_linked,Fail # This is caused by lowering mediump before linking: spec@glsl-es-1.00@linker@glsl-mismatched-uniform-precision-unused,Fail -KHR-GL46.shaders.uniform_block.random.nested_structs_instance_arrays.0,Fail - # See Khronos issue 5587: the test expects one-dimensional (array) texture to work while # it's explicitely marked as non-supported by EXT_sparse_texture2. KHR-GL46.sparse_texture2_tests.StandardPageSizesTestCase_texture_1d_array_r11f_g11f_b10f,Fail @@ -427,12 +425,3 @@ KHR-GL46.transform_feedback_overflow_query_ARB.multiple-streams-one-buffer-per-s KHR-GL46.texture_query_lod.sampler1D_test,Fail KHR-GL46.texture_query_lod.sampler2D_test,Fail KHR-GL46.texture_query_lod.sampler3D_test,Fail - -# escts failures (pass with ACO) -KHR-GLES3.shaders.uniform_block.random.nested_structs_instance_arrays.0,Fail -KHR-GLES31.core.shader_image_load_store.basic-allFormats-store-fs,Fail - -# deqp failures (pass with ACO) -dEQP-GLES3.functional.ubo.random.all_per_block_buffers.29,Fail -dEQP-GLES3.functional.ubo.random.basic_instance_arrays.22,Fail -dEQP-GLES3.functional.ubo.random.nested_structs.4,Fail diff --git a/src/gallium/drivers/radeonsi/si_pipe.c b/src/gallium/drivers/radeonsi/si_pipe.c index 8b9bd3e17a8..97f8ed4ef2e 100644 --- a/src/gallium/drivers/radeonsi/si_pipe.c +++ b/src/gallium/drivers/radeonsi/si_pipe.c @@ -121,7 +121,6 @@ static const struct debug_named_value radeonsi_shader_debug_options[] = { {"checkir", DBG(CHECK_IR), "Enable additional sanity checks on shader IR"}, {"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"}, DEBUG_NAMED_VALUE_END /* must be last */ @@ -1327,17 +1326,8 @@ static struct pipe_screen *radeonsi_screen_create_impl(struct radeon_winsys *ws, 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. Same for GFX12. - */ - if ((sscreen->info.gfx_level == GFX12 && LLVM_VERSION_MAJOR < 20) || - (sscreen->info.gfx_level == GFX11_5 && LLVM_VERSION_MAJOR < 19)) - sscreen->use_aco = true; - else if (sscreen->info.gfx_level >= GFX10) - sscreen->use_aco = (sscreen->shader_debug_flags & DBG(USE_ACO)); - else - sscreen->use_aco = support_aco && sscreen->info.has_image_opcodes && - !(sscreen->shader_debug_flags & DBG(USE_LLVM)); + sscreen->use_aco = support_aco && sscreen->info.has_image_opcodes && + !(sscreen->shader_debug_flags & DBG(USE_LLVM)); #else sscreen->use_aco = true; #endif diff --git a/src/gallium/drivers/radeonsi/si_pipe.h b/src/gallium/drivers/radeonsi/si_pipe.h index c3aab10c457..84e44aada42 100644 --- a/src/gallium/drivers/radeonsi/si_pipe.h +++ b/src/gallium/drivers/radeonsi/si_pipe.h @@ -257,7 +257,6 @@ enum DBG_MONOLITHIC_SHADERS, DBG_NO_OPT_VARIANT, - DBG_USE_ACO, DBG_USE_LLVM, };