ac/llvm: skip s_barrier if tess patches don't cross a wave boundary

If tess patches are wholly in one wave, "s_waitcnt lgkm(0)" is sufficient.

Reviewed-by: Pierre-Eric Pelloux-Prayer <pierre-eric.pelloux-prayer@amd.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/16304>
This commit is contained in:
Marek Olšák
2022-05-02 22:43:38 -04:00
committed by Marge Bot
parent 59673001c8
commit 2a1c711052
5 changed files with 31 additions and 5 deletions

View File

@@ -1017,7 +1017,17 @@ bool si_llvm_translate_nir(struct si_shader_context *ctx, struct si_shader *shad
shader->selector->info.base.inputs_read &
~shader->selector->info.tcs_vgpr_only_inputs) {
ac_build_waitcnt(&ctx->ac, AC_WAIT_LGKM);
ac_build_s_barrier(&ctx->ac, ctx->stage);
/* If both input and output patches are wholly in one wave, we don't need a barrier.
* That's true when both VS and TCS have the same number of patch vertices and
* the wave size is a multiple of the number of patch vertices.
*
* The fixed-func TCS doesn't set tcs_vertices_out.
*/
if (!shader->key.ge.opt.same_patch_vertices ||
(sel->info.base.tess.tcs_vertices_out &&
ctx->ac.wave_size % sel->info.base.tess.tcs_vertices_out != 0))
ac_build_s_barrier(&ctx->ac, ctx->stage);
}
} else if (ctx->stage == MESA_SHADER_GEOMETRY && !shader->key.ge.as_ngg) {
/* gfx10_ngg_gs_emit_prologue inserts the barrier for NGG. */