43struct InParallelDeallocOpInterface
44 :
public BufferDeallocationOpInterface::ExternalModel<
45 InParallelDeallocOpInterface, scf::InParallelOp> {
46 FailureOr<Operation *> process(Operation *op, DeallocationState &state,
47 const DeallocationOptions &
options)
const {
48 auto inParallelOp = cast<scf::InParallelOp>(op);
49 if (!inParallelOp.getBody()->empty())
50 return op->
emitError(
"only supported when nested region is empty");
52 SmallVector<Value> updatedOperandOwnership;
54 state, op, {}, updatedOperandOwnership);
58struct ReduceReturnOpInterface
59 :
public BufferDeallocationOpInterface::ExternalModel<
60 ReduceReturnOpInterface, scf::ReduceReturnOp> {
61 FailureOr<Operation *> process(Operation *op, DeallocationState &state,
62 const DeallocationOptions &
options)
const {
63 auto reduceReturnOp = cast<scf::ReduceReturnOp>(op);
64 if (isa<BaseMemRefType>(reduceReturnOp.getOperand().getType()))
65 return op->
emitError(
"only supported when operand is not a MemRef");
67 SmallVector<Value> updatedOperandOwnership;
69 state, op, {}, updatedOperandOwnership);
78 InParallelOp::attachInterface<InParallelDeallocOpInterface>(*ctx);
79 ReduceReturnOp::attachInterface<ReduceReturnOpInterface>(*ctx);
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.
InFlightDiagnostic emitError(const Twine &message={})
Emit an error about fatal conditions with this operation, reporting up to any diagnostic handlers tha...
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 ®istry)
Include the generated interface declarations.