Revert "Revert "radv: fallback to an in-memory cache when no pipline cache is provided""
authorBas Nieuwenhuizen <bas@basnieuwenhuizen.nl>
Mon, 25 Sep 2017 03:47:25 +0000 (05:47 +0200)
committerBas Nieuwenhuizen <bas@basnieuwenhuizen.nl>
Mon, 25 Sep 2017 13:36:19 +0000 (15:36 +0200)
I tested this 10 times with
./deqp-vk --deqp-case=dEQP-VK.texture.filtering.3d.formats.r4g4b4a4*

and one full run of CTS, seems the issue is gone.

Also reduces CTS runtime by 30% or so.

Reviewed-by: Timothy Arceri <tarceri@itsqueeze.com>
src/amd/vulkan/radv_pipeline.c
src/amd/vulkan/radv_pipeline_cache.c
src/amd/vulkan/radv_private.h

index 093940b69c2d7babc95403b61a7e61193904386b..228fdf4ab076ede3a3a1d5f140debf362a14becc 100644 (file)
@@ -153,7 +153,8 @@ radv_pipeline_compile(struct radv_pipeline *pipeline,
 
                if (pipeline->gs_copy_shader) {
                        pipeline->gs_copy_shader =
-                               radv_pipeline_cache_insert_shader(cache,
+                               radv_pipeline_cache_insert_shader(pipeline->device,
+                                                                 cache,
                                                                  gs_copy_sha1,
                                                                  pipeline->gs_copy_shader,
                                                                  gs_copy_code,
@@ -166,8 +167,10 @@ radv_pipeline_compile(struct radv_pipeline *pipeline,
                ralloc_free(nir);
 
        if (variant)
-               variant = radv_pipeline_cache_insert_shader(cache, sha1, variant,
-                                                           code, code_size);
+               variant = radv_pipeline_cache_insert_shader(pipeline->device,
+                                                           cache, sha1,
+                                                           variant, code,
+                                                           code_size);
 
        if (code)
                free(code);
@@ -290,11 +293,11 @@ radv_tess_pipeline_compile(struct radv_pipeline *pipeline,
                ralloc_free(tcs_nir);
 
        if (tes_variant)
-               tes_variant = radv_pipeline_cache_insert_shader(cache, tes_sha1, tes_variant,
+               tes_variant = radv_pipeline_cache_insert_shader(pipeline->device, cache, tes_sha1, tes_variant,
                                                                tes_code, tes_code_size);
 
        if (tcs_variant)
-               tcs_variant = radv_pipeline_cache_insert_shader(cache, tcs_sha1, tcs_variant,
+               tcs_variant = radv_pipeline_cache_insert_shader(pipeline->device, cache, tcs_sha1, tcs_variant,
                                                                tcs_code, tcs_code_size);
 
        if (tes_code)
index fa760f31eeec147f698a4c11a59e1a40a61172b4..43176b6fdf8893499c02265139a18161511bddab 100644 (file)
@@ -162,6 +162,8 @@ radv_create_shader_variant_from_pipeline_cache(struct radv_device *device,
 
        if (cache)
                entry = radv_pipeline_cache_search(cache, sha1);
+       else
+               entry = radv_pipeline_cache_search(device->mem_cache, sha1);
 
        if (!entry)
                return NULL;
@@ -262,13 +264,14 @@ radv_pipeline_cache_add_entry(struct radv_pipeline_cache *cache,
 }
 
 struct radv_shader_variant *
-radv_pipeline_cache_insert_shader(struct radv_pipeline_cache *cache,
+radv_pipeline_cache_insert_shader(struct radv_device *device,
+                                 struct radv_pipeline_cache *cache,
                                  const unsigned char *sha1,
                                  struct radv_shader_variant *variant,
                                  const void *code, unsigned code_size)
 {
        if (!cache)
-               return variant;
+               cache = device->mem_cache;
 
        pthread_mutex_lock(&cache->mutex);
        struct cache_entry *entry = radv_pipeline_cache_search_unlocked(cache, sha1);
index 3a78778a6952f55e26d5fac929cec910855192af..79ac295a0fd2cde76594f6482a8694ccc5442d28 100644 (file)
@@ -327,7 +327,8 @@ radv_create_shader_variant_from_pipeline_cache(struct radv_device *device,
                                               const unsigned char *sha1);
 
 struct radv_shader_variant *
-radv_pipeline_cache_insert_shader(struct radv_pipeline_cache *cache,
+radv_pipeline_cache_insert_shader(struct radv_device *device,
+                                 struct radv_pipeline_cache *cache,
                                  const unsigned char *sha1,
                                  struct radv_shader_variant *variant,
                                  const void *code, unsigned code_size);