Skip to content
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]: iterator-view support to DaCe backend #1790

Merged
merged 143 commits into from
Jan 15, 2025

Conversation

edopao
Copy link
Contributor

@edopao edopao commented Jan 8, 2025

The lowering of scan to SDFG requires the support for iterator view. This PR introduces a subset of iterator features:

  • Local if_ with exclusive branch execution
  • Lowering of list_get, make_tuple and tuple_get in iterator view
  • Field operators returning a tuple of fields
  • Tuple of fields with different size

Iterator tests are enabled on dace CPU backend without SDFG transformations (auto_optimize=False).

edopao added 30 commits December 3, 2024 15:30
@edopao edopao marked this pull request as ready for review January 10, 2025 15:57
Copy link
Contributor

@philip-paul-mueller philip-paul-mueller left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

It looks good, there are some issues I see, but it looks good.

Copy link
Contributor Author

@edopao edopao left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thank you for the review comments, I tried to address most of them.

Copy link
Contributor

@philip-paul-mueller philip-paul-mueller left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

There is the aspect of naming variables, i.e. the centralized naming stuff, I am not really happy.
The result looks good.

Copy link
Contributor

@philip-paul-mueller philip-paul-mueller left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I have two final remarks about, most importantly I think that an add_temp_array() function is missing and we should no longer generate __tmp names, but turn them differently.
Then there is something that I think is a bit inconsistent.

self, sdfg: dace.SDFG, dtype: dace.dtypes.typeclass
) -> tuple[str, dace.data.Scalar]:
"""Add a temporary scalar to the SDFG."""
temp_name = sdfg.temp_data_name()
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

  • To fully avoid the renaming problem, you should perform here the renaming, i.e. __tmp -> __gtit_tmp, also add a note to why this is done.
  • It looks rather strange that there is no add_temp_array() because they suffer from the same problem. Furthermore, it is just strange if that method is missing.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

  • The renaming problem was solved, the renaming of DaCe data containers was removed in the first place. All temporaries that are added during the lowering are safe to be __tmp dace transients. The GTIR temp symbols generated by the SSA pass are renamed into gtir_tmp before starting the lowering.
  • I have added the helper method add_temp_array()

Copy link
Contributor

@philip-paul-mueller philip-paul-mueller left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM

@edopao edopao merged commit 17bae8e into GridTools:main Jan 15, 2025
31 checks passed
@edopao edopao deleted the dace-gtir-iterator_view branch January 15, 2025 11:20
edopao added a commit that referenced this pull request Jan 29, 2025
…1824)

The implementation of scan field operator introduced a bug in the
lowering of if-statements to SDFG. The scan requires extended lowering
support for iterator view, therefore #1790 introduced the lowering of
local-if with exclusive branch execution. However, attention was not
paid to enable the exclusive behavior of if-expressions only in iterator
view, that is only in the scope of scan field operators. Regular field
operators should instead lower if-expressions to a tasklet, because the
field view behavior is that of a local select.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants