From 8ebb29245c5ac017c2d61734eddc29c5a06e94bd Mon Sep 17 00:00:00 2001 From: Samuel Pitoiset Date: Thu, 24 Aug 2023 09:41:46 +0200 Subject: [PATCH] aco: add support for compiling {VS,TES}+GS separately on GFX9+ Signed-off-by: Samuel Pitoiset Part-of: --- src/amd/compiler/aco_instruction_selection.cpp | 16 ++++++++++------ src/amd/compiler/aco_instruction_selection_setup.cpp | 2 +- 2 files changed, 11 insertions(+), 7 deletions(-) diff --git a/src/amd/compiler/aco_instruction_selection.cpp b/src/amd/compiler/aco_instruction_selection.cpp index 83aad96..70393d7 100644 --- a/src/amd/compiler/aco_instruction_selection.cpp +++ b/src/amd/compiler/aco_instruction_selection.cpp @@ -11446,7 +11446,7 @@ pops_await_overlapped_waves(isel_context* ctx) } static void -create_vs_jump_to_tcs(isel_context* ctx) +create_merged_jump_to_epilog(isel_context* ctx) { Builder bld(ctx->program, ctx->block); std::vector regs; @@ -11551,9 +11551,11 @@ select_shader(isel_context& ctx, nir_shader* nir, const bool need_startpgm, cons } } - if (ctx.stage.hw == AC_HW_HULL_SHADER && ctx.stage.sw == SWStage::VS) { + 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)) { assert(program->gfx_level >= GFX9); - create_vs_jump_to_tcs(&ctx); + create_merged_jump_to_epilog(&ctx); } cleanup_context(&ctx); @@ -11689,13 +11691,15 @@ select_program(Program* program, unsigned shader_count, struct nir_shader* const bool need_barrier = false, check_merged_wave_info = false, endif_merged_wave_info = false; if_context ic_merged_wave_info; - /* Handle separate compilation of VS+TCS on GFX9+. */ + /* Handle separate compilation of VS+TCS and {VS,TES}+GS on GFX9+. */ if (!ctx.program->info.is_monolithic) { assert(ctx.program->gfx_level >= GFX9); - if (ctx.stage.hw == AC_HW_HULL_SHADER && ctx.stage.sw == SWStage::VS) { + 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)) { check_merged_wave_info = endif_merged_wave_info = true; } else { - assert(ctx.stage == tess_control_hs); + assert(ctx.stage == tess_control_hs || ctx.stage == geometry_gs); check_merged_wave_info = endif_merged_wave_info = true; need_barrier = true; } diff --git a/src/amd/compiler/aco_instruction_selection_setup.cpp b/src/amd/compiler/aco_instruction_selection_setup.cpp index c87572a..d994e52 100644 --- a/src/amd/compiler/aco_instruction_selection_setup.cpp +++ b/src/amd/compiler/aco_instruction_selection_setup.cpp @@ -262,7 +262,7 @@ setup_lds_size(isel_context* ctx, nir_shader* nir) /* TCS and GFX9 GS are special cases, already in units of the allocation granule. */ if (ctx->stage.has(SWStage::TCS)) ctx->program->config->lds_size = ctx->program->info.tcs.num_lds_blocks; - else if (ctx->stage == vertex_geometry_gs || ctx->stage == tess_eval_geometry_gs) + else if (ctx->stage.hw == AC_HW_LEGACY_GEOMETRY_SHADER && ctx->options->gfx_level >= GFX9) ctx->program->config->lds_size = ctx->program->info.gfx9_gs_ring_lds_size; else ctx->program->config->lds_size = -- 2.7.4