[Openmp-dev] lone "omp target exit data" produces runtime error

Narayanaswamy, Ravi via Openmp-dev openmp-dev at lists.llvm.org
Wed Mar 3 14:22:28 PST 2021


We should add CheckDeviceAndCtors to  target_data_end_mapper so the device can configured.  There may be other  target constructs which follow this and they should work.  If the exit  data construct is  encounter 1st it should become a no-op.  At the least we should print a meaningful message.
Thanks
Ravi

From: Joel E. Denny <jdenny.ornl at gmail.com>
Sent: Wednesday, March 03, 2021 1:57 PM
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/52fb235f/attachment.html>


More information about the Openmp-dev mailing list