[Mlir-commits] [mlir] e50f131 - [MLIR][Affine] Fix bug and MSAN issue in affine loop utils
Uday Bondhugula
llvmlistbot at llvm.org
Thu Mar 23 01:44:32 PDT 2023
Author: Uday Bondhugula
Date: 2023-03-23T14:13:28+05:30
New Revision: e50f131ae6e22aefdaa502af09a3396f49726976
URL: https://github.com/llvm/llvm-project/commit/e50f131ae6e22aefdaa502af09a3396f49726976
DIFF: https://github.com/llvm/llvm-project/commit/e50f131ae6e22aefdaa502af09a3396f49726976.diff
LOG: [MLIR][Affine] Fix bug and MSAN issue in affine loop utils
Fix bug and MSAN issue in affine loop utils introduced by
d25e022cd19b83c22a6022edb78c4b97a5fc1b49 (D146495). While on it,
fix/clean up issues in immediately surrounding code.
Differential Revision: https://reviews.llvm.org/D146698
Added:
Modified:
mlir/lib/Dialect/Affine/Utils/LoopUtils.cpp
Removed:
################################################################################
diff --git a/mlir/lib/Dialect/Affine/Utils/LoopUtils.cpp b/mlir/lib/Dialect/Affine/Utils/LoopUtils.cpp
index 38d660d4ff90b..1e567a6db4108 100644
--- a/mlir/lib/Dialect/Affine/Utils/LoopUtils.cpp
+++ b/mlir/lib/Dialect/Affine/Utils/LoopUtils.cpp
@@ -2057,6 +2057,8 @@ static LogicalResult generateCopy(
OpBuilder topBuilder(f.getBody());
Value zeroIndex = topBuilder.create<arith::ConstantIndexOp>(f.getLoc(), 0);
+ *sizeInBytes = 0;
+
if (begin == end)
return success();
@@ -2105,7 +2107,6 @@ static LogicalResult generateCopy(
if (*numElements == 0) {
LLVM_DEBUG(llvm::dbgs() << "Nothing to copy\n");
- *sizeInBytes = 0;
return success();
}
@@ -2183,8 +2184,7 @@ static LogicalResult generateCopy(
// fastMemRefType is a constant shaped memref.
auto maySizeInBytes = getIntOrFloatMemRefSizeInBytes(fastMemRefType);
// We don't account for things of unknown size.
- if (!maySizeInBytes)
- maySizeInBytes = 0;
+ *sizeInBytes = maySizeInBytes ? *maySizeInBytes : 0;
LLVM_DEBUG(emitRemarkForBlock(*block)
<< "Creating fast buffer of type " << fastMemRefType
@@ -2193,7 +2193,6 @@ static LogicalResult generateCopy(
} else {
// Reuse the one already created.
fastMemRef = fastBufferMap[memref];
- *sizeInBytes = 0;
}
auto numElementsSSA = top.create<arith::ConstantIndexOp>(loc, *numElements);
@@ -2554,13 +2553,13 @@ LogicalResult mlir::affineDataCopyGenerate(Block::iterator begin,
if (llvm::DebugFlag && (forOp = dyn_cast<AffineForOp>(&*begin))) {
LLVM_DEBUG(forOp.emitRemark()
<< llvm::divideCeil(totalCopyBuffersSizeInBytes, 1024)
- << " KiB of copy buffers in fast memory space for this block\n");
+ << " KiB of copy buffers in fast memory space for this block");
}
if (totalCopyBuffersSizeInBytes > copyOptions.fastMemCapacityBytes) {
- StringRef str = "Total size of all copy buffers' for this block "
- "exceeds fast memory capacity\n";
- block->getParentOp()->emitWarning(str);
+ block->getParentOp()->emitWarning(
+ "total size of all copy buffers' for this block exceeds fast memory "
+ "capacity");
}
return success();
More information about the Mlir-commits
mailing list