[Mlir-commits] [mlir] [MLIR][Transform] FuseOp: accept transform params, add use_forall argument (PR #161883)

Tuomas Kärnä llvmlistbot at llvm.org
Mon Oct 6 06:07:41 PDT 2025


================
@@ -665,24 +759,69 @@ transform::FuseOp::apply(transform::TransformRewriter &rewriter,
 }
 
 LogicalResult transform::FuseOp::verify() {
-  SmallVector<int64_t> permutation =
-      extractFromIntegerArrayAttr<int64_t>(getTileInterchange());
-  auto sequence = llvm::to_vector(llvm::seq<int64_t>(0, permutation.size()));
-  if (!std::is_permutation(sequence.begin(), sequence.end(),
-                           permutation.begin(), permutation.end())) {
-    return emitOpError() << "expects interchange to be a permutation, found "
-                         << getTileInterchange();
+  ArrayRef<int64_t> permutation = getStaticTileInterchange();
+  if (!llvm::any_of(permutation,
+                    [](int64_t v) { return ShapedType::isDynamic(v); })) {
----------------
tkarna wrote:

The current implementation actually allows the interchange array to be shorter than the number of tiled loops. E.g., for 3 loops `interchange=[1, 0]` is a valid input and is equivalent to `[1, 0, 2]`. However, `[2, 0]` does not pass the existing verifier, and one must use `[2, 0, 1]` instead.

We could add a test that checks that `len(interchange) <= num_loops`, static values contain no duplicates and the values are in `0 <= v < len(interchange)`. Effectively, this would replace the existing `std::is_permutation` implementation.

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


More information about the Mlir-commits mailing list