From c98af78d041f726f55bf6ae7ad02853736b3258a Mon Sep 17 00:00:00 2001 From: Pratyai Mazumder Date: Mon, 7 Oct 2024 21:00:42 +0200 Subject: [PATCH] Make sure that the intermediate transient access nodes are not removed if they are used elsewhere. --- dace/transformation/dataflow/map_fusion.py | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/dace/transformation/dataflow/map_fusion.py b/dace/transformation/dataflow/map_fusion.py index df1c07612b..7366dd1ef9 100644 --- a/dace/transformation/dataflow/map_fusion.py +++ b/dace/transformation/dataflow/map_fusion.py @@ -283,12 +283,14 @@ def apply(self, graph: SDFGState, sdfg: SDFG): intermediate_nodes.add(dst) assert isinstance(dst, nodes.AccessNode) - # Check if an access node refers to non transient memory, or transient + # Check if an access node refers to non-transient memory, or transient # is used at another location (cannot erase) do_not_erase = set() for node in intermediate_nodes: if sdfg.arrays[node.data].transient is False: do_not_erase.add(node) + elif len([n for n in sdfg.data_nodes() if n.data == node.data]) > 1: + do_not_erase.add(node) else: for edge in graph.in_edges(node): if edge.src != first_exit: