spcl / dace

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

`gpu_persistent_fusion` creates incorrect src edges in `ArrayView` `AccessNodes` #1549

Open kylosus opened 5 months ago

kylosus commented 5 months ago

Describe the bug Applying gpu_persistent_fusion to some dace programs breaks during codegen if there are ArrayViews

To Reproduce Steps to reproduce the behavior:

  1. Modify dace/transformation/subgraph/gpu_persistent_fusion.py to fix an issue with code -> code scalars (gpu_persistent_fusion.py.patch.txt)
  2. Run attached dace program (modified from tests/npbench/polybench/correlation.py, correlation_test.py.patch.txt)

Relevant stack trace

...
  File "../dace-master/dace/codegen/targets/cpu.py", line 209, in allocate_view
    self._dispatcher.dispatch_allocate(sdfg, dfg, state_id, viewed_dnode, viewed_dnode.desc(sdfg), global_stream,
AttributeError: 'NestedSDFG' object has no attribute 'desc'

(What I believe to be the) Relevant part of code https://github.com/spcl/dace/blob/e542965a98de63a74eb4a3276ba5c0cd801b5f62/dace/transformation/subgraph/gpu_persistent_fusion.py#L214

Expected behavior ArrayView AccessNodes should be connected to AccessNodes, not the top-level nsdfg that persistent fusion creates.

Additional context Several other tests under tests/npbench/polybench for the same reason, but need more changes to the rest of the library for gpu_persistent_fusion to apply.

Tested with latest dace master branch

Uploaded patches and sdfg as txt because GitHub won't let me upload anything else.

failing.sdfgz.txt

tbennun commented 5 months ago

@kylosus Thank you for reporting. View issue should be fixed in #1552 now. It still won't apply persistent fusion correctly because of different dimensionalities of internal maps (correlation contains both 2D and 1D maps), but this is a separate issue.