Skip to content

Fixed remove_edge_and_dangling_path()#2307

Open
philip-paul-mueller wants to merge 10 commits into
spcl:mainfrom
philip-paul-mueller:fixed_remove_edge_path
Open

Fixed remove_edge_and_dangling_path()#2307
philip-paul-mueller wants to merge 10 commits into
spcl:mainfrom
philip-paul-mueller:fixed_remove_edge_path

Conversation

@philip-paul-mueller
Copy link
Copy Markdown
Collaborator

@philip-paul-mueller philip-paul-mueller commented Feb 13, 2026

Fixed remove_edge_and_dangling_path() such that it also handles the case where the edge is not located inside a Map.

@philip-paul-mueller philip-paul-mueller marked this pull request as draft February 13, 2026 12:07
@philip-paul-mueller philip-paul-mueller marked this pull request as ready for review May 8, 2026 09:21
Copy link
Copy Markdown
Collaborator

@tbennun tbennun left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Generally looks good, minor comments

Comment thread dace/sdfg/nodes.py Outdated
Comment thread dace/sdfg/nodes.py Outdated
Comment thread dace/sdfg/utils.py Outdated
Comment thread dace/sdfg/utils.py
curr_edge.src_conn))) == 0:
curr_edge.src.remove_out_connector(curr_edge.src_conn)

# The connector might be collecting.
Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

what case is this? I think it is generally disallowed in SDFG syntax

Copy link
Copy Markdown
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I actually wish that it would be disallowed but it is permitted and as far as I can tell parts of the toolchain (I suspect ConsolidateEdge) actually create such cases.

The case essentially represents the following:

A: np.ndarray[N, 40] = ...
for i in dace.map[0:N]:
    A[i, 0] = some_awesome_boundary_value()
    A[i, 39] = another_awesome_boundary_value()

So MapExit will have two incoming edges.
However, they do not have to go to the distinct (in-)connectors of the MapExit node.
In case they go to distinct connectors then there are also two outgoing edges one with subset [0:N, 0] and the other with [0:N, 39].

However, it is also allowed that they go to the same (in-)connector of MapExit.
In that case MapExit will only have one outgoing edge, and it will have a subset of [0:N, 0:40], which grossly overestimate the range that is written.

This is actually currently happening in GT4Py and it also blocks some optimization.

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Yes, there is an exception for passthrough (IN_*/OUT_*) connectors. I was only thinking about tasklets/library nodes/nested SDFGs. Thank you for the clarification

Copy link
Copy Markdown
Collaborator

@tbennun tbennun left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM

Comment thread dace/sdfg/utils.py
curr_edge.src_conn))) == 0:
curr_edge.src.remove_out_connector(curr_edge.src_conn)

# The connector might be collecting.
Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Yes, there is an exception for passthrough (IN_*/OUT_*) connectors. I was only thinking about tasklets/library nodes/nested SDFGs. Thank you for the clarification

@tbennun tbennun enabled auto-merge May 18, 2026 06:54
@tbennun tbennun added this pull request to the merge queue May 18, 2026
@github-merge-queue github-merge-queue Bot removed this pull request from the merge queue due to failed status checks May 18, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants