freedreno/ir3: add simplified stall estimation

Doesn't take into account stalls that result from a register written in
a different block, etc.  But this should be more useful than just using
number of (ss)'s by trying to estimate how costly a given sync is.

Signed-off-by: Rob Clark <robdclark@chromium.org>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/4071>
This commit is contained in:
Rob Clark
2020-03-04 10:51:10 -08:00
committed by Marge Bot
parent 64ae2ef8bb
commit 752b9985be
3 changed files with 16 additions and 2 deletions
+11 -1
View File
@@ -911,6 +911,8 @@ void * ir3_assemble(struct ir3 *shader, struct ir3_info *info,
ptr = dwords = calloc(4, info->sizedwords);
foreach_block (block, &shader->block_list) {
unsigned sfu_delay = 0;
foreach_instr (instr, &block->instr_list) {
int ret = emit[opc_cat(instr->opc)](instr, dwords, info);
if (ret)
@@ -925,11 +927,19 @@ void * ir3_assemble(struct ir3 *shader, struct ir3_info *info,
info->nops_count += 1 + instr->repeat;
dwords += 2;
if (instr->flags & IR3_INSTR_SS)
if (instr->flags & IR3_INSTR_SS) {
info->ss++;
info->sstall += sfu_delay;
}
if (instr->flags & IR3_INSTR_SY)
info->sy++;
if (is_sfu(instr)) {
sfu_delay = 10;
} else if (sfu_delay > 0) {
sfu_delay--;
}
}
}
+3
View File
@@ -59,6 +59,9 @@ struct ir3_info {
/* number of sync bits: */
uint16_t ss, sy;
/* estimate of number of cycles stalled on (ss) */
uint16_t sstall;
uint16_t last_baryf; /* instruction # of last varying fetch */
};
@@ -53,7 +53,7 @@ dump_shader_info(struct ir3_shader_variant *v, bool binning_pass,
pipe_debug_message(debug, SHADER_INFO,
"%s shader: %u inst, %u nops, %u non-nops, %u dwords, "
"%u last-baryf, %u half, %u full, %u constlen, "
"%u (ss), %u (sy), %d max_sun, %d loops\n",
"%u sstall, %u (ss), %u (sy), %d max_sun, %d loops\n",
ir3_shader_stage(v),
v->info.instrs_count,
v->info.nops_count,
@@ -63,6 +63,7 @@ dump_shader_info(struct ir3_shader_variant *v, bool binning_pass,
v->info.max_half_reg + 1,
v->info.max_reg + 1,
v->constlen,
v->info.sstall,
v->info.ss, v->info.sy,
v->max_sun, v->loops);
}