MLIR  16.0.0git
AffineMap.cpp File Reference
#include "mlir-c/AffineMap.h"
#include "mlir-c/IR.h"
#include "mlir/CAPI/AffineExpr.h"
#include "mlir/CAPI/AffineMap.h"
#include "mlir/CAPI/IR.h"
#include "mlir/CAPI/Utils.h"
#include "mlir/IR/AffineMap.h"
Include dependency graph for AffineMap.cpp:

Go to the source code of this file.

Functions

MlirContext mlirAffineMapGetContext (MlirAffineMap affineMap)
Gets the context that the given affine map was created with. More...

bool mlirAffineMapEqual (MlirAffineMap a1, MlirAffineMap a2)
Checks if two affine maps are equal. More...

void mlirAffineMapPrint (MlirAffineMap affineMap, MlirStringCallback callback, void *userData)
Prints an affine map by sending chunks of the string representation and forwarding userData tocallback. More...

void mlirAffineMapDump (MlirAffineMap affineMap)
Prints the affine map to the standard error stream. More...

MlirAffineMap mlirAffineMapEmptyGet (MlirContext ctx)
Creates a zero result affine map with no dimensions or symbols in the context. More...

MlirAffineMap mlirAffineMapZeroResultGet (MlirContext ctx, intptr_t dimCount, intptr_t symbolCount)
Creates a zero result affine map of the given dimensions and symbols in the context. More...

MlirAffineMap mlirAffineMapGet (MlirContext ctx, intptr_t dimCount, intptr_t symbolCount, intptr_t nAffineExprs, MlirAffineExpr *affineExprs)
Creates an affine map with results defined by the given list of affine expressions. More...

MlirAffineMap mlirAffineMapConstantGet (MlirContext ctx, int64_t val)
Creates a single constant result affine map in the context. More...

MlirAffineMap mlirAffineMapMultiDimIdentityGet (MlirContext ctx, intptr_t numDims)
Creates an affine map with 'numDims' identity in the context. More...

MlirAffineMap mlirAffineMapMinorIdentityGet (MlirContext ctx, intptr_t dims, intptr_t results)
Creates an identity affine map on the most minor dimensions in the context. More...

MlirAffineMap mlirAffineMapPermutationGet (MlirContext ctx, intptr_t size, unsigned *permutation)
Creates an affine map with a permutation expression and its size in the context. More...

bool mlirAffineMapIsIdentity (MlirAffineMap affineMap)
Checks whether the given affine map is an identity affine map. More...

bool mlirAffineMapIsMinorIdentity (MlirAffineMap affineMap)
Checks whether the given affine map is a minor identity affine map. More...

bool mlirAffineMapIsEmpty (MlirAffineMap affineMap)
Checks whether the given affine map is an empty affine map. More...

bool mlirAffineMapIsSingleConstant (MlirAffineMap affineMap)
Checks whether the given affine map is a single result constant affine map. More...

int64_t mlirAffineMapGetSingleConstantResult (MlirAffineMap affineMap)
Returns the constant result of the given affine map. More...

intptr_t mlirAffineMapGetNumDims (MlirAffineMap affineMap)
Returns the number of dimensions of the given affine map. More...

intptr_t mlirAffineMapGetNumSymbols (MlirAffineMap affineMap)
Returns the number of symbols of the given affine map. More...

intptr_t mlirAffineMapGetNumResults (MlirAffineMap affineMap)
Returns the number of results of the given affine map. More...

MlirAffineExpr mlirAffineMapGetResult (MlirAffineMap affineMap, intptr_t pos)
Returns the result at the given position. More...

intptr_t mlirAffineMapGetNumInputs (MlirAffineMap affineMap)
Returns the number of inputs (dimensions + symbols) of the given affine map. More...

bool mlirAffineMapIsProjectedPermutation (MlirAffineMap affineMap)
Checks whether the given affine map represents a subset of a symbol-less permutation map. More...

bool mlirAffineMapIsPermutation (MlirAffineMap affineMap)
Checks whether the given affine map represents a symbol-less permutation map. More...

MlirAffineMap mlirAffineMapGetSubMap (MlirAffineMap affineMap, intptr_t size, intptr_t *resultPos)
Returns the affine map consisting of the resultPos subset. More...

