i965/sched: Calculate the critical path of scheduling nodes non-recursively.
authorFrancisco Jerez <currojerez@riseup.net>
Tue, 16 Aug 2016 07:01:31 +0000 (00:01 -0700)
committerFrancisco Jerez <currojerez@riseup.net>
Fri, 19 Aug 2016 03:05:00 +0000 (20:05 -0700)
commitb295d7ca32bbab94d4038c5684a38fd8f3dc4373
tree1473429afd815d54e421f2f5d74a5a0efe7e65c8
parentb2b621a0ec57f08586b9afcf666c0eadc0993ca0
i965/sched: Calculate the critical path of scheduling nodes non-recursively.

The critical path of each node is calculated by induction based on the
critical paths of its children, which can be done in a post-order
depth-first traversal of the dependency graph.  The current code
implements graph traversal by iterating over all nodes of the graph
and then recursing into its children -- But it turns out that
recursion is unnecessary because the lexical order of instructions in
the block is already a good enough reverse post-order of the
dependency graph (if it weren't a reverse post-order some instruction
would have been located before one of its dependencies in the original
ordering of the basic block, which is impossible), so we just need to
walk the instruction list in reverse to achieve the same result more
efficiently.

No shader-db changes.

Reviewed-by: Jason Ekstrand <jason@jlekstrand.net>
src/mesa/drivers/dri/i965/brw_schedule_instructions.cpp