-
Notifications
You must be signed in to change notification settings - Fork 11
single_version_only for actx.compile #228
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
base: main
Are you sure you want to change the base?
Changes from 1 commit
183b9e8
5ed25a5
a3ca58b
20b03b2
b8c0e25
d8071ea
7175fad
b3c69c7
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -612,9 +612,11 @@ def call_loopy(self, program, **kwargs): | |
|
|
||
| return call_loopy(program, processed_kwargs, entrypoint) | ||
|
|
||
| def compile(self, f: Callable[..., Any]) -> Callable[..., Any]: | ||
| def compile(self, f: Callable[..., Any], | ||
| single_version_only: bool = False) -> Callable[..., Any]: | ||
| from .compile import LazilyPyOpenCLCompilingFunctionCaller | ||
| return LazilyPyOpenCLCompilingFunctionCaller(self, f) | ||
| return LazilyPyOpenCLCompilingFunctionCaller(self, | ||
|
Collaborator
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Maybe also handle the other sub-classes of BaseLazilyCompilingFunctionCaller?
Collaborator
Author
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Added in 5ed25a5 |
||
| f, single_version_only) | ||
|
|
||
| def transform_dag(self, dag: "pytato.DictOfNamedArrays" | ||
| ) -> "pytato.DictOfNamedArrays": | ||
|
|
||
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -262,6 +262,8 @@ class BaseLazilyCompilingFunctionCaller: | |
| program_cache: Dict["PMap[Tuple[Any, ...], AbstractInputDescriptor]", | ||
| "CompiledFunction"] = field(default_factory=lambda: {}) | ||
|
|
||
| single_version_only: bool = False | ||
|
Collaborator
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. I'm worried this might lead to developer errors. I would prefer if we don't default and ensure that the current version is passed during instantiation.
Collaborator
Author
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. I removed the default in 5ed25a5
Collaborator
Author
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. This fails in grudge now:
Collaborator
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Hmm... Maybe then we introduce the default as you suggested, but have a deprecation period attached to it? |
||
|
|
||
| # {{{ abstract interface | ||
|
|
||
| def _dag_to_transformed_pytato_prg(self, dict_of_named_arrays, *, prg_id=None): | ||
|
|
@@ -324,7 +326,10 @@ def __call__(self, *args: Any, **kwargs: Any) -> Any: | |
| try: | ||
| compiled_f = self.program_cache[arg_id_to_descr] | ||
|
Owner
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Can we save ourselves having to find
Collaborator
Author
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. If I remember correctly, this was the main goal of implementing single_version_only? What do you think of the approach in d8071ea? |
||
| except KeyError: | ||
| pass | ||
| if self.single_version_only and self.program_cache: | ||
| raise ValueError( | ||
| f"Function '{self.f.__name__}' to be compiled " | ||
| "was already compiled previously with different arguments.") | ||
| else: | ||
| return compiled_f(arg_id_to_arg) | ||
|
|
||
|
|
||
Uh oh!
There was an error while loading. Please reload this page.