From 48c7cb4bd961cfc5b669c7ccebc4b29570909f16 Mon Sep 17 00:00:00 2001 From: Philipp Schaad Date: Tue, 29 Oct 2024 18:21:25 +0100 Subject: [PATCH] Fix to block fusion --- dace/transformation/interstate/block_fusion.py | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/dace/transformation/interstate/block_fusion.py b/dace/transformation/interstate/block_fusion.py index 71736fc269..37da066be2 100644 --- a/dace/transformation/interstate/block_fusion.py +++ b/dace/transformation/interstate/block_fusion.py @@ -1,7 +1,7 @@ # Copyright 2019-2024 ETH Zurich and the DaCe authors. All rights reserved. from dace.sdfg import utils as sdutil -from dace.sdfg.state import ControlFlowBlock, ControlFlowRegion, SDFGState +from dace.sdfg.state import AbstractControlFlowRegion, ControlFlowBlock, ControlFlowRegion, SDFGState from dace.transformation import transformation @@ -53,6 +53,9 @@ def can_be_applied(self, graph, expr_index, sdfg, permissive=False): if out_edges[0].data.assignments: if not in_edges: return False + # If the first block is a control flow region, no absorbtion is possible. + if isinstance(self.first_block, AbstractControlFlowRegion): + return False # Fail if symbol is set before the block to fuse new_assignments = set(out_edges[0].data.assignments.keys()) if any((new_assignments & set(e.data.assignments.keys())) for e in in_edges):