MlirAffineMap mlirAffineMapGetMajorSubMap (MlirAffineMap affineMap, intptr_t numResults)
Returns the affine map consisting of the most major numResults results. More...

MlirAffineMap mlirAffineMapGetMinorSubMap (MlirAffineMap affineMap, intptr_t numResults)
Returns the affine map consisting of the most minor numResults results. More...

MlirAffineMap mlirAffineMapReplace (MlirAffineMap affineMap, MlirAffineExpr expression, MlirAffineExpr replacement, intptr_t numResultDims, intptr_t numResultSyms)
Apply AffineExpr::replace(map) to each of the results and return a new new AffineMap with the new results and the specified number of dims and symbols. More...

void mlirAffineMapCompressUnusedSymbols (MlirAffineMap *affineMaps, intptr_t size, void *result, void(*populateResult)(void *res, intptr_t idx, MlirAffineMap m))
Returns the simplified affine map resulting from dropping the symbols that do not appear in any of the individual maps in affineMaps. More...

◆ mlirAffineMapCompressUnusedSymbols()

 void mlirAffineMapCompressUnusedSymbols ( MlirAffineMap * affineMaps, intptr_t size, void * result, void(*)(void *res, intptr_t idx, MlirAffineMap m) populateResult )

Returns the simplified affine map resulting from dropping the symbols that do not appear in any of the individual maps in affineMaps.

Asserts that all maps in affineMaps are normalized to the same number of dims and symbols. Takes a callback populateResult to fill the res container with value m at entry idx. This allows returning without worrying about ownership considerations.

Definition at line 150 of file AffineMap.cpp.

Referenced by mlir::python::PyIntegerSet::createFromCapsule(), and mlirAffineMapIsNull().

◆ mlirAffineMapConstantGet()

 MlirAffineMap mlirAffineMapConstantGet ( MlirContext ctx, int64_t val )

Creates a single constant result affine map in the context.

The affine map is owned by the context.

Definition at line 54 of file AffineMap.cpp.

References mlir::AffineMap::getConstantMap(), unwrap(), and wrap().

Referenced by mlirAffineMapIsNull().

◆ mlirAffineMapDump()

 void mlirAffineMapDump ( MlirAffineMap affineMap )

Prints the affine map to the standard error stream.

Definition at line 35 of file AffineMap.cpp.

References unwrap().

Referenced by mlirAffineMapIsNull().

◆ mlirAffineMapEmptyGet()

 MlirAffineMap mlirAffineMapEmptyGet ( MlirContext ctx )

Creates a zero result affine map with no dimensions or symbols in the context.

The affine map is owned by the context.

Definition at line 37 of file AffineMap.cpp.

References mlir::AffineMap::get(), unwrap(), and wrap().

Referenced by mlirAffineMapIsNull().

◆ mlirAffineMapEqual()

 bool mlirAffineMapEqual ( MlirAffineMap a1, MlirAffineMap a2 )

Checks if two affine maps are equal.

Definition at line 25 of file AffineMap.cpp.

References unwrap().

Referenced by mlirAffineMapIsNull(), and mlir::python::PyAffineMap::operator==().

◆ mlirAffineMapGet()

 MlirAffineMap mlirAffineMapGet ( MlirContext ctx, intptr_t dimCount, intptr_t symbolCount, intptr_t nAffineExprs, MlirAffineExpr * affineExprs )

Creates an affine map with results defined by the given list of affine expressions.

The map resulting map also has the requested number of input dimensions and symbols, regardless of them being used in the results.

Definition at line 46 of file AffineMap.cpp.

References mlir::AffineMap::get(), unwrap(), unwrapList(), and wrap().

Referenced by mlirAffineMapIsNull().

◆ mlirAffineMapGetContext()

 MlirContext mlirAffineMapGetContext ( MlirAffineMap affineMap )

Gets the context that the given affine map was created with.

Definition at line 21 of file AffineMap.cpp.

References unwrap(), and wrap().

Referenced by mlir::python::PyAffineMap::createFromCapsule().

◆ mlirAffineMapGetMajorSubMap()

 MlirAffineMap mlirAffineMapGetMajorSubMap ( MlirAffineMap affineMap, intptr_t numResults )

