[Openmp-commits] [PATCH] D86039: [OpenMP][CUDA] Keep one kernel list per device, not globally.

Johannes Doerfert via Phabricator via Openmp-commits openmp-commits at lists.llvm.org
Sun Aug 16 09:04:20 PDT 2020


jdoerfert created this revision.
jdoerfert added reviewers: JonChesterfield, ye-luo, ABataev, grokos, tianshilei1992.
Herald added subscribers: guansong, bollu, yaxunl.
Herald added a project: OpenMP.
jdoerfert requested review of this revision.
Herald added a subscriber: sstefan1.

Repository:
  rG LLVM Github Monorepo

https://reviews.llvm.org/D86039

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
@@ -89,10 +89,6 @@
   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 @@
 
 // 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 @@
     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


-------------- next part --------------
A non-text attachment was scrubbed...
Name: D86039.285890.patch
Type: text/x-patch
Size: 1199 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/openmp-commits/attachments/20200816/91677407/attachment.bin>


More information about the Openmp-commits mailing list