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

Error in MapFusion (Array Branch) #1539

Open
philip-paul-mueller opened this issue Feb 29, 2024 · 0 comments
Open

Error in MapFusion (Array Branch) #1539

philip-paul-mueller opened this issue Feb 29, 2024 · 0 comments

Comments

@philip-paul-mueller
Copy link
Collaborator

philip-paul-mueller commented Feb 29, 2024

Hello,
in my #1535 I fixed a bug in the MapFusion transformation, in the "scalar branch".
I have now found a new bug, but this time in the "array branch" and it has a different nature.
I have tried to come up with a minimal example, but was unable to do so, thus the attached graph is quite large.
Nevertheless, I was able to pinpoint the error rather accurately, but I have no idea how to solve it.

Now let's describe the error.
Below (initial_state.png in the archive) we see a the state right before things go south.
We see that a Map is populating transient dc (inside the map is a nested Map, I think that this at least contributes to the problem) of shape [27, 2, 10].
It is then fed into the second Map which does slicing using a trivial Tasklet, in the end the Map is doing dd = dc[:, 1, :], where dd is the output transient of the lower Map with shape [27, 1, 10].
initial_state

Then MapFusion starts working (intermediate_state.png), it has to introduce a scalar __s0..._dc to fake the existence of dc transient inside the second Map, with a shape of [1, 2, 1].
By the way the transformation only checks if dc is used inside this particular state, it does not check if dc is needed further down, which could also be a bug.
As you can see in the picture below (I attached a modified copy of the map_fusion.py file, that contains a breakpoint at the time the intermediate state is generated) this temporary scalar is connected via a Memlet to the Tasklet, but this Memlet is of volume 2, but the Tasklet only expects volume 1.
initial_state

The last picture (final_state.png) shows the state after the transformation.
As you can see the dc transient has gone and only the temporary transient is there.
final_state

To solve this, one would need to to use the original Memlet and manipulate its subset.

Best, Philip

attachement.tar.gz

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

No branches or pull requests

1 participant