Skip to content

Commit

Permalink
Set the copy-sdfg's parent attributes to facilitate can_be_applied.
Browse files Browse the repository at this point in the history
  • Loading branch information
alexnick83 committed Sep 27, 2023
1 parent f6263b5 commit cf92481
Showing 1 changed file with 4 additions and 0 deletions.
4 changes: 4 additions & 0 deletions dace/transformation/subgraph/composite.py
Original file line number Diff line number Diff line change
Expand Up @@ -64,6 +64,10 @@ def can_be_applied(self, sdfg: SDFG, subgraph: SubgraphView) -> bool:
# deepcopy
graph_indices = [i for (i, n) in enumerate(graph.nodes()) if n in subgraph]
sdfg_copy = copy.deepcopy(sdfg)
# NOTE: for `can_be_applied` purposes, set the parent attributes to the original SDFG's parents
sdfg_copy.parent = sdfg.parent
sdfg_copy.parent_sdfg = sdfg.parent_sdfg
sdfg_copy.parent_nsdfg_node = sdfg.parent_nsdfg_node
sdfg_copy.reset_sdfg_list()
graph_copy = sdfg_copy.nodes()[sdfg.nodes().index(graph)]
subgraph_copy = SubgraphView(graph_copy, [graph_copy.nodes()[i] for i in graph_indices])
Expand Down

0 comments on commit cf92481

Please sign in to comment.