33 R
"(Dumps a debug representation of the object to stderr.)";
39template <
typename PyType,
typename CType>
41 std::string_view action) {
42 result.reserve(nb::len(list));
43 for (nb::handle item : list) {
45 result.push_back(nb::cast<PyType>(item));
46 }
catch (nb::cast_error &err) {
48 action,
" (", err.what(),
")");
49 throw std::runtime_error(msg.c_str());
50 }
catch (std::runtime_error &err) {
52 "Invalid expression (None?) when ", action,
" (", err.what(),
")");
53 throw std::runtime_error(msg.c_str());
58template <
typename PermutationTy>
59static bool isPermutation(
const std::vector<PermutationTy> &permutation) {
60 std::vector<bool> seen(permutation.size(),
false);
61 for (
auto val : permutation) {
62 if (val < permutation.size()) {
80template <
typename DerivedTy,
typename BaseTy = PyAffineExpr>
87 using ClassTy = nb::class_<DerivedTy, BaseTy>;
92 : BaseTy(std::move(contextRef), affineExpr) {}
97 if (!DerivedTy::isaFunction(orig)) {
98 auto origRepr = nb::cast<std::string>(nb::repr(nb::cast(orig)));
99 throw nb::value_error(
101 DerivedTy::pyClassName,
" (from ", origRepr,
108 static void bind(nb::module_ &m) {
109 auto cls =
ClassTy(m, DerivedTy::pyClassName);
110 cls.def(nb::init<PyAffineExpr &>(), nb::arg(
"expr"));
111 DerivedTy::bindDerived(cls);
126 MlirAffineExpr affineExpr =
133 nb::arg(
"context") = nb::none());
153 nb::arg(
"context") = nb::none());
173 nb::arg(
"context") = nb::none());
186 nb::typed<nb::object, PyAffineExpr>
lhs() {
191 nb::typed<nb::object, PyAffineExpr>
rhs() {
362 throw nb::python_error();
369 MlirAffineExpr expr =
get();
386 return nb::cast(*
this);
401 :
public Sliceable<PyAffineMapExprList, PyAffineExpr> {
445 throw nb::python_error();
461 : set(std::move(set)), pos(pos) {}
470 static void bind(nb::module_ &m) {
471 nb::class_<PyIntegerSetConstraint>(m,
"IntegerSetConstraint")
482 :
public Sliceable<PyIntegerSetConstraintList, PyIntegerSetConstraint> {
484 static constexpr const char *
pyClassName =
"IntegerSetConstraintList";
525 throw nb::python_error();
538 nb::class_<PyAffineExpr>(m,
"AffineExpr")
576 [](
PyAffineExpr &self, nb::object &other) {
return false; })
582 return printAccum.
join();
587 printAccum.
parts.append(
"AffineExpr(");
590 printAccum.
parts.append(
")");
591 return printAccum.
join();
595 return std::hash<const void *>{}(self.
get().
ptr);
599 [](
PyAffineExpr &self) -> nb::typed<nb::object, PyMlirContext> {
610 [](
PyAffineExpr &self, uint32_t numDims, uint32_t shift,
616 nb::arg(
"num_dims"), nb::arg(
"shift"), nb::arg(
"offset") = 0)
619 [](
PyAffineExpr &self, uint32_t numSymbols, uint32_t shift,
625 nb::arg(
"num_symbols"), nb::arg(
"shift"), nb::arg(
"offset") = 0)
627 "simplify_affine_expr",
628 [](
PyAffineExpr &self, uint32_t numDims, uint32_t numSymbols) {
633 nb::arg(
"expr"), nb::arg(
"num_dims"), nb::arg(
"num_symbols"),
634 "Simplify an affine expression by flattening and some amount of "
638 "Gets an affine expression containing a sum of two expressions.")
640 "Gets an affine expression containing a sum of a constant "
641 "and another expression.")
643 "Gets an affine expression containing a sum of an expression "
647 "Gets an affine expression containing a product of two expressions.")
649 "Gets an affine expression containing a product of a "
650 "constant and another expression.")
652 "Gets an affine expression containing a product of an "
653 "expression and a constant.")
655 "Gets an affine expression containing the modulo of dividing "
656 "one expression by another.")
658 "Gets a semi-affine expression containing the modulo of "
659 "dividing a constant by an expression.")
661 "Gets an affine expression containing the module of dividing"
662 "an expression by a constant.")
664 "Gets an affine expression containing the rounded-down "
665 "result of dividing one expression by another.")
667 "Gets a semi-affine expression containing the rounded-down "
668 "result of dividing a constant by an expression.")
670 "Gets an affine expression containing the rounded-down "
671 "result of dividing an expression by a constant.")
673 "Gets an affine expression containing the rounded-up result "
674 "of dividing one expression by another.")
676 "Gets a semi-affine expression containing the rounded-up "
677 "result of dividing a constant by an expression.")
679 "Gets an affine expression containing the rounded-up result "
680 "of dividing an expression by a constant.")
682 nb::arg(
"context") = nb::none(),
683 "Gets a constant affine expression with the given value.")
686 nb::arg(
"context") = nb::none(),
687 "Gets an affine expression of a dimension at the given position.")
690 nb::arg(
"context") = nb::none(),
691 "Gets an affine expression of a symbol at the given position.")
708 nb::class_<PyAffineMap>(m,
"AffineMap")
713 .def(
"__eq__", [](
PyAffineMap &self, nb::object &other) {
return false; })
719 return printAccum.
join();
724 printAccum.
parts.append(
"AffineMap(");
727 printAccum.
parts.append(
")");
728 return printAccum.
join();
732 return std::hash<const void *>{}(self.
get().
ptr);
735 "compress_unused_symbols",
736 [](nb::typed<nb::sequence, PyAffineMap> affineMaps,
738 std::vector<MlirAffineMap> maps;
740 affineMaps, maps,
"attempting to create an AffineMap");
741 std::vector<MlirAffineMap> compressed(nb::len(affineMaps));
743 static_cast<MlirAffineMap *
>(
result)[idx] = (m);
746 compressed.data(), populate);
747 std::vector<PyAffineMap> res;
748 res.reserve(compressed.size());
749 for (
auto m : compressed)
750 res.emplace_back(context->getRef(), m);
755 [](
PyAffineMap &self) -> nb::typed<nb::object, PyMlirContext> {
758 "Context that owns the Affine Map")
765 nb::typed<nb::sequence, PyAffineExpr> exprs,
767 std::vector<MlirAffineExpr> affineExprs;
769 exprs, affineExprs,
"attempting to create an AffineMap");
772 affineExprs.size(), affineExprs.data());
775 nb::arg(
"dim_count"), nb::arg(
"symbol_count"), nb::arg(
"exprs"),
776 nb::arg(
"context") = nb::none(),
777 "Gets a map with the given expressions as results.")
781 MlirAffineMap affineMap =
785 nb::arg(
"value"), nb::arg(
"context") = nb::none(),
786 "Gets an affine map with a single constant result")
793 nb::arg(
"context") = nb::none(),
"Gets an empty affine map.")
797 MlirAffineMap affineMap =
801 nb::arg(
"n_dims"), nb::arg(
"context") = nb::none(),
802 "Gets an identity map with the given number of dimensions.")
804 "get_minor_identity",
807 MlirAffineMap affineMap =
811 nb::arg(
"n_dims"), nb::arg(
"n_results"),
812 nb::arg(
"context") = nb::none(),
813 "Gets a minor identity map with the given number of dimensions and "
817 [](std::vector<unsigned> permutation,
820 throw std::runtime_error(
"Invalid permutation when attempting to "
821 "create an AffineMap");
823 context->
get(), permutation.size(), permutation.data());
826 nb::arg(
"permutation"), nb::arg(
"context") = nb::none(),
827 "Gets an affine map that permutes its inputs.")
830 [](
PyAffineMap &self, std::vector<intptr_t> &resultPos) {
833 if (pos < 0 || pos >= numResults)
834 throw nb::value_error(
"result position out of bounds");
837 self, resultPos.size(), resultPos.data());
840 nb::arg(
"result_positions"))
845 throw nb::value_error(
"number of results out of bounds");
846 MlirAffineMap affineMap =
850 nb::arg(
"n_results"))
855 throw nb::value_error(
"number of results out of bounds");
856 MlirAffineMap affineMap =
860 nb::arg(
"n_results"))
867 self, expression,
replacement, numResultDims, numResultSyms);
870 nb::arg(
"expr"), nb::arg(
"replacement"), nb::arg(
"n_result_dims"),
871 nb::arg(
"n_result_syms"))
875 .def_prop_ro(
"is_projected_permutation",
888 .def_prop_ro(
"results",
895 nb::class_<PyIntegerSet>(m,
"IntegerSet")
901 [](
PyIntegerSet &self,
const nb::object &other) {
return false; })
907 return printAccum.
join();
912 printAccum.
parts.append(
"IntegerSet(");
915 printAccum.
parts.append(
")");
916 return printAccum.
join();
920 return std::hash<const void *>{}(self.
get().
ptr);
924 [](
PyIntegerSet &self) -> nb::typed<nb::object, PyMlirContext> {
933 nb::typed<nb::sequence, PyAffineExpr> exprs,
935 if (nb::len(exprs) != eqFlags.size())
936 throw nb::value_error(
937 "Expected the number of constraints to match "
938 "that of equality flags");
939 if (nb::len(exprs) == 0)
940 throw nb::value_error(
"Expected non-empty list of constraints");
943 std::vector<char> flags(eqFlags.begin(), eqFlags.end());
944 std::vector<MlirAffineExpr> affineExprs;
946 "attempting to create an IntegerSet");
948 context->
get(), numDims, numSymbols, nb::len(exprs),
949 affineExprs.data(),
reinterpret_cast<bool *
>(flags.data()));
952 nb::arg(
"num_dims"), nb::arg(
"num_symbols"), nb::arg(
"exprs"),
953 nb::arg(
"eq_flags"), nb::arg(
"context") = nb::none())
962 nb::arg(
"num_dims"), nb::arg(
"num_symbols"),
963 nb::arg(
"context") = nb::none())
966 [](
PyIntegerSet &self, nb::typed<nb::sequence, PyAffineExpr> dimExprs,
967 nb::typed<nb::sequence, PyAffineExpr> symbolExprs,
969 if (
static_cast<intptr_t>(nb::len(dimExprs)) !=
971 throw nb::value_error(
972 "Expected the number of dimension replacement expressions "
973 "to match that of dimensions");
974 if (
static_cast<intptr_t>(nb::len(symbolExprs)) !=
976 throw nb::value_error(
977 "Expected the number of symbol replacement expressions "
978 "to match that of symbols");
980 std::vector<MlirAffineExpr> dimAffineExprs;
981 std::vector<MlirAffineExpr> symbolAffineExprs;
983 dimExprs, dimAffineExprs,
984 "attempting to create an IntegerSet by replacing dimensions");
986 symbolExprs, symbolAffineExprs,
987 "attempting to create an IntegerSet by replacing symbols");
989 self, dimAffineExprs.data(), symbolAffineExprs.data(),
990 numResultDims, numResultSymbols);
993 nb::arg(
"dim_exprs"), nb::arg(
"symbol_exprs"),
994 nb::arg(
"num_result_dims"), nb::arg(
"num_result_symbols"))
995 .def_prop_ro(
"is_canonical_empty",
1008 .def_prop_ro(
"n_equalities",
1012 .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 void pyListToVector(const nb::sequence &list, std::vector< CType > &result, std::string_view action)
Attempts to populate result with the content of list casted to the appropriate type (Python and C typ...
static bool isPermutation(const std::vector< PermutationTy > &permutation)
static const char kDumpDocstring[]
static MlirIntegerSet mlirPythonCapsuleToIntegerSet(PyObject *capsule)
Extracts an MlirIntegerSet from a capsule as produced from mlirPythonIntegerSetToCapsule.
#define MLIR_PYTHON_MAYBE_DOWNCAST_ATTR
Attribute on MLIR Python objects that expose a function for downcasting the corresponding Python obje...
#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.
std::string join(const Ts &...args)
Helper function to concatenate arguments into a std::string.
Accumulates into a python string from a method that accepts an MlirStringCallback.
MlirStringCallback getCallback()