[Openmp-commits] [openmp] r318790 - [Clang][OpenMP] New clang/libomptarget map interface: new function signatures, libomptarget-side
George Rokos via Openmp-commits
openmp-commits at lists.llvm.org
Tue Nov 21 10:26:41 PST 2017
Author: grokos
Date: Tue Nov 21 10:26:41 2017
New Revision: 318790
URL: http://llvm.org/viewvc/llvm-project?rev=318790&view=rev
Log:
[Clang][OpenMP] New clang/libomptarget map interface: new function signatures, libomptarget-side
This is the libomptarget-side patch which changes the __tgt_* API function signatures in preparation for the new map interface.
Changes are: Device IDs 32bits --> 64bits, Flags 32bits --> 64bits
Differential revision: https://reviews.llvm.org/D40313
Modified:
openmp/trunk/libomptarget/src/omptarget.cpp
openmp/trunk/libomptarget/src/omptarget.h
Modified: openmp/trunk/libomptarget/src/omptarget.cpp
URL: http://llvm.org/viewvc/llvm-project/openmp/trunk/libomptarget/src/omptarget.cpp?rev=318790&r1=318789&r2=318790&view=diff
==============================================================================
--- openmp/trunk/libomptarget/src/omptarget.cpp (original)
+++ openmp/trunk/libomptarget/src/omptarget.cpp Tue Nov 21 10:26:41 2017
@@ -52,7 +52,7 @@ static const char *RTLNames[] = {
// forward declarations
struct RTLInfoTy;
-static int target(int32_t device_id, void *host_ptr, int32_t arg_num,
+static int target(int64_t device_id, void *host_ptr, int32_t arg_num,
void **args_base, void **args, int64_t *arg_sizes, int64_t *arg_types,
int32_t team_num, int32_t thread_limit, int IsTeamConstruct);
@@ -1446,7 +1446,7 @@ struct combined_entry_t {
};
static void translate_map(int32_t arg_num, void **args_base, void **args,
- int64_t *arg_sizes, int32_t *arg_types, int32_t &new_arg_num,
+ int64_t *arg_sizes, int64_t *arg_types, int32_t &new_arg_num,
void **&new_args_base, void **&new_args, int64_t *&new_arg_sizes,
int64_t *&new_arg_types, bool is_target_construct) {
if (arg_num <= 0) {
@@ -1465,7 +1465,7 @@ static void translate_map(int32_t arg_nu
// old entry is member of member_of[old] cmb_entry
int *member_of = (int *) alloca(arg_num * sizeof(int));
// temporary storage for modifications of the original arg_types
- int32_t *mod_arg_types = (int32_t *) alloca(arg_num *sizeof(int32_t));
+ int64_t *mod_arg_types = (int64_t *) alloca(arg_num *sizeof(int64_t));
DP("Translating %d map entries\n", arg_num);
for (int i = 0; i < arg_num; ++i) {
@@ -1754,8 +1754,8 @@ static int target_data_begin(DeviceTy &D
return rc;
}
-EXTERN void __tgt_target_data_begin_nowait(int32_t device_id, int32_t arg_num,
- void **args_base, void **args, int64_t *arg_sizes, int32_t *arg_types,
+EXTERN void __tgt_target_data_begin_nowait(int64_t device_id, int32_t arg_num,
+ void **args_base, void **args, int64_t *arg_sizes, int64_t *arg_types,
int32_t depNum, void *depList, int32_t noAliasDepNum,
void *noAliasDepList) {
if (depNum + noAliasDepNum > 0)
@@ -1768,19 +1768,19 @@ EXTERN void __tgt_target_data_begin_nowa
/// creates host-to-target data mapping, stores it in the
/// libomptarget.so internal structure (an entry in a stack of data maps)
/// and passes the data to the device.
-EXTERN void __tgt_target_data_begin(int32_t device_id, int32_t arg_num,
- void **args_base, void **args, int64_t *arg_sizes, int32_t *arg_types) {
- DP("Entering data begin region for device %d with %d mappings\n", device_id,
+EXTERN void __tgt_target_data_begin(int64_t device_id, int32_t arg_num,
+ void **args_base, void **args, int64_t *arg_sizes, int64_t *arg_types) {
+ DP("Entering data begin region for device %ld with %d mappings\n", device_id,
arg_num);
// No devices available?
if (device_id == OFFLOAD_DEVICE_DEFAULT) {
device_id = omp_get_default_device();
- DP("Use default device id %d\n", device_id);
+ DP("Use default device id %ld\n", device_id);
}
if (CheckDevice(device_id) != OFFLOAD_SUCCESS) {
- DP("Failed to get device %d ready\n", device_id);
+ DP("Failed to get device %ld ready\n", device_id);
return;
}
@@ -1913,8 +1913,8 @@ static int target_data_end(DeviceTy &Dev
/// passes data from the target, releases target memory and destroys
/// the host-target mapping (top entry from the stack of data maps)
/// created by the last __tgt_target_data_begin.
-EXTERN void __tgt_target_data_end(int32_t device_id, int32_t arg_num,
- void **args_base, void **args, int64_t *arg_sizes, int32_t *arg_types) {
+EXTERN void __tgt_target_data_end(int64_t device_id, int32_t arg_num,
+ void **args_base, void **args, int64_t *arg_sizes, int64_t *arg_types) {
DP("Entering data end region with %d mappings\n", arg_num);
// No devices available?
@@ -1926,7 +1926,7 @@ EXTERN void __tgt_target_data_end(int32_
size_t Devices_size = Devices.size();
RTLsMtx.unlock();
if (Devices_size <= (size_t)device_id) {
- DP("Device ID %d does not have a matching RTL.\n", device_id);
+ DP("Device ID %ld does not have a matching RTL.\n", device_id);
return;
}
@@ -1954,8 +1954,8 @@ EXTERN void __tgt_target_data_end(int32_
new_arg_types, arg_num, args_base);
}
-EXTERN void __tgt_target_data_end_nowait(int32_t device_id, int32_t arg_num,
- void **args_base, void **args, int64_t *arg_sizes, int32_t *arg_types,
+EXTERN void __tgt_target_data_end_nowait(int64_t device_id, int32_t arg_num,
+ void **args_base, void **args, int64_t *arg_sizes, int64_t *arg_types,
int32_t depNum, void *depList, int32_t noAliasDepNum,
void *noAliasDepList) {
if (depNum + noAliasDepNum > 0)
@@ -1966,8 +1966,8 @@ EXTERN void __tgt_target_data_end_nowait
}
/// passes data to/from the target.
-EXTERN void __tgt_target_data_update(int32_t device_id, int32_t arg_num,
- void **args_base, void **args, int64_t *arg_sizes, int32_t *arg_types) {
+EXTERN void __tgt_target_data_update(int64_t device_id, int32_t arg_num,
+ void **args_base, void **args, int64_t *arg_sizes, int64_t *arg_types) {
DP("Entering data update with %d mappings\n", arg_num);
// No devices available?
@@ -1976,7 +1976,7 @@ EXTERN void __tgt_target_data_update(int
}
if (CheckDevice(device_id) != OFFLOAD_SUCCESS) {
- DP("Failed to get device %d ready\n", device_id);
+ DP("Failed to get device %ld ready\n", device_id);
return;
}
@@ -2044,8 +2044,8 @@ EXTERN void __tgt_target_data_update(int
}
EXTERN void __tgt_target_data_update_nowait(
- int32_t device_id, int32_t arg_num, void **args_base, void **args,
- int64_t *arg_sizes, int32_t *arg_types, int32_t depNum, void *depList,
+ int64_t device_id, int32_t arg_num, void **args_base, void **args,
+ int64_t *arg_sizes, int64_t *arg_types, int32_t depNum, void *depList,
int32_t noAliasDepNum, void *noAliasDepList) {
if (depNum + noAliasDepNum > 0)
__kmpc_omp_taskwait(NULL, 0);
@@ -2060,7 +2060,7 @@ EXTERN void __tgt_target_data_update_now
/// 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.
-static int target(int32_t device_id, void *host_ptr, int32_t arg_num,
+static int target(int64_t device_id, void *host_ptr, int32_t arg_num,
void **args_base, void **args, int64_t *arg_sizes, int64_t *arg_types,
int32_t team_num, int32_t thread_limit, int IsTeamConstruct) {
DeviceTy &Device = Devices[device_id];
@@ -2247,9 +2247,9 @@ static int target(int32_t device_id, voi
return rc;
}
-EXTERN int __tgt_target(int32_t device_id, void *host_ptr, int32_t arg_num,
- void **args_base, void **args, int64_t *arg_sizes, int32_t *arg_types) {
- DP("Entering target region with entry point " DPxMOD " and device Id %d\n",
+EXTERN int __tgt_target(int64_t device_id, void *host_ptr, int32_t arg_num,
+ void **args_base, void **args, int64_t *arg_sizes, int64_t *arg_types) {
+ DP("Entering target region with entry point " DPxMOD " and device Id %ld\n",
DPxPTR(host_ptr), device_id);
if (device_id == OFFLOAD_DEVICE_DEFAULT) {
@@ -2257,7 +2257,7 @@ EXTERN int __tgt_target(int32_t device_i
}
if (CheckDevice(device_id) != OFFLOAD_SUCCESS) {
- DP("Failed to get device %d ready\n", device_id);
+ DP("Failed to get device %ld ready\n", device_id);
return OFFLOAD_FAIL;
}
@@ -2282,9 +2282,9 @@ EXTERN int __tgt_target(int32_t device_i
return rc;
}
-EXTERN int __tgt_target_nowait(int32_t device_id, void *host_ptr,
+EXTERN int __tgt_target_nowait(int64_t device_id, void *host_ptr,
int32_t arg_num, void **args_base, void **args, int64_t *arg_sizes,
- int32_t *arg_types, int32_t depNum, void *depList, int32_t noAliasDepNum,
+ int64_t *arg_types, int32_t depNum, void *depList, int32_t noAliasDepNum,
void *noAliasDepList) {
if (depNum + noAliasDepNum > 0)
__kmpc_omp_taskwait(NULL, 0);
@@ -2293,10 +2293,10 @@ EXTERN int __tgt_target_nowait(int32_t d
arg_types);
}
-EXTERN int __tgt_target_teams(int32_t device_id, void *host_ptr,
+EXTERN int __tgt_target_teams(int64_t device_id, void *host_ptr,
int32_t arg_num, void **args_base, void **args, int64_t *arg_sizes,
- int32_t *arg_types, int32_t team_num, int32_t thread_limit) {
- DP("Entering target region with entry point " DPxMOD " and device Id %d\n",
+ int64_t *arg_types, int32_t team_num, int32_t thread_limit) {
+ DP("Entering target region with entry point " DPxMOD " and device Id %ld\n",
DPxPTR(host_ptr), device_id);
if (device_id == OFFLOAD_DEVICE_DEFAULT) {
@@ -2304,7 +2304,7 @@ EXTERN int __tgt_target_teams(int32_t de
}
if (CheckDevice(device_id) != OFFLOAD_SUCCESS) {
- DP("Failed to get device %d ready\n", device_id);
+ DP("Failed to get device %ld ready\n", device_id);
return OFFLOAD_FAIL;
}
@@ -2330,9 +2330,9 @@ EXTERN int __tgt_target_teams(int32_t de
return rc;
}
-EXTERN int __tgt_target_teams_nowait(int32_t device_id, void *host_ptr,
+EXTERN int __tgt_target_teams_nowait(int64_t device_id, void *host_ptr,
int32_t arg_num, void **args_base, void **args, int64_t *arg_sizes,
- int32_t *arg_types, int32_t team_num, int32_t thread_limit, int32_t depNum,
+ int64_t *arg_types, int32_t team_num, int32_t thread_limit, int32_t depNum,
void *depList, int32_t noAliasDepNum, void *noAliasDepList) {
if (depNum + noAliasDepNum > 0)
__kmpc_omp_taskwait(NULL, 0);
@@ -2343,18 +2343,18 @@ EXTERN int __tgt_target_teams_nowait(int
// The trip count mechanism will be revised - this scheme is not thread-safe.
-EXTERN void __kmpc_push_target_tripcount(int32_t device_id,
+EXTERN void __kmpc_push_target_tripcount(int64_t device_id,
uint64_t loop_tripcount) {
if (device_id == OFFLOAD_DEVICE_DEFAULT) {
device_id = omp_get_default_device();
}
if (CheckDevice(device_id) != OFFLOAD_SUCCESS) {
- DP("Failed to get device %d ready\n", device_id);
+ DP("Failed to get device %ld ready\n", device_id);
return;
}
- DP("__kmpc_push_target_tripcount(%d, %" PRIu64 ")\n", device_id,
+ DP("__kmpc_push_target_tripcount(%ld, %" PRIu64 ")\n", device_id,
loop_tripcount);
Devices[device_id].loopTripCnt = loop_tripcount;
}
Modified: openmp/trunk/libomptarget/src/omptarget.h
URL: http://llvm.org/viewvc/llvm-project/openmp/trunk/libomptarget/src/omptarget.h?rev=318790&r1=318789&r2=318790&view=diff
==============================================================================
--- openmp/trunk/libomptarget/src/omptarget.h (original)
+++ openmp/trunk/libomptarget/src/omptarget.h Tue Nov 21 10:26:41 2017
@@ -127,12 +127,12 @@ void __tgt_unregister_lib(__tgt_bin_desc
// creates the host to target data mapping, stores it in the
// libomptarget.so internal structure (an entry in a stack of data maps) and
// passes the data to the device;
-void __tgt_target_data_begin(int32_t device_id, int32_t arg_num,
+void __tgt_target_data_begin(int64_t device_id, int32_t arg_num,
void **args_base, void **args, int64_t *arg_sizes,
- int32_t *arg_types);
-void __tgt_target_data_begin_nowait(int32_t device_id, int32_t arg_num,
+ int64_t *arg_types);
+void __tgt_target_data_begin_nowait(int64_t device_id, int32_t arg_num,
void **args_base, void **args,
- int64_t *arg_sizes, int32_t *arg_types,
+ int64_t *arg_sizes, int64_t *arg_types,
int32_t depNum, void *depList,
int32_t noAliasDepNum,
void *noAliasDepList);
@@ -140,21 +140,21 @@ void __tgt_target_data_begin_nowait(int3
// passes data from the target, release target memory and destroys the
// host-target mapping (top entry from the stack of data maps) created by
// the last __tgt_target_data_begin
-void __tgt_target_data_end(int32_t device_id, int32_t arg_num, void **args_base,
- void **args, int64_t *arg_sizes, int32_t *arg_types);
-void __tgt_target_data_end_nowait(int32_t device_id, int32_t arg_num,
+void __tgt_target_data_end(int64_t device_id, int32_t arg_num, void **args_base,
+ void **args, int64_t *arg_sizes, int64_t *arg_types);
+void __tgt_target_data_end_nowait(int64_t device_id, int32_t arg_num,
void **args_base, void **args,
- int64_t *arg_sizes, int32_t *arg_types,
+ int64_t *arg_sizes, int64_t *arg_types,
int32_t depNum, void *depList,
int32_t noAliasDepNum, void *noAliasDepList);
/// passes data to/from the target
-void __tgt_target_data_update(int32_t device_id, int32_t arg_num,
+void __tgt_target_data_update(int64_t device_id, int32_t arg_num,
void **args_base, void **args, int64_t *arg_sizes,
- int32_t *arg_types);
-void __tgt_target_data_update_nowait(int32_t device_id, int32_t arg_num,
+ int64_t *arg_types);
+void __tgt_target_data_update_nowait(int64_t device_id, int32_t arg_num,
void **args_base, void **args,
- int64_t *arg_sizes, int32_t *arg_types,
+ int64_t *arg_sizes, int64_t *arg_types,
int32_t depNum, void *depList,
int32_t noAliasDepNum,
void *noAliasDepList);
@@ -165,25 +165,25 @@ void __tgt_target_data_update_nowait(int
// same action as data_end above. The following types are used; this
// function returns 0 if it was able to transfer the execution to a
// target and an int different from zero otherwise.
-int __tgt_target(int32_t device_id, void *host_ptr, int32_t arg_num,
+int __tgt_target(int64_t device_id, void *host_ptr, int32_t arg_num,
void **args_base, void **args, int64_t *arg_sizes,
- int32_t *arg_types);
-int __tgt_target_nowait(int32_t device_id, void *host_ptr, int32_t arg_num,
+ int64_t *arg_types);
+int __tgt_target_nowait(int64_t device_id, void *host_ptr, int32_t arg_num,
void **args_base, void **args, int64_t *arg_sizes,
- int32_t *arg_types, int32_t depNum, void *depList,
+ int64_t *arg_types, int32_t depNum, void *depList,
int32_t noAliasDepNum, void *noAliasDepList);
-int __tgt_target_teams(int32_t device_id, void *host_ptr, int32_t arg_num,
+int __tgt_target_teams(int64_t device_id, void *host_ptr, int32_t arg_num,
void **args_base, void **args, int64_t *arg_sizes,
- int32_t *arg_types, int32_t num_teams,
+ int64_t *arg_types, int32_t num_teams,
int32_t thread_limit);
-int __tgt_target_teams_nowait(int32_t device_id, void *host_ptr,
+int __tgt_target_teams_nowait(int64_t device_id, void *host_ptr,
int32_t arg_num, void **args_base, void **args,
- int64_t *arg_sizes, int32_t *arg_types,
+ int64_t *arg_sizes, int64_t *arg_types,
int32_t num_teams, int32_t thread_limit,
int32_t depNum, void *depList,
int32_t noAliasDepNum, void *noAliasDepList);
-void __kmpc_push_target_tripcount(int32_t device_id, uint64_t loop_tripcount);
+void __kmpc_push_target_tripcount(int64_t device_id, uint64_t loop_tripcount);
#ifdef __cplusplus
}
More information about the Openmp-commits
mailing list