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
6 changes: 3 additions & 3 deletions mlir/lib/Bindings/Python/MainModule.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -58,7 +58,7 @@ PYBIND11_MODULE(_mlir, m) {
// Registration decorators.
m.def(
"register_dialect",
[](py::object pyClass) {
[](py::type pyClass) {
std::string dialectNamespace =
pyClass.attr("DIALECT_NAMESPACE").cast<std::string>();
PyGlobals::get().registerDialectImpl(dialectNamespace, pyClass);
Expand All @@ -68,9 +68,9 @@ PYBIND11_MODULE(_mlir, m) {
"Class decorator for registering a custom Dialect wrapper");
m.def(
"register_operation",
[](const py::object &dialectClass, bool replace) -> py::cpp_function {
[](const py::type &dialectClass, bool replace) -> py::cpp_function {
return py::cpp_function(
[dialectClass, replace](py::object opClass) -> py::object {
[dialectClass, replace](py::type opClass) -> py::type {
std::string operationName =
opClass.attr("OPERATION_NAME").cast<std::string>();
PyGlobals::get().registerOperationImpl(operationName, opClass,
Expand Down
4 changes: 2 additions & 2 deletions mlir/python/mlir/_mlir_libs/_mlir/__init__.pyi
Original file line number Diff line number Diff line change
Expand Up @@ -8,5 +8,5 @@ class _Globals:
def append_dialect_search_prefix(self, module_name: str) -> None: ...
def _check_dialect_module_loaded(self, dialect_namespace: str) -> bool: ...

def register_dialect(dialect_class: type) -> object: ...
def register_operation(dialect_class: type, *, replace: bool = ...) -> object: ...
def register_dialect(dialect_class: type) -> type: ...
def register_operation(dialect_class: type, *, replace: bool = ...) -> type: ...
Loading