From: Rob Clark Date: Wed, 4 Mar 2020 18:51:10 +0000 (-0800) Subject: freedreno/ir3: add simplified stall estimation X-Git-Url: https://git.libre-soc.org/?a=commitdiff_plain;h=752b9985bed171a39bb439421d0e2cd8d0ab82aa;p=mesa.git 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 Part-of: --- diff --git a/src/freedreno/ir3/ir3.c b/src/freedreno/ir3/ir3.c index 0dbe9bba460..bf842701868 100644 --- a/src/freedreno/ir3/ir3.c +++ b/src/freedreno/ir3/ir3.c @@ -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--; + } } } diff --git a/src/freedreno/ir3/ir3.h b/src/freedreno/ir3/ir3.h index b66d8e2d6fd..1a3edbc4530 100644 --- a/src/freedreno/ir3/ir3.h +++ b/src/freedreno/ir3/ir3.h @@ -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 */ }; diff --git a/src/gallium/drivers/freedreno/ir3/ir3_gallium.c b/src/gallium/drivers/freedreno/ir3/ir3_gallium.c index 5a47376c14e..9ad67d2ec9b 100644 --- a/src/gallium/drivers/freedreno/ir3/ir3_gallium.c +++ b/src/gallium/drivers/freedreno/ir3/ir3_gallium.c @@ -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); }