diff options
author | Marek Olšák <[email protected]> | 2020-01-15 21:17:51 -0500 |
---|---|---|
committer | Marek Olšák <[email protected]> | 2020-01-24 20:29:29 -0500 |
commit | c046551e60342616a0a216bf1fb54b92b9d7313f (patch) | |
tree | e213a50b508616bf705e63ba4a0183b95b3e7e91 /src/gallium/drivers/radeonsi | |
parent | 2fd3bb23ab7eb2fc7f911fceda7c5d4e86f451ae (diff) |
radeonsi: print shader cache stats with AMD_DEBUG=cache_stats
Reviewed-by: Pierre-Eric Pelloux-Prayer <[email protected]>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/merge_requests/2929>
Diffstat (limited to 'src/gallium/drivers/radeonsi')
-rw-r--r-- | src/gallium/drivers/radeonsi/si_pipe.c | 13 | ||||
-rw-r--r-- | src/gallium/drivers/radeonsi/si_pipe.h | 6 | ||||
-rw-r--r-- | src/gallium/drivers/radeonsi/si_query.c | 4 | ||||
-rw-r--r-- | src/gallium/drivers/radeonsi/si_state_shaders.c | 6 |
4 files changed, 24 insertions, 5 deletions
diff --git a/src/gallium/drivers/radeonsi/si_pipe.c b/src/gallium/drivers/radeonsi/si_pipe.c index 55bd2b0324f..a11902e6031 100644 --- a/src/gallium/drivers/radeonsi/si_pipe.c +++ b/src/gallium/drivers/radeonsi/si_pipe.c @@ -80,6 +80,7 @@ static const struct debug_named_value debug_options[] = { { "tex", DBG(TEX), "Print texture info" }, { "compute", DBG(COMPUTE), "Print compute info" }, { "vm", DBG(VM), "Print virtual addresses when creating resources" }, + { "cache_stats", DBG(CACHE_STATS), "Print shader cache statistics." }, /* Driver options: */ { "forcedma", DBG(FORCE_SDMA), "Use SDMA for all operations when possible." }, @@ -771,6 +772,18 @@ static void si_destroy_screen(struct pipe_screen* pscreen) if (!sscreen->ws->unref(sscreen->ws)) return; + if (sscreen->debug_flags & DBG(CACHE_STATS)) { + printf("live shader cache: hits = %u, misses = %u\n", + sscreen->live_shader_cache.hits, + sscreen->live_shader_cache.misses); + printf("memory shader cache: hits = %u, misses = %u\n", + sscreen->num_memory_shader_cache_hits, + sscreen->num_memory_shader_cache_misses); + printf("disk shader cache: hits = %u, misses = %u\n", + sscreen->num_disk_shader_cache_hits, + sscreen->num_disk_shader_cache_misses); + } + simple_mtx_destroy(&sscreen->aux_context_lock); struct u_log_context *aux_log = ((struct si_context *)sscreen->aux_context)->log; diff --git a/src/gallium/drivers/radeonsi/si_pipe.h b/src/gallium/drivers/radeonsi/si_pipe.h index 523385228cc..ed25c14f740 100644 --- a/src/gallium/drivers/radeonsi/si_pipe.h +++ b/src/gallium/drivers/radeonsi/si_pipe.h @@ -169,6 +169,7 @@ enum { DBG_TEX, DBG_COMPUTE, DBG_VM, + DBG_CACHE_STATS, /* Driver options: */ DBG_FORCE_SDMA, @@ -540,7 +541,10 @@ struct si_screen { * are loading shaders on demand. This is a monotonic counter. */ unsigned num_shaders_created; - unsigned num_shader_cache_hits; + unsigned num_memory_shader_cache_hits; + unsigned num_memory_shader_cache_misses; + unsigned num_disk_shader_cache_hits; + unsigned num_disk_shader_cache_misses; /* GPU load thread. */ simple_mtx_t gpu_load_mutex; diff --git a/src/gallium/drivers/radeonsi/si_query.c b/src/gallium/drivers/radeonsi/si_query.c index 8776dde4521..d0f7986d4b4 100644 --- a/src/gallium/drivers/radeonsi/si_query.c +++ b/src/gallium/drivers/radeonsi/si_query.c @@ -251,7 +251,7 @@ static bool si_query_sw_begin(struct si_context *sctx, break; case SI_QUERY_NUM_SHADER_CACHE_HITS: query->begin_result = - p_atomic_read(&sctx->screen->num_shader_cache_hits); + p_atomic_read(&sctx->screen->num_memory_shader_cache_hits); break; case SI_QUERY_PD_NUM_PRIMS_ACCEPTED: query->begin_result = sctx->compute_num_verts_accepted; @@ -425,7 +425,7 @@ static bool si_query_sw_end(struct si_context *sctx, break; case SI_QUERY_NUM_SHADER_CACHE_HITS: query->end_result = - p_atomic_read(&sctx->screen->num_shader_cache_hits); + p_atomic_read(&sctx->screen->num_memory_shader_cache_hits); break; case SI_QUERY_PD_NUM_PRIMS_ACCEPTED: query->end_result = sctx->compute_num_verts_accepted; diff --git a/src/gallium/drivers/radeonsi/si_state_shaders.c b/src/gallium/drivers/radeonsi/si_state_shaders.c index 18cc1bd265a..fcf99088164 100644 --- a/src/gallium/drivers/radeonsi/si_state_shaders.c +++ b/src/gallium/drivers/radeonsi/si_state_shaders.c @@ -246,10 +246,11 @@ bool si_shader_cache_load_shader(struct si_screen *sscreen, if (entry) { if (si_load_shader_binary(shader, entry->data)) { - p_atomic_inc(&sscreen->num_shader_cache_hits); + p_atomic_inc(&sscreen->num_memory_shader_cache_hits); return true; } } + p_atomic_inc(&sscreen->num_memory_shader_cache_misses); if (!sscreen->disk_shader_cache) return false; @@ -268,7 +269,7 @@ bool si_shader_cache_load_shader(struct si_screen *sscreen, free(buffer); si_shader_cache_insert_shader(sscreen, ir_sha1_cache_key, shader, false); - p_atomic_inc(&sscreen->num_shader_cache_hits); + p_atomic_inc(&sscreen->num_disk_shader_cache_hits); return true; } } else { @@ -281,6 +282,7 @@ bool si_shader_cache_load_shader(struct si_screen *sscreen, } free(buffer); + p_atomic_inc(&sscreen->num_disk_shader_cache_misses); return false; } |