This is an archive of the discontinued LLVM Phabricator instance.

[SLP] Restructure RescheduleHandling [NFC]
AbandonedPublic

Authored by reames on Jan 22 2022, 9:18 AM.

Details

Summary

This change clarifies, but does not actually change the handling for, how we handle a scheduling window extension.

Context:

  • During normal pre-scheduling (i.e. what we do while walking the tree forming vector nodes), we only compute dependencies for instructions which are transitive users of a node in the vector tree.
  • Our scheduling dependencies change based on the end of the current scheduling window. When we change the boundary, we must ensure new dependencies are computed before the next schedule.
  • Because of the first point, it's normal to have nodes reached in the transitive users of a new node which don't yet have valid dependencies. As such, we can always leave nodes in the invalid dependency state so long as they haven't yet been scheduled.
  • When dependencies are invalid, the node was not considered "ready" for scheduling. As such, initialFillReadyList is a nop when no instruction has valid dependencies.

Let me explain the old code, because it was a tad non-obvious.

The case with a bundle is fairly straight forward. We cleared dependencies and schedule. Then initialFillReadyList is nop. Then we schedule all the transitive users of the bundle. And we've basically done a normal pre-schedule with a side effect of having to recompute dependencies and schedule for the entire DAG.

The case without a bundle is trickier, and the comments were misleading. The key point is that initialFillReadyList does nothing when all nodes are the invalid dependency state. As such, we hit the bottom, the readylist is empty, and we immediately exit having left both scheduling and dependencies cleared to their uncomputed states.

End result, we can do the same thing much more obviously by just resetting the info, and only attempting rescheduling if we have a bundle.

Diff Detail