-
Notifications
You must be signed in to change notification settings - Fork 33
(Closes #3251) Implementation for the PSyDirective. #3255
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
base: master
Are you sure you want to change the base?
Conversation
Codecov Report✅ All modified and coverable lines are covered by tests. Additional details and impacted files@@ Coverage Diff @@
## master #3255 +/- ##
=======================================
Coverage 99.95% 99.95%
=======================================
Files 376 377 +1
Lines 53545 53580 +35
=======================================
+ Hits 53523 53558 +35
Misses 22 22 ☔ View full report in Codecov by Sentry. 🚀 New features to boost your workflow:
|
|
I still don't think we need psyclone ( |
|
We could do that instead, but it would mean more false positives when people are looking for something specific to their script, e.g. after I would maybe with ok with doing some |
Good points, what about [Unrecognised/Unsupported/Unknown]Directive (being sibling of Standalone/RegionDirective)? So it is clear that we don't support them and if we ever try to parse OpenMP, OpenACC into their own Directive the name will still make sense for those that we have not done yet. (my preferd is UnknownDirective, but I am unsure)
I don't understand this. It will be better than the current Codeblock, and it would allow searching for "ivdep" or other know compiler directive that may exist in the code.
Why excluding those? |
|
Yeah I agree with most of that, so I'll modify this PR towards that. My reasoning for ignoring omp/acc/etc. directives is party that keeping them as CodeBlocks means they'd keep any current properties that CodeBlocks have (i.e. disabling transformations etc.) and also make it clear that they're not meant to be used as part of any tree manipulation programming, but are just for keeping elements of the source code that PSyclone doesn't or can't support. |
|
@sergisiso this is ready for review, but no rush to do so. |
sergisiso
left a 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.
@LonelyCat124 I like how this is implemented now, and especially having an example to showcase it. There are just minor comments now.
| Directive representing PSyclone-specific directives in the tree. | ||
| :param directive_string: The content after the !$psy part of this | ||
| node in the tree. |
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.
param kwargs is missing
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 think thats just up to examining parent classes docs - I don't think I want to document kwargs here right? I think they just result in the base Node class keyword arguments here so are simply provided for internal use wherever the node is constructed if required.
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.
We typically have :param kwargs: additional keyword arguments provided to the PSyIR node., I will add it myself if there is nothing else.
|
@sergisiso This is probably ready for another look now |
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.
@LonelyCat124 Almost there. The Directive part is all good now, but the example Makefile does not recurse to the directories and doesn't test some files that previously were tested and the README needs updating.
| for loop in routine.walk(Loop): | ||
| if loop in loops_to_skip: | ||
| continue | ||
| OMPLoopTrans(omp_directive="paralleldo").apply(loop) |
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.
This should be indented in (otherwise it just parallelises the last routine)
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.
Fixed.
| @@ -0,0 +1,56 @@ | |||
| # ----------------------------------------------------------------------------- | |||
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.
Also change the name of this file to something more descriptive like: identify_custom_directives.py
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
| # ------------------------------------------------------------------------------ | ||
| # Authors: A. R. Porter and S. Siso, STFC Daresbury Laboratory | ||
|
|
||
| include ../common.mk |
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.
This is broken now (so make transform in this folder does not work)
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.
Also, two of the examples in this folder's README should not be here, and instead should be in a parent readme
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.
Fixed, and moved the README sections into their own examples readme's (not in the parent).
examples/psyir/Makefile
Outdated
|
|
||
| run: compile | ||
| @echo "No run targets for PSyIR creation examples" | ||
| EXAMPLES=custom_directives |
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.
You should also list the new create_and_modify_psyir as this was tested before (it was what this Makefile was doing). Also test the matmul and transpose directories (they both work fine for me)
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.
Fixed those and added them too.
|
And not your fault but the examples/psyir/matmul|transpose |
|
@sergisiso I think I added everything and the gitignore should ignore the .F90 files generated in those directories now. |
| # We don't turn OpenMP, OpenACC or directives we can't output | ||
| # correctly into Directive nodes. PSyclone currently always | ||
| # outputs directives starting with !$ | ||
| dont_match = ["!$omp", "!$acc", "!$ompx", "!dir$"] |
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.
@LonelyCat124 I was a bit on the fence on these and wanted to wait for a use case. With what we discussed today: add profiling hooks around openmp in existing directives maybe it sways my opinion that these should be UnknownDirective so they are easier to identify. What do you think?
The !dir$ (and other !xxx$ ?) should still be CodeBlocks.
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.
My main resoning for this is preventing them occurring in parallel loops. I could also add UnknownDirective into excluded_node_types in ParallelLoopTrans if you'd prefer, though this would block compiler directives appearing inside Parallel loops.
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 could also add UnknownDirective into excluded_node_types in ParallelLoopTrans if you'd prefer, though this would block compiler directives appearing inside Parallel loops.
I am ok with this.
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 still disallowing ompx extensions since we don't know at the moment what these might be and thus they're not useful to keep I think.
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.
@sergisiso This is done now.
Example and doc TODO
Basic implementation of PSyDirective including reading and writing.
At the moment I implemented it as a Standalone Directive (as it doesn't make sense to me to be a RegionDirective) but that could be more difficult to use in some ways, but I'll put together an example and see.