spcl / spcl/dace

Validation should reject direct tasklet/code-node -> tasklet|NestedSDFG edges without an intermediate access node

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

Description

## Summary

DaCe currently allows a direct edge between two tasklets (or from a tasklet/code node/library node into a NestedSDFG) that carries named data, with no AccessNode in between. This makes dataflow implicit and causes real bugs: array/scalar elimination inside simplify can remove a value that only "exists" on such an edge, and `InlineSDFG` then crashes trying to propagate it upward, since it expects a producing AccessNode.

## Where this came up

Discussed on PR #2586: https://github.com/spcl/dace/pull/2586

- `_can_drop_shared_paths` checks whether a shared nested-SDFG connector "without a source (or sink) access node" can be dropped. I think the in/out connector on a NestedSDFG should always trace back to an AccessNode through the memlet path (e.g. AccessNode -> MapEntry -> NestedSDFG), so a missing source/sink access node looked confusing.
- Separately, a reported failure in `indirection_test.py` (`test()`) showed the same root cause: with a scalar (`__bla_value`) sitting directly on a tasklet -> tasklet edge (no AccessNode), array/scalar elimination removes it from the nested SDFG, and `InlineSDFG` then hits a hard crash (KeyError) trying to propagate it back up, because it assumes an AccessNode is present. The same issue would apply to arrays, not just scalars.

## Proposal

Treat a direct code-node -> code-node edge (tasklet -> tasklet, tasklet -> NestedSDFG, code node/library node -> NestedSDFG, etc.) carrying named data as invalid IR: there should always be an intermediate AccessNode making the dataflow explicit, i.e. code node -> AccessNode -> code node|NestedSDFG. This should be enforced in SDFG validation rather than silently tolerated, so passes (like the array/scalar elimination that is part of simplify) can rely on the invariant instead of being that ones causing crashes downstream.

This is a design change with tradeoffs (there may be existing graphs/tests relying on tasklet -> tasklet edges), so it likely needs discussion before implementation.

Contributor guide

Open the contributing guide

Research direction

Review the SDFG validation logic and the failure described in indirection_test.py's test(), then trace how simplify's array/scalar elimination reaches InlineSDFG. Check whether existing graphs or tests rely on direct named-data edges and resolve the proposed invariant across tasklet, code-node, and NestedSDFG cases. Done means the validation behavior and affected failure paths are covered by tests.

Written by the indexing model from the issue text.

Assessment

Tech stack
python
Domain
compilers
Issue type
Feature
Difficulty
5/5
Estimated time
Over a week
Activity status
Active
Clarity
Mostly clear
Newbie friendliness
35/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.