Module: Mesa
Branch: master
Commit: dbc86fa3de6aba480f679a36b40227c0fe27c37b
URL:    
http://cgit.freedesktop.org/mesa/mesa/commit/?id=dbc86fa3de6aba480f679a36b40227c0fe27c37b

Author: Pierre-Eric Pelloux-Prayer <[email protected]>
Date:   Fri Mar 27 13:45:08 2020 +0100

radeonsi: dump shader stats when hitting the live cache

With the introduction of the live shader cache, when a shader is
fetched from the cache no stats are printed for shaderdb.
So in a sequence like this: vs1, fs1, vs1, fs2, shaderdb may see
3 or 4 lines, depending on the threads being used.
If one run produces 3 lines while the other produces 4 lines, it
would compare vs1 stats with fs2 stats.

Reviewed-by: Marek Olšák <[email protected]>
Tested-by: Marge Bot 
<https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/4355>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/4355>

---

 src/gallium/drivers/radeonsi/si_state_shaders.c | 22 ++++++++++++++++++++--
 1 file changed, 20 insertions(+), 2 deletions(-)

diff --git a/src/gallium/drivers/radeonsi/si_state_shaders.c 
b/src/gallium/drivers/radeonsi/si_state_shaders.c
index d322cd1f341..8aeba4b9ad1 100644
--- a/src/gallium/drivers/radeonsi/si_state_shaders.c
+++ b/src/gallium/drivers/radeonsi/si_state_shaders.c
@@ -2827,9 +2827,27 @@ static void *si_create_shader_selector(struct 
pipe_context *ctx,
 
 static void *si_create_shader(struct pipe_context *ctx, const struct 
pipe_shader_state *state)
 {
+   struct si_context *sctx = (struct si_context *)ctx;
    struct si_screen *sscreen = (struct si_screen *)ctx->screen;
-
-   return util_live_shader_cache_get(ctx, &sscreen->live_shader_cache, state);
+   bool cache_hit;
+   struct si_shader_selector *sel = (struct si_shader_selector 
*)util_live_shader_cache_get(
+      ctx, &sscreen->live_shader_cache, state, &cache_hit);
+
+   if (sel && cache_hit && sctx->debug.debug_message) {
+      if (sel->main_shader_part)
+         si_shader_dump_stats_for_shader_db(sscreen, sel->main_shader_part, 
&sctx->debug);
+      if (sel->main_shader_part_ls)
+         si_shader_dump_stats_for_shader_db(sscreen, sel->main_shader_part_ls, 
&sctx->debug);
+      if (sel->main_shader_part_es)
+         si_shader_dump_stats_for_shader_db(sscreen, sel->main_shader_part_es, 
&sctx->debug);
+      if (sel->main_shader_part_ngg)
+         si_shader_dump_stats_for_shader_db(sscreen, 
sel->main_shader_part_ngg, &sctx->debug);
+      if (sel->main_shader_part_ngg_es)
+         si_shader_dump_stats_for_shader_db(sscreen, 
sel->main_shader_part_ngg_es, &sctx->debug);
+      if (sel->gs_copy_shader)
+         si_shader_dump_stats_for_shader_db(sscreen, sel->gs_copy_shader, 
&sctx->debug);
+   }
+   return sel;
 }
 
 static void si_update_streamout_state(struct si_context *sctx)

_______________________________________________
mesa-commit mailing list
[email protected]
https://lists.freedesktop.org/mailman/listinfo/mesa-commit

Reply via email to