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 <samuel.pitoiset@gmail.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/24832>
This commit is contained in:
Samuel Pitoiset
2023-08-22 20:36:57 +02:00
committed by Marge Bot
parent 6463e60fe4
commit f30d47c518

View File

@@ -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);
}