From 9ec981c512b00315e8dc85e7c0aa8aa83a398f22 Mon Sep 17 00:00:00 2001 From: Matthias Diener Date: Mon, 27 Jan 2025 16:23:48 -0600 Subject: [PATCH] remove deprecated kernel executor cache --- loopy/translation_unit.py | 25 +++---------------------- 1 file changed, 3 insertions(+), 22 deletions(-) diff --git a/loopy/translation_unit.py b/loopy/translation_unit.py index 37211ebc1..670feeef2 100644 --- a/loopy/translation_unit.py +++ b/loopy/translation_unit.py @@ -238,12 +238,9 @@ class TranslationUnit: entrypoints: frozenset[str] def __post_init__(self): - assert isinstance(self.entrypoints, abc_Set) assert isinstance(self.callables_table, Map) - object.__setattr__(self, "_program_executor_cache", {}) - def copy(self, **kwargs: Any) -> Self: target = kwargs.pop("target", None) t_unit = replace(self, **kwargs) @@ -411,7 +408,7 @@ def __call__(self, *args, **kwargs): # # In addition, the executor interface speeds up kernel invocation # by removing one unnecessary layer of function call. - warn("TranslationUnit.__call__ will become uncached in 2024, " + warn("TranslationUnit.__call__ is uncached as of 2025, " "meaning it will incur possibly substantial compilation cost " "with every invocation. Use TranslationUnit.executor to obtain " "an object that holds longer-lived caches.", @@ -444,12 +441,7 @@ def __call__(self, *args, **kwargs): kwargs["entrypoint"] = entrypoint - key = self.target.get_kernel_executor_cache_key(*args, **kwargs) - try: - pex = self._program_executor_cache[key] # pylint: disable=no-member - except KeyError: - pex = self.target.get_kernel_executor(self, *args, **kwargs) - self._program_executor_cache[key] = pex # pylint: disable=no-member + pex = self.target.get_kernel_executor(self, *args, **kwargs) del kwargs["entrypoint"] @@ -460,20 +452,9 @@ def __str__(self): return "\n".join( str(clbl.subkernel) - for name, clbl in self.callables_table.items() + for _name, clbl in self.callables_table.items() if isinstance(clbl, CallableKernel)) - # FIXME: Delete these when _program_executor_cache leaves the building - def __getstate__(self): - from dataclasses import asdict - return asdict(self) - - def __setstate__(self, state_obj): - for k, v in state_obj.items(): - object.__setattr__(self, k, v) - - object.__setattr__(self, "_program_executor_cache", {}) - # FIXME: This is here because Firedrake expects it, for some legacy reason. # Without that, it would be safe to delete. def update_persistent_hash(self, key_hash, key_builder):