(Closes #3367) statement next_accesses - #3560
Conversation
|
I've not implemented the tests for this yet - I'm not sure if there should be any specific order to the result (or whether that should matter). I'm wondering if it should be sorted by abs_position or not. I do think that for some blocks the way this has to be implemented at current will be prohibitively expensive, but the only solution to that will be a rewrite of the DUCs. However, for the LFRic halo exchange infrastructure that requires this code I'm hopeful its not too expensive. |
|
Looking at #3399, the way I implemented this for Assignments was to return a dictionary of In this PR I thought that distinguishing between them is not so relevant, the caller should be worrying about the result, and next/previous_accesses should always return just @arporter @sergisiso Do you agree? If so I'll modify |
Codecov Report✅ All modified and coverable lines are covered by tests. Additional details and impacted files@@ Coverage Diff @@
## master #3560 +/- ##
==========================================
Coverage 100.00% 100.00%
==========================================
Files 397 398 +1
Lines 55775 55944 +169
==========================================
+ Hits 55775 55944 +169 ☔ View full report in Codecov by Harness. 🚀 New features to boost your workflow:
|
|
It would be good to have a reminder/plan about how we are going to use this to do the HEx with the DUC. Does completing #3124 changes the need for these? For instance in the loop implementation you have Are this methods equivalent to: |
I don't remember to be honest, I think we need Kern to be a I could just do
Not quite, it should be similar, but with node equality rules that wouldn't quite work I think. It also doesn't return any accesses contained inside the Swapping Assignment to just return a singular list was easy and didn't cause any side effects anywhere that I can see (as it was done in preperation for this PR I believe) so I've made that change and will continue to implement tests, as I think they'll make it clearer. |
I'm a bit lost by this, could you show an example of an statement where it would have different results? |
If you just do |
… into 3367_statement_next_access
My worry is that next_accesses would return the ReadAfterRead without a way to differenciate them? In the Reference.next_accesses it is not a problem because we can do the is_read/is_write of both the location and target. But in a next_accesses of the statement we cannot do that.
Then maybe something like: |
I guess I don't remember if we have some way to check if a Statement has read/write access to a variable with reference_accesses anyway? I think thats sufficient to distinguish between WaR and RaR.
Because nodes aren't hashable this doesn't work, we can't put them in sets. |
|
Also calling ref.next_accesses() repeatedly is currently inefficient (until the DUC rewrite) as assignment.next_accesses() is more efficient where possible, and I can probably do a similar trick for some of loop's nodes later. |
|
Been a bit slow with this sorry, a first implementation is ready for a first look @sergisiso @arporter . I do (at some point during the review process) want to look at potentially improving the performance of the loop implementation, and maybe look at some of the DSL nodes implementations (may need some advice there), but a first review to see how it works would be better first I think. |
No description provided.