17 namespace bufferization {
18 #define GEN_PASS_DEF_EMPTYTENSORTOALLOCTENSORPASS
19 #include "mlir/Dialect/Bufferization/Transforms/Passes.h.inc"
28 struct EmptyTensorLoweringPattern :
public OpRewritePattern<tensor::EmptyOp> {
31 LogicalResult matchAndRewrite(tensor::EmptyOp op,
34 op, op.getType(), op.getDynamicSizes());
39 struct EmptyTensorToAllocTensor
40 :
public bufferization::impl::EmptyTensorToAllocTensorPassBase<
41 EmptyTensorToAllocTensor> {
42 void runOnOperation()
override;
46 .
insert<tensor::TensorDialect, bufferization::BufferizationDialect>();
56 void EmptyTensorToAllocTensor::runOnOperation() {
The DialectRegistry maps a dialect namespace to a constructor for the matching dialect.
Operation is the basic unit of execution within MLIR.
MLIRContext * getContext()
Return the context this operation is associated with.
A special type of RewriterBase that coordinates the application of a rewrite pattern on the current I...
OpTy replaceOpWithNewOp(Operation *op, Args &&...args)
Replace the results of the given (original) op with a new op that is created without verification (re...
void populateEmptyTensorToAllocTensorPattern(RewritePatternSet &patterns)
Populate patterns to lower tensor.empty ops to bufferization.alloc_tensor ops.
Include the generated interface declarations.
LogicalResult applyPatternsGreedily(Region ®ion, const FrozenRewritePatternSet &patterns, GreedyRewriteConfig config=GreedyRewriteConfig(), bool *changed=nullptr)
Rewrite ops in the given region, which must be isolated from above, by repeatedly applying the highes...
const FrozenRewritePatternSet & patterns
OpRewritePattern is a wrapper around RewritePattern that allows for matching and rewriting against an...