Skip to content
This repository was archived by the owner on Oct 11, 2025. It is now read-only.

Commit 88cf9b0

Browse files
authored
[mlir] Expose simplifyAffineExpr through python api (#133926)
1 parent f517fe2 commit 88cf9b0

File tree

1 file changed

+10
-0
lines changed

1 file changed

+10
-0
lines changed

mlir/lib/Bindings/Python/IRAffine.cpp

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -599,6 +599,16 @@ void mlir::python::populateIRAffine(nb::module_ &m) {
599599
},
600600
nb::arg("num_symbols"), nb::arg("shift"),
601601
nb::arg("offset").none() = 0)
602+
.def_static(
603+
"simplify_affine_expr",
604+
[](PyAffineExpr &self, uint32_t numDims, uint32_t numSymbols) {
605+
return PyAffineExpr(
606+
self.getContext(),
607+
mlirSimplifyAffineExpr(self, numDims, numSymbols));
608+
},
609+
nb::arg("expr"), nb::arg("num_dims"), nb::arg("num_symbols"),
610+
"Simplify an affine expression by flattening and some amount of "
611+
"simple analysis.")
602612
.def_static(
603613
"get_add", &PyAffineAddExpr::get,
604614
"Gets an affine expression containing a sum of two expressions.")

0 commit comments

Comments
 (0)