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

Maksim Levental llvmlistbot at llvm.org
Mon Nov 27 12:37:08 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"):
----------------
makslevental wrote:

Its' true but that's only for class fields - here I'm doing something even "dirtier" and setting it on the function object so it doesn't get mangled. 

But just this morning was thinking I'd refactor this to be a module global behind `threading.local()` instead of this hackery. Thoughts?

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


More information about the Mlir-commits mailing list