My Project
Public Types | Public Member Functions | Static Public Member Functions | Friends | List of all members
mlir::AffineMap Class Reference

#include <AffineMap.h>

Public Types

using ImplType = detail::AffineMapStorage
 

Public Member Functions

 AffineMap ()
 
 AffineMap (ImplType *map)
 
 AffineMap (const AffineMap &other)
 
AffineMapoperator= (const AffineMap &other)=default
 
MLIRContextgetContext () const
 
 operator bool ()
 
bool operator== (AffineMap other) const
 
bool operator!= (AffineMap other) const
 
bool isIdentity () const
 
bool isEmpty () const
 Returns true if this affine map is an empty map, i.e., () -> (). More...
 
bool isSingleConstant () const
 Returns true if this affine map is a single result constant function. More...
 
int64_t getSingleConstantResult () const
 
void print (raw_ostream &os) const
 
void dump () const
 
unsigned getNumDims () const
 
unsigned getNumSymbols () const
 
unsigned getNumResults () const
 
unsigned getNumInputs () const
 
ArrayRef< AffineExprgetResults () const
 
AffineExpr getResult (unsigned idx) const
 
void walkExprs (std::function< void(AffineExpr)> callback) const
 
AffineMap replaceDimsAndSymbols (ArrayRef< AffineExpr > dimReplacements, ArrayRef< AffineExpr > symReplacements, unsigned numResultDims, unsigned numResultSyms)
 
LogicalResult constantFold (ArrayRef< Attribute > operandConstants, SmallVectorImpl< Attribute > &results) const
 
AffineMap compose (AffineMap map)
 
bool isProjectedPermutation ()
 
bool isPermutation ()
 Returns true if the AffineMap represents a symbol-less permutation map. More...
 
AffineMap getSubMap (ArrayRef< unsigned > resultPos)
 Returns the map consisting of the resultPos subset. More...
 

Static Public Member Functions

static AffineMap get (MLIRContext *context)
 Returns a zero result affine map with no dimensions or symbols: () -> (). More...
 
static AffineMap get (unsigned dimCount, unsigned symbolCount, ArrayRef< AffineExpr > results)
 
static AffineMap getConstantMap (int64_t val, MLIRContext *context)
 Returns a single constant result affine map. More...
 
static AffineMap getMultiDimIdentityMap (unsigned numDims, MLIRContext *context)
 Returns an AffineMap with 'numDims' identity result dim exprs. More...
 
static AffineMap getPermutationMap (ArrayRef< unsigned > permutation, MLIRContext *context)
 Returns an AffineMap representing a permutation. More...
 

Friends

::llvm::hash_code hash_value (AffineMap arg)
 

Detailed Description

A multi-dimensional affine map Affine map's are immutable like Type's, and they are uniqued. Eg: (d0, d1) -> (d0/128, d0 mod 128, d1) The names used (d0, d1) don't matter - it's the mathematical function that is unique to this affine map.

Member Typedef Documentation

◆ ImplType

Constructor & Destructor Documentation

◆ AffineMap() [1/3]

mlir::AffineMap::AffineMap ( )
inline

◆ AffineMap() [2/3]

mlir::AffineMap::AffineMap ( ImplType map)
inlineexplicit

◆ AffineMap() [3/3]

mlir::AffineMap::AffineMap ( const AffineMap other)
inline

Member Function Documentation

◆ compose()

AffineMap AffineMap::compose ( AffineMap  map)

Returns the AffineMap resulting from composing this with map. The resulting AffineMap has as many AffineDimExpr as map and as many AffineSymbolExpr as the concatenation of this and map (in which case the symbols of this map come first).

Prerequisites: The maps are composable, i.e. that the number of AffineDimExpr of this matches the number of results of map.

Example: map1: (d0, d1)[s0, s1] -> (d0 + 1 + s1, d1 - 1 - s0) map2: (d0)[s0] -> (d0 + s0, d0 - s0) map1.compose(map2): (d0)[s0, s1, s2] -> (d0 + s1 + s2 + 1, d0 - s0 - s2 - 1)

◆ constantFold()

LogicalResult AffineMap::constantFold ( ArrayRef< Attribute operandConstants,
SmallVectorImpl< Attribute > &  results 
) const

Folds the results of the application of an affine map on the provided operands to a constant if possible.

Folds the results of the application of an affine map on the provided operands to a constant if possible. Returns false if the folding happens, true otherwise.

