radeonsi: don't sync VS and PS if they are idle

Reviewed-by: Pierre-Eric Pelloux-Prayer <pierre-eric.pelloux-prayer@amd.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/31291>
This commit is contained in:
Marek Olšák
2024-08-25 16:24:27 -04:00
committed by Marge Bot
parent 17e994dab1
commit 15e320e970
2 changed files with 17 additions and 1 deletions
+15 -1
View File
@@ -59,7 +59,7 @@ static unsigned get_reduced_barrier_flags(struct si_context *ctx)
if (!ctx->compute_is_busy)
flags &= ~SI_BARRIER_SYNC_CS;
/* Track the last flush. */
/* Track the last CB/DB flush. */
if (flags & SI_BARRIER_SYNC_AND_INV_CB) {
ctx->num_cb_cache_flushes++;
ctx->last_cb_flush_num_draw_calls = ctx->num_draw_calls;
@@ -71,6 +71,20 @@ static unsigned get_reduced_barrier_flags(struct si_context *ctx)
ctx->last_db_flush_num_decompress_calls = ctx->num_decompress_calls;
}
/* Skip VS and PS synchronization if they are idle. */
if (ctx->num_draw_calls == ctx->last_ps_sync_num_draw_calls)
flags &= ~SI_BARRIER_SYNC_VS & ~SI_BARRIER_SYNC_PS;
else if (ctx->num_draw_calls == ctx->last_vs_sync_num_draw_calls)
flags &= ~SI_BARRIER_SYNC_VS;
/* Track the last VS/PS flush. Flushing CB or DB also waits for PS (obviously). */
if (flags & (SI_BARRIER_SYNC_AND_INV_CB | SI_BARRIER_SYNC_AND_INV_DB | SI_BARRIER_SYNC_PS)) {
ctx->last_ps_sync_num_draw_calls = ctx->num_draw_calls;
ctx->last_vs_sync_num_draw_calls = ctx->num_draw_calls;
} else if (SI_BARRIER_SYNC_VS) {
ctx->last_vs_sync_num_draw_calls = ctx->num_draw_calls;
}
/* We use a TS event to flush CB/DB on GFX9+, which also waits for compute shaders. */
if (flags & SI_BARRIER_SYNC_CS ||
(ctx->gfx_level >= GFX9 &&
+2
View File
@@ -1277,6 +1277,8 @@ struct si_context {
unsigned num_decompress_calls;
unsigned last_cb_flush_num_draw_calls;
unsigned last_db_flush_num_draw_calls;
unsigned last_ps_sync_num_draw_calls;
unsigned last_vs_sync_num_draw_calls;
unsigned last_cb_flush_num_decompress_calls;
unsigned last_db_flush_num_decompress_calls;
unsigned num_compute_calls;