MLIR  19.0.0git
Bufferize.cpp
Go to the documentation of this file.
1 //===- Bufferize.cpp - Bufferization for `vector` dialect ops -------------===//
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 // This file implements bufferization of `vector` dialect ops
10 //
11 //===----------------------------------------------------------------------===//
12 
14 
23 
24 namespace mlir {
25 namespace vector {
26 #define GEN_PASS_DEF_VECTORBUFFERIZE
27 #include "mlir/Dialect/Vector/Transforms/Passes.h.inc"
28 } // namespace vector
29 } // namespace mlir
30 
31 using namespace mlir;
32 using namespace bufferization;
33 
34 namespace {
35 struct VectorBufferizePass
36  : public vector::impl::VectorBufferizeBase<VectorBufferizePass> {
37  void runOnOperation() override {
39  options.opFilter.allowDialect<vector::VectorDialect>();
40 
41  if (failed(bufferizeOp(getOperation(), options)))
42  signalPassFailure();
43  }
44 
45  void getDependentDialects(DialectRegistry &registry) const override {
46  registry.insert<bufferization::BufferizationDialect, memref::MemRefDialect,
47  tensor::TensorDialect, vector::VectorDialect>();
49  }
50 };
51 } // namespace
52 
53 std::unique_ptr<Pass> mlir::vector::createVectorBufferizePass() {
54  return std::make_unique<VectorBufferizePass>();
55 }
static llvm::ManagedStatic< PassManagerOptions > options
The DialectRegistry maps a dialect namespace to a constructor for the matching dialect.
LogicalResult bufferizeOp(Operation *op, const BufferizationOptions &options, BufferizationStatistics *statistics=nullptr)
Bufferize op and its nested ops that implement BufferizableOpInterface.
Definition: Bufferize.cpp:441
BufferizationOptions getPartialBufferizationOptions()
Return BufferizationOptions such that the bufferizeOp behaves like the old (deprecated) partial,...
Definition: Bufferize.cpp:645
std::unique_ptr< Pass > createVectorBufferizePass()
Creates an instance of the vector dialect bufferization pass.
Definition: Bufferize.cpp:53
void registerBufferizableOpInterfaceExternalModels(DialectRegistry &registry)
Include the generated interface declarations.
bool failed(LogicalResult result)
Utility function that returns true if the provided LogicalResult corresponds to a failure value.
Definition: LogicalResult.h:72
Options for BufferizableOpInterface-based bufferization.