radeonsi: expose shader cache stats to the HUD
authorMarek Olšák <marek.olsak@amd.com>
Thu, 16 Jan 2020 21:50:06 +0000 (16:50 -0500)
committerMarek Olšák <marek.olsak@amd.com>
Sat, 25 Jan 2020 01:29:29 +0000 (20:29 -0500)
Reviewed-by: Pierre-Eric Pelloux-Prayer <pierre-eric.pelloux-prayer@amd.com>
Tested-by: Marge Bot <https://gitlab.freedesktop.org/mesa/mesa/merge_requests/2929>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/merge_requests/2929>

src/gallium/drivers/radeonsi/si_query.c
src/gallium/drivers/radeonsi/si_query.h

index d0f7986d4b4c4679aa62cb4e1f628f5f09e4cd6f..bf80862e095639a2bfaff2efdbd53870d517b09d 100644 (file)
@@ -249,9 +249,23 @@ static bool si_query_sw_begin(struct si_context *sctx,
        case SI_QUERY_NUM_SHADERS_CREATED:
                query->begin_result = p_atomic_read(&sctx->screen->num_shaders_created);
                break;
-       case SI_QUERY_NUM_SHADER_CACHE_HITS:
-               query->begin_result =
-                       p_atomic_read(&sctx->screen->num_memory_shader_cache_hits);
+       case SI_QUERY_LIVE_SHADER_CACHE_HITS:
+               query->begin_result = sctx->screen->live_shader_cache.hits;
+               break;
+       case SI_QUERY_LIVE_SHADER_CACHE_MISSES:
+               query->begin_result = sctx->screen->live_shader_cache.misses;
+               break;
+       case SI_QUERY_MEMORY_SHADER_CACHE_HITS:
+               query->begin_result = sctx->screen->num_memory_shader_cache_hits;
+               break;
+       case SI_QUERY_MEMORY_SHADER_CACHE_MISSES:
+               query->begin_result = sctx->screen->num_memory_shader_cache_misses;
+               break;
+       case SI_QUERY_DISK_SHADER_CACHE_HITS:
+               query->begin_result = sctx->screen->num_disk_shader_cache_hits;
+               break;
+       case SI_QUERY_DISK_SHADER_CACHE_MISSES:
+               query->begin_result = sctx->screen->num_disk_shader_cache_misses;
                break;
        case SI_QUERY_PD_NUM_PRIMS_ACCEPTED:
                query->begin_result = sctx->compute_num_verts_accepted;
@@ -423,9 +437,23 @@ static bool si_query_sw_end(struct si_context *sctx,
        case SI_QUERY_BACK_BUFFER_PS_DRAW_RATIO:
                query->end_result = sctx->last_tex_ps_draw_ratio;
                break;
-       case SI_QUERY_NUM_SHADER_CACHE_HITS:
-               query->end_result =
-                       p_atomic_read(&sctx->screen->num_memory_shader_cache_hits);
+       case SI_QUERY_LIVE_SHADER_CACHE_HITS:
+               query->end_result = sctx->screen->live_shader_cache.hits;
+               break;
+       case SI_QUERY_LIVE_SHADER_CACHE_MISSES:
+               query->end_result = sctx->screen->live_shader_cache.misses;
+               break;
+       case SI_QUERY_MEMORY_SHADER_CACHE_HITS:
+               query->end_result = sctx->screen->num_memory_shader_cache_hits;
+               break;
+       case SI_QUERY_MEMORY_SHADER_CACHE_MISSES:
+               query->end_result = sctx->screen->num_memory_shader_cache_misses;
+               break;
+       case SI_QUERY_DISK_SHADER_CACHE_HITS:
+               query->end_result = sctx->screen->num_disk_shader_cache_hits;
+               break;
+       case SI_QUERY_DISK_SHADER_CACHE_MISSES:
+               query->end_result = sctx->screen->num_disk_shader_cache_misses;
                break;
        case SI_QUERY_PD_NUM_PRIMS_ACCEPTED:
                query->end_result = sctx->compute_num_verts_accepted;
@@ -1720,7 +1748,6 @@ void si_resume_queries(struct si_context *sctx)
 static struct pipe_driver_query_info si_driver_query_list[] = {
        X("num-compilations",           NUM_COMPILATIONS,       UINT64, CUMULATIVE),
        X("num-shaders-created",        NUM_SHADERS_CREATED,    UINT64, CUMULATIVE),
-       X("num-shader-cache-hits",      NUM_SHADER_CACHE_HITS,  UINT64, CUMULATIVE),
        X("draw-calls",                 DRAW_CALLS,             UINT64, AVERAGE),
        X("decompress-calls",           DECOMPRESS_CALLS,       UINT64, AVERAGE),
        X("MRT-draw-calls",             MRT_DRAW_CALLS,         UINT64, AVERAGE),
@@ -1760,6 +1787,12 @@ static struct pipe_driver_query_info si_driver_query_list[] = {
        X("VRAM-vis-usage",             VRAM_VIS_USAGE,         BYTES, AVERAGE),
        X("GTT-usage",                  GTT_USAGE,              BYTES, AVERAGE),
        X("back-buffer-ps-draw-ratio",  BACK_BUFFER_PS_DRAW_RATIO, UINT64, AVERAGE),
+       X("live-shader-cache-hits",     LIVE_SHADER_CACHE_HITS, UINT, CUMULATIVE),
+       X("live-shader-cache-misses",   LIVE_SHADER_CACHE_MISSES, UINT, CUMULATIVE),
+       X("memory-shader-cache-hits",   MEMORY_SHADER_CACHE_HITS, UINT, CUMULATIVE),
+       X("memory-shader-cache-misses", MEMORY_SHADER_CACHE_MISSES, UINT, CUMULATIVE),
+       X("disk-shader-cache-hits",     DISK_SHADER_CACHE_HITS, UINT, CUMULATIVE),
+       X("disk-shader-cache-misses",   DISK_SHADER_CACHE_MISSES, UINT, CUMULATIVE),
 
        /* GPIN queries are for the benefit of old versions of GPUPerfStudio,
         * which use it as a fallback path to detect the GPU type.
index dc219f8551c076069104f4e1d9c6f7f4e7301869..6c4386451cceb40c857c8d0bb0c4847ba51e1a56 100644 (file)
@@ -106,7 +106,6 @@ enum {
        SI_QUERY_NUM_COMPILATIONS,
        SI_QUERY_NUM_SHADERS_CREATED,
        SI_QUERY_BACK_BUFFER_PS_DRAW_RATIO,
-       SI_QUERY_NUM_SHADER_CACHE_HITS,
        SI_QUERY_GPIN_ASIC_ID,
        SI_QUERY_GPIN_NUM_SIMD,
        SI_QUERY_GPIN_NUM_RB,
@@ -117,6 +116,12 @@ enum {
        SI_QUERY_PD_NUM_PRIMS_ACCEPTED,
        SI_QUERY_PD_NUM_PRIMS_REJECTED,
        SI_QUERY_PD_NUM_PRIMS_INELIGIBLE,
+       SI_QUERY_LIVE_SHADER_CACHE_HITS,
+       SI_QUERY_LIVE_SHADER_CACHE_MISSES,
+       SI_QUERY_MEMORY_SHADER_CACHE_HITS,
+       SI_QUERY_MEMORY_SHADER_CACHE_MISSES,
+       SI_QUERY_DISK_SHADER_CACHE_HITS,
+       SI_QUERY_DISK_SHADER_CACHE_MISSES,
 
        SI_QUERY_FIRST_PERFCOUNTER = PIPE_QUERY_DRIVER_SPECIFIC + 100,
 };