Returns the affine map consisting of the most major numResults results.

Returns the null AffineMap if the numResults is equal to zero. Returns the affineMap if numResults is greater or equals to number of results of the given affine map.

Definition at line 131 of file AffineMap.cpp.

References unwrap(), and wrap().

Referenced by mlirAffineMapIsNull().

◆ mlirAffineMapGetMinorSubMap()

 MlirAffineMap mlirAffineMapGetMinorSubMap ( MlirAffineMap affineMap, intptr_t numResults )

Returns the affine map consisting of the most minor numResults results.

Returns the null AffineMap if the numResults is equal to zero. Returns the affineMap if numResults is greater or equals to number of results of the given affine map.

Definition at line 136 of file AffineMap.cpp.

References unwrap(), and wrap().

Referenced by mlirAffineMapIsNull().

◆ mlirAffineMapGetNumDims()

 intptr_t mlirAffineMapGetNumDims ( MlirAffineMap affineMap )

Returns the number of dimensions of the given affine map.

Definition at line 94 of file AffineMap.cpp.

References unwrap().

Referenced by mlirAffineMapIsNull().

◆ mlirAffineMapGetNumInputs()

 intptr_t mlirAffineMapGetNumInputs ( MlirAffineMap affineMap )

Returns the number of inputs (dimensions + symbols) of the given affine map.

Definition at line 110 of file AffineMap.cpp.

References unwrap().

Referenced by mlirAffineMapIsNull().

◆ mlirAffineMapGetNumResults()

 intptr_t mlirAffineMapGetNumResults ( MlirAffineMap affineMap )

Returns the number of results of the given affine map.

Definition at line 102 of file AffineMap.cpp.

References unwrap().

Referenced by mlir::python::PyAffineExpr::createFromCapsule(), and mlirAffineMapIsNull().

◆ mlirAffineMapGetNumSymbols()

 intptr_t mlirAffineMapGetNumSymbols ( MlirAffineMap affineMap )

Returns the number of symbols of the given affine map.

Definition at line 98 of file AffineMap.cpp.

References unwrap().

Referenced by mlirAffineMapIsNull().

◆ mlirAffineMapGetResult()

 MlirAffineExpr mlirAffineMapGetResult ( MlirAffineMap affineMap, intptr_t pos )

Returns the result at the given position.

Definition at line 106 of file AffineMap.cpp.

References unwrap(), and wrap().

Referenced by mlir::python::PyAffineExpr::createFromCapsule(), and mlirAffineMapIsNull().

◆ mlirAffineMapGetSingleConstantResult()

 int64_t mlirAffineMapGetSingleConstantResult ( MlirAffineMap affineMap )

Returns the constant result of the given affine map.

The function asserts that the map has a single constant result.

Definition at line 90 of file AffineMap.cpp.

References unwrap().

Referenced by mlirAffineMapIsNull().

◆ mlirAffineMapGetSubMap()

 MlirAffineMap mlirAffineMapGetSubMap ( MlirAffineMap affineMap, intptr_t size, intptr_t * resultPos )

Returns the affine map consisting of the resultPos subset.

Definition at line 122 of file AffineMap.cpp.

References unwrap(), and wrap().

Referenced by mlirAffineMapIsNull().

◆ mlirAffineMapIsEmpty()

 bool mlirAffineMapIsEmpty ( MlirAffineMap affineMap )

Checks whether the given affine map is an empty affine map.

Definition at line 82 of file AffineMap.cpp.

References unwrap().

Referenced by mlirAffineMapIsNull().

◆ mlirAffineMapIsIdentity()

 bool mlirAffineMapIsIdentity ( MlirAffineMap affineMap )

Checks whether the given affine map is an identity affine map.

The function asserts that the number of dimensions is greater or equal to the number of results.

Definition at line 74 of file AffineMap.cpp.

References unwrap().

Referenced by mlirAffineMapIsNull().

◆ mlirAffineMapIsMinorIdentity()

 bool mlirAffineMapIsMinorIdentity ( MlirAffineMap affineMap )

Checks whether the given affine map is a minor identity affine map.

