[Mlir-commits] [mlir] [mlir] Implement DestinationStyleOpInterface for scf::ForallOp (PR #66981)

Matthias Springer llvmlistbot at llvm.org
Thu Sep 21 05:11:15 PDT 2023


================
@@ -3970,6 +3971,11 @@ struct FoldTensorCastProducerOp
     if (isa<InsertSliceOp>(op.getOperation()))
       return failure();
 
+    // scf::ForallOp also has its own folding logic taking the Types of its
+    // BlockArguments into consideration.
+    if (isa<scf::ForallOp>(op.getOperation()))
+      return failure();
+
----------------
matthias-springer wrote:

Oh right, I missed that. We should avoid such references to other dialects. `FoldTensorCastProducerOp` should not fold casts into destination style ops that have a region without further checks. At the moment there is no way to query whether such folding is safe or not.

Maybe we can do something with a new interface. We already have `CastOpInterface`. We could have another `FoldCastOpInterface` that ops can implement that support folding of cast ops into themselves.


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


More information about the Mlir-commits mailing list