fix[next-dace]: return no successors for terminal blocks in find_successor_state - #2813
Open
edopao wants to merge 2 commits into
Open
fix[next-dace]: return no successors for terminal blocks in find_successor_state#2813edopao wants to merge 2 commits into
edopao wants to merge 2 commits into
Conversation
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Problem
find_successor_state(ingt4py.next.program_processors.runners.dace.transformations.utils) walks the outgoing region edges of a control-flow state, ascending into parent regions when a block has no successors locally. If the queried block and all its enclosing regions are terminal, the walk reached the SDFG root region and then recursed with the root region itself asstate, sograph = state.parent_graphwasNoneand the subsequentgraph.nodes()call raisedAttributeError: 'NoneType' object has no attribute 'nodes'.This was hit via
MultiStateGlobalSelfCopyElimination, which callsfind_successor_stateon transient-defining states (e.g. from OIR programs whose defining state is a terminal top-level block or inside a terminalLoopRegion).Fix
Treat the root region as the termination point of the walk: the no-successors early-return condition in the inner
_imploffind_successor_statenow also triggers whengraph.parent_graph is None(i.e.graphis the SDFG root region), returning an empty successor list instead of recursing intoNone.Tests
New file
tests/next_tests/unit_tests/program_processor_tests/runners_tests/dace_tests/transformation_tests/test_utils.pywith two regression tests:test_find_successor_state: a terminal top-level state returns[](previously crashed withAttributeError), a non-terminal state returns its successor.test_find_successor_state_terminal_loop_region: the last state of aLoopRegionbody, where the loop itself is terminal at the top level, returns[]instead of crashing.