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>
(cherry picked from commit 3584fc6482)
This commit is contained in:
Lionel Landwerlin 2024-05-20 08:21:55 +03:00 committed by Eric Engestrom
parent 93292d0904
commit 17cacaa5c8
3 changed files with 12 additions and 4 deletions

View file

@ -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

View file

@ -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

View file

@ -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;