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

ArrayElimination removes used array from SDFG #1468

Open
philip-paul-mueller opened this issue Nov 28, 2023 · 5 comments
Open

ArrayElimination removes used array from SDFG #1468

philip-paul-mueller opened this issue Nov 28, 2023 · 5 comments
Labels
bug Something isn't working transformations

Comments

@philip-paul-mueller
Copy link
Collaborator

I am working on the attached SDFG. In the beginning I am able to apply translations. But after some time I start to get errors such as:

  • TypeError: Memlet is not of type Memlet (type: <class 'dace.serialize.SerializableObject'>)
  • AttributeError: 'AccessNode' object has no attribute 'code'
  • Failed to load transformations (IndexError: list index out of range)

This happens primary if I want to apply the simplify pass or when I want to apply some transformations others will still work.
I am not sure if the error is located inside the transformation or the vscode extension, but since I located through the extension I put the issue here.

I was only able to identify deterministic steps to reproduce the first error, for this do the following:

  • Expand the map that goes over [__iq__gather=0:12, __i1=0:50] (inputs c, o and v).
  • Fuse the created map that goes over __iq__gather with the top map [__i0=0:12] (input e).
  • Run the simplify pass which will now fail.

I have attached the resulting SDFG.

initial_sdfg.json
Transformed_failing_sdfg.json

@phschaad phschaad self-assigned this Dec 1, 2023
@phschaad
Copy link
Collaborator

phschaad commented Dec 4, 2023

It looks like this is a problem with the simplify pass, specifically ArrayElimination.

We initially have a write to and read from a transient p between two maps.

image

However, once these maps are fused, there is no corresponding access node anymore (but the memlets of course still access the array p.

image

Running Simplify, or more specifically, ArrayElimination, now will remove the data container p from the SDFG because it is no longer in the access set for this state, since the 'cleanup' of ArrayElimination believes it has become redundant. This means that from now on the Memlet is no longer accepted as a correct memlet.

I am transferring this issue to the DaCe repository so the bug can be addressed.

@phschaad phschaad removed their assignment Dec 4, 2023
@phschaad phschaad transferred this issue from spcl/dace-vscode Dec 4, 2023
@phschaad phschaad added bug Something isn't working transformations labels Dec 4, 2023
@phschaad phschaad changed the title TypeError: Memlet is not of type Memlet ArrayElimination removes used array from SDFG Dec 4, 2023
@edopao
Copy link
Collaborator

edopao commented Dec 6, 2023

@BenWeber42 I have observed the same issue in icon4py stencils using GT4Py for SDFG generation: 8 stencils are broken on the DaCe candidate release.

edopao added a commit to edopao/gt4py that referenced this issue Dec 13, 2023
Not working in icon4py because of this issue:
spcl/dace#1468
@edopao
Copy link
Collaborator

edopao commented Dec 13, 2023

@philip-paul-mueller Can you please pull #1480 and see if this issue is still present?

Failed to load transformations (IndexError: list index out of range)

@edopao
Copy link
Collaborator

edopao commented Dec 13, 2023

@philip-paul-mueller Can you please pull #1480 and see if this issue is still present?

Failed to load transformations (IndexError: list index out of range)

I still have to work on it, it breaks another test.

@philip-paul-mueller
Copy link
Collaborator Author

@edopao I have now started to look into this issue a little bit. However, for me this issue only appears on the GPU, if I translate the same code to CPU, then nothing happens. Based on my observation (see below) this means that in GPU the nested SDFG can not be removed, and thus memlet propagation is done.

Just for my understanding. The error is basically because we extract one row/column from a matrix and we do this inside a nested SDFG. And the memlet propagation code implicitly assumes that the dimensionality of both must be the same.
Is this more or less correct?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working transformations
Projects
None yet
Development

No branches or pull requests

3 participants