Skip to content

Commit

Permalink
Fixes
Browse files Browse the repository at this point in the history
  • Loading branch information
phschaad committed Dec 23, 2024
1 parent e8b94b9 commit e657f2c
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 5 deletions.
4 changes: 2 additions & 2 deletions dace/frontend/fortran/fortran_parser.py
Original file line number Diff line number Diff line change
Expand Up @@ -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

Expand Down Expand Up @@ -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}")
Expand Down
8 changes: 5 additions & 3 deletions tests/fortran/array_test.py
Original file line number Diff line number Diff line change
Expand Up @@ -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


Expand Down Expand Up @@ -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:
Expand Down

0 comments on commit e657f2c

Please sign in to comment.