This is an archive of the discontinued LLVM Phabricator instance.

[MLIR][PDL] Clear up the terminology in the root ordering graph.
ClosedPublic

Authored by sfuniak on Dec 20 2021, 9:46 PM.

Details

Summary

Previously, we defined a struct named RootOrderingCost, which stored the cost (a pair consisting of the depth of the connector and a tie breaking ID), as well as the connector itself. This created some confusion, because we would sometimes write, e.g., cost.cost.first (the first cost referring to the struct, the second one referring to the cost field, and first referring to the depth). In order to address this confusion, here we rename RootOrderingCost to RootOrderingEntry (keeping the fields and their names as-is).

This clarification exposed non-determinism in the optimal branching algorithm. When choosing the best local parent, we were previuosly only considering its depth (cost.first) and not the tie-breaking ID (cost.second). This led to non-deterministic choice of the parent when multiple potential parents had the same depth. The solution is to compare both the depth and the tie-breaking ID.

Testing: Rely on existing unit tests. Non-detgerminism is hard to unit-test.

Diff Detail