MLIR  20.0.0git
Classes | Namespaces | Typedefs | Enumerations | Functions
ReshapeOpsUtils.h File Reference
#include "mlir/Dialect/Utils/StaticValueUtils.h"
#include "mlir/IR/OpImplementation.h"
#include "mlir/IR/PatternMatch.h"
#include "mlir/Support/LLVM.h"
#include "llvm/ADT/StringRef.h"
#include <optional>

Go to the source code of this file.

Classes

struct  mlir::ComposeReassociativeReshapeOps< ReshapeOpTy, opKind >
 Pattern to collapse producer/consumer reshape ops that are both collapsing dimensions or are both expanding dimensions. More...
 
struct  mlir::ComposeCollapseOfExpandOp< CollapseOpTy, ExpandOpTy, CastOpTy, DimOpTy, TensorTy >
 Pattern to compose collapse_shape(expand_shape(src, reassociation_1), reassociation_2). More...
 
struct  mlir::ComposeExpandOfCollapseOp< ExpandOpTy, CollapseOpTy >
 

Namespaces

 mlir
 Include the generated interface declarations.
 

Typedefs

using mlir::ReassociationIndicesRef = ArrayRef< int64_t >
 
using mlir::ReassociationExprs = SmallVector< AffineExpr, 2 >
 

Enumerations

enum class  mlir::ReshapeOpKind { mlir::kExpand , mlir::kCollapse }
 

Functions

constexpr StringRef mlir::getReassociationAttrName ()
 Attribute name for the ArrayAttr which encodes reassociation indices. More...
 
std::optional< SmallVector< ReassociationIndices > > mlir::composeReassociationIndices (ArrayRef< ReassociationIndices > producerReassociations, ArrayRef< ReassociationIndices > consumerReassociations, MLIRContext *context)
 Compose reassociation maps that are used in pair of reshape ops where one is a producer and other is the consumer. More...
 
SmallVector< SmallVector< AffineExpr, 2 >, 2 > mlir::convertReassociationIndicesToExprs (MLIRContext *context, ArrayRef< ReassociationIndices > reassociationIndices)
 Convert reassociation indices to affine expressions. More...
 
SmallVector< AffineMap, 4 > mlir::getSymbolLessAffineMaps (ArrayRef< ReassociationExprs > reassociation)
 Constructs affine maps out of Array<Array<AffineExpr>>. More...
 
ArrayAttr mlir::getReassociationIndicesAttribute (OpBuilder &b, ArrayRef< ReassociationIndices > reassociation)
 Wraps a list of reassociations in an ArrayAttr. More...
 
SmallVector< ReassociationIndices, 2 > mlir::convertReassociationMapsToIndices (ArrayRef< ReassociationExprs > reassociationExprs)
 Convert Array<Array<AffineExpr>> to Array<Array<int64_t>>. More...
 
std::optional< SmallVector< ReassociationIndices > > mlir::getReassociationIndicesForReshape (ShapedType sourceType, ShapedType targetType)
 Return the reassociations maps to use to reshape given the source type and the target type when possible. More...
 
std::optional< SmallVector< ReassociationIndices > > mlir::getReassociationIndicesForCollapse (ArrayRef< int64_t > sourceShape, ArrayRef< int64_t > targetShape)
 Returns the reassociation maps to collapse sourceShape to targetShape if possible. More...
 
bool mlir::isReassociationValid (ArrayRef< AffineMap > reassociation, int *invalidIndex=nullptr)
 Return true if the reassociation specification is valid, false otherwise. More...
 
template<typename ReshapeOpTy , typename InverseReshapeOpTy >
static OpFoldResult mlir::foldReshapeOp (ReshapeOpTy reshapeOp, ArrayRef< Attribute > operands)
 
template<typename Op , typename T >
static LogicalResult mlir::verifyReshapeLikeTypes (Op op, T expandedType, T collapsedType, bool isExpansion)
 Common verifier for reshape-like types. More...
 
LogicalResult mlir::reshapeLikeShapesAreCompatible (function_ref< LogicalResult(const Twine &)> emitError, ArrayRef< int64_t > collapsedShape, ArrayRef< int64_t > expandedShape, ArrayRef< ReassociationIndices > reassociationMaps, bool isExpandingReshape)
 Verify that shapes of the reshaped types using following rule: if a dimension in the collapsed type is static, then the corresponding dimensions in the expanded shape should be a) static b) the product should be same as the collaped shape. More...
 
bool mlir::hasNonIdentityLayout (Type type)
 Returns true iff the type is a MemRefType and has a non-identity layout. More...
 
llvm::SmallBitVector mlir::getSlicedDimensions (ArrayRef< OpFoldResult > sliceInputShape, ArrayRef< Range > sliceParams)
 The input parameters offsets, sizes, strides specify a rectangular non rank-reducing slice of the collapse_shape output. More...
 
llvm::SmallBitVector mlir::getLinearizedDimensions (ArrayRef< ReassociationIndices > reassociationIndices)
 Determine which dimensions are linearized by a tensor.collapse_shape op by inspecting its reassociation indices. More...