spcl / dace

DaCe - Data Centric Parallel Programming
http://dace.is/fast
BSD 3-Clause "New" or "Revised" License
496 stars 130 forks source link

`scope_work_depth()` analysis modifies original SDFG #1670

Open Berke-Ates opened 1 month ago

Berke-Ates commented 1 month ago

Describe the bug Using scope_work_depth() on an SDFG with loops removes the backedges in the state machine.

To Reproduce Steps to reproduce the behavior:

  1. Checkout DaCe (Commit Hash: 74a31cb71e624fe541a32b3b097e46b193d08114)
  2. Execute the provided Python script with the sample SDFG in this source
  3. Inspect out.sdfg

Expected behavior scope_work_depth() should not modify the passed SDFG.

Screenshots image The SDFG on the left is the sample SDFG and the SDFG on right has been analysed with scope_work_depth().

tbennun commented 1 month ago

@phschaad FYI

phschaad commented 1 month ago

It seems that the way the work-depth analysis for an SDFG was implemented, it is a destructive analysis (breaking loop cycles). I will indirectly fix this by transitioning the analysis into one that uses control flow lifting to perform the analysis on loop regions. This avoids the issue altogether. An intermediate quickfix is to create a deepcopy of the SDFG and performing analysis on that instead.