dace icon indicating copy to clipboard operation
dace copied to clipboard

Memlets propagated incorrectly out of nested SDFGs

Open phschaad opened this issue 1 year ago • 2 comments

phschaad avatar Nov 07 '24 16:11 phschaad

@phschaad it's not memlet propagation, it's the Python frontend.

The culprit is in newast.py, line 3134-3135:

            if ignore_indices:
                to_squeeze_rng = rng.offset_new(offset, True)

Upon squeezing, the offset of the outer memlet may change the offset of the internal memlet, so you need to offset it back to compensate. The offset for rng currently is the symbol's valid range. However, what you should be offsetting by (rather than the offset of the symbol's first value), is the final offset of the memlets on the outer SDFG. This is not yet computed at this point (as there may be multiple accesses, so the final offset may change).

This was introduced in #876, and the PR is nice because it includes several tests that demonstrate when you would want that offsetting. A correct fix should pass your test and also all of those tests.

As with similar issues, #1696 will fix it by removing this code altogether.

tbennun avatar Nov 08 '24 03:11 tbennun

@tbennun I see, that makes sense. I was expecting this to be a non-issue in 1.x, but I suppose we will need to fix newast.py for 1.0 then.

phschaad avatar Nov 08 '24 08:11 phschaad

Will be fixed in #1696

tbennun avatar Jul 22 '25 17:07 tbennun