9 #ifndef MLIR_DIALECT_BUFFERIZATION_TRANSFORMS_ONESHOTANALYSIS_H 10 #define MLIR_DIALECT_BUFFERIZATION_TRANSFORMS_ONESHOTANALYSIS_H 14 #include "llvm/ADT/EquivalenceClasses.h" 17 namespace bufferization {
19 struct OneShotBufferizationOptions;
20 class BufferizationAliasInfo;
21 class OneShotAnalysisState;
29 Operation *, AnalysisState &, BufferizationAliasInfo &,
67 void createAliasInfoEntry(
Value v);
71 void insertNewBufferAlias(
Value newValue,
Value alias);
75 void insertNewBufferEquivalence(
Value newValue,
Value alias);
82 void bufferizeOutOfPlace(
OpOperand &operand);
86 return aliasInfo.isEquivalent(v1, v2);
91 return equivalentInfo.isEquivalent(v1, v2);
99 equivalentInfo.unionSets(v1, v2);
118 struct ValueComparator {
119 bool operator()(
const Value &lhs,
const Value &rhs)
const {
125 llvm::EquivalenceClasses<Value, ValueComparator>::member_iterator>;
137 llvm::EquivalenceClasses<Value, ValueComparator> aliasInfo;
145 llvm::EquivalenceClasses<Value, ValueComparator> equivalentInfo;
167 bool areEquivalentBufferizedValues(
Value v1,
Value v2)
const override;
170 bool hasUndefinedContents(
OpOperand *opOperand)
const override;
174 bool isTensorYielded(
Value tensor)
const override;
178 void gatherUndefinedTensorUses(
Operation *op);
182 void gatherYieldedTensors(
Operation *op);
208 #endif // MLIR_DIALECT_BUFFERIZATION_TRANSFORMS_ONESHOTANALYSIS_H Include the generated interface declarations.
LogicalResult analyzeOp(Operation *op, OneShotAnalysisState &state)
Analyze op and its nested ops.
bool dropEquivalentFuncResults
Specifies whether buffer return values that are equivalent to a FuncOp bbArg should be dropped...
Operation is a basic unit of execution within MLIR.
bool allowReturnAllocs
Specifies whether returning newly allocated memrefs should be allowed.
bool areEquivalentBufferizedValues(Value v1, Value v2) const
Return true if v1 and v2 bufferize to equivalent buffers.
void unionEquivalenceClasses(Value v1, Value v2)
Union the equivalence classes of v1 and v2.
The BufferizationAliasInfo class maintains a list of buffer aliases and equivalence classes to suppor...
PostAnalysisStepList postAnalysisSteps
Registered post analysis steps.
AnalysisState provides a variety of helper functions for dealing with tensor values.
This class represents an efficient way to signal success or failure.
bool areAliasingBufferizedValues(Value v1, Value v2) const
Return true if v1 and v2 may bufferize to aliasing buffers.
void addPostAnalysisStep(PostAnalysisStepFn fn)
Register a "post analysis" step.
std::function< LogicalResult(Operation *, AnalysisState &, BufferizationAliasInfo &, SmallVector< Operation * > &)> PostAnalysisStepFn
PostAnalysisStepFns can be registered with BufferizationOptions and are executed after the analysis...
Options for BufferizableOpInterface-based bufferization.
void markInPlace(OpOperand &o)
Mark a value as in-place bufferized.
This class represents an instance of an SSA value in the MLIR system, representing a computable value...
static llvm::ManagedStatic< PassManagerOptions > options
LogicalResult runOneShotBufferize(Operation *op, const OneShotBufferizationOptions &options)
Run One-Shot Bufferize on the given op: Analysis + Bufferization.
static bool isInPlace(Value val)
Returns true if tensor has an in-place annotation.
State for analysis-enabled bufferization.
void unionAliasSets(Value v1, Value v2)
Union the alias sets of v1 and v2.
This class represents an operand of an operation.
OneShotBufferizationOptions()=default
BufferizationAliasInfo & getAliasInfo()
Return a reference to the BufferizationAliasInfo.
detail::ValueImpl * getImpl() const
Options for analysis-enabled bufferization.