-
Notifications
You must be signed in to change notification settings - Fork 155
Description
Describe the bug
There seems to be a problem in state fusion, related to the check for write-write hazards. This issue results in an SDFG with non-deterministic code generation, depending on the order of execution of different write edges.
To Reproduce
A reproducer is provided in #2256. The SDFG on the left is the start SDFG, provided by the new unit test, the one on the right is the result of state fusion on main:

The check for connecting path between two nodes, one in first state and and the other one in second state, is not checking if this is the only path writing to the second node. If other edges write to the node in the second state, state fusion cannot always rely on the sequencing assumption provided by a connecting path.
Solution
The check introduced in #2256 is very conservative, and restricts state fusion to a subset of all valid cases. By only allowing a single writing edge on the second node, this PR blocks state fusion in the durbin_kernel SDFG, which contains two write edges to __return in the second state, but is indeed a valid case:

The proper solution requires to check for valid cases, and prohibit state fusion only for real write-write hazards.