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

Fixed RedundantArray's handling of "reshaping" Memlets #1603

Merged
merged 11 commits into from
Jul 4, 2024

Conversation

philip-paul-mueller
Copy link
Collaborator

@philip-paul-mueller philip-paul-mueller commented Jun 18, 2024

This PR fixes an issue that was reported as issue 1595, that was traced back to RedundantArray.

The commit adds a deterministic test, unlike the one in the issue, that fails without the fix.
The underlying problem is, that the transformation does not correctly handle a Memlet that performs a reshaping.
This commit does not really solves the issue, instead it adds a special case for this particular case and then handles it correctly as I was unable to modify the code to handle it correctly.
It is not a nice solution, but it works.

I also verified that without the fix the test will fail.
It essentially creates a special case for it and applies then the correct way.
This is not very good but it works and I have no better solution.
This is for investigate why the CI fails.
After this commit all tests except the one I had added should pass.
And NOAA which should also fail.

This reverts commit 742568d.
@tbennun
Copy link
Collaborator

tbennun commented Jun 20, 2024

@philip-paul-mueller please rename the title, this is unclear. Even "Fix for issue #1595" is a better name.

@philip-paul-mueller philip-paul-mueller changed the title Fixed redundant array Fixed RedundantArray's handling of "reshaping" Memlets Jun 21, 2024
Copy link
Contributor

@alexnick83 alexnick83 left a comment

Choose a reason for hiding this comment

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

What happens if the first/input array has multiple incoming edges? It looks like the transformation will apply as before your fix and produce a similar error. You don't need to make the transformation work on such corner cases, but maybe it should not match those cases in the first place. How about refactoring the new login into a separate helper method and calling it also in can_be_applied?

@philip-paul-mueller
Copy link
Collaborator Author

I like that idea.

… handles the reshaping case but simply ignore it.

I put everything inside a helper function.
In the previous versions I tried to simply ignore the reshaping Memlet case, however, this break other tests.
In this version reshaping Memlets are not turned into a view, i.e. the source array is not removed but turned into a view.
This fixed the other tests again.

It is not the best solution but it works.
A reshaping memlet must change the shape of a datacontainer.
However, in the old version also the total size was considered.
Which is not fully correct, as the total size is more related to the memory layout and not to the "computational domain".
@alexnick83 alexnick83 added this pull request to the merge queue Jul 4, 2024
Merged via the queue into spcl:master with commit b5f5624 Jul 4, 2024
10 checks passed
philip-paul-mueller added a commit to philip-paul-mueller/jace that referenced this pull request Sep 25, 2024
I enabled the simplify pass in commit `411bd7bd` and it worked locally.
However, this was because I was not running it inside nox and using my own version of DaCe.
The bug in simplify was fixed in [PR#1603](spcl/dace#1603) which was merged _after_ 16.1 was released, thus the fix is not avaliable.
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.

3 participants