[Mlir-commits] [mlir] [mlir][python] enable registering dialects with the default `Context` (PR #72488)

Stella Laurenzo llvmlistbot at llvm.org
Mon Nov 27 13:07:16 PST 2023


================
@@ -56,14 +56,24 @@ def get_include_dirs() -> Sequence[str]:
 #
 # This facility allows downstreams to customize Context creation to their
 # needs.
+
+
+def get_registry():
+    if not hasattr(get_registry, "__registry"):
----------------
stellaraccident wrote:

Yeah, just move it up a level and use nonlocal. No need for dirty tricks that someone will need to grok later. I'm not sure it needs to be thread local. This is a really basic facility in the same vein as site_initialize, which is global-global.

Also, I note that your branch is named "remove_site_initialize_2". I assume this is all in addition to the current approach, which is used and works just fine for what we need it for.

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


More information about the Mlir-commits mailing list