Skip to content

Absolute K indexing fix: memlet volumn when mixed with cartesian#4

Merged
FlorianDeconinck merged 2 commits intostubbiali:physicsfrom
FlorianDeconinck:fix/absolute_indexing_write_cartesian_read_in_vert_loop
May 28, 2025
Merged

Absolute K indexing fix: memlet volumn when mixed with cartesian#4
FlorianDeconinck merged 2 commits intostubbiali:physicsfrom
FlorianDeconinck:fix/absolute_indexing_write_cartesian_read_in_vert_loop

Conversation

@FlorianDeconinck
Copy link
Copy Markdown
Collaborator

As per inline comment:

Today, we are looking at cases where absolute read and cartesian writes live in the same vertical loop e.g.

  with computation(PARALLEL), interval(...):
      _ = field.abs(K=x)                      # noqa: ERA001
      ...
      field = a + b                           # noqa: ERA001

This code is valid, the issue with DaCe bridge is that the volume given to the memlet differs in this case:

  • read memlet (absolute indexing): full array, we don't know
  • write memlet (cartesian): 1 - we know exactly
    Since those apply to the same underlying array, DaCe is not too happy about it. The workaround is to use the "variable K offset" pipeline for the cartesian to match the wider volume and at the same time keep the relative index correct.

@FlorianDeconinck FlorianDeconinck requested a review from romanc May 27, 2025 20:16
Copy link
Copy Markdown
Collaborator

@romanc romanc left a comment

Choose a reason for hiding this comment

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

I think this is fine as a workaround for this branch. If there's an easy test-case, we could take that and add it to the (mainstream) gt4py/cartesian testcases. That would make sure of "it'll go away (tm) in the new bridge".

@FlorianDeconinck
Copy link
Copy Markdown
Collaborator Author

I have the goods, I'll put in a test case.

@FlorianDeconinck FlorianDeconinck merged commit f13e2d8 into stubbiali:physics May 28, 2025
0 of 5 checks passed
@FlorianDeconinck FlorianDeconinck deleted the fix/absolute_indexing_write_cartesian_read_in_vert_loop branch May 28, 2025 13:22
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