From e657f2c4d7ce1fea9c69fe7ddd1631eb95857df8 Mon Sep 17 00:00:00 2001 From: Philipp Schaad Date: Mon, 23 Dec 2024 12:58:16 +0100 Subject: [PATCH] Fixes --- dace/frontend/fortran/fortran_parser.py | 4 ++-- tests/fortran/array_test.py | 8 +++++--- 2 files changed, 7 insertions(+), 5 deletions(-) diff --git a/dace/frontend/fortran/fortran_parser.py b/dace/frontend/fortran/fortran_parser.py index 68a174c130..dd9571636c 100644 --- a/dace/frontend/fortran/fortran_parser.py +++ b/dace/frontend/fortran/fortran_parser.py @@ -405,7 +405,7 @@ def _add_simple_state_to_cfg(self, cfg: ControlFlowRegion, state_name: str): if cfg in self.last_sdfg_states and self.last_sdfg_states[cfg] is not None: substate = cfg.add_state(state_name) else: - substate = cfg.add_state(state_name, is_start_state=True) + substate = cfg.add_state(state_name, is_start_block=True) self._finish_add_state_to_cfg(cfg, substate) return substate @@ -881,7 +881,7 @@ def symbol2sdfg(self, node: ast_internal_classes.Symbol_Decl_Node, sdfg: SDFG, c if node.name not in sdfg.symbols: sdfg.add_symbol(node.name, datatype) if cfg not in self.last_sdfg_states or self.last_sdfg_states[cfg] is None: - bstate = cfg.add_state("SDFGbegin", is_start_state=True) + bstate = cfg.add_state("SDFGbegin", is_start_block=True) self.last_sdfg_states[cfg] = bstate if node.init is not None: substate = cfg.add_state(f"Dummystate_{node.name}") diff --git a/tests/fortran/array_test.py b/tests/fortran/array_test.py index e83b8367ba..5ea8fb1a52 100644 --- a/tests/fortran/array_test.py +++ b/tests/fortran/array_test.py @@ -5,6 +5,7 @@ from dace import dtypes, symbolic from dace.sdfg import utils as sdutil from dace.sdfg.nodes import AccessNode +from dace.sdfg.state import LoopRegion from tests.fortran.fortran_test_helper import SourceCodeBuilder, create_singular_sdfg_from_string @@ -163,9 +164,10 @@ def test_fortran_frontend_memlet_in_map_test(): """).check_with_gfortran().get() sdfg = create_singular_sdfg_from_string(sources, 'main') sdfg.simplify() - # Expect that start is begin of for loop -> only one out edge to guard defining iterator variable - assert len(sdfg.out_edges(sdfg.start_state)) == 1 - iter_var = symbolic.symbol(list(sdfg.out_edges(sdfg.start_state)[0].data.assignments.keys())[0]) + # Expect that the start is the outer for loop + loop = sdfg.start_block + assert isinstance(loop, LoopRegion) + iter_var = symbolic.pystr_to_symbolic(loop.loop_variable) for state in sdfg.states(): if len(state.nodes()) > 1: