From 0b39f4ab42e2073a8039fd039f88db4331564ccf Mon Sep 17 00:00:00 2001 From: Connor Abbott Date: Fri, 23 Jul 2021 14:06:04 +0200 Subject: [PATCH] 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: --- 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 c3cc917..ed04c36 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 e0c678b..9981ece 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 fc4afd9..6e94f98 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 ee24f11..3ed1f75 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); } -- 2.7.4