◆ dump()

void AffineMap::dump ( ) const

◆ get() [1/2]

AffineMap AffineMap::get ( MLIRContext context)
static

Returns a zero result affine map with no dimensions or symbols: () -> ().

◆ get() [2/2]

AffineMap AffineMap::get ( unsigned  dimCount,
unsigned  symbolCount,
ArrayRef< AffineExpr results 
)
static

◆ getConstantMap()

AffineMap AffineMap::getConstantMap ( int64_t  val,
MLIRContext context 
)
static

Returns a single constant result affine map.

◆ getContext()

MLIRContext * AffineMap::getContext ( ) const

◆ getMultiDimIdentityMap()

AffineMap AffineMap::getMultiDimIdentityMap ( unsigned  numDims,
MLIRContext context 
)
static

Returns an AffineMap with 'numDims' identity result dim exprs.

◆ getNumDims()

unsigned AffineMap::getNumDims ( ) const

◆ getNumInputs()

unsigned AffineMap::getNumInputs ( ) const

◆ getNumResults()

unsigned AffineMap::getNumResults ( ) const

◆ getNumSymbols()

unsigned AffineMap::getNumSymbols ( ) const

◆ getPermutationMap()

AffineMap AffineMap::getPermutationMap ( ArrayRef< unsigned >  permutation,
MLIRContext context 
)
static

Returns an AffineMap representing a permutation.

Returns an AffineMap representing a permutation. The permutation is expressed as a non-empty vector of integers. E.g. the permutation (i,j,k) -> (j,k,i) will be expressed with permutation = [1,2,0]. All values in permutation must be integers, in the range 0..permutation.size()-1 without duplications (i.e. [1,1,2] is an invalid permutation).

◆ getResult()

AffineExpr AffineMap::getResult ( unsigned  idx) const

◆ getResults()

ArrayRef< AffineExpr > AffineMap::getResults ( ) const

◆ getSingleConstantResult()

int64_t AffineMap::getSingleConstantResult ( ) const

Returns the constant result of this map. This methods asserts that the map has a single constant result.

◆ getSubMap()

AffineMap AffineMap::getSubMap ( ArrayRef< unsigned >  resultPos)

Returns the map consisting of the resultPos subset.

◆ isEmpty()

bool AffineMap::isEmpty ( ) const

Returns true if this affine map is an empty map, i.e., () -> ().

◆ isIdentity()

bool AffineMap::isIdentity ( ) const

Returns true if this affine map is an identity affine map. An identity affine map corresponds to an identity affine function on the dimensional identifiers.

◆ isPermutation()

bool AffineMap::isPermutation ( )

Returns true if the AffineMap represents a symbol-less permutation map.

◆ isProjectedPermutation()

bool AffineMap::isProjectedPermutation ( )

Returns true if the AffineMap represents a subset (i.e. a projection) of a symbol-less permutation map.

◆ isSingleConstant()

bool AffineMap::isSingleConstant ( ) const

Returns true if this affine map is a single result constant function.

◆ operator bool()

mlir::AffineMap::operator bool ( )
inlineexplicit

◆ operator!=()

bool mlir::AffineMap::operator!= ( AffineMap  other) const
inline

◆ operator=()

AffineMap& mlir::AffineMap::operator= ( const AffineMap other)
default

◆ operator==()

bool mlir::AffineMap::operator== ( AffineMap  other) const
inline

◆ print()

void AffineMap::print ( raw_ostream &  os) const

◆ replaceDimsAndSymbols()

AffineMap AffineMap::replaceDimsAndSymbols ( ArrayRef< AffineExpr dimReplacements,
ArrayRef< AffineExpr symReplacements,
unsigned  numResultDims,
unsigned  numResultSyms 
)

This method substitutes any uses of dimensions and symbols (e.g. dim#0 with dimReplacements[0]) in subexpressions and returns the modified expression mapping. Because this can be used to eliminate dims and symbols, the client needs to specify the number of dims and symbols in the result. The returned map always has the same number of results.

◆ walkExprs()

void AffineMap::walkExprs ( std::function< void(AffineExpr)>  callback) const

Walk all of the AffineExpr's in this mapping. Each node in an expression tree is visited in postorder.

Friends And Related Function Documentation

◆ hash_value

::llvm::hash_code hash_value ( AffineMap  arg)
friend

The documentation for this class was generated from the following files: