[Mlir-commits] [mlir] e6edc1b - [MLIR] Fix non-deterministic generation from buffer-deallocation pass
Uday Bondhugula
llvmlistbot at llvm.org
Thu Feb 9 15:22:43 PST 2023
Author: Uday Bondhugula
Date: 2023-02-10T04:51:59+05:30
New Revision: e6edc1bd69c881eabf78c439be7f42a639f0df79
URL: https://github.com/llvm/llvm-project/commit/e6edc1bd69c881eabf78c439be7f42a639f0df79
DIFF: https://github.com/llvm/llvm-project/commit/e6edc1bd69c881eabf78c439be7f42a639f0df79.diff
LOG: [MLIR] Fix non-deterministic generation from buffer-deallocation pass
The buffer-deallocation pass generates a different output on each run
due to an unstable iteration order.
Fixes: https://github.com/llvm/llvm-project/issues/59118
Reviewed By: mehdi_amini
Differential Revision: https://reviews.llvm.org/D143622
Added:
Modified:
mlir/include/mlir/Dialect/Bufferization/Transforms/BufferViewFlowAnalysis.h
mlir/lib/Dialect/Bufferization/Transforms/BufferDeallocation.cpp
mlir/lib/Dialect/Bufferization/Transforms/BufferViewFlowAnalysis.cpp
Removed:
################################################################################
diff --git a/mlir/include/mlir/Dialect/Bufferization/Transforms/BufferViewFlowAnalysis.h b/mlir/include/mlir/Dialect/Bufferization/Transforms/BufferViewFlowAnalysis.h
index c03d78080888c..5905204fe9993 100644
--- a/mlir/include/mlir/Dialect/Bufferization/Transforms/BufferViewFlowAnalysis.h
+++ b/mlir/include/mlir/Dialect/Bufferization/Transforms/BufferViewFlowAnalysis.h
@@ -55,7 +55,7 @@ class BufferViewFlowAnalysis {
ValueSetT resolve(Value value) const;
/// Removes the given values from all alias sets.
- void remove(const SmallPtrSetImpl<Value> &aliasValues);
+ void remove(const SetVector<Value> &aliasValues);
private:
/// This function constructs a mapping from values to its immediate
diff --git a/mlir/lib/Dialect/Bufferization/Transforms/BufferDeallocation.cpp b/mlir/lib/Dialect/Bufferization/Transforms/BufferDeallocation.cpp
index 27a31c9080661..cf51aa58a93a9 100644
--- a/mlir/lib/Dialect/Bufferization/Transforms/BufferDeallocation.cpp
+++ b/mlir/lib/Dialect/Bufferization/Transforms/BufferDeallocation.cpp
@@ -259,7 +259,7 @@ class BufferDeallocation : public BufferPlacementTransformationBase {
// Initialize the set of values that require a dedicated memory free
// operation since their operands cannot be safely deallocated in a post
// dominator.
- SmallPtrSet<Value, 8> valuesToFree;
+ SetVector<Value> valuesToFree;
llvm::SmallDenseSet<std::tuple<Value, Block *>> visitedValues;
SmallVector<std::tuple<Value, Block *>, 8> toProcess;
diff --git a/mlir/lib/Dialect/Bufferization/Transforms/BufferViewFlowAnalysis.cpp b/mlir/lib/Dialect/Bufferization/Transforms/BufferViewFlowAnalysis.cpp
index 1d61a8be57815..b4cfe89d7ced6 100644
--- a/mlir/lib/Dialect/Bufferization/Transforms/BufferViewFlowAnalysis.cpp
+++ b/mlir/lib/Dialect/Bufferization/Transforms/BufferViewFlowAnalysis.cpp
@@ -12,6 +12,7 @@
#include "mlir/Interfaces/ControlFlowInterfaces.h"
#include "mlir/Interfaces/ViewLikeInterface.h"
#include "llvm/ADT/SetOperations.h"
+#include "llvm/ADT/SetVector.h"
using namespace mlir;
@@ -40,7 +41,7 @@ BufferViewFlowAnalysis::resolve(Value rootValue) const {
}
/// Removes the given values from all alias sets.
-void BufferViewFlowAnalysis::remove(const SmallPtrSetImpl<Value> &aliasValues) {
+void BufferViewFlowAnalysis::remove(const SetVector<Value> &aliasValues) {
for (auto &entry : dependencies)
llvm::set_subtract(entry.second, aliasValues);
}
More information about the Mlir-commits
mailing list