[Mesa-dev] [PATCH] anv/pipeline: honor the pipeline_cache_enabled run-time flag
Lionel Landwerlin
lionel.g.landwerlin at intel.com
Fri Jul 6 14:50:42 UTC 2018
On 04/07/18 09:44, Iago Toral Quiroga wrote:
> ---
> src/intel/vulkan/anv_pipeline_cache.c | 37 +++++++++++++++++++----------------
> 1 file changed, 20 insertions(+), 17 deletions(-)
>
> diff --git a/src/intel/vulkan/anv_pipeline_cache.c b/src/intel/vulkan/anv_pipeline_cache.c
> index d4c7262dc0..5825bf9f01 100644
> --- a/src/intel/vulkan/anv_pipeline_cache.c
> +++ b/src/intel/vulkan/anv_pipeline_cache.c
> @@ -570,23 +570,26 @@ anv_device_search_for_kernel(struct anv_device *device,
> }
>
I guess you could do :
if (disk_cache && device->instance->pipeline_cache_enabled) {
...
to minimize the diff.
Do we still want to save stuff in the cache (anv_device_upload_kernel)
when cache is disabled?
Regardless :
Reviewed-by: Lionel Landwerlin <lionel.g.landwerlin at intel.com>
Thanks!
> #ifdef ENABLE_SHADER_CACHE
> - struct disk_cache *disk_cache = device->instance->physicalDevice.disk_cache;
> - if (disk_cache) {
> - cache_key cache_key;
> - disk_cache_compute_key(disk_cache, key_data, key_size, cache_key);
> -
> - size_t buffer_size;
> - uint8_t *buffer = disk_cache_get(disk_cache, cache_key, &buffer_size);
> - if (buffer) {
> - struct blob_reader blob;
> - blob_reader_init(&blob, buffer, buffer_size);
> - bin = anv_shader_bin_create_from_blob(device, &blob);
> - free(buffer);
> -
> - if (bin) {
> - if (cache)
> - anv_pipeline_cache_add_shader_bin(cache, bin);
> - return bin;
> + if (device->instance->pipeline_cache_enabled) {
> + struct disk_cache *disk_cache =
> + device->instance->physicalDevice.disk_cache;
> + if (disk_cache) {
> + cache_key cache_key;
> + disk_cache_compute_key(disk_cache, key_data, key_size, cache_key);
> +
> + size_t buffer_size;
> + uint8_t *buffer = disk_cache_get(disk_cache, cache_key, &buffer_size);
> + if (buffer) {
> + struct blob_reader blob;
> + blob_reader_init(&blob, buffer, buffer_size);
> + bin = anv_shader_bin_create_from_blob(device, &blob);
> + free(buffer);
> +
> + if (bin) {
> + if (cache)
> + anv_pipeline_cache_add_shader_bin(cache, bin);
> + return bin;
> + }
> }
> }
> }
More information about the mesa-dev
mailing list