[Openmp-commits] [PATCH] D146081: [OpenMP][libomptarget] Init device when printing device info

Kevin Sala via Phabricator via Openmp-commits openmp-commits at lists.llvm.org
Tue Mar 14 12:34:21 PDT 2023


kevinsala created this revision.
kevinsala added reviewers: jdoerfert, josemonsalve2, jhuber6, tianshilei1992.
kevinsala added a project: OpenMP.
Herald added subscribers: sunshaoce, guansong, yaxunl.
Herald added a project: All.
kevinsala requested review of this revision.
Herald added subscribers: openmp-commits, sstefan1.

Make sure the device is ready and initialized when printing the device information

Fixes #61392


Repository:
  rG LLVM Github Monorepo

https://reviews.llvm.org/D146081

Files:
  openmp/libomptarget/src/interface.cpp


Index: openmp/libomptarget/src/interface.cpp
===================================================================
--- openmp/libomptarget/src/interface.cpp
+++ openmp/libomptarget/src/interface.cpp
@@ -384,6 +384,12 @@
 }
 
 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);
 }


-------------- next part --------------
A non-text attachment was scrubbed...
Name: D146081.505219.patch
Type: text/x-patch
Size: 537 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/openmp-commits/attachments/20230314/bf37c098/attachment.bin>


More information about the Openmp-commits mailing list