diff --git a/src/freedreno/ir3/ir3.c b/src/freedreno/ir3/ir3.c index 50e6cd239ce..adfe1f05f28 100644 --- a/src/freedreno/ir3/ir3.c +++ b/src/freedreno/ir3/ir3.c @@ -293,6 +293,7 @@ ir3_collect_info(struct ir3_shader_variant *v) info->sizedwords = info->size / 4; bool in_preamble = false; + bool has_eq = false; foreach_block (block, &shader->block_list) { int sfu_delay = 0, mem_delay = 0; @@ -325,6 +326,15 @@ ir3_collect_info(struct ir3_shader_variant *v) (instr->dsts[0]->flags & IR3_REG_EI)) info->last_baryf = info->instrs_count; + if ((instr->opc == OPC_NOP) && (instr->flags & IR3_INSTR_EQ)) { + info->last_helper = info->instrs_count; + has_eq = true; + } + + if (v->type == MESA_SHADER_FRAGMENT && v->need_pixlod && + instr->opc == OPC_END && !v->prefetch_end_of_quad && !has_eq) + info->last_helper = info->instrs_count; + if (instr->opc == OPC_SHPS) in_preamble = true; diff --git a/src/freedreno/ir3/ir3.h b/src/freedreno/ir3/ir3.h index b4b437125ad..93acf03009a 100644 --- a/src/freedreno/ir3/ir3.h +++ b/src/freedreno/ir3/ir3.h @@ -86,6 +86,8 @@ struct ir3_info { uint16_t last_baryf; /* instruction # of last varying fetch */ + uint16_t last_helper; /* last instruction to use helper invocations */ + /* Number of instructions of a given category: */ uint16_t instrs_per_cat[8]; }; diff --git a/src/freedreno/ir3/ir3_shader.c b/src/freedreno/ir3/ir3_shader.c index 50a05981663..c84f4379975 100644 --- a/src/freedreno/ir3/ir3_shader.c +++ b/src/freedreno/ir3/ir3_shader.c @@ -872,9 +872,10 @@ ir3_shader_disasm(struct ir3_shader_variant *so, uint32_t *bin, FILE *out) so->info.cov_count, so->info.sizedwords); fprintf(out, - "; %s prog %d/%d: %u last-baryf, %d half, %d full, %u constlen\n", + "; %s prog %d/%d: %u last-baryf, %u last-helper, %d half, %d full, %u constlen\n", type, so->shader_id, so->id, so->info.last_baryf, - so->info.max_half_reg + 1, so->info.max_reg + 1, so->constlen); + so->info.last_helper, so->info.max_half_reg + 1, + so->info.max_reg + 1, so->constlen); fprintf( out, diff --git a/src/freedreno/vulkan/tu_pipeline.cc b/src/freedreno/vulkan/tu_pipeline.cc index 77441eb03d8..2a9928c902e 100644 --- a/src/freedreno/vulkan/tu_pipeline.cc +++ b/src/freedreno/vulkan/tu_pipeline.cc @@ -5722,6 +5722,14 @@ tu_GetPipelineExecutableStatisticsKHR( stat->value.u64 = exe->stats.last_baryf; } + vk_outarray_append_typed(VkPipelineExecutableStatisticKHR, &out, stat) { + WRITE_STR(stat->name, "Last helper instruction"); + WRITE_STR(stat->description, + "The instruction where helper invocations are killed"); + stat->format = VK_PIPELINE_EXECUTABLE_STATISTIC_FORMAT_UINT64_KHR; + stat->value.u64 = exe->stats.last_helper; + } + vk_outarray_append_typed(VkPipelineExecutableStatisticKHR, &out, stat) { WRITE_STR(stat->name, "Instructions with SS sync bit"); 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 a5306dadb1e..32aee3b077e 100644 --- a/src/gallium/drivers/freedreno/ir3/ir3_gallium.c +++ b/src/gallium/drivers/freedreno/ir3/ir3_gallium.c @@ -83,14 +83,15 @@ dump_shader_info(struct ir3_shader_variant *v, util_debug_message( debug, SHADER_INFO, "%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 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", 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, - v->info.max_half_reg + 1, v->info.max_reg + 1, v->constlen, + v->info.last_helper, v->info.max_half_reg + 1, v->info.max_reg + 1, + v->constlen, 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],