[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 15:59:53 PST 2024


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

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.

>From 99255bb01a7ca83ae11f909901e9a3141eaed800 Mon Sep 17 00:00:00 2001
From: swapnilghanshyala <swapnilghanshyala at gmail.com>
Date: Tue, 3 Oct 2023 22:01:17 +0530
Subject: [PATCH] [MLIR][Affine]Fixed crash with invalid cachesize (Issue
 #64979)

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.
---
 mlir/lib/Dialect/Affine/Transforms/LoopTiling.cpp | 6 ++++++
 1 file changed, 6 insertions(+)

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);



More information about the Mlir-commits mailing list