[all-commits] [llvm/llvm-project] 9eb8e7: [MLIR][PDL] Clear up the terminology in the root o...

Stanislav Funiak via All-commits all-commits at lists.llvm.org
Wed Dec 22 11:10:40 PST 2021


  Branch: refs/heads/main
  Home:   https://github.com/llvm/llvm-project
  Commit: 9eb8e7b176e9fc38c8df86bd927663c6409ac262
      https://github.com/llvm/llvm-project/commit/9eb8e7b176e9fc38c8df86bd927663c6409ac262
  Author: Stanislav Funiak <stano at cerebras.net>
  Date:   2021-12-22 (Wed, 22 Dec 2021)

  Changed paths:
    M mlir/lib/Conversion/PDLToPDLInterp/PredicateTree.cpp
    M mlir/lib/Conversion/PDLToPDLInterp/RootOrdering.cpp
    M mlir/lib/Conversion/PDLToPDLInterp/RootOrdering.h

  Log Message:
  -----------
  [MLIR][PDL] Clear up the terminology in the root ordering graph.

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.

Reviewed By: rriddle, Mogball

Differential Revision: https://reviews.llvm.org/D116079




More information about the All-commits mailing list