freedreno/ir3: add scheduler traces
authorRob Clark <robdclark@chromium.org>
Fri, 22 Nov 2019 19:13:19 +0000 (11:13 -0800)
committerRob Clark <robdclark@chromium.org>
Fri, 13 Dec 2019 17:25:40 +0000 (09:25 -0800)
Add some infrastructure to trace scheduler decisions.  The next patch
will add some more traces, just splitting this out to reduce clutter.

Signed-off-by: Rob Clark <robdclark@chromium.org>
src/freedreno/ir3/ir3_compiler.c
src/freedreno/ir3/ir3_compiler.h
src/freedreno/ir3/ir3_print.c
src/freedreno/ir3/ir3_sched.c

index fc81246c5abebfacdb3134df729e8d784e5edb3d..d21f33e5bc56096f253ef866280a6fa9cd540dc4 100644 (file)
@@ -39,6 +39,9 @@ static const struct debug_named_value shader_debug_options[] = {
        {"optmsgs",    IR3_DBG_OPTMSGS,    "Enable optimizer debug messages"},
        {"forces2en",  IR3_DBG_FORCES2EN,  "Force s2en mode for tex sampler instructions"},
        {"nouboopt",   IR3_DBG_NOUBOOPT,   "Disable lowering UBO to uniform"},
+#ifdef DEBUG
+       {"schedmsgs",  IR3_DBG_SCHEDMSGS,  "Enable scheduler debug messages"},
+#endif
        DEBUG_NAMED_VALUE_END
 };
 
index b5e4c3e9c61c967857ddd4cf61fdaa1a0886afd0..c5213a65b089d6ee8a81306b5aead2f193c89d51 100644 (file)
@@ -92,6 +92,7 @@ enum ir3_shader_debug {
        IR3_DBG_OPTMSGS    = 0x080,
        IR3_DBG_FORCES2EN  = 0x100,
        IR3_DBG_NOUBOOPT   = 0x200,
+       IR3_DBG_SCHEDMSGS  = 0x400,
 };
 
 extern enum ir3_shader_debug ir3_shader_debug;
index f760f57e1a8a8f96cc01d38770849ccf2c16f6d6..db4cc98df904228449ae63f3b5cc971cee96fbb6 100644 (file)
@@ -73,6 +73,7 @@ static void print_instr_name(struct ir3_instruction *instr, bool flags)
        printf("%04u:", instr->name);
        printf("%04u:", instr->ip);
        printf("%03d:", instr->depth);
+       printf("%03u: ", instr->use_count);
 
        if (flags) {
                printf("\t");
index 247221d3a03b303aa599009d4789a89670b2c0f7..0756eaf51408d66c0369830ada258f3d323ddd74 100644 (file)
 #include "util/u_math.h"
 
 #include "ir3.h"
+#include "ir3_compiler.h"
+
+#ifdef DEBUG
+#define SCHED_DEBUG (ir3_shader_debug & IR3_DBG_SCHEDMSGS)
+#else
+#define SCHED_DEBUG 0
+#endif
+#define d(fmt, ...) do { if (SCHED_DEBUG) { \
+       printf("SCHED: "fmt"\n", ##__VA_ARGS__); \
+} } while (0)
+
+#define di(instr, fmt, ...) do { if (SCHED_DEBUG) { \
+       printf("SCHED: "fmt": ", ##__VA_ARGS__); \
+       ir3_print_instr(instr); \
+} } while (0)
 
 /*
  * Instruction Scheduling:
@@ -214,6 +229,8 @@ schedule(struct ir3_sched_ctx *ctx, struct ir3_instruction *instr)
 
        instr->flags |= IR3_INSTR_MARK;
 
+       di(instr, "schedule");
+
        list_addtail(&instr->node, &instr->block->instr_list);
        ctx->scheduled = instr;
 
@@ -812,6 +829,8 @@ sched_block(struct ir3_sched_ctx *ctx, struct ir3_block *block)
                if (instr) {
                        unsigned delay = delay_calc(ctx->block, instr, false, false);
 
+                       d("delay=%u", delay);
+
                        /* and if we run out of instructions that can be scheduled,
                         * then it is time for nop's:
                         */