radeonsi: init use_aco properly when llvm is disabled

Otherwise shaders are compiled with ACO anyway and we hit the assert
added by 7f7d6deb18 ("radeonsi: add ACO-specific main shader parts").

Reviewed-by: Marek Olšák <marek.olsak@amd.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/34574>
This commit is contained in:
Pierre-Eric Pelloux-Prayer 2025-04-17 10:59:28 +02:00 committed by Marge Bot
parent 2ab7ff51b9
commit 091d52965f
4 changed files with 28 additions and 0 deletions

View file

@ -643,6 +643,13 @@ static struct pipe_context *si_create_context(struct pipe_screen *screen, unsign
}
}
#if !AMD_LLVM_AVAILABLE
sctx->shader.vs.key.ge.use_aco = 1;
sctx->shader.gs.key.ge.use_aco = 1;
sctx->shader.tcs.key.ge.use_aco = 1;
sctx->shader.tes.key.ge.use_aco = 1;
#endif
sctx->ngg = sscreen->use_ngg;
si_shader_change_notify(sctx);

View file

@ -3013,6 +3013,10 @@ si_nir_generate_gs_copy_shader(struct si_screen *sscreen,
#endif
si_aco_compile_shader(shader, &linked, debug);
#if !AMD_LLVM_AVAILABLE
assert(gs_nir->info.use_aco_amd);
#endif
if (ok) {
assert(!shader->config.scratch_bytes_per_wave);
ok = si_shader_binary_upload(sscreen, shader, 0) >= 0;
@ -3115,6 +3119,10 @@ bool si_compile_shader(struct si_screen *sscreen, struct ac_llvm_compiler *compi
#endif
si_aco_compile_shader(shader, &linked, debug);
#if !AMD_LLVM_AVAILABLE
assert(nir->info.use_aco_amd);
#endif
if (!ret)
goto out;

View file

@ -484,6 +484,7 @@ static void scan_instruction(const struct nir_shader *nir, struct si_shader_info
void si_nir_scan_shader(struct si_screen *sscreen, struct nir_shader *nir,
struct si_shader_info *info, bool colors_lowered)
{
#if AMD_LLVM_AVAILABLE
bool force_use_aco = sscreen->use_aco_shader_type == nir->info.stage;
for (unsigned i = 0; i < sscreen->num_use_aco_shader_blakes; i++) {
if (!memcmp(sscreen->use_aco_shader_blakes[i], nir->info.source_blake3,
@ -499,6 +500,10 @@ void si_nir_scan_shader(struct si_screen *sscreen, struct nir_shader *nir,
/* Use ACO for streamout on gfx12 because it's faster. */
(sscreen->info.gfx_level >= GFX12 && nir->xfb_info &&
nir->xfb_info->output_count));
#else
assert(aco_is_gpu_supported(&sscreen->info));
nir->info.use_aco_amd = true;
#endif
if (nir->info.stage == MESA_SHADER_FRAGMENT) {
/* post_depth_coverage implies early_fragment_tests */

View file

@ -3829,7 +3829,9 @@ static void si_bind_vs_shader(struct pipe_context *ctx, void *state)
sctx->shader.vs.cso = sel;
sctx->shader.vs.current = (sel && sel->variants_count) ? sel->variants[0] : NULL;
#if AMD_LLVM_AVAILABLE
sctx->shader.vs.key.ge.use_aco = sel ? sel->info.base.use_aco_amd : 0;
#endif
sctx->num_vs_blit_sgprs = sel ? sel->info.base.vs.blit_sgprs_amd : 0;
sctx->vs_uses_draw_id = sel ? sel->info.uses_drawid : false;
@ -3921,7 +3923,9 @@ static void si_bind_gs_shader(struct pipe_context *ctx, void *state)
sctx->shader.gs.cso = sel;
sctx->shader.gs.current = (sel && sel->variants_count) ? sel->variants[0] : NULL;
#if AMD_LLVM_AVAILABLE
sctx->shader.gs.key.ge.use_aco = sel ? sel->info.base.use_aco_amd : 0;
#endif
sctx->ia_multi_vgt_param_key.u.uses_gs = sel != NULL;
si_update_common_shader_state(sctx, sel, PIPE_SHADER_GEOMETRY);
@ -3953,7 +3957,9 @@ static void si_bind_tcs_shader(struct pipe_context *ctx, void *state)
sctx->shader.tcs.cso = sel;
sctx->shader.tcs.current = (sel && sel->variants_count) ? sel->variants[0] : NULL;
#if AMD_LLVM_AVAILABLE
sctx->shader.tcs.key.ge.use_aco = sel ? sel->info.base.use_aco_amd : 0;
#endif
si_update_tess_uses_prim_id(sctx);
si_update_tess_in_out_patch_vertices(sctx);
@ -3976,7 +3982,9 @@ static void si_bind_tes_shader(struct pipe_context *ctx, void *state)
sctx->shader.tes.cso = sel;
sctx->shader.tes.current = (sel && sel->variants_count) ? sel->variants[0] : NULL;
#if AMD_LLVM_AVAILABLE
sctx->shader.tes.key.ge.use_aco = sel ? sel->info.base.use_aco_amd : 0;
#endif
sctx->ia_multi_vgt_param_key.u.uses_tess = sel != NULL;
si_update_tess_uses_prim_id(sctx);