[Openmp-dev] lone "omp target exit data" produces runtime error
Joel E. Denny via Openmp-dev
openmp-dev at lists.llvm.org
Wed Mar 3 14:26:53 PST 2021
Thanks, Ravi, Georgios. I'll work on that.
Joel
On Wed, Mar 3, 2021 at 5:22 PM Rokos, Georgios <georgios.rokos at intel.com>
wrote:
> Hi,
>
>
>
> You’re right, CheckDeviceAndCtors should be called from
> __tgt_target_data_end_mapper as well, just like any other __tgt_* function.
> The reason it’s currently missing is that it was assumed (as you said) that
> an orphan “target exit data” directive would make no sense, in other words
> the device would have been initialized by some other __tgt_* function
> already. However, since the example you provided seems to be a valid OpenMP
> program, then we should add code to initialize the device even in
> __tgt_target_data_end_mapper.
>
>
>
> George
>
>
>
> *From:* Joel E. Denny <jdenny.ornl at gmail.com>
> *Sent:* Wednesday, 3 March, 2021 23:57
> *To:* openmp-dev at lists.llvm.org
> *Cc:* Rokos, Georgios <georgios.rokos at intel.com>; Narayanaswamy, Ravi <
> ravi.narayanaswamy at intel.com>; Johannes Doerfert <
> johannesdoerfert at gmail.com>
> *Subject:* lone "omp target exit data" produces runtime error
>
>
>
> Hi,
>
>
>
> The following program produces an OpenMP runtime error.
> LIBOMPTARGET_DEBUG=1 reveals that the problem is that the device is
> uninitialized. Is this behavior specified by OpenMP?
>
>
>
> ```
>
> int main() {
>
> int x;
>
> #pragma omp target exit data map(from:x)
> return 0;
>
> }
>
> ```
>
>
>
> I'm not sure how it's useful to have an "omp target exit data" before any
> other offloading code. I've only run into this when writing toy test
> programs, and my solution has been to add an empty target region before
> it. Also, in the call today I mentioned I'd like to encapsulate more code
> into CheckDeviceAndCtors. It looks like __tgt_target_data_end_mapper
> could benefit from that encapsulation except it doesn't currently call
> CheckDeviceAndCtors. If it did call it, the above program would succeed.
>
>
>
> Thanks.
>
>
>
> Joel
>
>
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.llvm.org/pipermail/openmp-dev/attachments/20210303/0af12f4d/attachment.html>
More information about the Openmp-dev
mailing list