freedreno/ir3: print # of sync bits for shaderdb
authorRob Clark <robdclark@gmail.com>
Mon, 29 Jan 2018 20:28:10 +0000 (15:28 -0500)
committerRob Clark <robdclark@gmail.com>
Sat, 10 Feb 2018 19:54:58 +0000 (14:54 -0500)
When trying to optimize to reduce stalls, it is nice to see this info.

Signed-off-by: Rob Clark <robdclark@gmail.com>
src/gallium/drivers/freedreno/ir3/ir3.c
src/gallium/drivers/freedreno/ir3/ir3.h
src/gallium/drivers/freedreno/ir3/ir3_shader.c

index 01a7bbc..e59f10d 100644 (file)
@@ -683,6 +683,7 @@ void * ir3_assemble(struct ir3 *shader, struct ir3_info *info,
        info->max_const     = -1;
        info->instrs_count  = 0;
        info->sizedwords    = 0;
+       info->ss = info->sy = 0;
 
        list_for_each_entry (struct ir3_block, block, &shader->block_list, node) {
                list_for_each_entry (struct ir3_instruction, instr, &block->instr_list, node) {
@@ -709,6 +710,12 @@ void * ir3_assemble(struct ir3 *shader, struct ir3_info *info,
                                goto fail;
                        info->instrs_count += 1 + instr->repeat;
                        dwords += 2;
+
+                       if (instr->flags & IR3_INSTR_SS)
+                               info->ss++;
+
+                       if (instr->flags & IR3_INSTR_SY)
+                               info->sy++;
                }
        }
 
index 6ef0683..b8e4171 100644 (file)
@@ -51,6 +51,9 @@ struct ir3_info {
        int8_t   max_reg;   /* highest GPR # used by shader */
        int8_t   max_half_reg;
        int16_t  max_const;
+
+       /* number of sync bits: */
+       uint16_t ss, sy;
 };
 
 struct ir3_register {
index 5d67d48..3d6cae9 100644 (file)
@@ -169,7 +169,8 @@ dump_shader_info(struct ir3_shader_variant *v, struct pipe_debug_callback *debug
        pipe_debug_message(debug, SHADER_INFO, "\n"
                        "SHADER-DB: %s prog %d/%d: %u instructions, %u dwords\n"
                        "SHADER-DB: %s prog %d/%d: %u half, %u full\n"
-                       "SHADER-DB: %s prog %d/%d: %u const, %u constlen\n",
+                       "SHADER-DB: %s prog %d/%d: %u const, %u constlen\n"
+                       "SHADER-DB: %s prog %d/%d: %u (ss), %u (sy)\n",
                        ir3_shader_stage(v->shader),
                        v->shader->id, v->id,
                        v->info.instrs_count,
@@ -181,7 +182,10 @@ dump_shader_info(struct ir3_shader_variant *v, struct pipe_debug_callback *debug
                        ir3_shader_stage(v->shader),
                        v->shader->id, v->id,
                        v->info.max_const + 1,
-                       v->constlen);
+                       v->constlen,
+                       ir3_shader_stage(v->shader),
+                       v->shader->id, v->id,
+                       v->info.ss, v->info.sy);
 }
 
 static struct ir3_shader_variant *
@@ -486,6 +490,8 @@ ir3_shader_disasm(struct ir3_shader_variant *so, uint32_t *bin)
                        so->info.max_const + 1,
                        so->constlen);
 
+       debug_printf("; %u (ss), %u (sy)\n", so->info.ss, so->info.sy);
+
        /* print shader type specific info: */
        switch (so->type) {
        case SHADER_VERTEX: