-
Notifications
You must be signed in to change notification settings - Fork 54
feat[dace][next] More Roboust Calling #2353
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
Changes from 1 commit
78b8dce
e6133ce
366293b
17be22e
c228fc8
dab085b
5280c3a
4ab5227
efb562a
82fae60
b945c28
969405a
02e7375
94332f0
cec9e08
45ecdb7
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 |
|---|---|---|
|
|
@@ -38,11 +38,12 @@ class CompiledDaceProgram(stages.CompiledProgram): | |
| ] | ||
|
|
||
| # Processed argument vectors that are passed to `CompiledSDFG.fast_call()`. `None` | ||
| # means that it has not been initialized, i.e. no call was ever performed. The | ||
| # first argument vector is used in normal calls and will get updated, to avoid | ||
| # full argument reprocessing. The second argument vector is only needed for | ||
| # initialization and will never be updated. | ||
| csdfg_args: tuple[list[Any], Sequence[Any]] | None | ||
| # means that it has not been initialized, i.e. no call was ever performed. | ||
| # - csdfg_argv: Arguments used for calling the actual compiled SDFG, will be updated. | ||
| # - csdfg_init_argv: Arguments used for initialization; used only the first time and | ||
| # never updated. | ||
| csdfg_argv: MutableSequence[Any] | None | ||
| csdfg_init_argv: Sequence[Any] | None | ||
|
|
||
| def __init__( | ||
| self, | ||
|
|
@@ -64,26 +65,28 @@ def __init__( | |
| # For debug purpose, we set a unique module name on the compiled function. | ||
| self.update_sdfg_ctype_arglist.__module__ = os.path.basename(program.sdfg.build_folder) | ||
|
|
||
| # Since the sdfg program hasn't been called yet. | ||
| self.csdfg_args = None | ||
| # Since the SDFG hasn't been called yet. | ||
| self.csdfg_argv = None | ||
| self.csdfg_init_argv = None | ||
|
|
||
| def prepare_arguments(self, **kwargs: Any) -> None: | ||
| def construct_arguments(self, **kwargs: Any) -> None: | ||
| """ | ||
| This function will process the arguments and store the processed values in `self.csdfg_args`, | ||
| to call them use `self.fast_call()`. | ||
| """ | ||
| with dace.config.set_temporary("compiler", "allow_view_arguments", value=True): | ||
| csdfg_agrv, csdfg_init_argv = self.sdfg_program.construct_arguments(**kwargs) | ||
| # Note we only care about the first argument vector, that is used in normal call. | ||
| # Since we update it, we ensure that it is a `list`. | ||
| self.csdfg_args = ([*csdfg_agrv], csdfg_init_argv) | ||
| csdfg_argv, csdfg_init_argv = self.sdfg_program.construct_arguments(**kwargs) | ||
| # Note we only care about `csdfg_argv` (normal call), since we have to update it, | ||
| # we ensure that it is a `list`. | ||
| self.csdfg_argv = [*csdfg_argv] | ||
| self.csdfg_init_argv = csdfg_init_argv | ||
|
|
||
| def fast_call(self) -> None: | ||
| """Perform a call to the compiled SDFG using the processed arguments, see `self.prepare_arguments()`.""" | ||
| assert isinstance(self.csdfg_args, tuple) and len(self.csdfg_args) == 2, ( | ||
| assert self.csdfg_argv is not None and self.csdfg_init_argv is not None, ( | ||
| "Argument vector was not set properly." | ||
| ) | ||
| self.sdfg_program.fast_call(*self.csdfg_args) | ||
| self.sdfg_program.fast_call(self.csdfg_argv, self.csdfg_init_argv, do_gpu_check=False) | ||
|
Contributor
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. Are we really sure we want to pass
Contributor
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. @philip-paul-mueller , any thoughts on this comment?
Contributor
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. We should have added something here. |
||
|
|
||
| def __call__(self, **kwargs: Any) -> None: | ||
| warnings.warn( | ||
|
|
||
Uh oh!
There was an error while loading. Please reload this page.