MLIR 24.0.0git
AffineExpr.cpp File Reference
#include "mlir-c/AffineExpr.h"
#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/AffineExpr.h"

Go to the source code of this file.

Functions

MlirContext mlirAffineExprGetContext (MlirAffineExpr affineExpr)
 Gets the context that owns the affine expression.
bool mlirAffineExprEqual (MlirAffineExpr lhs, MlirAffineExpr rhs)
 Returns true if the two affine expressions are equal.
void mlirAffineExprPrint (MlirAffineExpr affineExpr, MlirStringCallback callback, void *userData)
void mlirAffineExprDump (MlirAffineExpr affineExpr)
bool mlirAffineExprIsSymbolicOrConstant (MlirAffineExpr affineExpr)
bool mlirAffineExprIsPureAffine (MlirAffineExpr affineExpr)
int64_t mlirAffineExprGetLargestKnownDivisor (MlirAffineExpr affineExpr)
bool mlirAffineExprIsMultipleOf (MlirAffineExpr affineExpr, int64_t factor)
bool mlirAffineExprIsFunctionOfDim (MlirAffineExpr affineExpr, intptr_t position)
MlirAffineExpr mlirAffineExprCompose (MlirAffineExpr affineExpr, MlirAffineMap affineMap)
MlirAffineExpr mlirAffineExprShiftDims (MlirAffineExpr affineExpr, uint32_t numDims, uint32_t shift, uint32_t offset)
MlirAffineExpr mlirAffineExprShiftSymbols (MlirAffineExpr affineExpr, uint32_t numSymbols, uint32_t shift, uint32_t offset)
MlirAffineExpr mlirSimplifyAffineExpr (MlirAffineExpr expr, uint32_t numDims, uint32_t numSymbols)
 Prints an affine expression by sending chunks of the string representation and forwarding userData to callback`.
bool mlirAffineExprIsADim (MlirAffineExpr affineExpr)
 Checks whether the given affine expression is a dimension expression.
MlirAffineExpr mlirAffineDimExprGet (MlirContext ctx, intptr_t position)
 Creates an affine dimension expression with 'position' in the context.
intptr_t mlirAffineDimExprGetPosition (MlirAffineExpr affineExpr)
 Returns the position of the given affine dimension expression.
bool mlirAffineExprIsASymbol (MlirAffineExpr affineExpr)
 Checks whether the given affine expression is a symbol expression.
MlirAffineExpr mlirAffineSymbolExprGet (MlirContext ctx, intptr_t position)
 Creates an affine symbol expression with 'position' in the context.
intptr_t mlirAffineSymbolExprGetPosition (MlirAffineExpr affineExpr)
 Returns the position of the given affine symbol expression.
bool mlirAffineExprIsAConstant (MlirAffineExpr affineExpr)
 Checks whether the given affine expression is a constant expression.
MlirAffineExpr mlirAffineConstantExprGet (MlirContext ctx, int64_t constant)
 Creates an affine constant expression with 'constant' in the context.
int64_t mlirAffineConstantExprGetValue (MlirAffineExpr affineExpr)
 Returns the value of the given affine constant expression.
bool mlirAffineExprIsAAdd (MlirAffineExpr affineExpr)
 Checks whether the given affine expression is an add expression.
MlirAffineExpr mlirAffineAddExprGet (MlirAffineExpr lhs, MlirAffineExpr rhs)
 Creates an affine add expression with 'lhs' and 'rhs'.
bool mlirAffineExprIsAMul (MlirAffineExpr affineExpr)
 Checks whether the given affine expression is an mul expression.
MlirAffineExpr mlirAffineMulExprGet (MlirAffineExpr lhs, MlirAffineExpr rhs)
 Creates an affine mul expression with 'lhs' and 'rhs'.
bool mlirAffineExprIsAMod (MlirAffineExpr affineExpr)
 Checks whether the given affine expression is an mod expression.
MlirAffineExpr mlirAffineModExprGet (MlirAffineExpr lhs, MlirAffineExpr rhs)
 Creates an affine mod expression with 'lhs' and 'rhs'.
bool mlirAffineExprIsAFloorDiv (MlirAffineExpr affineExpr)
 Checks whether the given affine expression is an floordiv expression.
MlirAffineExpr mlirAffineFloorDivExprGet (MlirAffineExpr lhs, MlirAffineExpr rhs)
 Creates an affine floordiv expression with 'lhs' and 'rhs'.
bool mlirAffineExprIsACeilDiv (MlirAffineExpr affineExpr)
 Checks whether the given affine expression is an ceildiv expression.
MlirAffineExpr mlirAffineCeilDivExprGet (MlirAffineExpr lhs, MlirAffineExpr rhs)
 Creates an affine ceildiv expression with 'lhs' and 'rhs'.
bool mlirAffineExprIsABinary (MlirAffineExpr affineExpr)
 Checks whether the given affine expression is binary.
MlirAffineExpr mlirAffineBinaryOpExprGetLHS (MlirAffineExpr affineExpr)
 Returns the left hand side affine expression of the given affine binary operation expression.
MlirAffineExpr mlirAffineBinaryOpExprGetRHS (MlirAffineExpr affineExpr)
 Returns the right hand side affine expression of the given affine binary operation expression.

Function Documentation

◆ mlirAffineAddExprGet()

MlirAffineExpr mlirAffineAddExprGet ( MlirAffineExpr lhs,
MlirAffineExpr rhs )

◆ mlirAffineBinaryOpExprGetLHS()

MlirAffineExpr mlirAffineBinaryOpExprGetLHS ( MlirAffineExpr affineExpr)

Returns the left hand side affine expression of the given affine binary operation expression.

Definition at line 205 of file AffineExpr.cpp.

References unwrap(), and wrap().

Referenced by mlir::python::MLIR_BINDINGS_PYTHON_DOMAIN::PyAffineBinaryExpr::lhs().

◆ mlirAffineBinaryOpExprGetRHS()

MlirAffineExpr mlirAffineBinaryOpExprGetRHS ( MlirAffineExpr affineExpr)

Returns the right hand side affine expression of the given affine binary operation expression.

Definition at line 209 of file AffineExpr.cpp.

References unwrap(), and wrap().

Referenced by mlir::python::MLIR_BINDINGS_PYTHON_DOMAIN::PyAffineBinaryExpr::rhs().

◆ mlirAffineCeilDivExprGet()

MlirAffineExpr mlirAffineCeilDivExprGet ( MlirAffineExpr lhs,
MlirAffineExpr rhs )

◆ mlirAffineConstantExprGet()

◆ mlirAffineConstantExprGetValue()

int64_t mlirAffineConstantExprGetValue ( MlirAffineExpr affineExpr)

Returns the value of the given affine constant expression.

Definition at line 126 of file AffineExpr.cpp.

References unwrap().

Referenced by mlir::python::MLIR_BINDINGS_PYTHON_DOMAIN::PyAffineConstantExpr::bindDerived().

◆ mlirAffineDimExprGet()

MlirAffineExpr mlirAffineDimExprGet ( MlirContext ctx,
intptr_t position )

Creates an affine dimension expression with 'position' in the context.

Definition at line 90 of file AffineExpr.cpp.

References mlir::getAffineDimExpr(), unwrap(), and wrap().

Referenced by mlir::python::MLIR_BINDINGS_PYTHON_DOMAIN::PyAffineDimExpr::get().

◆ mlirAffineDimExprGetPosition()

intptr_t mlirAffineDimExprGetPosition ( MlirAffineExpr affineExpr)

Returns the position of the given affine dimension expression.

Definition at line 94 of file AffineExpr.cpp.

References unwrap().

Referenced by mlir::python::MLIR_BINDINGS_PYTHON_DOMAIN::PyAffineDimExpr::bindDerived().

◆ mlirAffineExprCompose()

MlirAffineExpr mlirAffineExprCompose ( MlirAffineExpr affineExpr,
MlirAffineMap affineMap )

Definition at line 60 of file AffineExpr.cpp.

References unwrap(), and wrap().

Referenced by mlir::python::MLIR_BINDINGS_PYTHON_DOMAIN::populateIRAffine().

◆ mlirAffineExprDump()

void mlirAffineExprDump ( MlirAffineExpr affineExpr)

◆ mlirAffineExprEqual()

bool mlirAffineExprEqual ( MlirAffineExpr lhs,
MlirAffineExpr rhs )

Returns true if the two affine expressions are equal.

Definition at line 24 of file AffineExpr.cpp.

References unwrap().

Referenced by mlir::python::MLIR_BINDINGS_PYTHON_DOMAIN::PyAffineExpr::operator==().

◆ mlirAffineExprGetContext()

◆ mlirAffineExprGetLargestKnownDivisor()

int64_t mlirAffineExprGetLargestKnownDivisor ( MlirAffineExpr affineExpr)

Definition at line 47 of file AffineExpr.cpp.

References unwrap().

◆ mlirAffineExprIsAAdd()

bool mlirAffineExprIsAAdd ( MlirAffineExpr affineExpr)

Checks whether the given affine expression is an add expression.

Definition at line 134 of file AffineExpr.cpp.

References mlir::Add, and unwrap().

Referenced by mlir::python::MLIR_BINDINGS_PYTHON_DOMAIN::PyAffineExpr::maybeDownCast().

◆ mlirAffineExprIsABinary()

bool mlirAffineExprIsABinary ( MlirAffineExpr affineExpr)

Checks whether the given affine expression is binary.

Definition at line 201 of file AffineExpr.cpp.

References unwrap().

◆ mlirAffineExprIsACeilDiv()

bool mlirAffineExprIsACeilDiv ( MlirAffineExpr affineExpr)

Checks whether the given affine expression is an ceildiv expression.

Definition at line 187 of file AffineExpr.cpp.

References mlir::CeilDiv, and unwrap().

Referenced by mlir::python::MLIR_BINDINGS_PYTHON_DOMAIN::PyAffineExpr::maybeDownCast().

◆ mlirAffineExprIsAConstant()

bool mlirAffineExprIsAConstant ( MlirAffineExpr affineExpr)

Checks whether the given affine expression is a constant expression.

Definition at line 118 of file AffineExpr.cpp.

References unwrap().

Referenced by mlir::python::MLIR_BINDINGS_PYTHON_DOMAIN::PyAffineExpr::maybeDownCast().

◆ mlirAffineExprIsADim()

bool mlirAffineExprIsADim ( MlirAffineExpr affineExpr)

Checks whether the given affine expression is a dimension expression.

Definition at line 86 of file AffineExpr.cpp.

References unwrap().

Referenced by mlir::python::MLIR_BINDINGS_PYTHON_DOMAIN::PyAffineExpr::maybeDownCast().

◆ mlirAffineExprIsAFloorDiv()

bool mlirAffineExprIsAFloorDiv ( MlirAffineExpr affineExpr)

Checks whether the given affine expression is an floordiv expression.

Definition at line 173 of file AffineExpr.cpp.

References mlir::FloorDiv, and unwrap().

Referenced by mlir::python::MLIR_BINDINGS_PYTHON_DOMAIN::PyAffineExpr::maybeDownCast().

◆ mlirAffineExprIsAMod()

bool mlirAffineExprIsAMod ( MlirAffineExpr affineExpr)

Checks whether the given affine expression is an mod expression.

Definition at line 160 of file AffineExpr.cpp.

References mlir::Mod, and unwrap().

Referenced by mlir::python::MLIR_BINDINGS_PYTHON_DOMAIN::PyAffineExpr::maybeDownCast().

◆ mlirAffineExprIsAMul()

bool mlirAffineExprIsAMul ( MlirAffineExpr affineExpr)

Checks whether the given affine expression is an mul expression.

Definition at line 147 of file AffineExpr.cpp.

References mlir::Mul, and unwrap().

Referenced by mlir::python::MLIR_BINDINGS_PYTHON_DOMAIN::PyAffineExpr::maybeDownCast().

◆ mlirAffineExprIsASymbol()

bool mlirAffineExprIsASymbol ( MlirAffineExpr affineExpr)

Checks whether the given affine expression is a symbol expression.

Definition at line 102 of file AffineExpr.cpp.

References unwrap().

Referenced by mlir::python::MLIR_BINDINGS_PYTHON_DOMAIN::PyAffineExpr::maybeDownCast().

◆ mlirAffineExprIsFunctionOfDim()

bool mlirAffineExprIsFunctionOfDim ( MlirAffineExpr affineExpr,
intptr_t position )

Definition at line 55 of file AffineExpr.cpp.

References unwrap().

◆ mlirAffineExprIsMultipleOf()

bool mlirAffineExprIsMultipleOf ( MlirAffineExpr affineExpr,
int64_t factor )

Definition at line 51 of file AffineExpr.cpp.

References unwrap().

◆ mlirAffineExprIsPureAffine()

bool mlirAffineExprIsPureAffine ( MlirAffineExpr affineExpr)

Definition at line 43 of file AffineExpr.cpp.

References unwrap().

◆ mlirAffineExprIsSymbolicOrConstant()

bool mlirAffineExprIsSymbolicOrConstant ( MlirAffineExpr affineExpr)

Definition at line 39 of file AffineExpr.cpp.

References unwrap().

◆ mlirAffineExprPrint()

void mlirAffineExprPrint ( MlirAffineExpr affineExpr,
MlirStringCallback callback,
void * userData )

◆ mlirAffineExprShiftDims()

MlirAffineExpr mlirAffineExprShiftDims ( MlirAffineExpr affineExpr,
uint32_t numDims,
uint32_t shift,
uint32_t offset )

Definition at line 65 of file AffineExpr.cpp.

References unwrap(), and wrap().

Referenced by mlir::python::MLIR_BINDINGS_PYTHON_DOMAIN::populateIRAffine().

◆ mlirAffineExprShiftSymbols()

MlirAffineExpr mlirAffineExprShiftSymbols ( MlirAffineExpr affineExpr,
uint32_t numSymbols,
uint32_t shift,
uint32_t offset )

Definition at line 71 of file AffineExpr.cpp.

References unwrap(), and wrap().

Referenced by mlir::python::MLIR_BINDINGS_PYTHON_DOMAIN::populateIRAffine().

◆ mlirAffineFloorDivExprGet()

MlirAffineExpr mlirAffineFloorDivExprGet ( MlirAffineExpr lhs,
MlirAffineExpr rhs )

◆ mlirAffineModExprGet()

MlirAffineExpr mlirAffineModExprGet ( MlirAffineExpr lhs,
MlirAffineExpr rhs )

◆ mlirAffineMulExprGet()

MlirAffineExpr mlirAffineMulExprGet ( MlirAffineExpr lhs,
MlirAffineExpr rhs )

◆ mlirAffineSymbolExprGet()

MlirAffineExpr mlirAffineSymbolExprGet ( MlirContext ctx,
intptr_t position )

Creates an affine symbol expression with 'position' in the context.

Definition at line 106 of file AffineExpr.cpp.

References mlir::getAffineSymbolExpr(), unwrap(), and wrap().

Referenced by mlir::python::MLIR_BINDINGS_PYTHON_DOMAIN::PyAffineSymbolExpr::get().

◆ mlirAffineSymbolExprGetPosition()

intptr_t mlirAffineSymbolExprGetPosition ( MlirAffineExpr affineExpr)

Returns the position of the given affine symbol expression.

Definition at line 110 of file AffineExpr.cpp.

References unwrap().

Referenced by mlir::python::MLIR_BINDINGS_PYTHON_DOMAIN::PyAffineSymbolExpr::bindDerived().

◆ mlirSimplifyAffineExpr()

MlirAffineExpr mlirSimplifyAffineExpr ( MlirAffineExpr expr,
uint32_t numDims,
uint32_t numSymbols )

Prints an affine expression by sending chunks of the string representation and forwarding userData to callback`.

