aomp
aomp copied to clipboard
accessing Fortran global variables in target subroutine
I am trying to locate a bug in my Fortran 90 code using OpenMP Offloading. I found that the issue seems to be related to the implementation in AOMP. When I try to access a global variable defined in a module, inside a subroutine which has been declared as omp declare target, it always return 0.
This global variable has been declared as omp declare target to, and has been updated from host to device. If I access it in the main kernel it returns the correct value. But accessing it in target subroutine gives the wrong one. The only way to access it is to pass it as a argument.
I wonder if it is a known bug in AOMP, or is there a workaround.
Please read issue https://github.com/ROCm-Developer-Tools/aomp/issues/576 about the status of flang in AOMP and ROCm. The current flang-legacy is not considered production for offloading (target offload) to GPUs.
Can you create a short reproducer for us to add to our testing in both current flang-legacy and future flang-new (llvm flang)?
This could be a problem with setting link and/or visibility attributes.