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

Memlets propagated incorrectly out of nested SDFGs #1739

Open
phschaad opened this issue Nov 7, 2024 · 0 comments
Open

Memlets propagated incorrectly out of nested SDFGs #1739

phschaad opened this issue Nov 7, 2024 · 0 comments
Labels
bug Something isn't working
Milestone

Comments

@phschaad
Copy link
Collaborator

phschaad commented Nov 7, 2024

If a nested SDFG accesses a data container passed to it not starting from a 0 offset, the outside memlets are propagated incorrectly, leading to incorrect code being generated.

[Edit: It is not actually memlet propagation, but the Python frontend that is at fault here. Propagation works as intended. See the discussion in #1738]

For instance, take the following code:

N = dace.symbol('N')
M = dace.symbol('M')

@dace.program
def nested_conditional_in_loop_in_map(A: dace.float64[M, N]):
    for i in dace.map[0:M]:
        for j in range(2, N, 1):
            if A[0][0]:
                A[i, j] = 1
            else:
                A[i, j] = 2
            A[i, j] = A[i, j] * A[i, j]

It is clear that inside the nested SDFG, A is only accessed in the index range A[:, 2:N-1]. However, the memlet being propagated to the outside of the nested SDFG inside the map is on the subset A[i, 0:N-3]. This leads to the index expression A[i, j - 2] being generated in the corresponding C++, consequently producing wrong results.

A failing test was added in #1738.

@phschaad phschaad added the bug Something isn't working label Nov 7, 2024
@phschaad phschaad added this to the 1.0 milestone Nov 7, 2024
@tbennun tbennun modified the milestones: 1.0, 1.x Nov 8, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
None yet
Development

No branches or pull requests

2 participants