diff --git a/m1/perf/sched.c b/m1/perf/sched.c index 5f50d43..8a371d6 100644 --- a/m1/perf/sched.c +++ b/m1/perf/sched.c @@ -423,9 +423,31 @@ static void init_scheduler(struct fpvm_fragment *frag) for (i = frag->ninstructions-1; i >= 0; i--) { insn = sc->insns+i; +#if 0 + /* + * Theoretically, we should consider the distance through + * write-write dependencies too. In practice, this would + * mainly matter if we had operations whose result is ignored. + * This is a degenerate case that's probably not worth + * spending much effort on. + */ + if (insn->next_setter) { + insn->distance = + insn->next_setter->distance-insn->distance+1; + if (insn->distance < 1) + insn->distance = 1; + } +#endif foreach (dep, &insn->dependants) if (dep->insn->distance > insn->distance) insn->distance = dep->insn->distance; + /* + * While it wold be more correct to add one for the cycle + * following the write cycle, this also has the effect of + * producing slighly worse results on the example set of + * patches. Let's thus keep this "bug" for now. + */ +// insn->distance += insn->latency+1; insn->distance += insn->latency; } #endif