[Openmp-commits] [PATCH] D79255: [OpenMP] Fix an issue of wrong return type of DeviceRTLTy::getNumOfDevices

Shilei Tian via Phabricator via Openmp-commits openmp-commits at lists.llvm.org
Fri May 1 17:16:38 PDT 2020


tianshilei1992 created this revision.
Herald added subscribers: openmp-commits, guansong, yaxunl.
Herald added a reviewer: jdoerfert.
Herald added a project: OpenMP.

There is a typo in DeviceRTLTy::getNumOfDevices that the type of its return value is bool. It will lead to a problem of wrong device number returned from omp_get_num_devices.


Repository:
  rG LLVM Github Monorepo

https://reviews.llvm.org/D79255

Files:
  openmp/libomptarget/plugins/cuda/src/rtl.cpp


Index: openmp/libomptarget/plugins/cuda/src/rtl.cpp
===================================================================
--- openmp/libomptarget/plugins/cuda/src/rtl.cpp
+++ openmp/libomptarget/plugins/cuda/src/rtl.cpp
@@ -380,7 +380,7 @@
     return DeviceId >= 0 && DeviceId < NumberOfDevices;
   }
 
-  bool getNumOfDevices() const { return NumberOfDevices; }
+  int getNumOfDevices() const { return NumberOfDevices; }
 
   void setRequiresFlag(const int64_t Flags) { this->RequiresFlags = Flags; }
 


-------------- next part --------------
A non-text attachment was scrubbed...
Name: D79255.261515.patch
Type: text/x-patch
Size: 503 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/openmp-commits/attachments/20200502/12081413/attachment.bin>


More information about the Openmp-commits mailing list