Note that the callback may be called / several times with consecutive chunks of the string. MLIR_CAPI_EXPORTED void mlirAffineExprPrint(MlirAffineExpr affineExpr, MlirStringCallback callback, void *userData);

/ Prints the affine expression to the standard error stream. MLIR_CAPI_EXPORTED void mlirAffineExprDump(MlirAffineExpr affineExpr);

/ Checks whether the given affine expression is made out of only symbols and / constants. MLIR_CAPI_EXPORTED bool mlirAffineExprIsSymbolicOrConstant(MlirAffineExpr affineExpr);

/ Checks whether the given affine expression is a pure affine expression, i.e. / mul, floordiv, ceildic, and mod is only allowed w.r.t constants. MLIR_CAPI_EXPORTED bool mlirAffineExprIsPureAffine(MlirAffineExpr affineExpr);

/ Returns the greatest known integral divisor of this affine expression. The / result is always positive. MLIR_CAPI_EXPORTED int64_t mlirAffineExprGetLargestKnownDivisor(MlirAffineExpr affineExpr);

/ Checks whether the given affine expression is a multiple of 'factor'. MLIR_CAPI_EXPORTED bool mlirAffineExprIsMultipleOf(MlirAffineExpr affineExpr, int64_t factor);

/ Checks whether the given affine expression involves AffineDimExpr / 'position'. MLIR_CAPI_EXPORTED bool mlirAffineExprIsFunctionOfDim(MlirAffineExpr affineExpr, intptr_t position);

