Skip to content

Commit aa32655

Browse files
committed
[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
1 parent 0d6d8a8 commit aa32655

File tree

1 file changed

+6
-0
lines changed

1 file changed

+6
-0
lines changed

openmp/libomptarget/src/interface.cpp

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -384,6 +384,12 @@ EXTERN void __tgt_set_info_flag(uint32_t NewInfoLevel) {
384384
}
385385

386386
EXTERN int __tgt_print_device_info(int64_t DeviceId) {
387+
// Make sure the device is ready.
388+
if (!deviceIsReady(DeviceId)) {
389+
DP("Device %" PRId64 " is not ready\n", DeviceId);
390+
return OMP_TGT_FAIL;
391+
}
392+
387393
return PM->Devices[DeviceId]->printDeviceInfo(
388394
PM->Devices[DeviceId]->RTLDeviceID);
389395
}

0 commit comments

Comments
 (0)