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",
737 std::vector<MlirAffineMap> maps;
739 affineMaps, maps,
"attempting to create an AffineMap");
740 std::vector<MlirAffineMap> compressed(affineMaps.size());
742 static_cast<MlirAffineMap *
>(
result)[idx] = (m);
745 compressed.data(), populate);
746 std::vector<PyAffineMap> res;
747 res.reserve(compressed.size());
748 for (
auto m : compressed)
749 res.emplace_back(context->getRef(), m);
754 [](
PyAffineMap &self) -> nb::typed<nb::object, PyMlirContext> {
757 "Context that owns the Affine Map")
765 std::vector<MlirAffineExpr> affineExprs;
767 exprs, affineExprs,
"attempting to create an AffineMap");
770 affineExprs.size(), affineExprs.data());
773 nb::arg(
"dim_count"), nb::arg(
"symbol_count"), nb::arg(
"exprs"),
774 nb::arg(
"context") = nb::none(),
775 "Gets a map with the given expressions as results.")
779 MlirAffineMap affineMap =
783 nb::arg(
"value"), nb::arg(
"context") = nb::none(),
784 "Gets an affine map with a single constant result")
791 nb::arg(
"context") = nb::none(),
"Gets an empty affine map.")
795 MlirAffineMap affineMap =
799 nb::arg(
"n_dims"), nb::arg(
"context") = nb::none(),
800 "Gets an identity map with the given number of dimensions.")
802 "get_minor_identity",
805 MlirAffineMap affineMap =
809 nb::arg(
"n_dims"), nb::arg(
"n_results"),
810 nb::arg(
"context") = nb::none(),
811 "Gets a minor identity map with the given number of dimensions and "
815 [](std::vector<unsigned> permutation,
818 throw std::runtime_error(
"Invalid permutation when attempting to "
819 "create an AffineMap");
821 context->
get(), permutation.size(), permutation.data());
824 nb::arg(
"permutation"), nb::arg(
"context") = nb::none(),
825 "Gets an affine map that permutes its inputs.")
828 [](
PyAffineMap &self, std::vector<intptr_t> &resultPos) {
831 if (pos < 0 || pos >= numResults)
832 throw nb::value_error(
"result position out of bounds");
835 self, resultPos.size(), resultPos.data());
838 nb::arg(
"result_positions"))
843 throw nb::value_error(
"number of results out of bounds");
844 MlirAffineMap affineMap =
848 nb::arg(
"n_results"))
853 throw nb::value_error(
"number of results out of bounds");
854 MlirAffineMap affineMap =
858 nb::arg(
"n_results"))
865 self, expression,
replacement, numResultDims, numResultSyms);
868 nb::arg(
"expr"), nb::arg(
"replacement"), nb::arg(
"n_result_dims"),
869 nb::arg(
"n_result_syms"))
873 .def_prop_ro(
"is_projected_permutation",
886 .def_prop_ro(
"results",
893 nb::class_<PyIntegerSet>(m,
"IntegerSet")
899 [](
PyIntegerSet &self,
const nb::object &other) {
return false; })
905 return printAccum.
join();
910 printAccum.
parts.append(
"IntegerSet(");
913 printAccum.
parts.append(
")");
914 return printAccum.
join();
918 return std::hash<const void *>{}(self.
get().
ptr);
922 [](
PyIntegerSet &self) -> nb::typed<nb::object, PyMlirContext> {
932 if (exprs.size() != eqFlags.size())
933 throw nb::value_error(
934 "Expected the number of constraints to match "
935 "that of equality flags");
936 if (exprs.size() == 0)
937 throw nb::value_error(
"Expected non-empty list of constraints");
940 std::vector<char> flags(eqFlags.begin(), eqFlags.end());
941 std::vector<MlirAffineExpr> affineExprs;
943 "attempting to create an IntegerSet");
945 context->
get(), numDims, numSymbols, exprs.size(),
946 affineExprs.data(),
reinterpret_cast<bool *
>(flags.data()));
949 nb::arg(
"num_dims"), nb::arg(
"num_symbols"), nb::arg(
"exprs"),
950 nb::arg(
"eq_flags"), nb::arg(
"context") = nb::none())
959 nb::arg(
"num_dims"), nb::arg(
"num_symbols"),
960 nb::arg(
"context") = nb::none())
964 const nb::list &symbolExprs,
intptr_t numResultDims,
966 if (
static_cast<intptr_t>(dimExprs.size()) !=
968 throw nb::value_error(
969 "Expected the number of dimension replacement expressions "
970 "to match that of dimensions");
971 if (
static_cast<intptr_t>(symbolExprs.size()) !=
973 throw nb::value_error(
974 "Expected the number of symbol replacement expressions "
975 "to match that of symbols");
977 std::vector<MlirAffineExpr> dimAffineExprs;
978 std::vector<MlirAffineExpr> symbolAffineExprs;
980 dimExprs, dimAffineExprs,
981 "attempting to create an IntegerSet by replacing dimensions");
983 symbolExprs, symbolAffineExprs,
984 "attempting to create an IntegerSet by replacing symbols");
986 self, dimAffineExprs.data(), symbolAffineExprs.data(),
987 numResultDims, numResultSymbols);
990 nb::arg(
"dim_exprs"), nb::arg(
"symbol_exprs"),
991 nb::arg(
"num_result_dims"), nb::arg(
"num_result_symbols"))
992 .def_prop_ro(
"is_canonical_empty",
1005 .def_prop_ro(
"n_equalities",
1009 .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 const char kDumpDocstring[]
static void pyListToVector(const nb::list &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 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()