From a31996ce5a6b7eb3b324b71eb9e9c45173953c50 Mon Sep 17 00:00:00 2001 From: Lionel Landwerlin Date: Fri, 17 May 2024 10:09:16 +0300 Subject: [PATCH] anv: switch to vk_device::mem_cache field for default cache MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Signed-off-by: Lionel Landwerlin Closes: https://gitlab.freedesktop.org/mesa/mesa/-/issues/11175 Reviewed-by: José Roberto de Souza Part-of: --- src/intel/vulkan/anv_device.c | 8 ++++---- src/intel/vulkan/anv_pipeline_cache.c | 12 +++++------- src/intel/vulkan/anv_private.h | 1 - 3 files changed, 9 insertions(+), 12 deletions(-) diff --git a/src/intel/vulkan/anv_device.c b/src/intel/vulkan/anv_device.c index 32f6ecabab3..cbe665eb4e4 100644 --- a/src/intel/vulkan/anv_device.c +++ b/src/intel/vulkan/anv_device.c @@ -3797,9 +3797,9 @@ VkResult anv_CreateDevice( goto fail_btd_fifo_bo; struct vk_pipeline_cache_create_info pcc_info = { }; - device->default_pipeline_cache = + device->vk.mem_cache = vk_pipeline_cache_create(&device->vk, &pcc_info, NULL); - if (!device->default_pipeline_cache) { + if (!device->vk.mem_cache) { result = vk_error(device, VK_ERROR_OUT_OF_HOST_MEMORY); goto fail_trtt; } @@ -3930,7 +3930,7 @@ VkResult anv_CreateDevice( fail_internal_cache: vk_pipeline_cache_destroy(device->internal_cache, NULL); fail_default_pipeline_cache: - vk_pipeline_cache_destroy(device->default_pipeline_cache, NULL); + vk_pipeline_cache_destroy(device->vk.mem_cache, NULL); fail_trtt: anv_device_finish_trtt(device); fail_btd_fifo_bo: @@ -4051,7 +4051,7 @@ void anv_DestroyDevice( anv_device_print_fini(device); vk_pipeline_cache_destroy(device->internal_cache, NULL); - vk_pipeline_cache_destroy(device->default_pipeline_cache, NULL); + vk_pipeline_cache_destroy(device->vk.mem_cache, NULL); anv_device_finish_embedded_samplers(device); diff --git a/src/intel/vulkan/anv_pipeline_cache.c b/src/intel/vulkan/anv_pipeline_cache.c index dba492d6351..aa006a75aea 100644 --- a/src/intel/vulkan/anv_pipeline_cache.c +++ b/src/intel/vulkan/anv_pipeline_cache.c @@ -631,7 +631,7 @@ anv_device_search_for_kernel(struct anv_device *device, { /* Use the default pipeline cache if none is specified */ if (cache == NULL) - cache = device->default_pipeline_cache; + cache = device->vk.mem_cache; bool cache_hit = false; struct vk_pipeline_cache_object *object = @@ -639,7 +639,7 @@ anv_device_search_for_kernel(struct anv_device *device, &anv_shader_bin_ops, &cache_hit); if (user_cache_hit != NULL) { *user_cache_hit = object != NULL && cache_hit && - cache != device->default_pipeline_cache; + cache != device->vk.mem_cache; } if (object == NULL) @@ -655,9 +655,7 @@ anv_device_upload_kernel(struct anv_device *device, { /* Use the default pipeline cache if none is specified */ if (cache == NULL) - cache = device->default_pipeline_cache; - - + cache = device->vk.mem_cache; struct anv_shader_bin *shader = anv_shader_bin_create(device, @@ -693,7 +691,7 @@ anv_device_search_for_nir(struct anv_device *device, void *mem_ctx) { if (cache == NULL) - cache = device->default_pipeline_cache; + cache = device->vk.mem_cache; return vk_pipeline_cache_lookup_nir(cache, sha1_key, SHA1_KEY_SIZE, nir_options, NULL, mem_ctx); @@ -706,7 +704,7 @@ anv_device_upload_nir(struct anv_device *device, unsigned char sha1_key[SHA1_KEY_SIZE]) { if (cache == NULL) - cache = device->default_pipeline_cache; + cache = device->vk.mem_cache; vk_pipeline_cache_add_nir(cache, sha1_key, SHA1_KEY_SIZE, nir); } diff --git a/src/intel/vulkan/anv_private.h b/src/intel/vulkan/anv_private.h index 2ae46f3d234..498f17a5e7f 100644 --- a/src/intel/vulkan/anv_private.h +++ b/src/intel/vulkan/anv_private.h @@ -1863,7 +1863,6 @@ struct anv_device { */ char host_null_surface_state[ANV_SURFACE_STATE_SIZE]; - struct vk_pipeline_cache * default_pipeline_cache; struct vk_pipeline_cache * internal_cache; struct {