ir3, turnip, freedreno: Report stp/ldp in shader stats
authorConnor Abbott <cwabbott0@gmail.com>
Fri, 23 Jul 2021 12:06:04 +0000 (14:06 +0200)
committerMarge Bot <eric+marge@anholt.net>
Fri, 20 Aug 2021 10:37:36 +0000 (10:37 +0000)
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
src/freedreno/ir3/ir3.h
src/freedreno/vulkan/tu_pipeline.c
src/gallium/drivers/freedreno/ir3/ir3_gallium.c

index c3cc917..ed04c36 100644 (file)
@@ -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))
index e0c678b..9981ece 100644 (file)
@@ -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)
index fc4afd9..6e94f98 100644 (file)
@@ -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);
 }
 
index ee24f11..3ed1f75 100644 (file)
@@ -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);
 }