[Mlir-commits] [mlir] [mlir][python] remove various caching mechanism (PR #70831)

Oleksandr Alex Zinenko llvmlistbot at llvm.org
Thu Nov 2 02:42:04 PDT 2023


================
@@ -57,15 +57,18 @@ void PyGlobals::loadDialectModule(llvm::StringRef dialectNamespace) {
     break;
   }
 
+  if (loaded.is_none())
+    return false;
   // Note: Iterator cannot be shared from prior to loading, since re-entrancy
   // may have occurred, which may do anything.
-  loadedDialectModulesCache.insert(dialectNamespace);
+  loadedDialectModules.insert(dialectNamespace);
+  return true;
----------------
ftynse wrote:

I don't see any previous negative caching at module level, am I missing something?

It could make sense to add _here_. Several lookup functions are calling this, and in absence of the module for a specific dialect prefix, this will keep hitting the slow path of trying to load a module from a filesystem. This seems undesirable unless module import has its own cache. (I generally prefer adding optimizations when we know they are actually meaningful...) We should document this behavior and provide a way to reset the (negative) cache programmatically for extreme cases like the module being placed into one of the search paths by another process.

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


More information about the Mlir-commits mailing list