From: Rob Clark Date: Thu, 6 Aug 2020 16:24:50 +0000 (-0700) Subject: freedreno/ir3: add tracking for # of instructions per category X-Git-Url: https://git.libre-soc.org/?a=commitdiff_plain;h=7aa74ab7921606940844a2da16b455330eedc53f;p=mesa.git freedreno/ir3: add tracking for # of instructions per category Signed-off-by: Rob Clark Part-of: --- diff --git a/src/freedreno/ir3/ir3.c b/src/freedreno/ir3/ir3.c index 124b41f9a3a..c8d066088b4 100644 --- a/src/freedreno/ir3/ir3.c +++ b/src/freedreno/ir3/ir3.c @@ -954,10 +954,17 @@ void * ir3_assemble(struct ir3_shader_variant *v) if ((instr->opc == OPC_BARY_F) && (instr->regs[0]->flags & IR3_REG_EI)) info->last_baryf = info->instrs_count; - info->instrs_count += 1 + instr->repeat + instr->nop; - info->nops_count += instr->nop; - if (instr->opc == OPC_NOP) - info->nops_count += 1 + instr->repeat; + unsigned instrs_count = 1 + instr->repeat + instr->nop; + unsigned nops_count = instr->nop; + + if (instr->opc == OPC_NOP) { + nops_count = 1 + instr->repeat; + info->instrs_per_cat[0] += nops_count; + } else { + info->instrs_per_cat[opc_cat(instr->opc)] += instrs_count; + info->instrs_per_cat[0] += nops_count; + } + if (instr->opc == OPC_MOV) { if (instr->cat1.src_type == instr->cat1.dst_type) { info->mov_count += 1 + instr->repeat; @@ -965,6 +972,10 @@ void * ir3_assemble(struct ir3_shader_variant *v) info->cov_count += 1 + instr->repeat; } } + + info->instrs_count += instrs_count; + info->nops_count += nops_count; + dwords += 2; if (instr->flags & IR3_INSTR_SS) { diff --git a/src/freedreno/ir3/ir3.h b/src/freedreno/ir3/ir3.h index 2f5423238e0..cb42636f285 100644 --- a/src/freedreno/ir3/ir3.h +++ b/src/freedreno/ir3/ir3.h @@ -65,6 +65,9 @@ struct ir3_info { uint16_t sstall; uint16_t last_baryf; /* instruction # of last varying fetch */ + + /* Number of instructions of a given category: */ + uint16_t instrs_per_cat[8]; }; struct ir3_register { diff --git a/src/freedreno/ir3/ir3_shader.c b/src/freedreno/ir3/ir3_shader.c index f91c4508c6a..519fafec900 100644 --- a/src/freedreno/ir3/ir3_shader.c +++ b/src/freedreno/ir3/ir3_shader.c @@ -615,6 +615,17 @@ ir3_shader_disasm(struct ir3_shader_variant *so, uint32_t *bin, FILE *out) so->info.max_reg + 1, so->constlen); + fprintf(out, "; %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], + so->info.instrs_per_cat[5], + so->info.instrs_per_cat[6], + so->info.instrs_per_cat[7]); + fprintf(out, "; %s prog %d/%d: %u sstall, %u (ss), %u (sy), %d max_sun, %d loops\n", type, so->shader->id, so->id, so->info.sstall, diff --git a/src/gallium/drivers/freedreno/ir3/ir3_gallium.c b/src/gallium/drivers/freedreno/ir3/ir3_gallium.c index af307906896..810c3b2051e 100644 --- a/src/gallium/drivers/freedreno/ir3/ir3_gallium.c +++ b/src/gallium/drivers/freedreno/ir3/ir3_gallium.c @@ -52,6 +52,7 @@ dump_shader_info(struct ir3_shader_variant *v, struct pipe_debug_callback *debug pipe_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 cat0, %u cat1, %u cat2, %u cat3, %u cat4, %u cat5, %u cat6, %u cat7, " "%u sstall, %u (ss), %u (sy), %d max_sun, %d loops\n", ir3_shader_stage(v), v->info.instrs_count, @@ -64,6 +65,14 @@ dump_shader_info(struct ir3_shader_variant *v, struct pipe_debug_callback *debug 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], + v->info.instrs_per_cat[6], + v->info.instrs_per_cat[7], v->info.sstall, v->info.ss, v->info.sy, v->max_sun, v->loops);