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

fix[next-dace]: Preserve ITIR data layout #1346

Merged
merged 3 commits into from
Oct 16, 2023
Merged

Conversation

edopao
Copy link
Contributor

@edopao edopao commented Oct 6, 2023

Description

The DaCe backend is reordering the dimensions of field domain based on alphabetical order - we call this the canonical order of dimensions. This PR corrects indexing of field domain in get_scan_dim which was not consistent with the canonical order.

Additional minor edit:

  • rename map_domain -> map_ranges
  • replace dace.Memlet() with dace.Memlet.simple()

@edopao edopao marked this pull request as ready for review October 6, 2023 09:52
@edopao edopao requested a review from petiaccja October 6, 2023 09:52
Copy link
Contributor

@petiaccja petiaccja left a comment

Choose a reason for hiding this comment

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

Choose dimension ordering and ABI scheme:

  • Canonical ordering + no runtime casts: order dimensions lexicographically , shuffle strides, sizes and offsets consistently, everywhere (kinda error prone but simple and no runtime costs)
  • Dynamic ordering + runtime casts: generate each callable with whatever dimension order in its ABI, and generate runtime instructions for casting differently ordered arguments to the callable (kinda error prone, kinda complicated, kinda slow, but reuses function bodies)
  • Dynamic ordering + no runtime casts: generate each callable once for each different dimension order of its arguments (simple implementation, complicated caching for SDFG generation, not error prone, bloated generated code)

@edopao
Copy link
Contributor Author

edopao commented Oct 13, 2023

Decided to go for option 1, which means keeping the solution already present in main branch:

  • Canonical ordering + no runtime casts: order dimensions lexicographically , shuffle strides, sizes and offsets consistently, everywhere (kinda error prone but simple and no runtime costs)

However, one place needs to be updated because it was not consistent:

  • Addressing of scan dimension, which was using the ITIR order of dimensions in the output field domain.

@edopao edopao merged commit d07104d into GridTools:main Oct 16, 2023
@edopao edopao deleted the dace-domain branch October 16, 2023 09:07
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