From c34dc4bebf3213b6ceaef713fdb9b0c4f8adc42c 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: (cherry picked from commit d6978b1af2749f521c8371ba19526f56f1e5d42d) --- .pick_status.json | 2 +- 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 +- 5 files changed, 6 insertions(+), 6 deletions(-) diff --git a/.pick_status.json b/.pick_status.json index 890d0965426..48414c59549 100644 --- a/.pick_status.json +++ b/.pick_status.json @@ -1994,7 +1994,7 @@ "description": "Revert \"zink: store last pipeline directly for zink_gfx_program::last_pipeline\"", "nominated": true, "nomination_type": 2, - "resolution": 0, + "resolution": 1, "main_sha": null, "because_sha": "be8b7980e66f3526d7c1eb9b137772fb6fc90a96", "notes": null 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 66a4870a946..ba4aea002e8 100644 --- a/src/gallium/drivers/zink/zink_types.h +++ b/src/gallium/drivers/zink/zink_types.h @@ -1137,7 +1137,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; };