My Project
|
#include <AffineMap.h>
Public Types | |
using | ImplType = detail::AffineMapStorage |
Public Member Functions | |
AffineMap () | |
AffineMap (ImplType *map) | |
AffineMap (const AffineMap &other) | |
AffineMap & | operator= (const AffineMap &other)=default |
MLIRContext * | getContext () 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< AffineExpr > | getResults () 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) |
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.
|
inline |
|
inlineexplicit |
|
inline |
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)
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.
void AffineMap::dump | ( | ) | const |
|
static |
Returns a zero result affine map with no dimensions or symbols: () -> ().
|
static |
|
static |
Returns a single constant result affine map.
MLIRContext * AffineMap::getContext | ( | ) | const |
|
static |
Returns an AffineMap with 'numDims' identity result dim exprs.
unsigned AffineMap::getNumDims | ( | ) | const |
unsigned AffineMap::getNumInputs | ( | ) | const |
unsigned AffineMap::getNumResults | ( | ) | const |
unsigned AffineMap::getNumSymbols | ( | ) | const |
|
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).
AffineExpr AffineMap::getResult | ( | unsigned | idx | ) | const |
ArrayRef< AffineExpr > AffineMap::getResults | ( | ) | const |
int64_t AffineMap::getSingleConstantResult | ( | ) | const |
Returns the constant result of this map. This methods asserts that the map has a single constant result.
Returns the map consisting of the resultPos
subset.
bool AffineMap::isEmpty | ( | ) | const |
Returns true if this affine map is an empty map, i.e., () -> ().
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.
bool AffineMap::isPermutation | ( | ) |
Returns true if the AffineMap represents a symbol-less permutation map.
bool AffineMap::isProjectedPermutation | ( | ) |
Returns true if the AffineMap represents a subset (i.e. a projection) of a symbol-less permutation map.
bool AffineMap::isSingleConstant | ( | ) | const |
Returns true if this affine map is a single result constant function.
|
inlineexplicit |
|
inline |
|
inline |
void AffineMap::print | ( | raw_ostream & | os | ) | const |
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.
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.
|
friend |