[all-commits] [llvm/llvm-project] 138803: [MLIR][PDL] Make predicate order deterministic.
Stanislav Funiak via All-commits
all-commits at lists.llvm.org
Mon Jan 3 18:40:01 PST 2022
Branch: refs/heads/main
Home: https://github.com/llvm/llvm-project
Commit: 138803e017739c81b43b73631c7096bfc4d097d8
https://github.com/llvm/llvm-project/commit/138803e017739c81b43b73631c7096bfc4d097d8
Author: Stanislav Funiak <stano at cerebras.net>
Date: 2022-01-04 (Tue, 04 Jan 2022)
Changed paths:
M mlir/lib/Conversion/PDLToPDLInterp/PredicateTree.cpp
Log Message:
-----------
[MLIR][PDL] Make predicate order deterministic.
The tree merging of pattern predicates places the predicates in an unordered set. When the predicates are sorted, they are taken in the set order, not the insertion order. This results in nondeterministic behavior.
One solution to this problem would be to use `SetVector`. However, the value `SetVector` does not provide a `find` function for fast O(1) lookups and stores the predicates twice -- once in the set and once in the vector, which is undesirable, because we store patternToAnswer in each predicate. A simpler solution is to store the tie breaking ID (which follows the insertion order), and use this ID to break any ties when comparing predicates.
Reviewed By: Mogball
Differential Revision: https://reviews.llvm.org/D116081
More information about the All-commits
mailing list