Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 2 additions & 2 deletions mlir/lib/Bindings/Python/DialectGPU.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -38,7 +38,7 @@ NB_MODULE(_mlirDialectsGPU, m) {
return cls(mlirGPUAsyncTokenTypeGet(ctx));
},
"Gets an instance of AsyncTokenType in the same context", nb::arg("cls"),
nb::arg("ctx").none() = nb::none());
nb::arg("ctx") = nb::none());

//===-------------------------------------------------------------------===//
// ObjectAttr
Expand All @@ -62,7 +62,7 @@ NB_MODULE(_mlirDialectsGPU, m) {
: MlirAttribute{nullptr}));
},
"cls"_a, "target"_a, "format"_a, "object"_a,
"properties"_a.none() = nb::none(), "kernels"_a.none() = nb::none(),
"properties"_a = nb::none(), "kernels"_a = nb::none(),
"Gets a gpu.object from parameters.")
.def_property_readonly(
"target",
Expand Down
12 changes: 6 additions & 6 deletions mlir/lib/Bindings/Python/DialectLLVM.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -47,23 +47,23 @@ static void populateDialectLLVMSubmodule(const nanobind::module_ &m) {
return cls(type);
},
"cls"_a, "elements"_a, nb::kw_only(), "packed"_a = false,
"loc"_a.none() = nb::none());
"loc"_a = nb::none());

llvmStructType.def_classmethod(
"get_identified",
[](const nb::object &cls, const std::string &name, MlirContext context) {
return cls(mlirLLVMStructTypeIdentifiedGet(
context, mlirStringRefCreate(name.data(), name.size())));
},
"cls"_a, "name"_a, nb::kw_only(), "context"_a.none() = nb::none());
"cls"_a, "name"_a, nb::kw_only(), "context"_a = nb::none());

llvmStructType.def_classmethod(
"get_opaque",
[](const nb::object &cls, const std::string &name, MlirContext context) {
return cls(mlirLLVMStructTypeOpaqueGet(
context, mlirStringRefCreate(name.data(), name.size())));
},
"cls"_a, "name"_a, "context"_a.none() = nb::none());
"cls"_a, "name"_a, "context"_a = nb::none());

llvmStructType.def(
"set_body",
Expand All @@ -86,7 +86,7 @@ static void populateDialectLLVMSubmodule(const nanobind::module_ &m) {
elements.size(), elements.data(), packed));
},
"cls"_a, "name"_a, "elements"_a, nb::kw_only(), "packed"_a = false,
"context"_a.none() = nb::none());
"context"_a = nb::none());

llvmStructType.def_property_readonly(
"name", [](MlirType type) -> std::optional<std::string> {
Expand Down Expand Up @@ -133,8 +133,8 @@ static void populateDialectLLVMSubmodule(const nanobind::module_ &m) {
}
return cls(type);
},
"cls"_a, "address_space"_a.none() = nb::none(), nb::kw_only(),
"context"_a.none() = nb::none())
"cls"_a, "address_space"_a = nb::none(), nb::kw_only(),
"context"_a = nb::none())
.def_property_readonly("address_space", [](MlirType type) {
return mlirLLVMPointerTypeGetAddressSpace(type);
});
Expand Down
2 changes: 1 addition & 1 deletion mlir/lib/Bindings/Python/DialectNVGPU.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -31,7 +31,7 @@ static void populateDialectNVGPUSubmodule(const nb::module_ &m) {
"Gets an instance of TensorMapDescriptorType in the same context",
nb::arg("cls"), nb::arg("tensor_type"), nb::arg("swizzle"),
nb::arg("l2promo"), nb::arg("oob_fill"), nb::arg("interleave"),
nb::arg("ctx").none() = nb::none());
nb::arg("ctx") = nb::none());
}

NB_MODULE(_mlirDialectsNVGPU, m) {
Expand Down
8 changes: 4 additions & 4 deletions mlir/lib/Bindings/Python/DialectPDL.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -36,7 +36,7 @@ static void populateDialectPDLSubmodule(const nanobind::module_ &m) {
return cls(mlirPDLAttributeTypeGet(ctx));
},
"Get an instance of AttributeType in given context.", nb::arg("cls"),
nb::arg("context").none() = nb::none());
nb::arg("context") = nb::none());

