[Mesa-dev] [PATCH] anv/pipeline: honor the pipeline_cache_enabled run-time flag

Iago Toral itoral at igalia.com
Mon Jul 9 06:22:30 UTC 2018


On Fri, 2018-07-06 at 15:50 +0100, Lionel Landwerlin wrote:
> 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.

Sure, will do that.

> Do we still want to save stuff in the cache
> (anv_device_upload_kernel) 
> when cache is disabled?

Good question... looking at the implementation it looks that the intent
behind the flag was to also control in-memory cache, so it is probably
a good idea. I'll send a v2 disabling that too.

Iago

> 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