[Mlir-commits] [mlir] [mlir][python] remove various caching mechanism (PR #70831)
Maksim Levental
llvmlistbot at llvm.org
Tue Oct 31 10:12:27 PDT 2023
================
@@ -34,7 +34,6 @@ PYBIND11_MODULE(_mlir, m) {
"append_dialect_search_prefix",
[](PyGlobals &self, std::string moduleName) {
self.getDialectSearchPrefixes().push_back(std::move(moduleName));
- self.clearImportCache();
----------------
makslevental wrote:
The only question is whether there's any value in preserving these semantics for the - i.e., that when you append a dialect search prefix, that `llvm::StringSet<> loadedDialectModules` should be cleared thereby triggering "reloads" of existing dialect modules.
I put "reload" in quotes because according to my understanding a reimport doesn't actually trigger a reload of the module[^1]. So even if someone is dynamically moving around existing modules (expecting dialect modules found under former prefixes to be found elsewhere post a call to `append_dialect_search_prefix`), the current implementation doesn't actually do that (since it reimports by calling `py::module::import(moduleName.c_str())`).
[^1]: You need to use `importlib` [to accomplish this](https://stackoverflow.com/questions/437589/how-do-i-unload-reload-a-python-module/437591#437591).
https://github.com/llvm/llvm-project/pull/70831
More information about the Mlir-commits
mailing list