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 codegen with data access on inter-state edge #1434

Merged
merged 6 commits into from Dec 5, 2023

Conversation

edopao
Copy link
Collaborator

@edopao edopao commented Nov 17, 2023

After uplift to dace v0.15, one SDFG which was working before started to show compilation errors. The latest DaCe is moving a data access to an inter-state edge. For the data-access, the symbols that define array strides are needed for code generation. The SDFG was validated, before and after the simplify pass, but it did not compile for CPU. When skipping the simplify pass, the compilation did work. The problem has been narrowed down to the scalar-to-symbol promotion, which is moving a data access to an inter-state edge. Then, the method _used_symbols_internal needs to be update to account for data containers, including symbolic shape and strides.

This issue was reported in #1433. This PR contains a unit test to reproduce the issue and verify the proposed fix.

After uplift to dace v0.15, one SDFG which was working before started
to show compilation errors. The latest DaCe is moving a data access
to an inter-state edge. For the data-access, the symbols that define
array strides are needed for code generation. The SDFG was validated,
before and after the simplify pass, but it did not compile for CPU.
When skipping the simplify pass, the compilation did work.
The problem has been narrowed down to the scalar-to-symbol promotion,
which is moving a data access to an inter-state edge. Then, the
method _used_symbols_internal needs to be update to account for data
containers, including symbolic shape and strides.
This commit contains a unit test to reproduce the issue and verify
the proposed fix.
@edopao edopao changed the title Missing symbols for data access on inter-state edge Fix for codegen with data access on inter-state edge Nov 22, 2023
@edopao edopao changed the title Fix for codegen with data access on inter-state edge Fix codegen with data access on inter-state edge Nov 22, 2023
@edopao edopao linked an issue Nov 22, 2023 that may be closed by this pull request
@edopao edopao marked this pull request as ready for review November 23, 2023 08:23
Copy link
Contributor

@BenWeber42 BenWeber42 left a comment

Choose a reason for hiding this comment

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

Hey, sorry for the delayed review. I briefly talked with Tal, and the changes to DaCe are very good. Thanks a lot for that!

I would like to make some suggestions to the test:

  1. Move the test to this file: tests/codegen/codegen_used_symbols_test.py
  2. Try to reduce the test-case. Particularly, build the SDFG directly instead of starting with a different SDFG and then applying transformations until you reach the SDFG that triggers the bug

Regarding (2), I am worried that if the transformations change, then that might nullify the test. We don't really want to test the transformations here (most of the asserts just check that the test should work correctly).

Unit-test reduced to reproduce the origin of this issue.
Also, unit-test moved to codegen test file.
@edopao
Copy link
Collaborator Author

edopao commented Nov 30, 2023

@BenWeber42 Thank you for the review. Very good comment, I totally agree. I had focused my test more on the trigger of this issue rather than on its cause. I have pushed a commit where I apply the changes you proposed.

Copy link
Contributor

@BenWeber42 BenWeber42 left a comment

Choose a reason for hiding this comment

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

Thanks for the changes! Yea, I often also forget about the tests once I start focusing on the actual changes. But now the test is really nice 👌

@BenWeber42 BenWeber42 merged commit 1c0b0f6 into spcl:master Dec 5, 2023
11 checks passed
@edopao edopao deleted the bug-missing-symbols branch December 5, 2023 10:16
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.

Missing symbols for data access on inter-state edge
2 participants