-
Notifications
You must be signed in to change notification settings - Fork 13
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
Pipeline-plan duplicate/remove transformation changing dependencies #462
Conversation
Documentation for this branch can be viewed at https://sites.ecmwf.int/docs/loki/462/index.html |
a9ad546
to
afb5750
Compare
Codecov ReportAttention: Patch coverage is
Additional details and impacted files@@ Coverage Diff @@
## main #462 +/- ##
==========================================
+ Coverage 93.35% 93.38% +0.03%
==========================================
Files 223 226 +3
Lines 41428 41906 +478
==========================================
+ Hits 38676 39136 +460
- Misses 2752 2770 +18
Flags with carried forward coverage won't be shown. Click here to find out more. ☔ View full report in Codecov by Sentry. |
@mlange05 and @reuterbal I would wait for some short feedback before I add more tests to improve code coverage |
afb5750
to
3415e92
Compare
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.
Many thanks for this, this is a very useful demonstration of this functionality!
Conceptually, there's a few gotchas and things that I would prefer to do differently, and I'll try to explain here:
-
Item creation should always go through the item_factory, and the introduced
clone
method shortcuts this. Instead, we should have aget_or_create_from_item
method or similar on the ItemFactory, to make sure any new items automatically land in the cache. -
You inject the dependency changes incurred from plan_data in the
dependencies
property. However, that property returns (and I would like to keep it that way) IR nodes that constitute the dependency, e.g.,CallStatement
,Import
, etc. So, we have two options: (a) inject (and remove) relevant IR nodes during planning to fake these dependencies or (b) inject the plan dependencies at a point where we are already working with items. I think (b) is a little easier and I have explored doing this viacreate_dependency_items
instead, which seems to work (more details below). -
The need for a recursive clone can be inferred from not specifying an IR to the clone method. For contained subroutines in ProgramUnit we are already doing this, and I would prefer to do the same for source files instead of introducing a new rebuild-method on scoped nodes.
-
We need to separate plan and trafo in the tests - both need to be able to apply the relevant sgraph topology changes independently, because we run either plan or trafo mode in practice. Getting both to work, i.e., trafo after plan, might be rather tricky but I also don't see a need for that at the moment.
Admittedly, half the observations above I only figured out when starting to play with this directly and trying to apply the relevant changes. So, I've decided not to bother you with too many inline comments that I kept editing and changing and I will instead file a PR on top of yours against your PR branch. I hope this doesn't come across as dismissive, but I've underestimated how fiddly this gets...
Ah, I forgot to delete the inline comments. Disregard them or at least don't action on them, yet :) |
That is perfectly fine for me and I wasn't expecting this PR to go in as it is but to serve as a first step/proof of concept. |
fc49d42
to
534e575
Compare
Multi-level call tree duplication/removal for a follow-up PR. |
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.
Thanks for mopping up the outstanding housekeeping tasks, @MichaelSt98!
I think this is ready for integration, more testing and expansion to multi-level graph changes etc. should happen in follow-up PRs.
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.
Agreed! Looks great now and next steps go into follow-ons. Many thanks to both! GTG
Proof-of-concept transformations
DuplicateKernel
andRemoveKernel
with both changing the dependencies for the scheduler.This builds on top of #453
DuplicateKernel
takes a kernel and creates a duplicated kernel with corresponding duplicated items and adds a call to this duplicated kernel.RemoveKernel
removes a kernel from the scheduler and also removes the call.