From: Rob Clark Date: Fri, 22 Nov 2019 19:13:19 +0000 (-0800) Subject: freedreno/ir3: add scheduler traces X-Git-Url: https://git.libre-soc.org/?a=commitdiff_plain;h=ad92aa36acd6a30cc75ac9cdf8ade07f5429ac74;p=mesa.git freedreno/ir3: add scheduler traces 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 --- diff --git a/src/freedreno/ir3/ir3_compiler.c b/src/freedreno/ir3/ir3_compiler.c index fc81246c5ab..d21f33e5bc5 100644 --- a/src/freedreno/ir3/ir3_compiler.c +++ b/src/freedreno/ir3/ir3_compiler.c @@ -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 }; diff --git a/src/freedreno/ir3/ir3_compiler.h b/src/freedreno/ir3/ir3_compiler.h index b5e4c3e9c61..c5213a65b08 100644 --- a/src/freedreno/ir3/ir3_compiler.h +++ b/src/freedreno/ir3/ir3_compiler.h @@ -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; diff --git a/src/freedreno/ir3/ir3_print.c b/src/freedreno/ir3/ir3_print.c index f760f57e1a8..db4cc98df90 100644 --- a/src/freedreno/ir3/ir3_print.c +++ b/src/freedreno/ir3/ir3_print.c @@ -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"); diff --git a/src/freedreno/ir3/ir3_sched.c b/src/freedreno/ir3/ir3_sched.c index 247221d3a03..0756eaf5140 100644 --- a/src/freedreno/ir3/ir3_sched.c +++ b/src/freedreno/ir3/ir3_sched.c @@ -28,6 +28,21 @@ #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: */