Mesa (main): ir3, turnip, freedreno: Report stp/ldp in shader stats

GitLab Mirror gitlab-mirror at kemper.freedesktop.org
Fri Aug 20 10:57:11 UTC 2021


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

Author: Connor Abbott <cwabbott0 at gmail.com>
Date:   Fri Jul 23 14:06:04 2021 +0200

ir3, turnip, freedreno: Report stp/ldp in shader stats

This is important after spilling, so that we get an indication when a
change causes spilling.

Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/12033>

---

 src/freedreno/ir3/ir3.c                         |  5 +++++
 src/freedreno/ir3/ir3.h                         |  2 ++
 src/freedreno/vulkan/tu_pipeline.c              | 18 ++++++++++++++++++
 src/gallium/drivers/freedreno/ir3/ir3_gallium.c |  6 ++++--
 4 files changed, 29 insertions(+), 2 deletions(-)

diff --git a/src/freedreno/ir3/ir3.c b/src/freedreno/ir3/ir3.c
index c3cc917c368..ed04c36f037 100644
--- a/src/freedreno/ir3/ir3.c
+++ b/src/freedreno/ir3/ir3.c
@@ -266,6 +266,11 @@ ir3_collect_info(struct ir3_shader_variant *v)
             if (components * type_size(instr->cat6.type) > 32) {
                info->multi_dword_ldp_stp = true;
             }
+
+            if (instr->opc == OPC_STP)
+               info->stp_count += components;
+            else
+               info->ldp_count += components;
          }
 
          if ((instr->opc == OPC_BARY_F) && (instr->dsts[0]->flags & IR3_REG_EI))
diff --git a/src/freedreno/ir3/ir3.h b/src/freedreno/ir3/ir3.h
index e0c678b0534..9981ece8fb6 100644
--- a/src/freedreno/ir3/ir3.h
+++ b/src/freedreno/ir3/ir3.h
@@ -57,6 +57,8 @@ struct ir3_info {
    uint16_t nops_count;   /* # of nop instructions, including nopN */
    uint16_t mov_count;
    uint16_t cov_count;
+   uint16_t stp_count;
+   uint16_t ldp_count;
    /* NOTE: max_reg, etc, does not include registers not touched
     * by the shader (ie. vertex fetched via VFD_DECODE but not
     * touched by shader)
diff --git a/src/freedreno/vulkan/tu_pipeline.c b/src/freedreno/vulkan/tu_pipeline.c
index fc4afd9e9fd..6e94f987c59 100644
--- a/src/freedreno/vulkan/tu_pipeline.c
+++ b/src/freedreno/vulkan/tu_pipeline.c
@@ -3489,6 +3489,24 @@ tu_GetPipelineExecutableStatisticsKHR(
       }
    }
 
+   vk_outarray_append(&out, stat) {
+      WRITE_STR(stat->name, "STP Count");
+      WRITE_STR(stat->description,
+                "Number of STore Private instructions in the final generated "
+                "shader executable.");
+      stat->format = VK_PIPELINE_EXECUTABLE_STATISTIC_FORMAT_UINT64_KHR;
+      stat->value.u64 = exe->stats.stp_count;
+   }
+
+   vk_outarray_append(&out, stat) {
+      WRITE_STR(stat->name, "LDP Count");
+      WRITE_STR(stat->description,
+                "Number of LoaD Private instructions in the final generated "
+                "shader executable.");
+      stat->format = VK_PIPELINE_EXECUTABLE_STATISTIC_FORMAT_UINT64_KHR;
+      stat->value.u64 = exe->stats.ldp_count;
+   }
+
    return vk_outarray_status(&out);
 }
 
diff --git a/src/gallium/drivers/freedreno/ir3/ir3_gallium.c b/src/gallium/drivers/freedreno/ir3/ir3_gallium.c
index ee24f1192e4..3ed1f75dc3e 100644
--- a/src/gallium/drivers/freedreno/ir3/ir3_gallium.c
+++ b/src/gallium/drivers/freedreno/ir3/ir3_gallium.c
@@ -84,7 +84,8 @@ dump_shader_info(struct ir3_shader_variant *v,
       "%s shader: %u inst, %u nops, %u non-nops, %u mov, %u cov, "
       "%u dwords, %u last-baryf, %u half, %u full, %u constlen, "
       "%u cat0, %u cat1, %u cat2, %u cat3, %u cat4, %u cat5, %u cat6, %u cat7, "
-      "%u sstall, %u (ss), %u (sy), %d waves, %d max_sun, %d loops\n",
+      "%u stp, %u ldp, %u sstall, %u (ss), %u (sy), %d waves, %d max_sun, "
+      "%d loops\n",
       ir3_shader_stage(v), v->info.instrs_count, v->info.nops_count,
       v->info.instrs_count - v->info.nops_count, v->info.mov_count,
       v->info.cov_count, v->info.sizedwords, v->info.last_baryf,
@@ -92,7 +93,8 @@ dump_shader_info(struct ir3_shader_variant *v,
       v->info.instrs_per_cat[0], v->info.instrs_per_cat[1],
       v->info.instrs_per_cat[2], v->info.instrs_per_cat[3],
       v->info.instrs_per_cat[4], v->info.instrs_per_cat[5],
-      v->info.instrs_per_cat[6], v->info.instrs_per_cat[7], v->info.sstall,
+      v->info.instrs_per_cat[6], v->info.instrs_per_cat[7],
+      v->info.stp_count, v->info.ldp_count, v->info.sstall,
       v->info.ss, v->info.sy, v->info.max_waves, v->max_sun, v->loops);
 }
 



More information about the mesa-commit mailing list