Revert "zink: store last pipeline directly for zink_gfx_program::last_pipeline"

This reverts commit be8b7980e6.

Store the cache entry so that the fast path picks up the optimized
pipeline when its available from a background optimized_compile_job().

Observed traces where it would take the fast path back and forth using
an unoptimized pipeline and never pick up the optimized pipeline leading
to >50% fps drop.

Signed-off-by: Juston Li <justonli@google.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/28440>
This commit is contained in:
Juston Li
2024-03-27 16:26:53 -07:00
committed by Marge Bot
parent 5eb0dec525
commit d6978b1af2
4 changed files with 5 additions and 5 deletions

View File

@@ -60,7 +60,7 @@ traces:
text: https://gitlab.freedesktop.org/mesa/mesa/-/issues/8986
TheRavenRemastered/Raven-f10900-v2.trace:
gl-zink-anv-tgl:
checksum: db7b901177e7ac00cc489e0e13f71f76
checksum: e910141d9520739c653fa7de0d8a1c9b
TombRaider2013/TombRaider-f1430-v2.trace:
gl-zink-anv-tgl:
label: [crash]

View File

@@ -30,7 +30,7 @@ traces:
checksum: 433b69bea68cfe81914b857bbdc60ea5
gputest/pixmark-piano-v2.trace:
gl-zink-anv-tgl:
checksum: 4c7afcce5d87ec2bced65e92a1c9a41c
checksum: 9e7b3f2d38e6cea705af8161cfd41465
gputest/triangle-v2.trace:
gl-zink-anv-tgl:
checksum: 5f694874b15bcd7a3689b387c143590b

View File

@@ -168,7 +168,7 @@ zink_get_gfx_pipeline(struct zink_context *ctx,
!prog->inline_variants && likely(prog->last_pipeline[rp_idx][idx]) &&
/* this data is too big to compare in the fast-path */
likely(!prog->shaders[MESA_SHADER_FRAGMENT]->fs.legacy_shadow_mask)) {
state->pipeline = prog->last_pipeline[rp_idx][idx];
state->pipeline = prog->last_pipeline[rp_idx][idx]->pipeline;
return state->pipeline;
}
}
@@ -245,7 +245,7 @@ zink_get_gfx_pipeline(struct zink_context *ctx,
/* update states for fastpath */
if (DYNAMIC_STATE >= ZINK_DYNAMIC_VERTEX_INPUT) {
prog->last_finalized_hash[rp_idx][idx] = state->final_hash;
prog->last_pipeline[rp_idx][idx] = cache_entry->pipeline;
prog->last_pipeline[rp_idx][idx] = cache_entry;
}
return state->pipeline;
}

View File

@@ -1139,7 +1139,7 @@ struct zink_gfx_program {
uint32_t last_variant_hash;
uint32_t last_finalized_hash[2][4]; //[dynamic, renderpass][primtype idx]
VkPipeline last_pipeline[2][4]; //[dynamic, renderpass][primtype idx]
struct zink_gfx_pipeline_cache_entry *last_pipeline[2][4]; //[dynamic, renderpass][primtype idx]
struct zink_gfx_lib_cache *libs;
};