anv: switch to vk_device::mem_cache field for default cache

Signed-off-by: Lionel Landwerlin <lionel.g.landwerlin@intel.com>
Closes: https://gitlab.freedesktop.org/mesa/mesa/-/issues/11175
Reviewed-by: José Roberto de Souza <jose.souza@intel.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/29258>
This commit is contained in:
Lionel Landwerlin 2024-05-17 10:09:16 +03:00 committed by Marge Bot
parent b2282e3a57
commit a31996ce5a
3 changed files with 9 additions and 12 deletions

View File

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

View File

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

View File

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