From: Samuel Pitoiset Date: Tue, 22 Aug 2023 18:36:57 +0000 (+0200) Subject: aco: fix emitting TCS epilogs end on GFX9+ X-Git-Tag: upstream/23.3.3~2735 X-Git-Url: http://review.tizen.org/git/?a=commitdiff_plain;h=f30d47c518b8b454de1a6f44a94cd3afcaefcc79;p=platform%2Fupstream%2Fmesa.git aco: fix emitting TCS epilogs end on GFX9+ With merged shaders, the long-jump should be emitted inside the divergent if (ie. only for TCS invocations) and other non TCS invocations should just end the program. This fixes a bunch of failures with CTS by forcing TCS epilogs on RDNA2. Not sure how RadeonSI will handle that but maybe doing the merged wave info thing in epilogs would help. Signed-off-by: Samuel Pitoiset Part-of: --- diff --git a/src/amd/compiler/aco_instruction_selection.cpp b/src/amd/compiler/aco_instruction_selection.cpp index 70393d7..2e4f7af 100644 --- a/src/amd/compiler/aco_instruction_selection.cpp +++ b/src/amd/compiler/aco_instruction_selection.cpp @@ -11530,11 +11530,6 @@ select_shader(isel_context& ctx, nir_shader* nir, const bool need_startpgm, cons nir_function_impl* func = nir_shader_get_entrypoint(nir); visit_cf_list(&ctx, &func->body); - if (endif_merged_wave_info) { - begin_divergent_if_else(&ctx, ic_merged_wave_info); - end_divergent_if(&ctx, ic_merged_wave_info); - } - if (ctx.program->info.has_epilog) { if (ctx.stage == fragment_fs) { create_fs_jump_to_epilog(&ctx); @@ -11551,6 +11546,11 @@ select_shader(isel_context& ctx, nir_shader* nir, const bool need_startpgm, cons } } + if (endif_merged_wave_info) { + begin_divergent_if_else(&ctx, ic_merged_wave_info); + end_divergent_if(&ctx, ic_merged_wave_info); + } + if ((ctx.stage.sw == SWStage::VS && (ctx.stage.hw == AC_HW_HULL_SHADER || ctx.stage.hw == AC_HW_LEGACY_GEOMETRY_SHADER)) || (ctx.stage.sw == SWStage::TES && ctx.stage.hw == AC_HW_LEGACY_GEOMETRY_SHADER)) { @@ -11714,7 +11714,9 @@ select_program(Program* program, unsigned shader_count, struct nir_shader* const append_logical_end(ctx.block); ctx.block->kind |= block_kind_uniform; - if (!ctx.program->info.has_epilog) { + if (!ctx.program->info.has_epilog || + (shaders[shader_count - 1]->info.stage == MESA_SHADER_TESS_CTRL && + options->gfx_level >= GFX9)) { Builder bld(ctx.program, ctx.block); bld.sopp(aco_opcode::s_endpgm); }