Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

feat[dace][next]: Updated Array Removal Transformations #1915

Conversation

philip-paul-mueller
Copy link
Contributor

@philip-paul-mueller philip-paul-mueller commented Mar 17, 2025

This PR updates how the redundant array removal transformations works.

First of all it updates the "self copy" transformation, i.e. where information is copied from global memory into global memory, either directly or indirectly.
Because of ADR-18 we know that we can simply remove such connections without doing an elaborated analysis.
There are two different transformations, that handles the case of a self copy in the same state (there is also one that handles them across multiple states):

  • SingleStateGlobalSelfCopyElimination: This transformation was there before. It essentially handles the pattern (G) -> (T) -> (G), i.e. the write is not direct but involves an intermediate. The transformation was updated to handle more cases.
  • SingleStateGlobalDirectSelfCopyElimination: This transformation was newly added, it essentially handles the following pattern (G) -> (G), i.e. there is no temporary data involved.

In the long run these two transformation should be combined.

In addition the CopyChainRemover was updated.
Before it was required that the whole array, that should be removed, henceforth called A1, was read, however, in some cases this could not be checked symbolically.
To handle these cases, a new heuristic was implemented, which assumes a certain behavior of the domain interference, i.e. that all arrays are as small as possible, i.e. nothing that is not needed is computed.

Which handles a special case of the self copy elimination transformation, that should actually be merged with this one.
The function can now handle more complicated situations, especially if there are multiple paths between the two `G` nodes, i.e. either connected directly or through the temporary node.
@philip-paul-mueller philip-paul-mueller changed the title feat[dace][next]: Better Self Copy Removal Transformation feat[dace][next]: Updated Array Removal Transformations Mar 18, 2025
@philip-paul-mueller philip-paul-mueller marked this pull request as draft March 18, 2025 06:07
It is no longer needed that the whole array is read.
There is no a new heuristic allows to detect some chases where it is also possible.
It adds a new mode to the direct remover, which fully splits the two nodes.
philip-paul-mueller added a commit to philip-paul-mueller/gt4py that referenced this pull request Mar 19, 2025
This [issue](spcl/dace#1959) leaded to some problem, especially in ICON4Py stencil `39_to_40`.
However, through an [update](GridTools#1915) in GT4Py this leads to now to other problems (`ConstantPropagation` involving AcccessNodes) in `19_to_20`.
The underlying issue in DaCe was solved in [PR#1980](spcl/dace#1980) and this PR now deactivate the workaround.

Only merge if the DaCe dependency in GT4Py was updated to include that fix.
@philip-paul-mueller philip-paul-mueller marked this pull request as ready for review March 19, 2025 14:33
@philip-paul-mueller
Copy link
Contributor Author

@edopao Can we merge this PR?

@philip-paul-mueller philip-paul-mueller merged commit 5082050 into GridTools:main Mar 20, 2025
28 checks passed
philip-paul-mueller added a commit that referenced this pull request Mar 24, 2025
This [issue](spcl/dace#1959) leaded to some
problem, especially in ICON4Py stencil `39_to_40`. However, through an
[update](#1915) in GT4Py this
leads to now to other problems (`ConstantPropagation` involving
AcccessNodes) in `19_to_20`. The underlying issue in DaCe was solved in
[PR#1980](spcl/dace#1980) and this PR now
deactivate the workaround.

It also updates the version of DaCe.
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.

None yet

2 participants