From d6978b1af2749f521c8371ba19526f56f1e5d42d Mon Sep 17 00:00:00 2001 From: Juston Li Date: Wed, 27 Mar 2024 16:26:53 -0700 Subject: [PATCH] Revert "zink: store last pipeline directly for zink_gfx_program::last_pipeline" This reverts commit be8b7980e66f3526d7c1eb9b137772fb6fc90a96. 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 Part-of: --- src/gallium/drivers/zink/ci/traces-zink-restricted.yml | 2 +- src/gallium/drivers/zink/ci/traces-zink.yml | 2 +- src/gallium/drivers/zink/zink_program_state.hpp | 4 ++-- src/gallium/drivers/zink/zink_types.h | 2 +- 4 files changed, 5 insertions(+), 5 deletions(-) diff --git a/src/gallium/drivers/zink/ci/traces-zink-restricted.yml b/src/gallium/drivers/zink/ci/traces-zink-restricted.yml index c45b40947f3..37eff63598a 100644 --- a/src/gallium/drivers/zink/ci/traces-zink-restricted.yml +++ b/src/gallium/drivers/zink/ci/traces-zink-restricted.yml @@ -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] diff --git a/src/gallium/drivers/zink/ci/traces-zink.yml b/src/gallium/drivers/zink/ci/traces-zink.yml index b1af198f019..0882be78295 100644 --- a/src/gallium/drivers/zink/ci/traces-zink.yml +++ b/src/gallium/drivers/zink/ci/traces-zink.yml @@ -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 diff --git a/src/gallium/drivers/zink/zink_program_state.hpp b/src/gallium/drivers/zink/zink_program_state.hpp index 10e2fb94897..2cabc678660 100644 --- a/src/gallium/drivers/zink/zink_program_state.hpp +++ b/src/gallium/drivers/zink/zink_program_state.hpp @@ -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; } diff --git a/src/gallium/drivers/zink/zink_types.h b/src/gallium/drivers/zink/zink_types.h index 3d8f6a58ed0..d0c502be52a 100644 --- a/src/gallium/drivers/zink/zink_types.h +++ b/src/gallium/drivers/zink/zink_types.h @@ -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; };