dace icon indicating copy to clipboard operation
dace copied to clipboard

sdfg.validate goes on infinite recursion with loopy sdfg

Open tim0s opened this issue 10 months ago • 0 comments

Describe the bug

For certain (erroneous) SDFGs, sdfg.validate() does not thrown an exception, instead it crashes with a RecursionError. This may be undesirable, since it is unclear to the user if the SDFG is erroneous or he should increase the stack size in order to be able to validate the SDFG.

To Reproduce

Run the following Python code:

import dace
sdfg = dace.SDFG("foo")
state = sdfg.add_state()
mentry_2, mexit_2 = state.add_map("map_2", dict(i="0:9"))
mentry_6, mexit_6 = state.add_map("map_6", dict(i="0:9"))
mentry_8, mexit_8 = state.add_map("map_8", dict(i="0:9"))
state.add_edge(mentry_8, "OUT_0", mentry_6, "IN_0", dace.Memlet(data="bla", subset='0:9'))
state.add_edge(mentry_6, "OUT_0", mentry_2, "IN_0", dace.Memlet(data="bla", subset='0:9'))
state.add_edge(mentry_2, "OUT_0", mentry_6, "IN_0", dace.Memlet(data="bla", subset='0:9'))
sdfg.validate()

Expected behavior Either sdfg.validate() throws an exception telling me I formed a loop, or the last add_edge() throws an exception telling me I cannot add this edge because it would form a loop.

tim0s avatar Apr 26 '24 20:04 tim0s