[Mlir-commits] [mlir] [mlir][python] make loading dialect module (for type and value casting) best effort only (PR #72338)

Stella Laurenzo llvmlistbot at llvm.org
Tue Nov 14 23:03:24 PST 2023


================
@@ -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)));
----------------
stellaraccident wrote:

No one has noticed it, but the Python API overhead for all of the fancy stuff is raising on my hit list. There are a wide swatch of use cases that need no frills, and I worry about the overhead of this kind of thing. For some cases, I've already wanted a big switch that just turns off all OpViews, for example.

https://github.com/llvm/llvm-project/pull/72338


More information about the Mlir-commits mailing list