Skip to content

Conversation

@philip-paul-mueller
Copy link
Contributor

@philip-paul-mueller philip-paul-mueller commented Oct 29, 2025

Especially older DaCe transformations have trouble handling non standard Memlets. i.e. they expect a particular assignment of Memlet.data and Memlet.subset, among them is Memlet propagation.
The recently introduced helper function canonicalize_memlet_trees() allows to transform the SDFG in such a way that it conforms to this format.
This PR introduces calls to this function at particular locations, mostly before Memlet propagation happens.

TODO:

  • Verify correctness in ICON4Py CI or verification mode
  • Verify performance stability.

# into the split transformation.
# TODO(phimuell): Implement a data cleaner.
dace_sdutils.canonicalize_memlet_trees(sdfg)
dace_propagation.propagate_memlets_sdfg(sdfg)
Copy link
Contributor

@edopao edopao Oct 29, 2025

Choose a reason for hiding this comment

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

Would it be useful to have 2 gt4py wrapper functions?

  • gt_propagate_memlet_sdfg() that also calls canonicalize_memlet_trees(sdfg)
  • gt_propagate_memlet_map() that also calls canonicalize_memlet_trees_for_scope(map_entry / map_exit)

Copy link
Contributor Author

@philip-paul-mueller philip-paul-mueller Oct 29, 2025

Choose a reason for hiding this comment

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

I am not fully sure, as we only call canonicalize_memlet_trees() (which seems to have a bug) to fix some other things and in the long run the only reason where it is called is in front of dace simplify or other (known) DaCe transformation.
So I am not sure if it makes sense in the long run.

However I agree that there should be a function that runs the thing for entry and exit but this should life in dace.
I will do a PR tomorrow.

Rather, made some botherline legal behaviour more explicit.
Also removed the reference to `dace_iterator`, which no longer exists from the `pyproject.toml` file.
Copy link
Contributor

@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.

LGTM

@philip-paul-mueller
Copy link
Contributor Author

Correctness can be seen here: C2SM/icon4py#928

@philip-paul-mueller
Copy link
Contributor Author

I am currently running a performance regression test, but it will take some time until it got through.

@philip-paul-mueller
Copy link
Contributor Author

Performance is okay, but we have an issue in the ICON4Py CI.
In the cscs/dace pipeline, we have an error, but the same test in cscs/default We have seen this in PR#2358 and it is probably a flaky test.

@philip-paul-mueller
Copy link
Contributor Author

bench_blueline_stencil_compute

@philip-paul-mueller philip-paul-mueller merged commit bb3b071 into GridTools:main Nov 3, 2025
23 checks passed
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