Skip to content

Conversation

@edopao
Copy link
Contributor

@edopao edopao commented Dec 5, 2025

Change the visitor class so that we can generate unique labels for temporaries/maps/tasklets across all nested SDFG.

@edopao edopao changed the title fix[next[dace]: Better usage of SubgraphContext during SDFG lowering fix[next][dace]: Better usage of SubgraphContext during SDFG lowering Dec 5, 2025
@edopao edopao marked this pull request as ready for review December 5, 2025 16:25
Copy link
Contributor

@philip-paul-mueller philip-paul-mueller left a comment

Choose a reason for hiding this comment

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

An initial review, if you need clarification let me know.

data=target.dc_node.data, subset=target_subset, other_subset=source_subset
),
)
if ctx.state.degree(source.dc_node) == 0:
Copy link
Contributor

Choose a reason for hiding this comment

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

What is this node?
Was it created in the (eager) assumption that it is an inout node and it is not?
Because it is also a bit strange considering the creation of the edge before.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

This happens in case of a conditional expression, which ends with a join state containing only an access node to the result, while the dataflow is in the then-else branches.

Copy link
Contributor

Choose a reason for hiding this comment

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

For my curiosity, who/where/why was the node put into that state?

Copy link
Contributor Author

@edopao edopao Dec 19, 2025

Choose a reason for hiding this comment

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

The SDFG will look like this, at this stage, for a simple conditional expression:
image

The access node to gtir_tmp_4 (and the state) is added by gtir_to_sdfg_primitives.translate_if()

Copy link
Contributor Author

@edopao edopao left a comment

Choose a reason for hiding this comment

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

Thanks for the review comments!

data=target.dc_node.data, subset=target_subset, other_subset=source_subset
),
)
if ctx.state.degree(source.dc_node) == 0:
Copy link
Contributor Author

Choose a reason for hiding this comment

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

This happens in case of a conditional expression, which ends with a join state containing only an access node to the result, while the dataflow is in the then-else branches.

Copy link
Contributor

@philip-paul-mueller philip-paul-mueller left a comment

Choose a reason for hiding this comment

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

It looks okay, there are some parts I have a bit trouble understanding, especially the motivation behind it, but there should be nothing blocking.

data=target.dc_node.data, subset=target_subset, other_subset=source_subset
),
)
if ctx.state.degree(source.dc_node) == 0:
Copy link
Contributor

Choose a reason for hiding this comment

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

For my curiosity, who/where/why was the node put into that state?

@edopao
Copy link
Contributor Author

edopao commented Dec 23, 2025

Performance looks good:
bench_blueline_stencil_compute

We wait for the icon4py PR#896 to be merged, because we need to remove a write-write pattern which dace state fusion cannot handle (see spcl/dace#2256). This PR reveals the issue, because of non-deterministic code generation, by introducing a new name convention of transient arrays and map nodes.

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