MLIR 22.0.0git
OneShotModuleBufferize.h
Go to the documentation of this file.
1//===- OneShotModuleBufferize.h - Bufferization across Func. Boundaries ---===//
2//
3// Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions.
4// See https://llvm.org/LICENSE.txt for license information.
5// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
6//
7//===----------------------------------------------------------------------===//
8
9#ifndef MLIR_DIALECT_BUFFERIZATION_TRANSFORMS_ONESHOTMODULEBUFFERIZE_H
10#define MLIR_DIALECT_BUFFERIZATION_TRANSFORMS_ONESHOTMODULEBUFFERIZE_H
11
12namespace llvm {
13struct LogicalResult;
14} // namespace llvm
15
16namespace mlir {
17class Operation;
18
19namespace bufferization {
23class BufferizationState;
24
25/// Analyze `moduleOp` and its nested ops. Bufferization decisions are stored in
26/// `state`. This operates on any `SymbolTable` op.
27llvm::LogicalResult
28analyzeModuleOp(Operation *moduleOp, OneShotAnalysisState &state,
29 BufferizationStatistics *statistics = nullptr);
30
31/// Bufferize an `op`s nested ops that implement `BufferizableOpInterface`.
32/// This operates on any `SymbolTable` op.
33///
34/// Note: This function does not run One-Shot Analysis. No buffer copies are
35/// inserted except two cases:
36/// - `options.copyBeforeWrite` is set, in which case buffers are copied before
37/// every write.
38/// - `options.copyBeforeWrite` is not set and `options.noAnalysisFuncFilter`
39/// is not empty. The FuncOps it contains were not analyzed. Buffer copies
40/// will be inserted only to these FuncOps.
41llvm::LogicalResult bufferizeModuleOp(
42 Operation *moduleOp, const OneShotBufferizationOptions &options,
43 BufferizationState &state, BufferizationStatistics *statistics = nullptr);
44
45/// Remove bufferization attributes on every FuncOp arguments in the SymbolTable
46/// op.
47void removeBufferizationAttributesInModule(Operation *moduleOp);
48
49/// Run One-Shot Module Bufferization on the given SymbolTable. Performs a
50/// simple function call analysis to determine which function arguments are
51/// inplaceable. Then analyzes and bufferizes FuncOps one-by-one with One-Shot
52/// Bufferize.
53llvm::LogicalResult runOneShotModuleBufferize(
54 Operation *moduleOp,
55 const bufferization::OneShotBufferizationOptions &options,
56 BufferizationState &state, BufferizationStatistics *statistics = nullptr);
57
58} // namespace bufferization
59} // namespace mlir
60
61#endif // MLIR_DIALECT_BUFFERIZATION_TRANSFORMS_ONESHOTMODULEBUFFERIZE_H
static llvm::ManagedStatic< PassManagerOptions > options
Operation is the basic unit of execution within MLIR.
Definition Operation.h:88
State for analysis-enabled bufferization.
The OpAsmOpInterface, see OpAsmInterface.td for more details.
Definition CallGraph.h:229
llvm::LogicalResult bufferizeModuleOp(Operation *moduleOp, const OneShotBufferizationOptions &options, BufferizationState &state, BufferizationStatistics *statistics=nullptr)
Bufferize an ops nested ops that implement BufferizableOpInterface.
void removeBufferizationAttributesInModule(Operation *moduleOp)
Remove bufferization attributes on every FuncOp arguments in the SymbolTable op.
llvm::LogicalResult analyzeModuleOp(Operation *moduleOp, OneShotAnalysisState &state, BufferizationStatistics *statistics=nullptr)
Analyze moduleOp and its nested ops.
llvm::LogicalResult runOneShotModuleBufferize(Operation *moduleOp, const bufferization::OneShotBufferizationOptions &options, BufferizationState &state, BufferizationStatistics *statistics=nullptr)
Run One-Shot Module Bufferization on the given SymbolTable.
Include the generated interface declarations.
Bufferization statistics for debugging.
Definition Bufferize.h:35
Options for analysis-enabled bufferization.