summaryrefslogtreecommitdiff
path: root/openmp
diff options
context:
space:
mode:
authorKevin Sala <kevin.sala@bsc.es>2023-05-09 16:03:21 +0200
committerKevin Sala <kevin.sala@bsc.es>2023-05-09 18:47:46 +0200
commitaa326559c443382030c735db167645685da245a2 (patch)
tree9ddc5498b1fab8da61ac1690c0e14532dc0292b6 /openmp
parent0d6d8a853a6ea29b5f461a475a8f8eb7e7ba18e2 (diff)
downloadllvm-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.cpp6
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);
}