MLIR 22.0.0git
ConvertConv2DToImg2Col.cpp File Reference

Go to the source code of this file.

Classes

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

Namespaces

namespace  mlir
 Include the generated interface declarations.
namespace  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.
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.
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.
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.
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.
void mlir::linalg::populateConvertConv2DToImg2ColPatterns (RewritePatternSet &patterns)
 Populates patterns to transform linalg.conv_2d_xxx operations into linalg.generic (for img2col packing) and linalg.matmul.