I’ve been tinkering with the MachinePipeliner for my team’s downstream target, and have run into a particular issue with node ordering in the SMS algorithm. In particular, I’ve noticed that in some cases, I’m receiving an ‘Invalid node order’ warning in the debug. I’ve tracked this down to how ‘computeNodeOrder’ is implemented.

computeNodeOrder’s algorithm seems to be relatively untouched from the initial commit:

https://reviews.llvm.org/D16829

However, the algorithm is very different from those found in the 3 papers upon which the implementation is based:

In the implementation:

The order seems to be:

- If pred_L is a subset of the NodeSet, BottomUp and add subset to work list
- If succ_L is s subset of the NodeSet, TopDown and add subset to work list
- If intersect(succ_L, NodeSet) is non-empty, TopDown and add intersect to work list
- If there is only 1 NodeSet, BottomUp and add nodes at the bottom of the schedule (Succs.size() == 0) to work list
- Otherwise, BottomUp and add node with the highest ASAP to work list

In the papers (Using Tanya Lattner’s master’s thesis as the example), the order is:

- If intersect(pred_L, NodeSet) is non-empty, BottomUp and add subset to work list
- If intersect(succ_L, NodeSet) is non-empty, TopDown and add subset to work list
- Otherwise, BottomUp and add node with the highest ASAP to work list

Interestingly, when I implement the ordering from the paper, the node order for my loop is valid.

This difference in implementation is not mentioned or commented on in the review, so I’m wondering if there are any documents or emails I may have missed in my search that would shed some light. Certainly, this ordering is just a heuristic, so I can understand that the current incarnation just resulted in better performance for the targets utilizing it, but I’m curious if there was something more to the decision.

Regards,

J.B. Nagurne

Code Generation

Texas Instruments