MLIR  20.0.0git
Classes | Namespaces | Functions
IndexingUtils.h File Reference
#include "mlir/IR/Builders.h"
#include "mlir/Support/LLVM.h"
#include "llvm/ADT/ArrayRef.h"
#include "llvm/ADT/SmallVector.h"
#include "llvm/ADT/iterator.h"
#include <optional>
#include <utility>

Go to the source code of this file.

Classes

class  mlir::detail::TileOffsetRangeImpl
 Encapsulates the set of parameters that are used to make tile offset calculations in the TileOffsetRangeIterator. More...
 
class  mlir::detail::TileOffsetRangeIterator< ElementType >
 The STL-style iterator implementation for StaticTileOffsetRange. More...
 
class  mlir::StaticTileOffsetRange
 A range-style iterator that allows for iterating over the offsets of all potential tiles of size tileShape within the larger shape shape, using an ordering specified by loopOrder. More...
 

Namespaces

 mlir
 Include the generated interface declarations.
 
 mlir::detail
 AttrTypeReplacer.
 

Functions

SmallVector< int64_t > mlir::computeSuffixProduct (ArrayRef< int64_t > sizes)
 Given a set of sizes, return the suffix product. More...
 
SmallVector< int64_t > mlir::computeStrides (ArrayRef< int64_t > sizes)
 
SmallVector< int64_t > mlir::computeElementwiseMul (ArrayRef< int64_t > v1, ArrayRef< int64_t > v2)
 Return a vector containing llvm::zip_equal(v1, v2) multiplied elementwise. More...
 
int64_t mlir::computeSum (ArrayRef< int64_t > basis)
 Self-explicit. More...
 
int64_t mlir::computeProduct (ArrayRef< int64_t > basis)
 Self-explicit. More...
 
int64_t mlir::computeMaxLinearIndex (ArrayRef< int64_t > basis)
 Return the number of elements of basis (i.e. More...
 
int64_t mlir::linearize (ArrayRef< int64_t > offsets, ArrayRef< int64_t > basis)
 Return the linearized index of 'offsets' w.r.t. More...
 
SmallVector< int64_t > mlir::delinearize (int64_t linearIndex, ArrayRef< int64_t > strides)
 Given the strides together with a linear index in the dimension space, return the vector-space offsets in each dimension for a de-linearized index. More...
 
std::optional< SmallVector< int64_t > > mlir::computeShapeRatio (ArrayRef< int64_t > shape, ArrayRef< int64_t > subShape)
 Return the multi-dimensional integral ratio of subShape to the trailing dimensions of shape. More...
 
SmallVector< AffineExprmlir::computeSuffixProduct (ArrayRef< AffineExpr > sizes)
 Given a set of sizes, return the suffix product. More...
 
SmallVector< AffineExpr > mlir::computeStrides (ArrayRef< AffineExpr > sizes)
 
SmallVector< AffineExprmlir::computeElementwiseMul (ArrayRef< AffineExpr > v1, ArrayRef< AffineExpr > v2)
 Return a vector containing llvm::zip_equal(v1, v2) multiplied elementwise. More...
 
AffineExpr mlir::computeSum (MLIRContext *ctx, ArrayRef< AffineExpr > basis)
 Self-explicit. More...
 
AffineExpr mlir::computeProduct (MLIRContext *ctx, ArrayRef< AffineExpr > basis)
 Self-explicit. More...
 
AffineExpr mlir::computeMaxLinearIndex (MLIRContext *ctx, ArrayRef< AffineExpr > basis)
 Return the number of elements of basis (i.e. More...
 
AffineExpr mlir::linearize (MLIRContext *ctx, ArrayRef< AffineExpr > offsets, ArrayRef< AffineExpr > basis)
 Return the linearized index of 'offsets' w.r.t. More...
 
AffineExpr mlir::linearize (MLIRContext *ctx, ArrayRef< AffineExpr > offsets, ArrayRef< int64_t > basis)
 
SmallVector< AffineExprmlir::delinearize (AffineExpr linearIndex, ArrayRef< AffineExpr > strides)
 Given the strides together with a linear index in the dimension space, return the vector-space offsets in each dimension for a de-linearized index. More...
 
SmallVector< AffineExprmlir::delinearize (AffineExpr linearIndex, ArrayRef< int64_t > strides)
 
template<typename T >
SmallVector< T > mlir::applyPermutation (ArrayRef< T > input, ArrayRef< int64_t > permutation)
 
template<typename T >
SmallVector< T > mlir::applyPermutation (const SmallVectorImpl< T > &input, ArrayRef< int64_t > permutation)
 
template<typename T , unsigned N>
void mlir::applyPermutationToVector (SmallVector< T, N > &inVec, ArrayRef< int64_t > permutation)
 Apply the permutation defined by permutation to inVec. More...
 
SmallVector< int64_t > mlir::invertPermutationVector (ArrayRef< int64_t > permutation)
 Helper method to apply to inverse a permutation. More...
 
bool mlir::isIdentityPermutation (ArrayRef< int64_t > permutation)
 Returns true if permutation is an identity permutation. More...
 
bool mlir::isPermutationVector (ArrayRef< int64_t > interchange)
 Method to check if an interchange vector is a permutation. More...
 
SmallVector< int64_t > mlir::computePermutationVector (int64_t permSize, ArrayRef< int64_t > positions, ArrayRef< int64_t > desiredPositions)
 Return a permutation vector of size permSize that would result in moving positions into desiredPositions. More...
 
SmallVector< int64_t > mlir::dropDims (ArrayRef< int64_t > inputPerm, ArrayRef< int64_t > dropPositions)
 Returns a permutation vector that drop the input dims in dropPositions from inputPerm. More...
 
SmallVector< int64_t > mlir::getI64SubArray (ArrayAttr arrayAttr, unsigned dropFront=0, unsigned dropBack=0)
 Helper to return a subset of arrayAttr as a vector of int64_t. More...
 
std::pair< AffineExpr, SmallVector< OpFoldResult > > mlir::computeLinearIndex (OpFoldResult sourceOffset, ArrayRef< OpFoldResult > strides, ArrayRef< OpFoldResult > indices)
 Compute linear index from provided strides and indices, assuming strided layout. More...
 
std::pair< AffineExpr, SmallVector< OpFoldResult > > mlir::computeLinearIndex (OpFoldResult sourceOffset, ArrayRef< int64_t > strides, ArrayRef< Value > indices)