-
Notifications
You must be signed in to change notification settings - Fork 49
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
feat[next][dace]: DaCe support for temporaries #1351
Conversation
This reverts commit 7b251f8.
e2564f8
to
326748a
Compare
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Drive-by review.
src/gt4py/next/program_processors/runners/dace_iterator/utility.py
Outdated
Show resolved
Hide resolved
src/gt4py/next/program_processors/runners/dace_iterator/itir_to_sdfg.py
Outdated
Show resolved
Hide resolved
@tehrengruber Thank you for the review comments. At last week's DaCe workshop, we were informed that array offsets will be deprecated in DaCe. The reason is that offsets are difficult to translate across nested-SDFG boundaries, and therefore very error prone during SDFG transformation. Currently the domain of temporary fields contains offsets in range definitions. The SDFG generated by this PR works, but It's not guarantee to still work in the future. In DaCe front-ends, in order to avoid offsets, they are running a pass to normalize all array access to be 0-based. We could discuss how to do it in ITIR as well. |
src/gt4py/next/program_processors/runners/dace_iterator/__init__.py
Outdated
Show resolved
Hide resolved
src/gt4py/next/program_processors/runners/dace_iterator/utility.py
Outdated
Show resolved
Hide resolved
src/gt4py/next/program_processors/runners/dace_iterator/itir_to_sdfg.py
Outdated
Show resolved
Hide resolved
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Small changes to conform to upcomming error message guidelines.
src/gt4py/next/program_processors/runners/dace_iterator/__init__.py
Outdated
Show resolved
Hide resolved
src/gt4py/next/program_processors/runners/dace_iterator/__init__.py
Outdated
Show resolved
Hide resolved
I would like to merge this PR, in order to stop overriding |
@@ -189,6 +197,103 @@ def add_storage( | |||
raise NotImplementedError() | |||
self.storage_types[name] = type_ | |||
|
|||
def generate_temporaries( |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I am not sure about the name.
What confuses me is that self.tmps
are the temporaries, or not?
And later you call this function only if self.tmps
is not empty, which seems a bit contradictory.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Right, function name changed to add_storage_for_temporaries
|
||
symbol_dtype = dace.int64 | ||
tmp_symbols: dict[str, TaskletExpr] = {} | ||
for tmp in self.tmps: |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
You spend ~70 lines on filling tmp_symbols
and does not explains what the loop does or the variable represents.
But for the small loop above you write a description, this seems a bit strange.
src/gt4py/next/program_processors/runners/dace_iterator/itir_to_sdfg.py
Outdated
Show resolved
Hide resolved
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
There are two suggestions, however, they are not mandatory in my view, so I will approve it.
shape_var = unique_var_name() | ||
program_sdfg.add_scalar(shape_var, symbol_dtype, transient=True) | ||
shape_node = defs_state.add_access(shape_var) | ||
defs_state.add_edge( |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
According to my understanding, you should be able to put even complex expressions in assignments on interstate edge.
The pass to sanitize unicode symbols is not needed at this stage. We will introduce it in separate PR, if needed in the future.
Description
Lift operators are removed by an ITIR transformation by introducing temporaries. Temporaries are implemented in DaCe backend as transient arrays. This PR adds extraction of temporaries and generation of corresponding transient arrays in the SDFG representation.