Skip to content

Conversation

@philip-paul-mueller
Copy link
Contributor

@philip-paul-mueller philip-paul-mueller commented Jan 28, 2026

Refines the condition which determines what can be moved into the if body and what not.

TODO:

# `True` then this order is better. Solve that issue.
# TODO(phimuell): Because of the limitation that the transformation only works
# for dataflow that is directly enclosed by a Map, the order in which it is
# applied matters. Instead we have to run it into a topological order.
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
# applied matters. Instead we have to run it into a topological order.
# applied matters. Instead we should run it into a topological order.

that can be relocated, not yet filtered.
non_relocatable_dataflow: The connectors and their associated dataflow
that can not be relocated.
enclosing_map: The limiting node, i.e. the MapEntry of the Map `if_block`
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
enclosing_map: The limiting node, i.e. the MapEntry of the Map `if_block`
enclosing_map: The limiting node, i.e. the MapEntry of the Map where `if_block`

for oedge in state.out_edges(reloc_node)
if oedge.dst is not if_block
):
nodes_proposed_for_reloc.discard(reloc_node)
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Why discard() and not remove()? remove() is more strict because it also checks that it exists, right? and the node has to exists in nodes_proposed_for_reloc

return branch_nodes

else:
# Only some of the incoming nodes will be moved into the `if`
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The first part of the comment is misleading, in my opinion. I would write:

Suggested change
# Only some of the incoming nodes will be moved into the `if`
# Only some of the incoming nodes could be moved into the `if`


else:
# Only some of the incoming nodes will be moved into the `if`
# body. This is legal only if the not moved nodes are
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

and below:

Suggested change
# body. This is legal only if the not moved nodes are
# body. It would be legal to relocate the node if all incoming nodes were access nodes, this is why access nodes are not included in 'incoming_nodes'.
# In this case, we cannot relocate the node, so we discard also those 'incoming_nodes' that were candidates for relocation.

```
"""
# This test is temporarily disabled.
return
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I would use a skip annotation @pytest.mark.skip(reason="")

state.add_edge(a1, None, top_if_block, "__arg1", dace.Memlet("a1[0]"))
state.add_edge(b1, None, top_if_block, "__arg2", dace.Memlet("b1[0]"))
state.add_edge(c1, None, top_if_block, "__cond", dace.Memlet("c1[0]"))
state.add_edge(top_if_block, "__output", t1, None, dace.Memlet("t1[0]"))
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I tried this test but t1 is not defined.

@edopao edopao changed the title feat[dace-next]: Updated MoveDataflowIntoIfBody feat[next-dace]: Updated MoveDataflowIntoIfBody Jan 29, 2026
@philip-paul-mueller
Copy link
Contributor Author

No degradation is observed.
bench_blueline_stencil_compute

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants