Skip to content

Commit d1d837c

Browse files
committed
Add BufferizationState class
1 parent 7ec1e0f commit d1d837c

File tree

2 files changed

+17
-0
lines changed

2 files changed

+17
-0
lines changed

mlir/include/mlir/Dialect/Bufferization/IR/BufferizableOpInterface.h

Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -578,6 +578,19 @@ class AnalysisState {
578578
insideMutuallyExclusiveRegionsCache;
579579
};
580580

581+
/// BufferizationState provides information about the state of the IR during the
582+
/// bufferization process.
583+
class BufferizationState {
584+
public:
585+
/// Get the cached symbol tables.
586+
/// The user is expected to update / invalidate the cached symbol tables if
587+
/// the bufferized operation have the Symbol or SymbolTable traits.
588+
SymbolTableCollection &getSymbolTables();
589+
590+
private:
591+
SymbolTableCollection symbolTables;
592+
};
593+
581594
/// Create an AllocTensorOp for the given shaped value (memref or tensor).
582595
/// If `copy` is set, the shaped value is copied. Otherwise, a tensor with
583596
/// undefined contents is allocated.

mlir/lib/Dialect/Bufferization/IR/BufferizableOpInterface.cpp

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -125,6 +125,10 @@ void AnalysisState::resetCache() {
125125
insideMutuallyExclusiveRegionsCache.clear();
126126
}
127127

128+
SymbolTableCollection &BufferizationState::getSymbolTables() {
129+
return symbolTables;
130+
}
131+
128132
Region *bufferization::getNextEnclosingRepetitiveRegion(
129133
Region *region, const BufferizationOptions &options) {
130134
assert(isRepetitiveRegion(region, options) && "expected repetitive region");

0 commit comments

Comments
 (0)