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 01a7bbc7dc6ce0e4580d0a33964fd04378de5646..e59f10dab9368be0dae97c158772660b6817f554 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 6ef0683ab00f07b8bb5d27ead310d5cf87ec0e7e..b8e41718da48e205c7f4e6501ef176571c869de6 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 5d67d4877f55c3463ec3924a0025c3a48dc5e91f..3d6cae9f80ee31b50a0e1d3fee6ed3d4527a235d 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: