}
#endif
- int rc = target(loc, device_id, host_ptr, arg_num, args_base, args, arg_sizes,
+ DeviceTy &Device = PM->Devices[device_id];
+ int rc = target(loc, Device, host_ptr, arg_num, args_base, args, arg_sizes,
arg_types, arg_names, arg_mappers, 0, 0, false /*team*/);
HandleTargetOutcome(rc == OFFLOAD_SUCCESS, loc);
return rc;
}
#endif
- int rc = target(loc, device_id, host_ptr, arg_num, args_base, args, arg_sizes,
+ DeviceTy &Device = PM->Devices[device_id];
+ int rc = target(loc, Device, host_ptr, arg_num, args_base, args, arg_sizes,
arg_types, arg_names, arg_mappers, team_num, thread_limit,
true /*team*/);
HandleTargetOutcome(rc == OFFLOAD_SUCCESS, loc);
DP("Has pending ctors... call now\n");
for (auto &entry : lib.second.PendingCtors) {
void *ctor = entry;
- int rc =
- target(nullptr, device_id, ctor, 0, nullptr, nullptr, nullptr,
- nullptr, nullptr, nullptr, 1, 1, true /*team*/);
+ int rc = target(nullptr, Device, ctor, 0, nullptr, nullptr, nullptr,
+ nullptr, nullptr, nullptr, 1, 1, true /*team*/);
if (rc != OFFLOAD_SUCCESS) {
REPORT("Running ctor " DPxMOD " failed.\n", DPxPTR(ctor));
Device.PendingGlobalsMtx.unlock();
/// performs the same action as data_update and data_end above. This function
/// returns 0 if it was able to transfer the execution to a target and an
/// integer different from zero otherwise.
-int target(ident_t *loc, int64_t DeviceId, void *HostPtr, int32_t ArgNum,
+int target(ident_t *loc, DeviceTy &Device, void *HostPtr, int32_t ArgNum,
void **ArgBases, void **Args, int64_t *ArgSizes, int64_t *ArgTypes,
map_var_info_t *ArgNames, void **ArgMappers, int32_t TeamNum,
int32_t ThreadLimit, int IsTeamConstruct) {
- DeviceTy &Device = PM->Devices[DeviceId];
+ int32_t DeviceId = Device.DeviceID;
TableMap *TM = getTableMap(HostPtr);
// No map for this host pointer found!
#ifndef _OMPTARGET_PRIVATE_H
#define _OMPTARGET_PRIVATE_H
+#include "device.h"
#include <Debug.h>
#include <SourceInfo.h>
#include <omptarget.h>
void **arg_mappers,
__tgt_async_info *async_info_ptr = nullptr);
-extern int target(ident_t *loc, int64_t DeviceId, void *HostPtr, int32_t ArgNum,
+extern int target(ident_t *loc, DeviceTy &Device, void *HostPtr, int32_t ArgNum,
void **ArgBases, void **Args, int64_t *ArgSizes,
int64_t *ArgTypes, map_var_info_t *arg_names,
void **ArgMappers, int32_t TeamNum, int32_t ThreadLimit,
Device.PendingGlobalsMtx.lock();
if (Device.PendingCtorsDtors[desc].PendingCtors.empty()) {
for (auto &dtor : Device.PendingCtorsDtors[desc].PendingDtors) {
- int rc =
- target(nullptr, Device.DeviceID, dtor, 0, nullptr, nullptr,
- nullptr, nullptr, nullptr, nullptr, 1, 1, true /*team*/);
+ int rc = target(nullptr, Device, dtor, 0, nullptr, nullptr, nullptr,
+ nullptr, nullptr, nullptr, 1, 1, true /*team*/);
if (rc != OFFLOAD_SUCCESS) {
DP("Running destructor " DPxMOD " failed.\n", DPxPTR(dtor));
}