-
Notifications
You must be signed in to change notification settings - Fork 29
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
Add nowait and required barriers to satisfy dependencies. #2551
Comments
Summary of today discussion (and the OpenACC version tracked in #1664): For OMP this means that
the Directive lowering will use the dataflow graph connection to look forward and put a wait before "A". Note that this needs to be conservatively, e.g:
The same logic can be applied for OpenACC to add wait/barriers, but in addition we need to look backwards to previous acc directive to chose the right queue-number to satisfy dependencies. For example:
Here the second "acc" has to look backwards the the previous "acc" and use queue 1 if there is a dependency to that directive body or a new queue number if there isn't or it finds a wait (restart all queues). The task depends implementation currently needs "depend" clauses as nodes (not strings generated at the end) because the parent's "OMPSingle" lowering needs to analyse them to insert the proper taskwait. Currently this can not use the foward dataflow check to add taskwaits because in this implementation we mark sections of arrays as dependencies. |
Whilst using the NEMO API on some UM source, it would be helpful to have an option to do a no wait for a OMP parrallel do loop transformation. Some of the UM source has existing OMP which means it maybe slightly more perfomant than psyclone generated clauses without it. |
Hi @MetBenjaminWent - at the moment this is focused on generating |
@arporter are you working on async support for OpenACC (as discussed in WP1 meeting this morning)? We should maybe have a discussion as this might overlap with that work. |
That's a good point @LonelyCat124. I've picked up #2664 which is adding support for the necessary clauses - so "mechanism" rather than "policy". Maybe we should have a walk through it and consider whether and how to generalise it. |
Thanks @LonelyCat124, understood. I'll add my comment context to the other ticket, is it definatly #2384 to support existing OpenMP (for CPU) directives for this, that looks like more ACC kernels? |
#2384 does mention ACC directives - but the thing preventing it is the same blockage - maybe the best would be a new issue that references 2384 so we're tracking that we need to solve it for OpenMP ideally as well - not sure if Sergi/Andy agree. |
We do now have beta support for retaining comments (but it's off by default for now). I don't know whether we currently distinguish directives from general comments though @JulienRemy ? I don't think we need a new issue - we have this one for adding support for asynch-related functionality and #2384 for handling existing directives (although it only proposes capturing them as CodeBlocks for now). |
Okay, I'll note on #2384 for now, thanks all. |
re Sergi's original comment: #2551 (comment) Our basic strategy likely will use the new next/previous_accesses functionality. When we lower an NB. I think if a target loop contains a call or codeblock then we have to disable nowait for that loop. For OpenACC i think its a bit different - there's also the "which queue does this go in" which can replace the need for some barriers - but then uses previous_access instead (and we need to keep track of queues) |
@arporter Directives should be possible to retain as |
Things to be careful of:
Control flow jumps, e.g.
Loops with break clauses - barriers are more complex
barriers inside if statements.
When adding a nowait look forward for dependency and add appropriate barrier if non-satisfiable.
Some similar requirements to #2499 in terms of dependency finding.
Some similar behaviours to OMPTaskwaitTrans.
The text was updated successfully, but these errors were encountered: