MLIR  20.0.0git
Functions
ReshapeOpsUtils.cpp File Reference
#include "mlir/Dialect/Utils/ReshapeOpsUtils.h"
#include "mlir/IR/AffineMap.h"
#include "mlir/IR/Builders.h"
#include <numeric>
#include <optional>

Go to the source code of this file.

Functions

template<typename AffineExprTy >
unsigned getMaxPosOfType (ArrayRef< ReassociationExprs > exprArrays)
 
static std::optional< int64_t > getUniqueNonUnitDim (ArrayRef< int64_t > indices, ArrayRef< int64_t > shape)
 Returns the index of the only non-unit dimension among indices of shape, if such a dimension exists and indices has more than one element. More...
 
static SmallVector< std::optional< int64_t > > getCollapseShapeTrivialSegments (RankedTensorType sourceType, ArrayRef< ReassociationIndices > reassociationIndices)
 
static FailureOr< SmallVector< std::optional< int64_t > > > canCollapseShapeBeSimplifiedByRankReducingSlice (RankedTensorType sourceType, ArrayRef< ReassociationIndices > reassociationIndices)
 Returns true if any of the segments of the reassociation indices for a collapsing reshape can be simplified using a rank-reducing slice. More...
 

Function Documentation

◆ canCollapseShapeBeSimplifiedByRankReducingSlice()

static FailureOr<SmallVector<std::optional<int64_t> > > canCollapseShapeBeSimplifiedByRankReducingSlice ( RankedTensorType  sourceType,
ArrayRef< ReassociationIndices reassociationIndices 
)
static

Returns true if any of the segments of the reassociation indices for a collapsing reshape can be simplified using a rank-reducing slice.

Definition at line 385 of file ReshapeOpsUtils.cpp.

References getCollapseShapeTrivialSegments().

◆ getCollapseShapeTrivialSegments()

static SmallVector<std::optional<int64_t> > getCollapseShapeTrivialSegments ( RankedTensorType  sourceType,
ArrayRef< ReassociationIndices reassociationIndices 
)
static

◆ getMaxPosOfType()

template<typename AffineExprTy >
unsigned getMaxPosOfType ( ArrayRef< ReassociationExprs exprArrays)

Definition at line 147 of file ReshapeOpsUtils.cpp.

References max().

◆ getUniqueNonUnitDim()

static std::optional<int64_t> getUniqueNonUnitDim ( ArrayRef< int64_t >  indices,
ArrayRef< int64_t >  shape 
)
static

Returns the index of the only non-unit dimension among indices of shape, if such a dimension exists and indices has more than one element.

Otherwise, return std::nullopt.

Definition at line 353 of file ReshapeOpsUtils.cpp.

Referenced by getCollapseShapeTrivialSegments().