42 intptr_t symbolCount) {
47 intptr_t symbolCount, intptr_t nAffineExprs,
48 MlirAffineExpr *affineExprs) {
69 unsigned *permutation) {
75 return unwrap(affineMap).isIdentity();
79 return unwrap(affineMap).isMinorIdentity();
83 return unwrap(affineMap).isEmpty();
87 return unwrap(affineMap).isSingleConstant();
91 return unwrap(affineMap).getSingleConstantResult();
95 return unwrap(affineMap).getNumDims();
99 return unwrap(affineMap).getNumSymbols();
103 return unwrap(affineMap).getNumResults();
107 return wrap(
unwrap(affineMap).getResult(
static_cast<unsigned>(pos)));
111 return unwrap(affineMap).getNumInputs();
115 return unwrap(affineMap).isProjectedPermutation();
119 return unwrap(affineMap).isPermutation();
123 intptr_t *resultPos) {
126 for (intptr_t i = 0; i < size; ++i)
127 pos.push_back(
static_cast<unsigned>(resultPos[i]));
128 return wrap(
unwrap(affineMap).getSubMap(pos));
132 intptr_t numResults) {
133 return wrap(
unwrap(affineMap).getMajorSubMap(numResults));
137 intptr_t numResults) {
138 return wrap(
unwrap(affineMap).getMinorSubMap(numResults));
142 MlirAffineExpr expression,
143 MlirAffineExpr replacement,
144 intptr_t numResultDims,
145 intptr_t numResultSyms) {
147 numResultDims, numResultSyms));
151 MlirAffineMap *affineMaps, intptr_t size,
void *result,
152 void (*populateResult)(
void *res, intptr_t idx, MlirAffineMap m)) {
154 for (intptr_t idx = 0; idx < size; ++idx)
155 maps.push_back(
unwrap(affineMaps[idx]));
158 populateResult(result, idx++,
wrap(m));
MlirAffineMap mlirAffineMapMultiDimIdentityGet(MlirContext ctx, intptr_t numDims)
Creates an affine map with 'numDims' identity in the context.
MlirAffineMap mlirAffineMapPermutationGet(MlirContext ctx, intptr_t size, unsigned *permutation)
Creates an affine map with a permutation expression and its size in the context.
void mlirAffineMapDump(MlirAffineMap affineMap)
Prints the affine map to the standard error stream.
bool mlirAffineMapIsProjectedPermutation(MlirAffineMap affineMap)
Checks whether the given affine map represents a subset of a symbol-less permutation map.
bool mlirAffineMapIsEmpty(MlirAffineMap affineMap)
Checks whether the given affine map is an empty affine map.
MlirAffineMap mlirAffineMapConstantGet(MlirContext ctx, int64_t val)
Creates a single constant result affine map in the context.
MlirAffineExpr mlirAffineMapGetResult(MlirAffineMap affineMap, intptr_t pos)
Returns the result at the given position.
intptr_t mlirAffineMapGetNumInputs(MlirAffineMap affineMap)
Returns the number of inputs (dimensions + symbols) of the given affine map.
bool mlirAffineMapIsMinorIdentity(MlirAffineMap affineMap)
Checks whether the given affine map is a minor identity affine map.
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.
int64_t mlirAffineMapGetSingleConstantResult(MlirAffineMap affineMap)
Returns the constant result of the given affine map.
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.
MlirAffineMap mlirAffineMapGetSubMap(MlirAffineMap affineMap, intptr_t size, intptr_t *resultPos)
Returns the affine map consisting of the resultPos subset.
MlirContext mlirAffineMapGetContext(MlirAffineMap affineMap)
Gets the context that the given affine map was created with.
void mlirAffineMapPrint(MlirAffineMap affineMap, MlirStringCallback callback, void *userData)
Prints an affine map by sending chunks of the string representation and forwarding userData tocallbac...
MlirAffineMap mlirAffineMapEmptyGet(MlirContext ctx)
Creates a zero result affine map with no dimensions or symbols in the context.
MlirAffineMap mlirAffineMapGetMajorSubMap(MlirAffineMap affineMap, intptr_t numResults)
Returns the affine map consisting of the most major numResults results.
bool mlirAffineMapIsSingleConstant(MlirAffineMap affineMap)
Checks whether the given affine map is a single result constant affine map.
MlirAffineMap mlirAffineMapMinorIdentityGet(MlirContext ctx, intptr_t dims, intptr_t results)
Creates an identity affine map on the most minor dimensions in the context.
bool mlirAffineMapIsPermutation(MlirAffineMap affineMap)
Checks whether the given affine map represents a symbol-less permutation map.
MlirAffineMap mlirAffineMapGetMinorSubMap(MlirAffineMap affineMap, intptr_t numResults)
Returns the affine map consisting of the most minor numResults results.
bool mlirAffineMapEqual(MlirAffineMap a1, MlirAffineMap a2)
Checks if two affine maps are equal.
intptr_t mlirAffineMapGetNumDims(MlirAffineMap affineMap)
Returns the number of dimensions of the given affine map.
intptr_t mlirAffineMapGetNumResults(MlirAffineMap affineMap)
Returns the number of results of the given affine map.
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 res...
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 th...
intptr_t mlirAffineMapGetNumSymbols(MlirAffineMap affineMap)
Returns the number of symbols of the given affine map.
bool mlirAffineMapIsIdentity(MlirAffineMap affineMap)
Checks whether the given affine map is an identity affine map.
static MLIRContext * getContext(OpFoldResult val)
static llvm::ArrayRef< CppTy > unwrapList(size_t size, CTy *first, llvm::SmallVectorImpl< CppTy > &storage)
static AffineMap getMinorIdentityMap(unsigned dims, unsigned results, MLIRContext *context)
Returns an identity affine map (d0, ..., dn) -> (dp, ..., dn) on the most minor dimensions.
static AffineMap getMultiDimIdentityMap(unsigned numDims, MLIRContext *context)
Returns an AffineMap with 'numDims' identity result dim exprs.
static AffineMap get(MLIRContext *context)
Returns a zero result affine map with no dimensions or symbols: () -> ().
static AffineMap getPermutationMap(ArrayRef< unsigned > permutation, MLIRContext *context)
Returns an AffineMap representing a permutation.
static AffineMap getConstantMap(int64_t val, MLIRContext *context)
Returns a single constant result affine map.
void print(raw_ostream &os) const
Outputs this diagnostic to a stream.
A simple raw ostream subclass that forwards write_impl calls to the user-supplied callback together w...
mlir::Diagnostic & unwrap(MlirDiagnostic diagnostic)
MlirDiagnostic wrap(mlir::Diagnostic &diagnostic)
void(* MlirStringCallback)(MlirStringRef, void *)
A callback for returning string references.
Include the generated interface declarations.
AffineMap compressUnusedSymbols(AffineMap map)
Drop the symbols that are not used.