[Mlir-commits] [mlir] [mlir] Extend `tile_using_for` verifier to fix a crash (PR #98366)
Felix Schneider
llvmlistbot at llvm.org
Wed Jul 10 11:52:17 PDT 2024
https://github.com/ubfx created https://github.com/llvm/llvm-project/pull/98366
This patch adds a check for the correct number of `loops` results of the `transform.structured.tile_using_for` Op to the verifier, fixing a crash.
Fix https://github.com/llvm/llvm-project/issues/98008
>From 79a4667ae685539a95f8a4abce10955dee922bc5 Mon Sep 17 00:00:00 2001
From: Felix Schneider <fx.schn at gmail.com>
Date: Wed, 10 Jul 2024 20:48:37 +0200
Subject: [PATCH] [mlir] Extend `tile_using_for` verifier to fix a crash
This patch adds a check for the correct number of `loops` results of the
`transform.structured.tile_using_for` Op to the verifier, fixing a crash.
Fix https://github.com/llvm/llvm-project/issues/98008
---
mlir/lib/Dialect/Linalg/TransformOps/LinalgTransformOps.cpp | 6 ++++++
1 file changed, 6 insertions(+)
diff --git a/mlir/lib/Dialect/Linalg/TransformOps/LinalgTransformOps.cpp b/mlir/lib/Dialect/Linalg/TransformOps/LinalgTransformOps.cpp
index 4eb334f8bbbfa..e53426083527a 100644
--- a/mlir/lib/Dialect/Linalg/TransformOps/LinalgTransformOps.cpp
+++ b/mlir/lib/Dialect/Linalg/TransformOps/LinalgTransformOps.cpp
@@ -2890,6 +2890,12 @@ LogicalResult transform::TileUsingForOp::verify() {
return emitOpError("expected same number of sizes (")
<< getMixedSizes().size() << ") and scalable sizes ()"
<< getScalableSizes().size() << ")";
+ auto staticSizes = getStaticSizes();
+ unsigned numExpectedLoops = staticSizes.size() - llvm::count(staticSizes, 0);
+ if (getLoops().size() != numExpectedLoops)
+ return emitOpError("expected number of loops to tile (")
+ << numExpectedLoops << ") to match number of `loops` results ("
+ << getLoops().size() << ")";
return success();
}
More information about the Mlir-commits
mailing list