summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorConnor Abbott <cwabbott0@gmail.com>2016-05-20 16:23:29 -0400
committerConnor Abbott <cwabbott0@gmail.com>2017-01-05 13:25:19 -0500
commit20e38331ff78dec7984e93d24fed0631183508b1 (patch)
tree6312c0b06944d0b2da36b9884950038195ca6b08
parent741fea211ce51f14e5acc52689820f1e9e6e9847 (diff)
add new depth calc to scheduler
-rw-r--r--src/gallium/drivers/freedreno/ir3/ir3_sched.c38
1 files changed, 21 insertions, 17 deletions
diff --git a/src/gallium/drivers/freedreno/ir3/ir3_sched.c b/src/gallium/drivers/freedreno/ir3/ir3_sched.c
index 62fc15126f..a17f835f99 100644
--- a/src/gallium/drivers/freedreno/ir3/ir3_sched.c
+++ b/src/gallium/drivers/freedreno/ir3/ir3_sched.c
@@ -303,32 +303,20 @@ distance(struct ir3_sched_ctx *ctx, struct ir3_instruction *instr,
/* calculate delay for specified src: */
static unsigned
-delay_calc_srcn(struct ir3_sched_ctx *ctx,
+depth_calc_srcn(struct ir3_sched_ctx *ctx,
struct ir3_instruction *assigner,
struct ir3_instruction *consumer, unsigned srcn)
{
- unsigned delay = 0;
-
if (is_meta(assigner)) {
- struct ir3_instruction *src;
- foreach_ssa_src(src, assigner) {
- unsigned d;
- if (src->block != assigner->block)
- break;
- d = delay_calc_srcn(ctx, src, consumer, srcn);
- delay = MAX2(delay, d);
- }
+ return 0;
} else {
- delay = ir3_delayslots(assigner, consumer, srcn);
- delay -= distance(ctx, assigner, delay);
+ return ir3_delayslots(assigner, consumer, srcn) + 1;
}
-
- return delay;
}
/* calculate delay for instruction (maximum of delay for all srcs): */
static unsigned
-delay_calc(struct ir3_sched_ctx *ctx, struct ir3_instruction *instr)
+depth_calc_instr(struct ir3_sched_ctx *ctx, struct ir3_instruction *instr)
{
unsigned delay = 0;
struct ir3_instruction *src;
@@ -340,17 +328,33 @@ delay_calc(struct ir3_sched_ctx *ctx, struct ir3_instruction *instr)
continue;
if (src->block != instr->block)
continue;
- d = delay_calc_srcn(ctx, src, instr, i);
+ d = depth_calc_srcn(ctx, src, instr, i);
delay = MAX2(delay, d);
}
+ nir_array_foreach(&instr->false_deps, struct ir3_instruction *, dep_ptr) {
+ struct ir3_instruction *dep = *dep_ptr;
+ delay = MAX2(delay, dep->depth + 1);
+ }
+
return delay;
}
static void
+depth_calc(struct ir3_sched_ctx *ctx)
+{
+ struct ir3_block *block = ctx->block;
+
+ list_for_each_entry(struct ir3_instruction, instr, &block->instr_list, node) {
+ instr->depth = depth_calc_instr(ctx, instr);
+ }
+}
+
+static void
sched_block(struct ir3_sched_ctx *ctx, struct ir3_block *block)
{
ctx->block = block;
+ depth_calc(ctx);
init_scheduler(ctx);
while (!list_empty(&ctx->ready)) {