Definition at line 78 of file AffineMap.cpp.

References unwrap().

Referenced by mlirAffineMapIsNull().

◆ mlirAffineMapIsPermutation()

 bool mlirAffineMapIsPermutation ( MlirAffineMap affineMap )

Checks whether the given affine map represents a symbol-less permutation map.

Definition at line 118 of file AffineMap.cpp.

References unwrap().

Referenced by mlirAffineMapIsNull().

◆ mlirAffineMapIsProjectedPermutation()

 bool mlirAffineMapIsProjectedPermutation ( MlirAffineMap affineMap )

Checks whether the given affine map represents a subset of a symbol-less permutation map.

Definition at line 114 of file AffineMap.cpp.

References unwrap().

Referenced by mlirAffineMapIsNull().

◆ mlirAffineMapIsSingleConstant()

 bool mlirAffineMapIsSingleConstant ( MlirAffineMap affineMap )

Checks whether the given affine map is a single result constant affine map.

Definition at line 86 of file AffineMap.cpp.

References unwrap().

Referenced by mlirAffineMapIsNull().

◆ mlirAffineMapMinorIdentityGet()

 MlirAffineMap mlirAffineMapMinorIdentityGet ( MlirContext ctx, intptr_t dims, intptr_t results )

Creates an identity affine map on the most minor dimensions in the context.

The affine map is owned by the context. The function asserts that the number of dimensions is greater or equal to the number of results.

Definition at line 63 of file AffineMap.cpp.

References mlir::AffineMap::getMinorIdentityMap(), unwrap(), and wrap().

Referenced by mlirAffineMapIsNull().

◆ mlirAffineMapMultiDimIdentityGet()

 MlirAffineMap mlirAffineMapMultiDimIdentityGet ( MlirContext ctx, intptr_t numDims )

Creates an affine map with 'numDims' identity in the context.

The affine map is owned by the context.

Definition at line 58 of file AffineMap.cpp.

References mlir::AffineMap::getMultiDimIdentityMap(), unwrap(), and wrap().

Referenced by mlirAffineMapIsNull().

◆ mlirAffineMapPermutationGet()

 MlirAffineMap mlirAffineMapPermutationGet ( MlirContext ctx, intptr_t size, unsigned * permutation )

Creates an affine map with a permutation expression and its size in the context.

The permutation expression is a non-empty vector of integers. The elements of the permutation vector must be continuous from 0 and cannot be repeated (i.e. [1,2,0] is a valid permutation. [2,0] or [1,1,2] is an invalid invalid permutation.) The affine map is owned by the context.

Definition at line 68 of file AffineMap.cpp.

References mlir::AffineMap::getPermutationMap(), unwrap(), and wrap().

Referenced by mlirAffineMapIsNull().

◆ mlirAffineMapPrint()

 void mlirAffineMapPrint ( MlirAffineMap affineMap, MlirStringCallback callback, void * userData )

Prints an affine map by sending chunks of the string representation and forwarding userData tocallback.

Note that the callback may be called several times with consecutive chunks of the string.

Definition at line 29 of file AffineMap.cpp.

References mlir::Diagnostic::print(), and unwrap().

Referenced by mlir::python::PyIntegerSet::createFromCapsule(), and mlirAffineMapIsNull().

◆ mlirAffineMapReplace()

 MlirAffineMap mlirAffineMapReplace ( MlirAffineMap affineMap, MlirAffineExpr expression, MlirAffineExpr replacement, intptr_t numResultDims, intptr_t numResultSyms )

Apply AffineExpr::replace(map) to each of the results and return a new new AffineMap with the new results and the specified number of dims and symbols.

Definition at line 141 of file AffineMap.cpp.

References unwrap(), and wrap().

Referenced by mlirAffineMapIsNull().

◆ mlirAffineMapZeroResultGet()

 MlirAffineMap mlirAffineMapZeroResultGet ( MlirContext ctx, intptr_t dimCount, intptr_t symbolCount )

Creates a zero result affine map of the given dimensions and symbols in the context.

The affine map is owned by the context.

Definition at line 41 of file AffineMap.cpp.

References mlir::AffineMap::get(), unwrap(), and wrap().

Referenced by mlirAffineMapIsNull().