freedreno/ir3: add mov/cov stats
authorRob Clark <robdclark@chromium.org>
Mon, 16 Mar 2020 13:41:41 +0000 (06:41 -0700)
committerMarge Bot <eric+marge@anholt.net>
Mon, 13 Apr 2020 20:47:28 +0000 (20:47 +0000)
While not always avoidable, cov instructions are a useful thing to look
at to see if we could fold into src.

Signed-off-by: Rob Clark <robdclark@chromium.org>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/4440>

src/freedreno/ir3/ir3.c
src/freedreno/ir3/ir3.h
src/freedreno/ir3/ir3_shader.c
src/gallium/drivers/freedreno/ir3/ir3_gallium.c

index 6b6b83b62cfa30a6a364baa7328f2edf189db0e6..f2dbc88f3bb2bd0470a5891254eb72ee104eac11 100644 (file)
@@ -917,13 +917,11 @@ void * ir3_assemble(struct ir3 *shader, struct ir3_info *info,
 {
        uint32_t *ptr, *dwords;
 
+       memset(info, 0, sizeof(*info));
        info->gpu_id        = gpu_id;
        info->max_reg       = -1;
        info->max_half_reg  = -1;
        info->max_const     = -1;
-       info->instrs_count  = 0;
-       info->sizedwords    = 0;
-       info->ss = info->sy = 0;
 
        foreach_block (block, &shader->block_list) {
                foreach_instr (instr, &block->instr_list) {
@@ -958,6 +956,13 @@ void * ir3_assemble(struct ir3 *shader, struct ir3_info *info,
                        info->nops_count += instr->nop;
                        if (instr->opc == OPC_NOP)
                                info->nops_count += 1 + instr->repeat;
+                       if (instr->opc == OPC_MOV) {
+                               if (instr->cat1.src_type == instr->cat1.dst_type) {
+                                       info->mov_count += 1 + instr->repeat;
+                               } else {
+                                       info->cov_count += 1 + instr->repeat;
+                               }
+                       }
                        dwords += 2;
 
                        if (instr->flags & IR3_INSTR_SS) {
index 4dfcdf0da51d753c74c2a63e475f838ce6de9a4d..65c16791e6277500ff77e252269bdc8fae81b2aa 100644 (file)
@@ -48,6 +48,8 @@ struct ir3_info {
        uint16_t sizedwords;
        uint16_t instrs_count;   /* expanded to account for rpt's */
        uint16_t nops_count;     /* # of nop instructions, including nopN */
+       uint16_t mov_count;
+       uint16_t cov_count;
        /* NOTE: max_reg, etc, does not include registers not touched
         * by the shader (ie. vertex fetched via VFD_DECODE but not
         * touched by shader)
index e42f7713e099418bde2c9ed41d149323df4f0d18..80a56a53aa9dad88e4b1cbd6c98ee4dfa16b9c6e 100644 (file)
@@ -508,11 +508,12 @@ ir3_shader_disasm(struct ir3_shader_variant *so, uint32_t *bin, FILE *out)
        fprintf(out, "\n");
 
        /* print generic shader info: */
-       fprintf(out, "; %s prog %d/%d: %u instr, %u nops, %u non-nops, %u dwords\n",
+       fprintf(out, "; %s prog %d/%d: %u instr, %u nops, %u non-nops, %u mov, %u cov, %u dwords\n",
                        type, so->shader->id, so->id,
                        so->info.instrs_count,
                        so->info.nops_count,
                        so->info.instrs_count - so->info.nops_count,
+                       so->info.mov_count, so->info.cov_count,
                        so->info.sizedwords);
 
        fprintf(out, "; %s prog %d/%d: %u last-baryf, %d half, %d full, %u constlen\n",
index 8fff7da0c5e6219dffaab487f38357898c45e60b..158869a610133a6a142a4ee5edbf75dffaea5d34 100644 (file)
@@ -51,13 +51,15 @@ dump_shader_info(struct ir3_shader_variant *v, bool binning_pass,
                return;
 
        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, "
+                       "%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 sstall, %u (ss), %u (sy), %d max_sun, %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,