26#include "llvm/ADT/Hashing.h"
27#include "llvm/ADT/SmallVector.h"
28#include "llvm/ADT/StringRef.h"
29#include "llvm/ADT/Twine.h"
40 R
"(Dumps a debug representation of the object to stderr.)";
46template <
typename PyType,
typename CType>
50 result.reserve(nb::len(list));
51 for (nb::handle item : list) {
53 result.push_back(nb::cast<PyType>(item));
54 }
catch (nb::cast_error &err) {
55 std::string msg = (llvm::Twine(
"Invalid expression when ") + action +
56 " (" + err.what() +
")")
58 throw std::runtime_error(msg.c_str());
59 }
catch (std::runtime_error &err) {
60 std::string msg = (llvm::Twine(
"Invalid expression (None?) when ") +
61 action +
" (" + err.what() +
")")
63 throw std::runtime_error(msg.c_str());
68template <
typename PermutationTy>
69static bool isPermutation(
const std::vector<PermutationTy> &permutation) {
71 for (
auto val : permutation) {
72 if (val < permutation.size()) {
90template <
typename DerivedTy,
typename BaseTy = PyAffineExpr>
97 using ClassTy = nb::class_<DerivedTy, BaseTy>;
102 : BaseTy(std::move(contextRef), affineExpr) {}
107 if (!DerivedTy::isaFunction(orig)) {
108 auto origRepr = nb::cast<std::string>(nb::repr(nb::cast(orig)));
109 throw nb::value_error((Twine(
"Cannot cast affine expression to ") +
110 DerivedTy::pyClassName +
" (from " + origRepr +
118 static void bind(nb::module_ &m) {
119 auto cls =
ClassTy(m, DerivedTy::pyClassName);
120 cls.def(nb::init<PyAffineExpr &>(), nb::arg(
"expr"));
121 DerivedTy::bindDerived(cls);
136 MlirAffineExpr affineExpr =
143 nb::arg(
"context") = nb::none());
163 nb::arg(
"context") = nb::none());
183 nb::arg(
"context") = nb::none());
196 nb::typed<nb::object, PyAffineExpr>
lhs() {
201 nb::typed<nb::object, PyAffineExpr>
rhs() {
372 throw nb::python_error();
379 MlirAffineExpr expr =
get();
396 return nb::cast(*
this);
411 :
public Sliceable<PyAffineMapExprList, PyAffineExpr> {
455 throw nb::python_error();
471 : set(std::move(set)), pos(pos) {}
480 static void bind(nb::module_ &m) {
481 nb::class_<PyIntegerSetConstraint>(m,
"IntegerSetConstraint")
492 :
public Sliceable<PyIntegerSetConstraintList, PyIntegerSetConstraint> {
494 static constexpr const char *
pyClassName =
"IntegerSetConstraintList";
535 throw nb::python_error();
548 nb::class_<PyAffineExpr>(m,
"AffineExpr")
586 [](
PyAffineExpr &self, nb::object &other) {
return false; })
592 return printAccum.
join();
597 printAccum.
parts.append(
"AffineExpr(");
600 printAccum.
parts.append(
")");
601 return printAccum.
join();
605 return static_cast<size_t>(llvm::hash_value(self.
get().ptr));
609 [](
PyAffineExpr &self) -> nb::typed<nb::object, PyMlirContext> {
620 [](
PyAffineExpr &self, uint32_t numDims, uint32_t shift,
626 nb::arg(
"num_dims"), nb::arg(
"shift"), nb::arg(
"offset") = 0)
629 [](
PyAffineExpr &self, uint32_t numSymbols, uint32_t shift,
635 nb::arg(
"num_symbols"), nb::arg(
"shift"), nb::arg(
"offset") = 0)
637 "simplify_affine_expr",
638 [](
PyAffineExpr &self, uint32_t numDims, uint32_t numSymbols) {
643 nb::arg(
"expr"), nb::arg(
"num_dims"), nb::arg(
"num_symbols"),
644 "Simplify an affine expression by flattening and some amount of "
648 "Gets an affine expression containing a sum of two expressions.")
650 "Gets an affine expression containing a sum of a constant "
651 "and another expression.")
653 "Gets an affine expression containing a sum of an expression "
657 "Gets an affine expression containing a product of two expressions.")
659 "Gets an affine expression containing a product of a "
660 "constant and another expression.")
662 "Gets an affine expression containing a product of an "
663 "expression and a constant.")
665 "Gets an affine expression containing the modulo of dividing "
666 "one expression by another.")
668 "Gets a semi-affine expression containing the modulo of "
669 "dividing a constant by an expression.")
671 "Gets an affine expression containing the module of dividing"
672 "an expression by a constant.")
674 "Gets an affine expression containing the rounded-down "
675 "result of dividing one expression by another.")
677 "Gets a semi-affine expression containing the rounded-down "
678 "result of dividing a constant by an expression.")
680 "Gets an affine expression containing the rounded-down "
681 "result of dividing an expression by a constant.")
683 "Gets an affine expression containing the rounded-up result "
684 "of dividing one expression by another.")
686 "Gets a semi-affine expression containing the rounded-up "
687 "result of dividing a constant by an expression.")
689 "Gets an affine expression containing the rounded-up result "
690 "of dividing an expression by a constant.")
692 nb::arg(
"context") = nb::none(),
693 "Gets a constant affine expression with the given value.")
696 nb::arg(
"context") = nb::none(),
697 "Gets an affine expression of a dimension at the given position.")
700 nb::arg(
"context") = nb::none(),
701 "Gets an affine expression of a symbol at the given position.")
718 nb::class_<PyAffineMap>(m,
"AffineMap")
723 .def(
"__eq__", [](
PyAffineMap &self, nb::object &other) {
return false; })
729 return printAccum.
join();
734 printAccum.
parts.append(
"AffineMap(");
737 printAccum.
parts.append(
")");
738 return printAccum.
join();
742 return static_cast<size_t>(llvm::hash_value(self.
get().ptr));
745 "compress_unused_symbols",
749 affineMaps, maps,
"attempting to create an AffineMap");
750 std::vector<MlirAffineMap> compressed(affineMaps.size());
752 static_cast<MlirAffineMap *
>(
result)[idx] = (m);
755 compressed.data(), populate);
756 std::vector<PyAffineMap> res;
757 res.reserve(compressed.size());
758 for (
auto m : compressed)
759 res.emplace_back(context->getRef(), m);
764 [](
PyAffineMap &self) -> nb::typed<nb::object, PyMlirContext> {
767 "Context that owns the Affine Map")
777 exprs, affineExprs,
"attempting to create an AffineMap");
780 affineExprs.size(), affineExprs.data());
783 nb::arg(
"dim_count"), nb::arg(
"symbol_count"), nb::arg(
"exprs"),
784 nb::arg(
"context") = nb::none(),
785 "Gets a map with the given expressions as results.")
789 MlirAffineMap affineMap =
793 nb::arg(
"value"), nb::arg(
"context") = nb::none(),
794 "Gets an affine map with a single constant result")
801 nb::arg(
"context") = nb::none(),
"Gets an empty affine map.")
805 MlirAffineMap affineMap =
809 nb::arg(
"n_dims"), nb::arg(
"context") = nb::none(),
810 "Gets an identity map with the given number of dimensions.")
812 "get_minor_identity",
815 MlirAffineMap affineMap =
819 nb::arg(
"n_dims"), nb::arg(
"n_results"),
820 nb::arg(
"context") = nb::none(),
821 "Gets a minor identity map with the given number of dimensions and "
825 [](std::vector<unsigned> permutation,
828 throw std::runtime_error(
"Invalid permutation when attempting to "
829 "create an AffineMap");
831 context->
get(), permutation.size(), permutation.data());
834 nb::arg(
"permutation"), nb::arg(
"context") = nb::none(),
835 "Gets an affine map that permutes its inputs.")
838 [](
PyAffineMap &self, std::vector<intptr_t> &resultPos) {
841 if (pos < 0 || pos >= numResults)
842 throw nb::value_error(
"result position out of bounds");
845 self, resultPos.size(), resultPos.data());
848 nb::arg(
"result_positions"))
853 throw nb::value_error(
"number of results out of bounds");
854 MlirAffineMap affineMap =
858 nb::arg(
"n_results"))
863 throw nb::value_error(
"number of results out of bounds");
864 MlirAffineMap affineMap =
868 nb::arg(
"n_results"))
875 self, expression,
replacement, numResultDims, numResultSyms);
878 nb::arg(
"expr"), nb::arg(
"replacement"), nb::arg(
"n_result_dims"),
879 nb::arg(
"n_result_syms"))
883 .def_prop_ro(
"is_projected_permutation",
896 .def_prop_ro(
"results",
903 nb::class_<PyIntegerSet>(m,
"IntegerSet")
909 [](
PyIntegerSet &self,
const nb::object &other) {
return false; })
915 return printAccum.
join();
920 printAccum.
parts.append(
"IntegerSet(");
923 printAccum.
parts.append(
")");
924 return printAccum.
join();
928 return static_cast<size_t>(llvm::hash_value(self.
get().ptr));
932 [](
PyIntegerSet &self) -> nb::typed<nb::object, PyMlirContext> {
942 if (exprs.size() != eqFlags.size())
943 throw nb::value_error(
944 "Expected the number of constraints to match "
945 "that of equality flags");
946 if (exprs.size() == 0)
947 throw nb::value_error(
"Expected non-empty list of constraints");
956 "attempting to create an IntegerSet");
958 context->
get(), numDims, numSymbols, exprs.size(),
959 affineExprs.data(), flags.data());
962 nb::arg(
"num_dims"), nb::arg(
"num_symbols"), nb::arg(
"exprs"),
963 nb::arg(
"eq_flags"), nb::arg(
"context") = nb::none())
972 nb::arg(
"num_dims"), nb::arg(
"num_symbols"),
973 nb::arg(
"context") = nb::none())
977 const nb::list &symbolExprs,
intptr_t numResultDims,
979 if (
static_cast<intptr_t>(dimExprs.size()) !=
981 throw nb::value_error(
982 "Expected the number of dimension replacement expressions "
983 "to match that of dimensions");
984 if (
static_cast<intptr_t>(symbolExprs.size()) !=
986 throw nb::value_error(
987 "Expected the number of symbol replacement expressions "
988 "to match that of symbols");
992 dimExprs, dimAffineExprs,
993 "attempting to create an IntegerSet by replacing dimensions");
995 symbolExprs, symbolAffineExprs,
996 "attempting to create an IntegerSet by replacing symbols");
998 self, dimAffineExprs.data(), symbolAffineExprs.data(),
999 numResultDims, numResultSymbols);
1002 nb::arg(
"dim_exprs"), nb::arg(
"symbol_exprs"),
1003 nb::arg(
"num_result_dims"), nb::arg(
"num_result_symbols"))
1004 .def_prop_ro(
"is_canonical_empty",
1017 .def_prop_ro(
"n_equalities",
1021 .def_prop_ro(
"n_inequalities",
MlirAffineExpr mlirAffineExprCompose(MlirAffineExpr affineExpr, MlirAffineMap affineMap)
void mlirAffineExprDump(MlirAffineExpr affineExpr)
MlirAffineExpr mlirAffineExprShiftDims(MlirAffineExpr affineExpr, uint32_t numDims, uint32_t shift, uint32_t offset)
void mlirAffineExprPrint(MlirAffineExpr affineExpr, MlirStringCallback callback, void *userData)
MlirAffineExpr mlirAffineExprShiftSymbols(MlirAffineExpr affineExpr, uint32_t numSymbols, uint32_t shift, uint32_t offset)
MlirAffineMap mlirAffineMapMultiDimIdentityGet(MlirContext ctx, intptr_t numDims)
MlirAffineMap mlirAffineMapPermutationGet(MlirContext ctx, intptr_t size, unsigned *permutation)
void mlirAffineMapDump(MlirAffineMap affineMap)
bool mlirAffineMapIsProjectedPermutation(MlirAffineMap affineMap)
MlirAffineMap mlirAffineMapConstantGet(MlirContext ctx, int64_t val)
MlirAffineExpr mlirAffineMapGetResult(MlirAffineMap affineMap, intptr_t pos)
intptr_t mlirAffineMapGetNumInputs(MlirAffineMap affineMap)
MlirAffineMap mlirAffineMapGet(MlirContext ctx, intptr_t dimCount, intptr_t symbolCount, intptr_t nAffineExprs, MlirAffineExpr *affineExprs)
MlirAffineMap mlirAffineMapGetSubMap(MlirAffineMap affineMap, intptr_t size, intptr_t *resultPos)
void mlirAffineMapPrint(MlirAffineMap affineMap, MlirStringCallback callback, void *userData)
MlirAffineMap mlirAffineMapEmptyGet(MlirContext ctx)
MlirAffineMap mlirAffineMapGetMajorSubMap(MlirAffineMap affineMap, intptr_t numResults)
MlirAffineMap mlirAffineMapMinorIdentityGet(MlirContext ctx, intptr_t dims, intptr_t results)
bool mlirAffineMapIsPermutation(MlirAffineMap affineMap)
MlirAffineMap mlirAffineMapGetMinorSubMap(MlirAffineMap affineMap, intptr_t numResults)
intptr_t mlirAffineMapGetNumDims(MlirAffineMap affineMap)
intptr_t mlirAffineMapGetNumResults(MlirAffineMap affineMap)
MlirAffineMap mlirAffineMapReplace(MlirAffineMap affineMap, MlirAffineExpr expression, MlirAffineExpr replacement, intptr_t numResultDims, intptr_t numResultSyms)
intptr_t mlirAffineMapGetNumSymbols(MlirAffineMap affineMap)
MlirIntegerSet mlirIntegerSetReplaceGet(MlirIntegerSet set, const MlirAffineExpr *dimReplacements, const MlirAffineExpr *symbolReplacements, intptr_t numResultDims, intptr_t numResultSymbols)
void mlirIntegerSetDump(MlirIntegerSet set)
intptr_t mlirIntegerSetGetNumSymbols(MlirIntegerSet set)
bool mlirIntegerSetIsCanonicalEmpty(MlirIntegerSet set)
intptr_t mlirIntegerSetGetNumEqualities(MlirIntegerSet set)
intptr_t mlirIntegerSetGetNumConstraints(MlirIntegerSet set)
intptr_t mlirIntegerSetGetNumInequalities(MlirIntegerSet set)
intptr_t mlirIntegerSetGetNumInputs(MlirIntegerSet set)
MlirIntegerSet mlirIntegerSetEmptyGet(MlirContext context, intptr_t numDims, intptr_t numSymbols)
void mlirIntegerSetPrint(MlirIntegerSet set, MlirStringCallback callback, void *userData)
MlirAffineExpr mlirIntegerSetGetConstraint(MlirIntegerSet set, intptr_t pos)
intptr_t mlirIntegerSetGetNumDims(MlirIntegerSet set)
MlirIntegerSet mlirIntegerSetGet(MlirContext context, intptr_t numDims, intptr_t numSymbols, intptr_t numConstraints, const MlirAffineExpr *constraints, const bool *eqFlags)
static bool isPermutation(const std::vector< PermutationTy > &permutation)
static void pyListToVector(const nb::list &list, llvm::SmallVectorImpl< CType > &result, StringRef action)
Attempts to populate result with the content of list casted to the appropriate type (Python and C typ...
static const char kDumpDocstring[]
static MlirIntegerSet mlirPythonCapsuleToIntegerSet(PyObject *capsule)
Extracts an MlirIntegerSet from a capsule as produced from mlirPythonIntegerSetToCapsule.
#define MLIR_PYTHON_CAPI_PTR_ATTR
Attribute on MLIR Python objects that expose their C-API pointer.
static MlirAffineMap mlirPythonCapsuleToAffineMap(PyObject *capsule)
Extracts an MlirAffineMap from a capsule as produced from mlirPythonAffineMapToCapsule.
#define MLIR_PYTHON_CAPI_FACTORY_ATTR
Attribute on MLIR Python objects that exposes a factory function for constructing the corresponding P...
static PyObject * mlirPythonAffineMapToCapsule(MlirAffineMap affineMap)
Creates a capsule object encapsulating the raw C-API MlirAffineMap.
static PyObject * mlirPythonIntegerSetToCapsule(MlirIntegerSet integerSet)
Creates a capsule object encapsulating the raw C-API MlirIntegerSet.
static MlirAffineExpr mlirPythonCapsuleToAffineExpr(PyObject *capsule)
Extracts an MlirAffineExpr from a capsule as produced from mlirPythonAffineExprToCapsule.
static PyObject * mlirPythonAffineExprToCapsule(MlirAffineExpr expr)
Creates a capsule object encapsulating the raw C-API MlirAffineExpr.
*if copies could not be generated due to yet unimplemented cases *copyInPlacementStart and copyOutPlacementStart in copyPlacementBlock *specify the insertion points where the incoming copies and outgoing should be the output argument nBegin is set to its * replacement(set to `begin` if no invalidation happens). Since outgoing *copies could have been inserted at `end`
A CRTP base class for pseudo-containers willing to support Python-type slicing access on top of index...
static void bind(nanobind::module_ &m)
Sliceable(intptr_t startIndex, intptr_t length, intptr_t step)
ReferrentTy * get() const
PyMlirContextRef & getContext()
Accesses the context reference.
Used in function arguments when None should resolve to the current context manager set instance.
static PyAffineAddExpr getLHSConstant(intptr_t lhs, PyAffineExpr rhs)
static PyAffineAddExpr getRHSConstant(PyAffineExpr lhs, intptr_t rhs)
static constexpr const char * pyClassName
PyConcreteAffineExpr()=default
static PyAffineAddExpr get(PyAffineExpr lhs, const PyAffineExpr &rhs)
static void bindDerived(ClassTy &c)
static constexpr IsAFunctionTy isaFunction
static constexpr IsAFunctionTy isaFunction
static void bindDerived(ClassTy &c)
static constexpr const char * pyClassName
nb::typed< nb::object, PyAffineExpr > lhs()
PyConcreteAffineExpr()=default
nb::typed< nb::object, PyAffineExpr > rhs()
static PyAffineCeilDivExpr get(PyAffineExpr lhs, const PyAffineExpr &rhs)
static constexpr IsAFunctionTy isaFunction
static void bindDerived(ClassTy &c)
static constexpr const char * pyClassName
PyConcreteAffineExpr()=default
static PyAffineCeilDivExpr getRHSConstant(PyAffineExpr lhs, intptr_t rhs)
static PyAffineCeilDivExpr getLHSConstant(intptr_t lhs, PyAffineExpr rhs)
static constexpr const char * pyClassName
static PyAffineConstantExpr get(intptr_t value, DefaultingPyMlirContext context)
static constexpr IsAFunctionTy isaFunction
PyConcreteAffineExpr()=default
static void bindDerived(ClassTy &c)
static constexpr IsAFunctionTy isaFunction
static PyAffineDimExpr get(intptr_t pos, DefaultingPyMlirContext context)
PyConcreteAffineExpr()=default
static void bindDerived(ClassTy &c)
static constexpr const char * pyClassName
Wrapper around MlirAffineExpr. Affine expressions are owned by the context.
nanobind::object getCapsule()
Gets a capsule wrapping the void* within the MlirAffineExpr.
static PyAffineExpr createFromCapsule(const nanobind::object &capsule)
Creates a PyAffineExpr from the MlirAffineExpr wrapped by a capsule.
MlirAffineExpr get() const
PyAffineExpr(PyMlirContextRef contextRef, MlirAffineExpr affineExpr)
bool operator==(const PyAffineExpr &other) const
nanobind::typed< nanobind::object, PyAffineExpr > maybeDownCast()
static PyAffineFloorDivExpr getRHSConstant(PyAffineExpr lhs, intptr_t rhs)
static constexpr const char * pyClassName
PyConcreteAffineExpr()=default
static PyAffineFloorDivExpr get(PyAffineExpr lhs, const PyAffineExpr &rhs)
static constexpr IsAFunctionTy isaFunction
static void bindDerived(ClassTy &c)
static PyAffineFloorDivExpr getLHSConstant(intptr_t lhs, PyAffineExpr rhs)
A list of expressions contained in an affine map.
static constexpr const char * pyClassName
PyAffineMapExprList(const PyAffineMap &map, intptr_t startIndex=0, intptr_t length=-1, intptr_t step=1)
PyAffineMap(PyMlirContextRef contextRef, MlirAffineMap affineMap)
bool operator==(const PyAffineMap &other) const
nanobind::object getCapsule()
Gets a capsule wrapping the void* within the MlirAffineMap.
static PyAffineMap createFromCapsule(const nanobind::object &capsule)
Creates a PyAffineMap from the MlirAffineMap wrapped by a capsule.
static constexpr const char * pyClassName
static PyAffineModExpr getLHSConstant(intptr_t lhs, PyAffineExpr rhs)
PyConcreteAffineExpr()=default
static void bindDerived(ClassTy &c)
static PyAffineModExpr getRHSConstant(PyAffineExpr lhs, intptr_t rhs)
static PyAffineModExpr get(PyAffineExpr lhs, const PyAffineExpr &rhs)
static constexpr IsAFunctionTy isaFunction
static PyAffineMulExpr getRHSConstant(PyAffineExpr lhs, intptr_t rhs)
static PyAffineMulExpr get(PyAffineExpr lhs, const PyAffineExpr &rhs)
PyConcreteAffineExpr()=default
static PyAffineMulExpr getLHSConstant(intptr_t lhs, PyAffineExpr rhs)
static constexpr const char * pyClassName
static constexpr IsAFunctionTy isaFunction
static void bindDerived(ClassTy &c)
static PyAffineSymbolExpr get(intptr_t pos, DefaultingPyMlirContext context)
static void bindDerived(ClassTy &c)
PyConcreteAffineExpr()=default
static constexpr IsAFunctionTy isaFunction
static constexpr const char * pyClassName
bool(*)(MlirAffineExpr) IsAFunctionTy
PyConcreteAffineExpr(PyMlirContextRef contextRef, MlirAffineExpr affineExpr)
static void bind(nb::module_ &m)
PyConcreteAffineExpr()=default
static void bindDerived(ClassTy &m)
Implemented by derived classes to add methods to the Python subclass.
PyConcreteAffineExpr(PyAffineExpr &orig)
nb::class_< DerivedTy, BaseTy > ClassTy
static MlirAffineExpr castFrom(PyAffineExpr &orig)
PyIntegerSetConstraintList(const PyIntegerSet &set, intptr_t startIndex=0, intptr_t length=-1, intptr_t step=1)
static constexpr const char * pyClassName
static void bind(nb::module_ &m)
PyIntegerSetConstraint(PyIntegerSet set, intptr_t pos)
PyIntegerSet(PyMlirContextRef contextRef, MlirIntegerSet integerSet)
static PyIntegerSet createFromCapsule(const nanobind::object &capsule)
Creates a PyIntegerSet from the MlirAffineMap wrapped by a capsule.
bool operator==(const PyIntegerSet &other) const
nanobind::object getCapsule()
Gets a capsule wrapping the void* within the MlirIntegerSet.
static PyMlirContextRef forContext(MlirContext context)
Returns a context reference for the singleton PyMlirContext wrapper for the given context.
nanobind::object getObject()
MLIR_CAPI_EXPORTED 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...
MLIR_CAPI_EXPORTED bool mlirAffineExprIsAConstant(MlirAffineExpr affineExpr)
Checks whether the given affine expression is a constant expression.
MLIR_CAPI_EXPORTED MlirAffineExpr mlirAffineBinaryOpExprGetLHS(MlirAffineExpr affineExpr)
Returns the left hand side affine expression of the given affine binary operation expression.
MLIR_CAPI_EXPORTED MlirAffineExpr mlirAffineMulExprGet(MlirAffineExpr lhs, MlirAffineExpr rhs)
Creates an affine mul expression with 'lhs' and 'rhs'.
MLIR_CAPI_EXPORTED MlirAffineExpr mlirAffineConstantExprGet(MlirContext ctx, int64_t constant)
Creates an affine constant expression with 'constant' in the context.
MLIR_CAPI_EXPORTED MlirAffineExpr mlirAffineBinaryOpExprGetRHS(MlirAffineExpr affineExpr)
Returns the right hand side affine expression of the given affine binary operation expression.
MLIR_CAPI_EXPORTED MlirAffineExpr mlirAffineAddExprGet(MlirAffineExpr lhs, MlirAffineExpr rhs)
Creates an affine add expression with 'lhs' and 'rhs'.
MLIR_CAPI_EXPORTED intptr_t mlirAffineDimExprGetPosition(MlirAffineExpr affineExpr)
Returns the position of the given affine dimension expression.
MLIR_CAPI_EXPORTED bool mlirAffineExprIsAAdd(MlirAffineExpr affineExpr)
Checks whether the given affine expression is an add expression.
MLIR_CAPI_EXPORTED bool mlirAffineExprIsABinary(MlirAffineExpr affineExpr)
Checks whether the given affine expression is binary.
MLIR_CAPI_EXPORTED bool mlirAffineExprIsAMul(MlirAffineExpr affineExpr)
Checks whether the given affine expression is an mul expression.
MLIR_CAPI_EXPORTED int64_t mlirAffineConstantExprGetValue(MlirAffineExpr affineExpr)
Returns the value of the given affine constant expression.
MLIR_CAPI_EXPORTED MlirContext mlirAffineExprGetContext(MlirAffineExpr affineExpr)
Gets the context that owns the affine expression.
MLIR_CAPI_EXPORTED bool mlirAffineExprIsASymbol(MlirAffineExpr affineExpr)
Checks whether the given affine expression is a symbol expression.
MLIR_CAPI_EXPORTED bool mlirAffineExprIsACeilDiv(MlirAffineExpr affineExpr)
Checks whether the given affine expression is an ceildiv expression.
MLIR_CAPI_EXPORTED MlirAffineExpr mlirAffineFloorDivExprGet(MlirAffineExpr lhs, MlirAffineExpr rhs)
Creates an affine floordiv expression with 'lhs' and 'rhs'.
MLIR_CAPI_EXPORTED bool mlirAffineExprIsAFloorDiv(MlirAffineExpr affineExpr)
Checks whether the given affine expression is an floordiv expression.
MLIR_CAPI_EXPORTED bool mlirAffineExprEqual(MlirAffineExpr lhs, MlirAffineExpr rhs)
Returns true if the two affine expressions are equal.
MLIR_CAPI_EXPORTED MlirAffineExpr mlirAffineDimExprGet(MlirContext ctx, intptr_t position)
Creates an affine dimension expression with 'position' in the context.
MLIR_CAPI_EXPORTED bool mlirAffineExprIsAMod(MlirAffineExpr affineExpr)
Checks whether the given affine expression is an mod expression.
MLIR_CAPI_EXPORTED MlirAffineExpr mlirAffineModExprGet(MlirAffineExpr lhs, MlirAffineExpr rhs)
Creates an affine mod expression with 'lhs' and 'rhs'.
MLIR_CAPI_EXPORTED MlirAffineExpr mlirAffineSymbolExprGet(MlirContext ctx, intptr_t position)
Creates an affine symbol expression with 'position' in the context.
static bool mlirAffineExprIsNull(MlirAffineExpr affineExpr)
Returns true if the given affine expression is a null expression.
MLIR_CAPI_EXPORTED MlirAffineExpr mlirAffineCeilDivExprGet(MlirAffineExpr lhs, MlirAffineExpr rhs)
Creates an affine ceildiv expression with 'lhs' and 'rhs'.
MLIR_CAPI_EXPORTED intptr_t mlirAffineSymbolExprGetPosition(MlirAffineExpr affineExpr)
Returns the position of the given affine symbol expression.
MLIR_CAPI_EXPORTED bool mlirAffineExprIsADim(MlirAffineExpr affineExpr)
Checks whether the given affine expression is a dimension expression.
MLIR_CAPI_EXPORTED bool mlirAffineMapEqual(MlirAffineMap a1, MlirAffineMap a2)
Checks if two affine maps are equal.
MLIR_CAPI_EXPORTED MlirContext mlirAffineMapGetContext(MlirAffineMap affineMap)
Gets the context that the given affine map was created with.
MLIR_CAPI_EXPORTED void mlirAffineMapCompressUnusedSymbols(MlirAffineMap *affineMaps, intptr_t size, void *result, void(*populateResult)(void *res, intptr_t idx, MlirAffineMap m))
Prints an affine map by sending chunks of the string representation and forwarding userData to callba...
static bool mlirAffineMapIsNull(MlirAffineMap affineMap)
Checks whether an affine map is null.
static bool mlirIntegerSetIsNull(MlirIntegerSet set)
Checks whether an integer set is a null object.
MLIR_CAPI_EXPORTED MlirContext mlirIntegerSetGetContext(MlirIntegerSet set)
Gets the context in which the given integer set lives.
MLIR_CAPI_EXPORTED bool mlirIntegerSetEqual(MlirIntegerSet s1, MlirIntegerSet s2)
Checks if two integer set objects are equal.
MLIR_CAPI_EXPORTED bool mlirIntegerSetIsConstraintEq(MlirIntegerSet set, intptr_t pos)
Prints an integer set by sending chunks of the string representation and forwarding userData to callb...
void populateIRAffine(nb::module_ &m)
PyObjectRef< PyMlirContext > PyMlirContextRef
Wrapper around MlirContext.
Include the generated interface declarations.
Accumulates into a python string from a method that accepts an MlirStringCallback.
MlirStringCallback getCallback()