MLIR  22.0.0git
BufferDeallocationOpInterfaceImpl.cpp
Go to the documentation of this file.
1 //===- BufferDeallocationOpInterfaceImpl.cpp ------------------------------===//
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 
12 
13 using namespace mlir;
14 using namespace mlir::bufferization;
15 
16 namespace {
17 ///
18 struct GPUTerminatorOpInterface
19  : public BufferDeallocationOpInterface::ExternalModel<
20  GPUTerminatorOpInterface, gpu::TerminatorOp> {
21  FailureOr<Operation *> process(Operation *op, DeallocationState &state,
22  const DeallocationOptions &options) const {
23  SmallVector<Value> updatedOperandOwnerships;
25  state, op, {}, updatedOperandOwnerships);
26  }
27 };
28 
29 } // namespace
30 
32  DialectRegistry &registry) {
33  registry.addExtension(+[](MLIRContext *ctx, GPUDialect *dialect) {
34  gpu::TerminatorOp::attachInterface<GPUTerminatorOpInterface>(*ctx);
35  });
36 }
static llvm::ManagedStatic< PassManagerOptions > options
The DialectRegistry maps a dialect namespace to a constructor for the matching dialect.
bool addExtension(TypeID extensionID, std::unique_ptr< DialectExtensionBase > extension)
Add the given extension to the registry.
MLIRContext is the top-level object for a collection of MLIR operations.
Definition: MLIRContext.h:63
Operation is the basic unit of execution within MLIR.
Definition: Operation.h:88
This class collects all the state that we need to perform the buffer deallocation pass with associate...
FailureOr< Operation * > insertDeallocOpForReturnLike(DeallocationState &state, Operation *op, ValueRange operands, SmallVectorImpl< Value > &updatedOperandOwnerships)
Insert a bufferization.dealloc operation right before op which has to be a terminator without any suc...
void registerBufferDeallocationOpInterfaceExternalModels(DialectRegistry &registry)
Include the generated interface declarations.
Options for BufferDeallocationOpInterface-based buffer deallocation.