-
Notifications
You must be signed in to change notification settings - Fork 31
(#Towards 2302) intrinsic argument names #3150
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
|
I think we could also delete the IAttr class entirely and replace it with |
I quickly tried this and decided its worse because you can't pass named arguments to |
|
I've fixed the remaining problems with the test suite. I expect there will be some coverage changes I need to look at next, notably I expect there are now unreachable sections of fparser2.py that I can remove, but I will wait to see what pycov says and go from there in case there are other sections I either miss testing or that can now be removed. One option I leave up to the review is whether to add something to the backend to not output argument names, as we will now be very explicit and add argument names wherever possible (assuming an IntrinsicCall has been canonicalised). |
Codecov Report❌ Patch coverage is
Additional details and impacted files@@ Coverage Diff @@
## master #3150 +/- ##
==========================================
- Coverage 99.90% 99.89% -0.01%
==========================================
Files 376 376
Lines 53211 53360 +149
==========================================
+ Hits 53159 53305 +146
- Misses 52 55 +3 ☔ View full report in Codecov by Sentry. 🚀 New features to boost your workflow:
|
|
@arporter @sergisiso This is ready for a first look now. |
|
@arporter I think this is ready for another look. I left a couple of things not quite as you suggested as I thought i made the help text too complicated. This still needs integration test updates I think for NEMO - I think at the moment these will fail. @sergisiso is there an easy way for me to change the NEMO tests to use the new flag to disable intrinsic names arguments? |
Yes and no. For the ones that use psyclonefc yes. You just need to add the flags to the PSYCLONE_OPTS env var. For the ones that use the patched nemo no. But I would be in favour of moving them all to psyclonefc so that this is not a problem anymore. |
arporter
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.
Very nearly there. I just can't quite live with the current set of backend-related flags so am suggesting a change there - it's up for discussion. While that's rumbling in the background, we need to bite the bullet and update the integration tests so that they can be run for this PR. I think this means updating the PSyclone commands in examples/nemo/scripts/Makefile, .github/workflows/nemo_tests.yml and .github/workflows/nemo_v5_tests.yml. Unfortunately, the latter uses the native support in the NEMO buildsystem. As Sergi suggests, I think we'd be better off chaning those to use psyclonefc (see nemo_tests.yml for examples).
| Fortran backend control options.: | ||
| These settings control how PSyclone outputs Fortran. | ||
| --backend {disable-validation,disable-indentation} |
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 the only remaining sticking point. I'm not keen on having two different forms for backend options. Since we now have a nice group, we probably don't need the --backend option way of doing it. We could just have three different flags: --backend_disable_validation, --backend-disable-indentation and --backend-disable-named-intrinsic-args. This is wordy but consistent. We could shorten "backend" to "be" or "BE" perhaps? This is a change to the interface but not a big one and probably not one that affects many people. What do @LonelyCat124 @sergisiso and @hiker 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.
I have no problem in moving them to independent flags grouped in the help. But I prefer "backend" rather than the abbreviations. Also "disable-named-intrinsic-args" seems like we are disabling some intrinsics, I would call it "--backend-omit-unneeded-intrinsic-arg-names" (or something shorter if the intent is clear)
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.
Yeah I'm happy with those names, I'll fix those.
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
| one of the interfaces for the intrinsic (as some intrinsics have multiple | ||
| possible argument interfaces). If the canonicalisation is successful, PSyclone | ||
| will convert all of the arguments to be named arguments, and reorder arguments | ||
| to match the specification from the Fortran standard. If canonicalisation |
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.
and reorder arguments to match the specification from the Fortran standard.
I suppose this is a leftover?
If canonicalisation fails, then PSyclone will not ...
I think it would be more interesting to know what it will do, e.g. "PSyclone will produce and error" or "will create a CodeBlock"
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, clarified.
I haven't seen the clarification commit yet but I have been looking at the code and it seems we don't do re-ordering anymore. The frontend (through create) just tries to match the interface and give names, and produces a CodeBlock if it can't. The transformations should be using the If that's the case, maybe we don't need the flag? This seems a good output style (no names while they match the order, named afterwards or in case of doubt). It also prevents the NEMO sign issue. And I am not too keen on having output style knobs. What do you think @arporter @LonelyCat124 about making that the backend behaviour (no options needed). That said, NEMOv5 fails with a wrong arg-name that will need to be fixed: |
|
Also, I am not sure To be clear, I am not suggesting any implementation change, just renaming the method and associated comments. |
|
It does a bit more than naming arguments: it works out which version of an intrinsic is being called. Perhaps |
I debated this previously when i stopped reshaping, but I felt like we still end up with a canonicalised (standard w.r.t argument names, but not argument order) version of the IntrinsicCall so I didn't rename it. I can rename if you feel strongly about it though. Either way I probably need to check over the docstring and docs.
It only removes required argument names (as I think optional ones should be left in generally). |
|
My problem with
I will let you two decide about this. I don't think I care too much about the output style as far as is readable and reasonable. The previous backend options are to bypass issues. Going down to provide style options could make the backend much more complex and I am not sure this is the focus of psyclone. But if it is just this one it is not a big deal. |
|
Yeah I'm fine to change it then. I'll look at doing that after the bug fix. I'm also happy I think to change the default output and have an option to enable argument names separately. |
Could be closes, not sure, up to review.
Work in progress on doing this, remaining steps I have for this PR: