spcl / spcl/dace

`InlineMultistateSDFG` Destroys SSA Invariant

Open
#1,959 0 comments 0 reactions 0 assignees View on GitHub
Dominant language
Python
Stars
593
Forks
163
Avg merge
2d 23h
Merged PRs (30d)
60

Description

This is not a bug per se, as the resulting SDFGs are correct, however, the `InlineMultistateSDFG` transformation destroys the SSA invariant of SDFGs, which is a less than optimal behaviour.

Consider the following SDFG:

![Image](https://github.com/user-attachments/assets/b844a85b-4180-4f09-b530-f32d45934434)

The first nested SDFG writes into `T1` which is then written into `T3[0:a]`, the second nested SDFG writes its output into `T2` which is then copied into `T3[a:N]`.
`T3` is then finally written into the global memory `G`.
As you can see al _transients_ are written to exactly once, for certain reason (I am looking at you FORTRAN) we can not enforce this on global data, but this is not the issue here.

After we run `InlineMultistateSDFG` we get the following SDFG:

![Image](https://github.com/user-attachments/assets/b2c07258-adbf-4283-b770-c6212caaa2e2)

As you can see now the writing of the output, i.e. `{(T1), (T2)} -> (T3) -> (G)` is now split and put into different states.
Thus the transients are no longer SSA.

Since SSA is a very nice and useful property I would think/expect/hope that the transformation would maintain this invariant.
Thus from this perspective it is a bug.

Contributor guide

Open the contributing guide

Assessment

This issue has not been assessed yet.

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.