[Mlir-commits] [mlir] [MLIR] Ensure deterministic parallel verification (PR #134963)

Mehdi Amini llvmlistbot at llvm.org
Wed Apr 9 10:47:39 PDT 2025


================
@@ -220,10 +220,15 @@ LogicalResult OperationVerifier::verifyOnExit(Operation &op) {
               o.hasTrait<OpTrait::IsIsolatedFromAbove>())
             opsWithIsolatedRegions.push_back(&o);
   }
-  if (failed(failableParallelForEach(
-          op.getContext(), opsWithIsolatedRegions,
-          [&](Operation *o) { return verifyOpAndDominance(*o); })))
+
+  std::atomic<bool> opFailedVerify = false;
+  parallelForEach(op.getContext(), opsWithIsolatedRegions, [&](Operation *o) {
+    if (failed(verifyOpAndDominance(*o)))
+      opFailedVerify.store(true, std::memory_order_relaxed);
+  });
+  if (opFailedVerify.load(std::memory_order_relaxed))
----------------
joker-eph wrote:

Do we really need the `memory_order_relaxed` for this kind of granularity here?

https://github.com/llvm/llvm-project/pull/134963


More information about the Mlir-commits mailing list