-
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
(Closes #1664) Add ACCWaitDirective and async keyword on kernels, enter data, parallel #2664
base: master
Are you sure you want to change the base?
Conversation
Now that I look at this again, there don't seem to be any tests of the new directive and keyword for the Fortran psyir backend (it's all gen_code in LFRic). |
I see from #2070 (comment) that this PR was started before we had ACCClause (#2157). However, we do now have clauses and therefore this code needs updating (to remove the use of |
Codecov ReportAttention: Patch coverage is
Additional details and impacted files@@ Coverage Diff @@
## master #2664 +/- ##
==========================================
- Coverage 99.88% 99.88% -0.01%
==========================================
Files 359 360 +1
Lines 50681 50874 +193
==========================================
+ Hits 50625 50815 +190
- Misses 56 59 +3 ☔ View full report in Codecov by Sentry. |
|
I updated the async part in the previous push.
|
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.
@arporter @schreiberx I don't know who is the owner of this PR but I added my review. My main concern is that it adds PSyIR nodes in a private attribute of a mixin, and this has been a source of issues in the past as these are easy to forget when doing tree modifications. I think we should consider making it a ACCClause so all the tree functionality works as expected.
self.parallelism = parallelism | ||
assert self.parallelism in self.SUPPORTED_PARALLELISM |
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.
Remove, this is done in the setter above
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.
Done.
:param async_queue: Enable async support and attach it to the given queue. | ||
Can use False to disable, True to enable on default | ||
stream. Int to attach to the given stream ID or use a | ||
variable Signature to say at runtime what stream to be |
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.
The code does not use a Singature, but a Reference which is better, update the docstring.
We could also consider replacing it with a DataNode to accept operations as they are valid.
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.
Done and moved to DataNode. Updated appropriate test to check this works.
self, | ||
children: List[Node] = None, | ||
parent: Node = None, | ||
async_queue: Union[bool, int, Reference, None] = None |
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.
Could we do: Union[bool, int, Reference] = False
as I assume False and None have the same meaning?
Also everywhere else that has async_queue
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'm not sure they did but I've changed things now so that True
means an async
clause without an explicit queue while False
means no async
clause. I've removed the support for None
.
Tuple[ | ||
Set[Signature], Set[Signature] | ||
] |
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.
Being picky I slightly prefer would put this tree lines into one. But to make it more readable, but I can also be convinced not too (e.g. is what black choses)
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.
''' This module contains the mixins to apply some ACC features on many | ||
classes.''' |
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 am tempted to say that this should be in acc_directives.py, as I quite liked that everything regarding OpenACC was encapsulated there, but that file has reached the 1000 (although we will delete gen_code soon - hopefully), so can be convinced otherwise.
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'm fairly relaxed about having another file and as you say, the directives file is at 1.3K now. If we really care we could have an openacc submodule?
from psyclone.psyir.symbols import UnsupportedFortranType | ||
from psyclone.psyir.transformations.region_trans import RegionTrans | ||
from psyclone.psyir.transformations.transformation_error import ( | ||
TransformationError) | ||
|
||
from typing import Any, Dict, List, Union |
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.
pylint wants this before third party libs
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.
Done.
:param options: a dictionary with options for transformations. | ||
:type options: Optional[Dict[str, Any]] | ||
:param bool options["default_present"]: whether or not the kernels | ||
"default_present": boolean whether or not the kernels |
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.
Should this still be :param bool options["default_present"]:
as before?
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.
Yes it should. I've also put back the one for "async_queue".
:param options: a dictionary with options for transformations. | ||
:type options: Optional[Dict[str, Any]] | ||
:param bool options["disable_loop_check"]: whether to disable the | ||
"disable_loop_check": boolean whether to disable the |
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.
Same here and below, I am unsure which format is rendered more clearly in the docs.
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've reverted to our original form.
src/psyclone/transformations.py
Outdated
The available options are : | ||
- async_queue : Permit to force using the given async stream if | ||
not None. |
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.
Use common format for option arguments.
@@ -35,6 +35,7 @@ | |||
# A. B. G. Chalk, STFC Daresbury Lab | |||
# Modified I. Kavcic, Met Office | |||
# Modified J. Henrichs, Bureau of Meteorology | |||
# Modified S. Valat, INRIA / LJK |
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.
Maybe delete since at this point there isn't modifications at this specific file (but there is a couple of actually modified files in this PR where the contributors' names could be added).
This is a replacement/takeover of #2070 as Sebastien has moved to a new job.