[Openmp-commits] [openmp] 5272d29 - [OpenMP][CUDA] Keep one kernel list per device, not globally.

Johannes Doerfert via Openmp-commits openmp-commits at lists.llvm.org
Sun Aug 16 12:40:41 PDT 2020


Author: Johannes Doerfert
Date: 2020-08-16T14:38:35-05:00
New Revision: 5272d29e2cb7c967c3016fa285f14edc7515d9bf

URL: https://github.com/llvm/llvm-project/commit/5272d29e2cb7c967c3016fa285f14edc7515d9bf
DIFF: https://github.com/llvm/llvm-project/commit/5272d29e2cb7c967c3016fa285f14edc7515d9bf.diff

LOG: [OpenMP][CUDA] Keep one kernel list per device, not globally.

Reviewed By: JonChesterfield

Differential Revision: https://reviews.llvm.org/D86039

Added: 
    

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

Removed: 
    


################################################################################
diff  --git a/openmp/libomptarget/plugins/cuda/src/rtl.cpp b/openmp/libomptarget/plugins/cuda/src/rtl.cpp
index 6921c781e27f..a0060dbb22b8 100644
--- a/openmp/libomptarget/plugins/cuda/src/rtl.cpp
+++ b/openmp/libomptarget/plugins/cuda/src/rtl.cpp
@@ -89,10 +89,6 @@ struct omptarget_device_environmentTy {
   int32_t debug_level;
 };
 
-/// List that contains all the kernels.
-/// FIXME: we may need this to be per device and per library.
-std::list<KernelTy> KernelsList;
-
 namespace {
 bool checkResult(CUresult Err, const char *ErrMsg) {
   if (Err == CUDA_SUCCESS)
@@ -121,7 +117,11 @@ int memcpyDtoD(const void *SrcPtr, void *DstPtr, int64_t Size,
 
 // Structure contains per-device data
 struct DeviceDataTy {
+  /// List that contains all the kernels.
+  std::list<KernelTy> KernelsList;
+
   std::list<FuncOrGblEntryTy> FuncGblEntries;
+
   CUcontext Context = nullptr;
   // Device properties
   int ThreadsPerBlock = 0;
@@ -568,6 +568,7 @@ class DeviceRTLTy {
     const __tgt_offload_entry *HostBegin = Image->EntriesBegin;
     const __tgt_offload_entry *HostEnd = Image->EntriesEnd;
 
+    std::list<KernelTy> &KernelsList = DeviceData[DeviceId].KernelsList;
     for (const __tgt_offload_entry *E = HostBegin; E != HostEnd; ++E) {
       if (!E->addr) {
         // We return nullptr when something like this happens, the host should


        


More information about the Openmp-commits mailing list