Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
framecode: Fix missing SingleState argument (#1630)
Updated for v0.16: The (renamed) `BasicCFBlock` class still requires 4 arguments in a different order and with none being optional. The new `__init__` method as provided by `@dataclass` looks like this: ```python def __init__(self, dispatch_state: Callable[[SDFGState], str], # from ControlFlow parent: Optional['ControlFlow'], # from ControlFlow last_block: bool, # from ControlFlow state: SDFGState, ) ``` The current code still supplies 3 arguments and in a wrong order. This PR fixes that. Original PR description (when I was still running on DaCe v0.15.1) follows. --- With `optimizer.detect_control_flow == False`, this part of code causes an error later on: ```text File "/home/ibug/examples/dace/dace/codegen/control_flow.py", line 221, in as_cpp expr += elem.as_cpp(codegen, symbols) ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ File "/home/ibug/examples/dace/dace/codegen/control_flow.py", line 128, in as_cpp sdfg = self.state.parent ^^^^^^^^^^^^^^^^^ AttributeError: 'bool' object has no attribute 'parent' ``` I identified this as `cflow.SingleState` requiring 4 arguments to its `__init__` method with the last one being optional, i.e.: ```python def __init__(self, dispatch_state: Callable[[SDFGState], str], # from ControlFlow parent: Optional['ControlFlow'], # from ControlFlow state: SDFGState, last_state: bool = False, ) ``` The current code incorrectly feeds 3 and did not trigger a `TypeError` due to the last one having a default value. This PR adds back the missing `parent` argument, although I'm not sure if the `sdfg` object is correct. Local testing shows that `None` suffices, though.
- Loading branch information