From 17cacaa5c8f33822fcdb84e1a5575084faa00e07 Mon Sep 17 00:00:00 2001 From: Lionel Landwerlin Date: Mon, 20 May 2024 08:21:55 +0300 Subject: [PATCH] anv: use weak_ref mode for global pipeline caches MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit So that as soon as pipelines are freed, they're removed from the cache. Signed-off-by: Lionel Landwerlin Closes: https://gitlab.freedesktop.org/mesa/mesa/-/issues/11185 Reviewed-by: Tapani Pälli Reviewed-by: Sagar Ghuge Tested-by: Brian Paul Reviewed-by: Faith Ekstrand Cc: mesa-stable Part-of: (cherry picked from commit 3584fc64828ad2ad4d486572ec915aab8321aadd) --- .pick_status.json | 2 +- src/gallium/drivers/zink/ci/zink-anv-tgl-fails.txt | 5 +++++ src/intel/vulkan/anv_device.c | 9 ++++++--- 3 files changed, 12 insertions(+), 4 deletions(-) diff --git a/.pick_status.json b/.pick_status.json index c4b592a9d7d..20c003f7de7 100644 --- a/.pick_status.json +++ b/.pick_status.json @@ -3854,7 +3854,7 @@ "description": "anv: use weak_ref mode for global pipeline caches", "nominated": true, "nomination_type": 0, - "resolution": 0, + "resolution": 1, "main_sha": null, "because_sha": null, "notes": null diff --git a/src/gallium/drivers/zink/ci/zink-anv-tgl-fails.txt b/src/gallium/drivers/zink/ci/zink-anv-tgl-fails.txt index e9d05f3a463..1f4373e869d 100644 --- a/src/gallium/drivers/zink/ci/zink-anv-tgl-fails.txt +++ b/src/gallium/drivers/zink/ci/zink-anv-tgl-fails.txt @@ -668,3 +668,8 @@ KHR-GL46.sparse_texture_tests.SparseTextureCommitment,Crash # Assertion `size % ZINK_SPARSE_BUFFER_PAGE_SIZE == 0 || offset + size == bo->base.size' failed. spec@arb_sparse_buffer@basic,Crash spec@arb_sparse_buffer@buffer-data,Crash + +# Failing on a bunch of drivers with an assert on the weak_ref +# pipeline cache, seems to be a zink issue not destroying a +# shader/pipeline before calling vkDestroyPipeline() +spec@ext_external_objects@vk-vert-buf-reuse,Crash diff --git a/src/intel/vulkan/anv_device.c b/src/intel/vulkan/anv_device.c index c048b32a2f1..86b5f1ebcc1 100644 --- a/src/intel/vulkan/anv_device.c +++ b/src/intel/vulkan/anv_device.c @@ -3550,7 +3550,7 @@ VkResult anv_CreateDevice( if (result != VK_SUCCESS) goto fail_trtt; - struct vk_pipeline_cache_create_info pcc_info = { }; + struct vk_pipeline_cache_create_info pcc_info = { .weak_ref = true, }; device->default_pipeline_cache = vk_pipeline_cache_create(&device->vk, &pcc_info, NULL); if (!device->default_pipeline_cache) { @@ -3563,9 +3563,12 @@ VkResult anv_CreateDevice( * shaders to remain resident while it runs. Therefore, we need a special * cache just for BLORP/RT that's forced to always be enabled. */ - pcc_info.force_enable = true; + struct vk_pipeline_cache_create_info internal_pcc_info = { + .force_enable = true, + .weak_ref = false, + }; device->internal_cache = - vk_pipeline_cache_create(&device->vk, &pcc_info, NULL); + vk_pipeline_cache_create(&device->vk, &internal_pcc_info, NULL); if (device->internal_cache == NULL) { result = vk_error(device, VK_ERROR_OUT_OF_HOST_MEMORY); goto fail_default_pipeline_cache;