diff --git a/src/freedreno/ir3/ir3.c b/src/freedreno/ir3/ir3.c index 8af7d85fcb0..914b532d069 100644 --- a/src/freedreno/ir3/ir3.c +++ b/src/freedreno/ir3/ir3.c @@ -374,6 +374,9 @@ ir3_collect_info(struct ir3_shader_variant *v) int n = MIN2(mem_delay, 1 + instr->repeat + instr->nop); mem_delay -= n; } + } else { + unsigned instrs_count = 1 + instr->repeat + instr->nop; + info->preamble_instrs_count += instrs_count; } if (instr->opc == OPC_SHPE) diff --git a/src/freedreno/ir3/ir3.h b/src/freedreno/ir3/ir3.h index accb8cc97a7..9100108ecd8 100644 --- a/src/freedreno/ir3/ir3.h +++ b/src/freedreno/ir3/ir3.h @@ -38,6 +38,7 @@ struct ir3_info { /* Size in dwords of the instructions. */ uint16_t sizedwords; uint16_t instrs_count; /* expanded to account for rpt's */ + uint16_t preamble_instrs_count; uint16_t nops_count; /* # of nop instructions, including nopN */ uint16_t mov_count; uint16_t cov_count; diff --git a/src/freedreno/ir3/ir3_shader.c b/src/freedreno/ir3/ir3_shader.c index c3d5ede4160..ef00c897843 100644 --- a/src/freedreno/ir3/ir3_shader.c +++ b/src/freedreno/ir3/ir3_shader.c @@ -930,7 +930,7 @@ ir3_shader_disasm(struct ir3_shader_variant *so, uint32_t *bin, FILE *out) fprintf( out, - "; %s prog %d/%d: %u cat0, %u cat1, %u cat2, %u cat3, %u cat4, %u cat5, %u cat6, %u cat7, \n", + "; %s prog %d/%d: %u cat0, %u cat1, %u cat2, %u cat3, %u cat4, %u cat5, %u cat6, %u cat7\n", type, so->shader_id, so->id, so->info.instrs_per_cat[0], so->info.instrs_per_cat[1], so->info.instrs_per_cat[2], so->info.instrs_per_cat[3], so->info.instrs_per_cat[4], @@ -943,6 +943,12 @@ ir3_shader_disasm(struct ir3_shader_variant *so, uint32_t *bin, FILE *out) type, so->shader_id, so->id, so->info.sstall, so->info.ss, so->info.systall, so->info.sy, so->loops); + if (so->info.preamble_instrs_count) { + fprintf( + out, "; %u preamble instr, %s preamble\n", + so->info.preamble_instrs_count, so->info.early_preamble ? "early" : "late"); + } + /* print shader type specific info: */ switch (so->type) { case MESA_SHADER_VERTEX: diff --git a/src/freedreno/vulkan/tu_pipeline.cc b/src/freedreno/vulkan/tu_pipeline.cc index 0c04f9b7e71..9d8383f4a7f 100644 --- a/src/freedreno/vulkan/tu_pipeline.cc +++ b/src/freedreno/vulkan/tu_pipeline.cc @@ -4816,6 +4816,14 @@ tu_GetPipelineExecutableStatisticsKHR( stat->value.u64 = exe->stats.ldp_count; } + vk_outarray_append_typed(VkPipelineExecutableStatisticKHR, &out, stat) { + WRITE_STR(stat->name, "Preamble Instruction Count"); + WRITE_STR(stat->description, + "Total number of IR3 instructions in the preamble."); + stat->format = VK_PIPELINE_EXECUTABLE_STATISTIC_FORMAT_UINT64_KHR; + stat->value.u64 = exe->stats.preamble_instrs_count; + } + vk_outarray_append_typed(VkPipelineExecutableStatisticKHR, &out, stat) { WRITE_STR(stat->name, "Early preamble"); WRITE_STR(stat->description, diff --git a/src/gallium/drivers/freedreno/ir3/ir3_gallium.c b/src/gallium/drivers/freedreno/ir3/ir3_gallium.c index 6eeac058cd8..4b15501d362 100644 --- a/src/gallium/drivers/freedreno/ir3/ir3_gallium.c +++ b/src/gallium/drivers/freedreno/ir3/ir3_gallium.c @@ -68,7 +68,7 @@ dump_shader_info(struct ir3_shader_variant *v, "%u dwords, %u last-baryf, %u last-helper, %u half, %u full, %u constlen, " "%u cat0, %u cat1, %u cat2, %u cat3, %u cat4, %u cat5, %u cat6, %u cat7, " "%u stp, %u ldp, %u sstall, %u (ss), %u systall, %u (sy), %d waves, " - "%d loops\n", + "%d loops, %u preamble inst, %s preamble\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, @@ -79,7 +79,8 @@ dump_shader_info(struct ir3_shader_variant *v, 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.stp_count, v->info.ldp_count, v->info.sstall, - v->info.ss, v->info.systall, v->info.sy, v->info.max_waves, v->loops); + v->info.ss, v->info.systall, v->info.sy, v->info.max_waves, v->loops, + v->info.preamble_instrs_count, v->info.early_preamble ? "early" : "late"); } static void