Skip to content

Commit 5272d29

Browse files
committed
[OpenMP][CUDA] Keep one kernel list per device, not globally.
Reviewed By: JonChesterfield Differential Revision: https://reviews.llvm.org/D86039
1 parent aa27cfc commit 5272d29

File tree

1 file changed

+5
-4
lines changed
  • openmp/libomptarget/plugins/cuda/src

1 file changed

+5
-4
lines changed

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

Lines changed: 5 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -89,10 +89,6 @@ struct omptarget_device_environmentTy {
8989
int32_t debug_level;
9090
};
9191

92-
/// List that contains all the kernels.
93-
/// FIXME: we may need this to be per device and per library.
94-
std::list<KernelTy> KernelsList;
95-
9692
namespace {
9793
bool checkResult(CUresult Err, const char *ErrMsg) {
9894
if (Err == CUDA_SUCCESS)
@@ -121,7 +117,11 @@ int memcpyDtoD(const void *SrcPtr, void *DstPtr, int64_t Size,
121117

122118
// Structure contains per-device data
123119
struct DeviceDataTy {
120+
/// List that contains all the kernels.
121+
std::list<KernelTy> KernelsList;
122+
124123
std::list<FuncOrGblEntryTy> FuncGblEntries;
124+
125125
CUcontext Context = nullptr;
126126
// Device properties
127127
int ThreadsPerBlock = 0;
@@ -568,6 +568,7 @@ class DeviceRTLTy {
568568
const __tgt_offload_entry *HostBegin = Image->EntriesBegin;
569569
const __tgt_offload_entry *HostEnd = Image->EntriesEnd;
570570

571+
std::list<KernelTy> &KernelsList = DeviceData[DeviceId].KernelsList;
571572
for (const __tgt_offload_entry *E = HostBegin; E != HostEnd; ++E) {
572573
if (!E->addr) {
573574
// We return nullptr when something like this happens, the host should

0 commit comments

Comments
 (0)