[Mlir-commits] [mlir] [MLIR][Affine]Fixed crash with invalid cachesize (Issue #64979) (PR #114722)

llvmlistbot at llvm.org llvmlistbot at llvm.org
Sun Nov 3 16:00:42 PST 2024


llvmbot wrote:


<!--LLVM PR SUMMARY COMMENT-->

@llvm/pr-subscribers-mlir-affine

Author: None (SwapnilGhanshyala)

<details>
<summary>Changes</summary>

Updated LoopTiling::runOnOperation() to signal pass failure incase the set cachesize is invalid, i.e., less than or equal to zero.

 #<!-- -->64979 is the reporting issue.

---
Full diff: https://github.com/llvm/llvm-project/pull/114722.diff


1 Files Affected:

- (modified) mlir/lib/Dialect/Affine/Transforms/LoopTiling.cpp (+6) 


``````````diff
diff --git a/mlir/lib/Dialect/Affine/Transforms/LoopTiling.cpp b/mlir/lib/Dialect/Affine/Transforms/LoopTiling.cpp
index c8400dfe8cd5c7..b4cf9e13729a30 100644
--- a/mlir/lib/Dialect/Affine/Transforms/LoopTiling.cpp
+++ b/mlir/lib/Dialect/Affine/Transforms/LoopTiling.cpp
@@ -173,6 +173,12 @@ void LoopTiling::getTileSizes(ArrayRef<AffineForOp> band,
 }
 
 void LoopTiling::runOnOperation() {
+  if (cacheSizeInKiB <= 0) {
+    getOperation().emitError(
+        "illegal argument: '--affine-loop-tile=cache-size' cannot be "
+        "less than or equal to zero. \nAborted!");
+    return signalPassFailure();
+  }
   // Bands of loops to tile.
   std::vector<SmallVector<AffineForOp, 6>> bands;
   getTileableBands(getOperation(), &bands);

``````````

</details>


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


More information about the Mlir-commits mailing list