diff options
author | Kevin Sala <kevin.sala@bsc.es> | 2023-05-09 16:03:21 +0200 |
---|---|---|
committer | Kevin Sala <kevin.sala@bsc.es> | 2023-05-09 18:47:46 +0200 |
commit | aa326559c443382030c735db167645685da245a2 (patch) | |
tree | 9ddc5498b1fab8da61ac1690c0e14532dc0292b6 /openmp | |
parent | 0d6d8a853a6ea29b5f461a475a8f8eb7e7ba18e2 (diff) | |
download | llvm-aa326559c443382030c735db167645685da245a2.tar.gz |
[OpenMP][libomptarget] Init device when printing device info
This patch fixes the printing of device information. Devices are initialized
before printing its information. Fixes #61392
Differential Revision: https://reviews.llvm.org/D146081
Diffstat (limited to 'openmp')
-rw-r--r-- | openmp/libomptarget/src/interface.cpp | 6 |
1 files changed, 6 insertions, 0 deletions
diff --git a/openmp/libomptarget/src/interface.cpp b/openmp/libomptarget/src/interface.cpp index b155d09dcf8c..6f9c63ab941e 100644 --- a/openmp/libomptarget/src/interface.cpp +++ b/openmp/libomptarget/src/interface.cpp @@ -384,6 +384,12 @@ EXTERN void __tgt_set_info_flag(uint32_t NewInfoLevel) { } EXTERN int __tgt_print_device_info(int64_t DeviceId) { + // Make sure the device is ready. + if (!deviceIsReady(DeviceId)) { + DP("Device %" PRId64 " is not ready\n", DeviceId); + return OMP_TGT_FAIL; + } + return PM->Devices[DeviceId]->printDeviceInfo( PM->Devices[DeviceId]->RTLDeviceID); } |