Skip to content

Commit 251808f

Browse files
committed
implement feedback
1 parent 9a98029 commit 251808f

File tree

3 files changed

+6
-2
lines changed

3 files changed

+6
-2
lines changed

offload/libomptarget/OpenMP/API.cpp

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -93,6 +93,10 @@ EXTERN int omp_get_device_num(void) {
9393
return HostDevice;
9494
}
9595

96+
static inline bool is_host_device_uid(const char *DeviceUid) {
97+
return strcmp(DeviceUid, GenericDeviceTy::getHostDeviceUid()) == 0;
98+
}
99+
96100
EXTERN int omp_get_device_from_uid(const char *DeviceUid) {
97101
TIMESCOPE();
98102
OMPT_IF_BUILT(ReturnAddressSetterRAII RA(__builtin_return_address(0)));
@@ -101,7 +105,7 @@ EXTERN int omp_get_device_from_uid(const char *DeviceUid) {
101105
DP("Call to omp_get_device_from_uid returning omp_invalid_device\n");
102106
return omp_invalid_device;
103107
}
104-
if (strcmp(DeviceUid, GenericDeviceTy::getHostDeviceUid()) == 0) {
108+
if (is_host_device_uid(DeviceUid)) {
105109
DP("Call to omp_get_device_from_uid returning host device number %d\n",
106110
omp_get_initial_device());
107111
return omp_get_initial_device();

openmp/device/include/DeviceTypes.h

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -21,6 +21,7 @@ template <typename T> using Constant = __gpu_constant T;
2121
template <typename T> using Local = __gpu_local T;
2222
template <typename T> using Global = __gpu_local T;
2323

24+
// See definition in OpenMP (omp.h.var/omp_lib.(F90|h).var)
2425
#define omp_invalid_device -2
2526

2627
enum omp_proc_bind_t {

openmp/runtime/src/kmp_ftn_entry.h

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1550,7 +1550,6 @@ int FTN_STDCALL FTN_GET_DEVICE_NUM(void) KMP_WEAK_ATTRIBUTE_EXTERNAL;
15501550
int FTN_STDCALL FTN_GET_DEVICE_NUM(void) {
15511551
return KMP_EXPAND_NAME(FTN_GET_INITIAL_DEVICE)();
15521552
}
1553-
15541553
const char *FTN_STDCALL FTN_GET_UID_FROM_DEVICE(int device_num)
15551554
KMP_WEAK_ATTRIBUTE_EXTERNAL;
15561555
const char *FTN_STDCALL FTN_GET_UID_FROM_DEVICE(int device_num) {

0 commit comments

Comments
 (0)