Mesa (main): v3dv/pipeline_cache: add on disk cache hit stats

GitLab Mirror gitlab-mirror at kemper.freedesktop.org
Wed May 4 09:56:59 UTC 2022


Module: Mesa
Branch: main
Commit: 502fae57be254da55c482f9f54335a4670321fad
URL:    http://cgit.freedesktop.org/mesa/mesa/commit/?id=502fae57be254da55c482f9f54335a4670321fad

Author: Alejandro Piñeiro <apinheiro at igalia.com>
Date:   Tue May  3 13:10:30 2022 +0200

v3dv/pipeline_cache: add on disk cache hit stats

Useful when debugging/testing on disk cache.

Reviewed-by: Juan A. Suarez <jasuarez at igalia.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/16313>

---

 src/broadcom/vulkan/v3dv_pipeline_cache.c | 7 +++++++
 src/broadcom/vulkan/v3dv_private.h        | 1 +
 2 files changed, 8 insertions(+)

diff --git a/src/broadcom/vulkan/v3dv_pipeline_cache.c b/src/broadcom/vulkan/v3dv_pipeline_cache.c
index 9a78d30a5ba..a61a57fa166 100644
--- a/src/broadcom/vulkan/v3dv_pipeline_cache.c
+++ b/src/broadcom/vulkan/v3dv_pipeline_cache.c
@@ -61,6 +61,8 @@ cache_dump_stats(struct v3dv_pipeline_cache *cache)
    fprintf(stderr, "  cache entries:      %d\n", cache->stats.count);
    fprintf(stderr, "  cache miss count:   %d\n", cache->stats.miss);
    fprintf(stderr, "  cache hit  count:   %d\n", cache->stats.hit);
+
+   fprintf(stderr, "  on-disk cache hit  count:   %d\n", cache->stats.on_disk_hit);
 }
 
 static void
@@ -326,6 +328,11 @@ v3dv_pipeline_cache_search_for_pipeline(struct v3dv_pipeline_cache *cache,
          free(buffer);
 
          if (shared_data) {
+            /* Technically we could increase on_disk_hit as soon as we have a
+             * buffer, but we are more interested on hits that got a valid
+             * shared_data
+             */
+            cache->stats.on_disk_hit++;
             if (cache)
                pipeline_cache_upload_shared_data(cache, shared_data, true);
             return shared_data;
diff --git a/src/broadcom/vulkan/v3dv_private.h b/src/broadcom/vulkan/v3dv_private.h
index b8bb4254d6b..411047b50de 100644
--- a/src/broadcom/vulkan/v3dv_private.h
+++ b/src/broadcom/vulkan/v3dv_private.h
@@ -320,6 +320,7 @@ struct v3dv_pipeline_cache_stats {
    uint32_t miss;
    uint32_t hit;
    uint32_t count;
+   uint32_t on_disk_hit;
 };
 
 /* Equivalent to gl_shader_stage, but including the coordinate shaders



More information about the mesa-commit mailing list