MLIR  22.0.0git
Classes | Namespaces | Functions
ConvertConv2DToImg2Col.cpp File Reference
#include "mlir/Dialect/Affine/Utils.h"
#include "mlir/Dialect/Arith/IR/Arith.h"
#include "mlir/Dialect/Complex/IR/Complex.h"
#include "mlir/Dialect/Linalg/IR/Linalg.h"
#include "mlir/Dialect/Linalg/Transforms/Transforms.h"
#include "mlir/Dialect/Tensor/IR/Tensor.h"
#include "mlir/Dialect/Utils/IndexingUtils.h"
#include "mlir/Dialect/Utils/ReshapeOpsUtils.h"
#include "mlir/Dialect/Utils/StructuredOpsUtils.h"
#include "mlir/IR/AffineExpr.h"
#include "mlir/IR/AffineMap.h"
#include "mlir/IR/Builders.h"
#include "mlir/IR/BuiltinAttributes.h"
#include "mlir/IR/BuiltinTypes.h"
#include <utility>

Go to the source code of this file.

Classes

struct  mlir::linalg::Im2ColToOperandsExprs
 
struct  mlir::linalg::Im2ColToInputDimsExprs
 

Namespaces

 mlir
 Include the generated interface declarations.
 
 mlir::linalg
 

Functions

static bool mlir::linalg::hasAllOneValues (DenseIntElementsAttr attr)
 
static Value mlir::linalg::createAdd (Location loc, Value x, Value y, OpBuilder &builder)
 
static Value mlir::linalg::createMul (Location loc, Value x, Value y, Type accType, OpBuilder &builder)
 
static AffineExpr mlir::linalg::getConvolvedExpr (OpBuilder &b, int64_t stride, bool useSymbols=true)
 
static Im2ColToInputDimsExprs mlir::linalg::getIm2ColInputExpressions (Im2ColToOperandsExprs exprs, ArrayRef< int64_t > strides, RewriterBase &rewriter)
 Construct the affine expressions that map the indices of the im2col matrix to the corresponding input tensor indices for a 2D convolution with the the provided strides. More...
 
FailureOr< std::pair< Operation *, Operation * > > mlir::linalg::rewriteInIm2Col (RewriterBase &rewriter, linalg::Conv2DNhwcHwcfOp convOp)
 Convert linalg.conv_2d_nhwc_hwcf into linalg.generic (for img2col packing) and linalg.matmul. More...
 
FailureOr< std::pair< Operation *, Operation * > > mlir::linalg::rewriteInIm2Col (RewriterBase &rewriter, linalg::DepthwiseConv2DNhwcHwcOp convOp)
 Similar to rewriteInIm2Col with linalg::Conv2DNhwcHwcfOp except there is no reduction among the input channels so each convolution can be a matrix-vector product and by transposing both input filter so channels are outer most the computation is a batched matrix-vector product. More...
 
FailureOr< std::pair< Operation *, Operation * > > mlir::linalg::rewriteInIm2Col (RewriterBase &rewriter, linalg::Conv2DNchwFchwOp convOp)
 Similar to rewriteInIm2Col with linalg::Conv2DNhwcHwcfOp except because the channels are to the left of the image shape dimensions, the position of the contraction dimension in the resulting matmul is reversed. More...
 
FailureOr< std::pair< Operation *, Operation * > > mlir::linalg::rewriteInIm2Col (RewriterBase &rewriter, linalg::Conv2DNhwcFhwcOp convOp)
 Same as the above but for Fhwc channel orderings in the filter. More...
 
void mlir::linalg::populateConvertConv2DToImg2ColPatterns (RewritePatternSet &patterns)
 Populates patterns to transform linalg.conv_2d_xxx operations into linalg.generic (for img2col packing) and linalg.matmul. More...