Commit 351f2ac
committed
[flang][mlir] fix irreflexibility violation of strict weak ordering in llvm#155348
This fixes strict weak ordering checks violations from llvm#155348
when running these two tests:
mlir/test/Dialect/OpenMP/omp-offload-privatization-prepare.mlir
mlir/test/Dialect/OpenMP/omp-offload-privatization-prepare-by-value.mlir
Sample error:
/stable/src/libcxx/include/__debug_utils/strict_weak_ordering_check.h:50: libc++ Hardening assertion !__comp(*(__first + __a), *(__first + __b)) failed: Your comparator is not a valid strict-weak ordering
This is because (x < x) should be false, not true, to meet
the irreflexibility property. (Note that .dominates(x, x) returns true.)
I'm afraid that even after this commit we can't guarantee a
strict weak ordering, because we can't guarantee transitivity of
equivalence by sorting with a strict dominance function. However the tests
are not failing anymore, and I am not at all familiar with this code so
I will leave this concern up to the original author for consideration.
(Ideas without any further context: I would consider a topological sort
or walking a dominator tree.)
Reference on std::sort and strict weak ordering:
https://danlark.org/2022/04/20/changing-stdsort-at-googles-scale-and-beyond/1 parent 9a5ae34 commit 351f2ac
File tree
1 file changed
+3
-1
lines changed- mlir/lib/Dialect/OpenMP/Transforms
1 file changed
+3
-1
lines changedLines changed: 3 additions & 1 deletion
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
189 | 189 | | |
190 | 190 | | |
191 | 191 | | |
192 | | - | |
| 192 | + | |
| 193 | + | |
| 194 | + | |
193 | 195 | | |
194 | 196 | | |
195 | 197 | | |
| |||
0 commit comments