-
Notifications
You must be signed in to change notification settings - Fork 51
feat[next][dace]: Filter unused connectivity tables #1502
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[next][dace]: Filter unused connectivity tables #1502
Conversation
This is mainly a cosmetic change, right? |
It might have some impact, indeed. If we reduce the number of arguments, we reduce the overhead of sorting and mapping the program arguments to the SDFG binary interface. Besides, we could test this simplified interface in the fused SDFG prototype and see if it solves the problem of closure propagation (for some reason, the connectivity tables are not automatically parsed by the dace frontend: one theory is that the dace frontend is expecting all tables with the current SDFG, while the diffusion modules is passing only the tables that are actually used by the stencil). |
Moreover, a simpler SDFG seems to trigger a different optimization strategy. The resulting SDFG is different for some stencils. |
Interesting, this should probably also be fixed in DaCe then? |
Adding @philip-paul-mueller and @kotsaloscv so they are aware of this discussion. My understanding is that the non-transient arrays allocated in the outermost SDFG are supposed to be program arguments. You can also see this in the other way: you define the program interface by allocating non-transient arrays in the outermost SDFG. Should DaCe then silently modify the program interface, in case some of the arguments are not used? This we can discuss with the DaCe team, but I see some risks for confusion there. What DaCe does already is to remove data dependencies between a nested SDFG and its parent. |
What do you mean by 'unnecessary data dependencies from program arguments' exactly? If it is the first one, then DaCe will never touch global memory, so it will by design (or rather convention) not remove them. If it is the second, then I have experienced the same issue in the past, when I looked at advenction stencil 13, i.e. def adv13(A, B):
A -= B
return A I can not read the names of the names of the access nodes, but the following assumes that the inputs, that have these intermediate transient, are also used as output. In my above example it is trivial to see that there is not issue, since everything is done pointwise, but I am sure that determining this in general is hard, thus DaCe play it safe by adding some transient (if you want I can give you some Since we porting ICON stencils, we knew from the get go that this will never happen. |
We were discussing here the first case you described, that the unused connectivity tables are not removed. |
Okay then the explanation is: They are global hence they are not removed. @edopao Some transformations have a |
I totally agree with you, @edopao. They should not be removed, because they are the interface. But unused parameters should not lead to different optimizations. That's the part that should be fixed, no? |
Maybe I used the word optimization inappropriately. I should have used transformations. Also, there is a DaCe bug which shows up in icon4py stencils and that prevents this PR from being merged: |
I thought about it a bit more and came to the conclusion that at least from DaCe's perspective they are "used", at least in a sense. @edopao could you post an example where the removal triggered a different optimization path? |
@philip-paul-mueller I forgot to answer you, the example of different transformation result is shown above, in my previous comment, without and with this PR. I agree with your comment. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I approve it, but please see my comment to to filter_neighbor_table()
.
During SDFG construction, only include the connectivity tables that are used by the stencil program. By convention, DaCe will not remove unnecessary data dependencies from program arguments.
Before this PR:

with this PR:
