anv: use weak_ref mode for global pipeline caches

So that as soon as pipelines are freed, they're removed from the
cache.

Signed-off-by: Lionel Landwerlin <lionel.g.landwerlin@intel.com>
Closes: https://gitlab.freedesktop.org/mesa/mesa/-/issues/11185
Reviewed-by: Tapani Pälli <tapani.palli@intel.com>
Reviewed-by: Sagar Ghuge <sagar.ghuge@intel.com>
Tested-by: Brian Paul <brian.paul@broadcom.com>
Reviewed-by: Faith Ekstrand <faith.ekstrand@collabora.com>
Cc: mesa-stable
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/29283>
This commit is contained in:
Lionel Landwerlin 2024-05-20 08:21:55 +03:00 committed by Marge Bot
parent 3963e4b53a
commit 3584fc6482
2 changed files with 10 additions and 3 deletions

View file

@ -607,3 +607,7 @@ KHR-GL46.sparse_texture2_tests.SparseTexture2Lookup,Crash
spec@arb_shader_storage_buffer_object@max-ssbo-size@fs,Crash
spec@arb_shader_storage_buffer_object@max-ssbo-size@vs,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

View file

@ -3796,7 +3796,7 @@ VkResult anv_CreateDevice(
if (result != VK_SUCCESS)
goto fail_btd_fifo_bo;
struct vk_pipeline_cache_create_info pcc_info = { };
struct vk_pipeline_cache_create_info pcc_info = { .weak_ref = true, };
device->vk.mem_cache =
vk_pipeline_cache_create(&device->vk, &pcc_info, NULL);
if (!device->vk.mem_cache) {
@ -3809,9 +3809,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;