MLIR 22.0.0git
ReshapeOpsUtils.h File Reference
#include "mlir/Dialect/Arith/IR/Arith.h"
#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::ComposeCollapseOfExpandOp< CollapseOpTy, ExpandOpTy, CastOpTy, DimOpTy, TensorTy >
 Common verifier for reshape-like types. More...
struct  mlir::ComposeExpandOfCollapseOp< ExpandOpTy, CollapseOpTy >

Namespaces

namespace  mlir
 Include the generated interface declarations.

Typedefs

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

Functions

constexpr StringRef mlir::getReassociationAttrName ()
 Attribute name for the ArrayAttr which encodes reassociation indices.
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.
SmallVector< SmallVector< AffineExpr, 2 >, 2 > mlir::convertReassociationIndicesToExprs (MLIRContext *context, ArrayRef< ReassociationIndices > reassociationIndices)
 Convert reassociation indices to affine expressions.
SmallVector< AffineMap, 4 > mlir::getSymbolLessAffineMaps (ArrayRef< ReassociationExprs > reassociation)
 Constructs affine maps out of Array<Array<AffineExpr>>.
ArrayAttr mlir::getReassociationIndicesAttribute (Builder &b, ArrayRef< ReassociationIndices > reassociation)
 Wraps a list of reassociations in an ArrayAttr.
SmallVector< ReassociationIndices, 2 > mlir::convertReassociationMapsToIndices (ArrayRef< ReassociationExprs > reassociationExprs)
 Convert Array<Array<AffineExpr>> to Array<Array<int64_t>>.
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.
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.
bool mlir::isReassociationValid (ArrayRef< AffineMap > reassociation, int *invalidIndex=nullptr)
 Return true if the reassociation specification is valid, false otherwise.
template<typename ReshapeOpTy, typename InverseReshapeOpTy>
static OpFoldResult mlir::foldReshapeOp (ReshapeOpTy reshapeOp, ArrayRef< Attribute > operands)
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.
llvm::SmallBitVector mlir::getLinearizedDimensions (ArrayRef< ReassociationIndices > reassociationIndices)
 Determine which dimensions are linearized by a tensor.collapse_shape op by inspecting its reassociation indices.