Module: Mesa Branch: main Commit: 152092b8eaddd46a11f1a08514742e72ba1c195e URL: http://cgit.freedesktop.org/mesa/mesa/commit/?id=152092b8eaddd46a11f1a08514742e72ba1c195e
Author: Rhys Perry <[email protected]> Date: Wed May 4 13:03:52 2022 +0100 aco: skip s_barrier if TCS patches are within subgroup fossil-db (Sienna Cichlid): Totals from 518 (0.32% of 162293) affected shaders: Instrs: 124943 -> 123908 (-0.83%) CodeSize: 708764 -> 704624 (-0.58%) Latency: 618380 -> 618279 (-0.02%) InvThroughput: 214061 -> 214051 (-0.00%) Signed-off-by: Rhys Perry <[email protected]> Reviewed-by: Timur Kristóf <[email protected]> Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/16356> --- src/amd/compiler/aco_instruction_selection.cpp | 18 +++++++++--------- 1 file changed, 9 insertions(+), 9 deletions(-) diff --git a/src/amd/compiler/aco_instruction_selection.cpp b/src/amd/compiler/aco_instruction_selection.cpp index 4bd7ca1cea6..8996d4835fd 100644 --- a/src/amd/compiler/aco_instruction_selection.cpp +++ b/src/amd/compiler/aco_instruction_selection.cpp @@ -11004,13 +11004,6 @@ create_fs_exports(isel_context* ctx) ctx->block->kind |= block_kind_export_end; } -static void -create_workgroup_barrier(Builder& bld) -{ - bld.barrier(aco_opcode::p_barrier, - memory_sync_info(storage_shared, semantic_acqrel, scope_workgroup), scope_workgroup); -} - static void emit_stream_output(isel_context* ctx, Temp const* so_buffers, Temp const* so_write_offset, const struct radv_stream_output* output) @@ -11522,8 +11515,15 @@ select_program(Program* program, unsigned shader_count, struct nir_shader* const bool tcs_skip_barrier = ctx.stage == vertex_tess_control_hs && ctx.tcs_temp_only_inputs == nir->info.inputs_read; - if (!ngg_gs && !tcs_skip_barrier) - create_workgroup_barrier(bld); + if (!ngg_gs && !tcs_skip_barrier) { + sync_scope scope = + ctx.stage == vertex_tess_control_hs && + program->wave_size % ctx.options->key.tcs.tess_input_vertices == 0 + ? scope_subgroup + : scope_workgroup; + bld.barrier(aco_opcode::p_barrier, + memory_sync_info(storage_shared, semantic_acqrel, scope), scope); + } if (ctx.stage == vertex_geometry_gs || ctx.stage == tess_eval_geometry_gs) { ctx.gs_wave_id = bld.pseudo(aco_opcode::p_extract, bld.def(s1, m0), bld.def(s1, scc),
