[Mlir-commits] [mlir] [MLIR] Add `InParallelOpInterface` for parallel combining operations (PR #157736)
Alan Li
llvmlistbot at llvm.org
Wed Sep 10 08:01:14 PDT 2025
================
@@ -10,18 +10,47 @@
using namespace mlir;
+/// Include the definitions of the interface.
+#include "mlir/Interfaces/ParallelCombiningOpInterface.cpp.inc"
+
//===----------------------------------------------------------------------===//
-// ParallelCombiningOpInterface
+// InParallelOpInterface
//===----------------------------------------------------------------------===//
+// TODO: Catch-22 with interface methods used to verify means methods can't
+// assume the impl is valid.
+LogicalResult mlir::detail::verifyInParallelOpInterface(Operation *op) {
+ auto inParallel = cast<InParallelOpInterface>(op);
+ auto parent = inParallel.getIteratingParent();
+ if (!parent) {
+ return op->emitError(
+ "in_parallel interface op must have an iterating parent");
+ }
+
+ // Simple verification without requiring ParallelIterationOpInterface
+ // Just check that updated destinations are block arguments
+ for (OpOperand &updatedValue : inParallel.getUpdatedDestinations()) {
+ auto bbArg = dyn_cast<BlockArgument>(updatedValue.get());
+ if (!bbArg) {
+ return op->emitError("updating a non block argument");
+ }
+ }
+ return success();
+}
----------------
lialan wrote:
Dropped the verifier and rely on implementing op's verification.
https://github.com/llvm/llvm-project/pull/157736
More information about the Mlir-commits
mailing list