[Mlir-commits] [mlir] 26dc765 - [mlir][python] remove eager loading of dialect module (for type and value casting) (#72338)
llvmlistbot at llvm.org
llvmlistbot at llvm.org
Mon Nov 20 17:54:59 PST 2023
Author: Maksim Levental
Date: 2023-11-20T19:54:55-06:00
New Revision: 26dc765088d27dff9cae3df7de198f3aed4f757b
URL: https://github.com/llvm/llvm-project/commit/26dc765088d27dff9cae3df7de198f3aed4f757b
DIFF: https://github.com/llvm/llvm-project/commit/26dc765088d27dff9cae3df7de198f3aed4f757b.diff
LOG: [mlir][python] remove eager loading of dialect module (for type and value casting) (#72338)
Added:
Modified:
mlir/lib/Bindings/Python/IRModule.cpp
Removed:
################################################################################
diff --git a/mlir/lib/Bindings/Python/IRModule.cpp b/mlir/lib/Bindings/Python/IRModule.cpp
index 5538924d2481849..6727860c094a2a1 100644
--- a/mlir/lib/Bindings/Python/IRModule.cpp
+++ b/mlir/lib/Bindings/Python/IRModule.cpp
@@ -132,10 +132,8 @@ PyGlobals::lookupAttributeBuilder(const std::string &attributeKind) {
std::optional<py::function> PyGlobals::lookupTypeCaster(MlirTypeID mlirTypeID,
MlirDialect dialect) {
- // Make sure dialect module is loaded.
- if (!loadDialectModule(unwrap(mlirDialectGetNamespace(dialect))))
- return std::nullopt;
-
+ // Try to load dialect module.
+ (void)loadDialectModule(unwrap(mlirDialectGetNamespace(dialect)));
const auto foundIt = typeCasterMap.find(mlirTypeID);
if (foundIt != typeCasterMap.end()) {
assert(foundIt->second && "type caster is defined");
@@ -146,7 +144,8 @@ std::optional<py::function> PyGlobals::lookupTypeCaster(MlirTypeID mlirTypeID,
std::optional<py::function> PyGlobals::lookupValueCaster(MlirTypeID mlirTypeID,
MlirDialect dialect) {
- loadDialectModule(unwrap(mlirDialectGetNamespace(dialect)));
+ // Try to load dialect module.
+ (void)loadDialectModule(unwrap(mlirDialectGetNamespace(dialect)));
const auto foundIt = valueCasterMap.find(mlirTypeID);
if (foundIt != valueCasterMap.end()) {
assert(foundIt->second && "value caster is defined");
More information about the Mlir-commits
mailing list