/ Composes the given map with the given expression. MLIR_CAPI_EXPORTED MlirAffineExpr mlirAffineExprCompose( MlirAffineExpr affineExpr, struct MlirAffineMap affineMap);

/ Replace dims[offset ... numDims) / by dims[offset + shift ... shift + numDims). MLIR_CAPI_EXPORTED MlirAffineExpr mlirAffineExprShiftDims(MlirAffineExpr affineExpr, uint32_t numDims, uint32_t shift, uint32_t offset);

/ Replace symbols[offset ... numSymbols) / by symbols[offset + shift ... shift + numSymbols). MLIR_CAPI_EXPORTED MlirAffineExpr mlirAffineExprShiftSymbols(MlirAffineExpr affineExpr, uint32_t numSymbols, uint32_t shift, uint32_t offset);

/ Simplify an affine expression by flattening and some amount of simple / analysis. This has complexity linear in the number of nodes in 'expr'. / Returns the simplified expression, which is the same as the input expression / if it can't be simplified. When expr is semi-affine, a simplified semi-affine expression is constructed in the sorted order of dimension and symbol positions.

Definition at line 77 of file AffineExpr.cpp.

References mlir::simplifyAffineExpr(), unwrap(), and wrap().

Referenced by mlir::python::MLIR_BINDINGS_PYTHON_DOMAIN::populateIRAffine().