spcl / spcl/dace

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

Open
#1,549 1 comment 0 reactions 0 assignees View on GitHub
Dominant language
Python
Stars
595
Forks
163
Avg merge
2d 23h
Merged PRs (30d)
60

Description

**Describe the bug**
Applying `gpu_persistent_fusion` to some dace programs breaks during codegen if there are `ArrayView`s

**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](https://github.com/spcl/dace/files/14637072/gpu_persistent_fusion.py.patch.txt))
2. Run attached dace program (modified from `tests/npbench/polybench/correlation.py`, [correlation_test.py.patch.txt](https://github.com/spcl/dace/files/14637076/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` `AccessNode`s should be connected to `AccessNode`s, 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](https://github.com/spcl/dace/files/14637094/failing.sdfgz.txt)

Contributor guide

Open the contributing guide

Research direction

Start in dace/transformation/subgraph/gpu_persistent_fusion.py around line 214 and reproduce the failure with the attached correlation_test.py patch. Trace the resulting ArrayView AccessNodes into dace/codegen/targets/cpu.py:209, where allocate_view receives a NestedSDFG without desc. Done means the relevant ArrayView edges target AccessNodes and the reproduced program proceeds through code generation.

Written by the indexing model from the issue text.

Assessment

Tech stack
python
Domain
compilers
Issue type
Bug
Difficulty
4/5
Estimated time
3-5 days
Activity status
Stale
Clarity
Mostly clear
Newbie friendliness
35/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.