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
[openmp][flang] Add tests for map clause #70394
Conversation
This patch adds basic tests for map clause on target construct for commonblocks. There will be more tests to add, which will be added in future patches. Currently failing tests are added in a separate folder with XFAIL. They should be moved as they are fixed.
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.
LG
devices(1) = omp_get_device_num() | ||
!$omp target map(tofrom:devices) map(tofrom:var1) | ||
var1 = 20 | ||
devices(2) = omp_get_device_num() |
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.
awesome to see this working! :D admittedly have never tried it
Awesome work, it would be cool to have an example like the following eventually:
Which I believe is legal Fortran+OpenMP @mjklemm or @kiranchandramohan may be able to clarify completely. The above example doesn't appear to work upstream or downstream from what I can tell though, so likely something for a future PR where we add the features needed to run it. The proper syntax for the map (at least from looking at some examples) also doesn't seem to get accepted currently either, I think it should be possible to write:
With the"/" slashes, but the symbol unfortunately doesn't appear to be found currently when utilised like that. Someone with more Fortran and OpenMP knowledge might know better though, I am very unfamiliar with common blocks. But yes, things for the future. Otherwise this PR LGTM, nice 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.
Looks good 👍🏽
The correct spelling would be |
Thank you @mjklemm ! Weirdly the |
For threadprivate, that syntax is accepted.
|
Seems to work for declare target link (and probably to as well). Just seems to be map that I get the following error for:
When providing the correct syntax. |
I'm smelling a bug here. :-) |
Thanks for the reviews! I will add more cases, that seem to be working and failing. Should I file issues for failing cases or is it okay to just add them as failing testcases? |
Unfortunately not sure if there is a place for failing test cases in upstream llvm (someone else likely knows better than me though). However, opening issues may be the best way to track them and then downstream we also have: https://github.com/ROCm-Developer-Tools/aomp/tree/aomp-dev/test/smoke-fort-fails which you could place the test cases in for the interim (and perhaps add the opened issue number it correlates to). These tests are ran nightly from what I understand with both our downstream branch and upstream llvm, once they start passing, they can be moved to the pass folder + upstreamed (if they haven't been already). |
As a part of this patch, I have added two failing tests - |
Ah both these cases work downstream which is what I tested with then glossed over the xfail and failing directory, that's my bad. I'd lean towards open up issues on things and point towards the file that's failing when it's added as a test to the failing directory (and perhaps add the issue number or link as a comment to the failing test, so people can close the issue once it's fixed, i.e. when they see the test fail locally after making changes that fix it and move the test). Although, for both of these failing cases I'm not sure it's worth generating an issue, the second with implicit capture should work after @TIFitis IsolatedFromAbove patch series and the first should work with the changes added in the array sectioning patch! However, feel free to open up an issue on them if you wish! |
Okay, I will open the issues and assign them to @TIFitis and you to keep track of it. Thanks for the details. |
print *, "devices: ", devices | ||
end subroutine check_device | ||
|
||
!CHECK: devices: 1 0 |
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.
FWIW, this will sooner or later blow up. You assume there is only one GPU. I'd recommend to do something like:
print omp_get_num_devices()
!CHECK: [[ND:[0-9]*]]
print omp_get_default_device()
!CHECK: [[DD:[0-9]*]]
!CHECK: devices: [[ND]] [[DD]]
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 pointing this out.
If possible, I'd like to do something like this, and make sure this runs only if there is a device. Is it possible to do this with LIT directives to ensure this test runs when there is atleast one device, and doesn't run (unsupported) otherwise?
print omp_get_num_devices()
!CHECK: [[ND:[1-9]*]]
This patch adds basic tests for map clause on target construct for commonblocks. There will be more tests to add, which will be added in future patches. Currently failing tests are added in a separate folder with XFAIL. They should be moved as they are fixed.