//===-------------------------------------------------------------------===//
// OperationType
Expand All @@ -50,7 +50,7 @@ static void populateDialectPDLSubmodule(const nanobind::module_ &m) {
return cls(mlirPDLOperationTypeGet(ctx));
},
"Get an instance of OperationType in given context.", nb::arg("cls"),
nb::arg("context").none() = nb::none());
nb::arg("context") = nb::none());

//===-------------------------------------------------------------------===//
// RangeType
Expand Down Expand Up @@ -81,7 +81,7 @@ static void populateDialectPDLSubmodule(const nanobind::module_ &m) {
return cls(mlirPDLTypeTypeGet(ctx));
},
"Get an instance of TypeType in given context.", nb::arg("cls"),
nb::arg("context").none() = nb::none());
nb::arg("context") = nb::none());

//===-------------------------------------------------------------------===//
// ValueType
Expand All @@ -94,7 +94,7 @@ static void populateDialectPDLSubmodule(const nanobind::module_ &m) {
return cls(mlirPDLValueTypeGet(ctx));
},
"Get an instance of TypeType in given context.", nb::arg("cls"),
nb::arg("context").none() = nb::none());
nb::arg("context") = nb::none());
}

NB_MODULE(_mlirDialectsPDL, m) {
Expand Down
4 changes: 2 additions & 2 deletions mlir/lib/Bindings/Python/DialectSMT.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -32,15 +32,15 @@ static void populateDialectSMTSubmodule(nanobind::module_ &m) {
[](const nb::object &, MlirContext context) {
return mlirSMTTypeGetBool(context);
},
"cls"_a, "context"_a.none() = nb::none());
"cls"_a, "context"_a = nb::none());
auto smtBitVectorType =
mlir_type_subclass(m, "BitVectorType", mlirSMTTypeIsABitVector)
.def_classmethod(
"get",
[](const nb::object &, int32_t width, MlirContext context) {
return mlirSMTTypeGetBitVector(context, width);
},
"cls"_a, "width"_a, "context"_a.none() = nb::none());
"cls"_a, "width"_a, "context"_a = nb::none());

auto exportSMTLIB = [](MlirOperation module, bool inlineSingleUseValues,
bool indentLetBody) {
Expand Down
5 changes: 2 additions & 3 deletions mlir/lib/Bindings/Python/DialectSparseTensor.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -53,9 +53,8 @@ static void populateDialectSparseTensorSubmodule(const nb::module_ &m) {
},
nb::arg("cls"), nb::arg("lvl_types"), nb::arg("dim_to_lvl").none(),
nb::arg("lvl_to_dim").none(), nb::arg("pos_width"),
nb::arg("crd_width"), nb::arg("explicit_val").none() = nb::none(),
nb::arg("implicit_val").none() = nb::none(),
nb::arg("context").none() = nb::none(),
nb::arg("crd_width"), nb::arg("explicit_val") = nb::none(),
nb::arg("implicit_val") = nb::none(), nb::arg("context") = nb::none(),
"Gets a sparse_tensor.encoding from parameters.")
.def_classmethod(
"build_level_type",
Expand Down
10 changes: 5 additions & 5 deletions mlir/lib/Bindings/Python/DialectTransform.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -33,7 +33,7 @@ static void populateDialectTransformSubmodule(const nb::module_ &m) {
return cls(mlirTransformAnyOpTypeGet(ctx));
},
"Get an instance of AnyOpType in the given context.", nb::arg("cls"),
nb::arg("context").none() = nb::none());
nb::arg("context") = nb::none());

//===-------------------------------------------------------------------===//
// AnyParamType
Expand All @@ -48,7 +48,7 @@ static void populateDialectTransformSubmodule(const nb::module_ &m) {
return cls(mlirTransformAnyParamTypeGet(ctx));
},
"Get an instance of AnyParamType in the given context.", nb::arg("cls"),
nb::arg("context").none() = nb::none());
nb::arg("context") = nb::none());

//===-------------------------------------------------------------------===//
// AnyValueType
Expand All @@ -63,7 +63,7 @@ static void populateDialectTransformSubmodule(const nb::module_ &m) {
return cls(mlirTransformAnyValueTypeGet(ctx));
},
"Get an instance of AnyValueType in the given context.", nb::arg("cls"),
nb::arg("context").none() = nb::none());
nb::arg("context") = nb::none());

//===-------------------------------------------------------------------===//
// OperationType
Expand All @@ -83,7 +83,7 @@ static void populateDialectTransformSubmodule(const nb::module_ &m) {
"Get an instance of OperationType for the given kind in the given "
"context",
nb::arg("cls"), nb::arg("operation_name"),
nb::arg("context").none() = nb::none());
nb::arg("context") = nb::none());
operationType.def_property_readonly(
"operation_name",
[](MlirType type) {
Expand All @@ -106,7 +106,7 @@ static void populateDialectTransformSubmodule(const nb::module_ &m) {
return cls(mlirTransformParamTypeGet(ctx, type));
},
"Get an instance of ParamType for the given type in the given context.",
nb::arg("cls"), nb::arg("type"), nb::arg("context").none() = nb::none());
nb::arg("cls"), nb::arg("type"), nb::arg("context") = nb::none());
paramType.def_property_readonly(
"type",
[](MlirType type) {
Expand Down
33 changes: 16 additions & 17 deletions mlir/lib/Bindings/Python/IRAffine.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -142,7 +142,7 @@ class PyAffineConstantExpr : public PyConcreteAffineExpr<PyAffineConstantExpr> {

static void bindDerived(ClassTy &c) {
c.def_static("get", &PyAffineConstantExpr::get, nb::arg("value"),
nb::arg("context").none() = nb::none());
nb::arg("context") = nb::none());
c.def_prop_ro("value", [](PyAffineConstantExpr &self) {
return mlirAffineConstantExprGetValue(self);
});
Expand All @@ -162,7 +162,7 @@ class PyAffineDimExpr : public PyConcreteAffineExpr<PyAffineDimExpr> {

static void bindDerived(ClassTy &c) {
c.def_static("get", &PyAffineDimExpr::get, nb::arg("position"),
nb::arg("context").none() = nb::none());
nb::arg("context") = nb::none());
c.def_prop_ro("position", [](PyAffineDimExpr &self) {
return mlirAffineDimExprGetPosition(self);
});
Expand All @@ -182,7 +182,7 @@ class PyAffineSymbolExpr : public PyConcreteAffineExpr<PyAffineSymbolExpr> {

static void bindDerived(ClassTy &c) {
c.def_static("get", &PyAffineSymbolExpr::get, nb::arg("position"),
nb::arg("context").none() = nb::none());
nb::arg("context") = nb::none());
c.def_prop_ro("position", [](PyAffineSymbolExpr &self) {
return mlirAffineSymbolExprGetPosition(self);
});
Expand Down Expand Up @@ -588,7 +588,7 @@ void mlir::python::populateIRAffine(nb::module_ &m) {
self.getContext(),
mlirAffineExprShiftDims(self, numDims, shift, offset));
},
nb::arg("num_dims"), nb::arg("shift"), nb::arg("offset").none() = 0)
nb::arg("num_dims"), nb::arg("shift"), nb::arg("offset") = 0)
.def(
"shift_symbols",
[](PyAffineExpr &self, uint32_t numSymbols, uint32_t shift,
Expand All @@ -597,8 +597,7 @@ void mlir::python::populateIRAffine(nb::module_ &m) {
self.getContext(),
mlirAffineExprShiftSymbols(self, numSymbols, shift, offset));
},
nb::arg("num_symbols"), nb::arg("shift"),
nb::arg("offset").none() = 0)
nb::arg("num_symbols"), nb::arg("shift"), nb::arg("offset") = 0)
.def_static(
"simplify_affine_expr",
[](PyAffineExpr &self, uint32_t numDims, uint32_t numSymbols) {
Expand Down Expand Up @@ -655,15 +654,15 @@ void mlir::python::populateIRAffine(nb::module_ &m) {
"Gets an affine expression containing the rounded-up result "
"of dividing an expression by a constant.")
.def_static("get_constant", &PyAffineConstantExpr::get, nb::arg("value"),
nb::arg("context").none() = nb::none(),
nb::arg("context") = nb::none(),
"Gets a constant affine expression with the given value.")
.def_static(
"get_dim", &PyAffineDimExpr::get, nb::arg("position"),
nb::arg("context").none() = nb::none(),
nb::arg("context") = nb::none(),
"Gets an affine expression of a dimension at the given position.")
.def_static(
"get_symbol", &PyAffineSymbolExpr::get, nb::arg("position"),
nb::arg("context").none() = nb::none(),
nb::arg("context") = nb::none(),
"Gets an affine expression of a symbol at the given position.")
.def(
"dump", [](PyAffineExpr &self) { mlirAffineExprDump(self); },
Expand Down Expand Up @@ -746,7 +745,7 @@ void mlir::python::populateIRAffine(nb::module_ &m) {
return PyAffineMap(context->getRef(), map);
},
nb::arg("dim_count"), nb::arg("symbol_count"), nb::arg("exprs"),
nb::arg("context").none() = nb::none(),
nb::arg("context") = nb::none(),
"Gets a map with the given expressions as results.")
.def_static(
"get_constant",
Expand All @@ -755,23 +754,23 @@ void mlir::python::populateIRAffine(nb::module_ &m) {
mlirAffineMapConstantGet(context->get(), value);
return PyAffineMap(context->getRef(), affineMap);
},
nb::arg("value"), nb::arg("context").none() = nb::none(),
nb::arg("value"), nb::arg("context") = nb::none(),
"Gets an affine map with a single constant result")
.def_static(
"get_empty",
[](DefaultingPyMlirContext context) {
MlirAffineMap affineMap = mlirAffineMapEmptyGet(context->get());
return PyAffineMap(context->getRef(), affineMap);
},
nb::arg("context").none() = nb::none(), "Gets an empty affine map.")
nb::arg("context") = nb::none(), "Gets an empty affine map.")
.def_static(
"get_identity",
[](intptr_t nDims, DefaultingPyMlirContext context) {
MlirAffineMap affineMap =
mlirAffineMapMultiDimIdentityGet(context->get(), nDims);
return PyAffineMap(context->getRef(), affineMap);
},
nb::arg("n_dims"), nb::arg("context").none() = nb::none(),
nb::arg("n_dims"), nb::arg("context") = nb::none(),
"Gets an identity map with the given number of dimensions.")
.def_static(
"get_minor_identity",
Expand All @@ -782,7 +781,7 @@ void mlir::python::populateIRAffine(nb::module_ &m) {
return PyAffineMap(context->getRef(), affineMap);
},
nb::arg("n_dims"), nb::arg("n_results"),
nb::arg("context").none() = nb::none(),
nb::arg("context") = nb::none(),
"Gets a minor identity map with the given number of dimensions and "
"results.")
.def_static(
Expand All @@ -796,7 +795,7 @@ void mlir::python::populateIRAffine(nb::module_ &m) {
context->get(), permutation.size(), permutation.data());
return PyAffineMap(context->getRef(), affineMap);
},
nb::arg("permutation"), nb::arg("context").none() = nb::none(),
nb::arg("permutation"), nb::arg("context") = nb::none(),
"Gets an affine map that permutes its inputs.")
.def(
"get_submap",
Expand Down Expand Up @@ -923,7 +922,7 @@ void mlir::python::populateIRAffine(nb::module_ &m) {
return PyIntegerSet(context->getRef(), set);
},
nb::arg("num_dims"), nb::arg("num_symbols"), nb::arg("exprs"),
nb::arg("eq_flags"), nb::arg("context").none() = nb::none())
nb::arg("eq_flags"), nb::arg("context") = nb::none())
.def_static(
"get_empty",
[](intptr_t numDims, intptr_t numSymbols,
Expand All @@ -933,7 +932,7 @@ void mlir::python::populateIRAffine(nb::module_ &m) {
return PyIntegerSet(context->getRef(), set);
},
nb::arg("num_dims"), nb::arg("num_symbols"),
nb::arg("context").none() = nb::none())
nb::arg("context") = nb::none())
.def(
"get_replaced",
[](PyIntegerSet &self, const nb::list &dimExprs,
Expand Down
Loading