8000 Add option to enable caching of symbol tables · llvm/llvm-project@adf34f0 · GitHub
[go: up one dir, main page]

Skip to content

Commit adf34f0

Browse files
committed
Add option to enable caching of symbol tables
1 parent b9432ae commit adf34f0

File tree

4 files changed

+21
-0
lines changed

4 files changed

+21
-0
lines changed

mlir/include/mlir/Dialect/Bufferization/Transforms/OneShotAnalysis.h

+6
Original file line numberDiff line numberDiff line change
@@ -52,6 +52,12 @@ struct OneShotBufferizationOptions : public BufferizationOptions {
5252
/// `AnalysisHeuristic::Fuzzer`. The fuzzer should be used only with
5353
/// `testAnalysisOnly = true`.
5454
unsigned analysisFuzzerSeed = 0;
55+
56+
/// Enable caching of symbol tables. If enabled, the SymbolBufferizationState
57+
/// class is attached to the bufferization state and the user is required to
58+
/// keep the cached symbol tables consistent with respect to the performed
59+
/// bufferizations.
60+
bool cacheSymbolTables = false;
5561
};
5662

5763
/// State for analysis-enabled bufferization. This class keeps track of alias

mlir/lib/Dialect/Bufferization/TransformOps/BufferizationTransformOps.cpp

+5
Original file line numberDiff line numberDiff line change
@@ -85,6 +85,10 @@ transform::OneShotBufferizeOp::apply(transform::TransformRewriter &rewriter,
8585
auto payloadOps = state.getPayloadOps(getTarget());
8686
BufferizationState bufferizationState;
8787

88+
if (options.cacheSymbolTables) {
89+
bufferizationState.addExtension<SymbolBufferizationState>();
90+
}
91+
8892
for (Operation *target : payloadOps) {
8993
if (!isa<ModuleOp, FunctionOpInterface>(target))
9094
return emitSilenceableError() << "expected module or function target";
@@ -166,6 +170,7 @@ class BufferizationTransformDialectExtension
166170
registerTransformOps<
167171
#define GET_OP_LIST
168172
#include "mlir/Dialect/Bufferization/TransformOps/BufferizationTransformOps.cpp.inc"
173+
169174
>();
170175
}
171176
};

mlir/lib/Dialect/Bufferization/Transforms/Bufferize.cpp

+5
Original file line numberDiff line numberDiff line change
@@ -162,6 +162,11 @@ struct OneShotBufferizePass
162162
}
163163

164164
BufferizationState state;
165+
166+
if (opt.cacheSymbolTables) {
167+
state.addExtension<SymbolBufferizationState>();
168+
}
169+
165170
BufferizationStatistics statistics;
166171
ModuleOp moduleOp = getOperation();
167172
if (opt.bufferizeFunctionBoundaries) {

mlir/lib/Dialect/SparseTensor/Transforms/SparsificationAndBufferizationPass.cpp

+5
Original file line numberDiff line numberDiff line change
@@ -116,6 +116,11 @@ class SparsificationAndBufferizationPass
116116

117117
bufferization::BufferizationState bufferizationState;
118118

119+
if (updatedOptions.cacheSymbolTables) {
120+
bufferizationState
121+
.addExtension<bufferization::SymbolBufferizationState>();
122+
}
123+
119124
if (failed(bufferization::bufferizeModuleOp(cast<ModuleOp>(getOperation()),
120125
updatedOptions,
121126
bufferizationState)))

0 commit comments

Comments
 (0)
0