Skip to content

Commit 46a1ba7

Browse files
adurangmjklemm
authored andcommitted
[OFFLOAD] Remove weak from __kmpc_* calls and gather them in one header (llvm#164613)
Follow-up from llvm#162652 --------- Co-authored-by: Michael Klemm <[email protected]>
1 parent 4558e6e commit 46a1ba7

File tree

5 files changed

+18
-38
lines changed

5 files changed

+18
-38
lines changed

offload/include/OffloadPolicy.h

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -22,8 +22,6 @@ enum kmp_target_offload_kind_t {
2222
tgt_mandatory = 2
2323
};
2424

25-
extern "C" int __kmpc_get_target_offload(void) __attribute__((weak));
26-
2725
class OffloadPolicy {
2826

2927
OffloadPolicy(PluginManager &PM) {

offload/include/OpenMP/InternalTypes.h

Lines changed: 17 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -70,10 +70,23 @@ typedef struct kmp_task {
7070
int32_t part_id;
7171
} kmp_task_t;
7272

73-
int32_t __kmpc_global_thread_num(void *) __attribute__((weak));
74-
bool __kmpc_omp_has_task_team(int32_t gtid) __attribute__((weak));
75-
void **__kmpc_omp_get_target_async_handle_ptr(int32_t gtid)
76-
__attribute__((weak));
73+
// Implemented in libomp, they are called from within __tgt_* functions.
74+
int32_t __kmpc_global_thread_num(void *);
75+
bool __kmpc_omp_has_task_team(int32_t gtid);
76+
void **__kmpc_omp_get_target_async_handle_ptr(int32_t gtid);
77+
int __kmpc_get_target_offload(void);
78+
kmp_task_t *
79+
__kmpc_omp_target_task_alloc(ident_t *loc_ref, int32_t gtid, int32_t flags,
80+
size_t sizeof_kmp_task_t, size_t sizeof_shareds,
81+
kmp_routine_entry_t task_entry, int64_t device_id);
82+
int32_t __kmpc_omp_task_with_deps(ident_t *loc_ref, int32_t gtid,
83+
kmp_task_t *new_task, int32_t ndeps,
84+
kmp_depend_info_t *dep_list,
85+
int32_t ndeps_noalias,
86+
kmp_depend_info_t *noalias_dep_list);
87+
void __kmpc_omp_wait_deps(ident_t *loc_ref, int32_t gtid, int32_t ndeps,
88+
kmp_depend_info_t *dep_list, int32_t ndeps_noalias,
89+
kmp_depend_info_t *noalias_dep_list);
7790

7891
/**
7992
* The argument set that is passed from asynchronous memory copy to block

offload/include/OpenMP/omp.h

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -40,7 +40,7 @@ typedef void *omp_depend_t;
4040
/// API declarations
4141
///{
4242

43-
int omp_get_default_device(void) __attribute__((weak));
43+
int omp_get_default_device(void);
4444

4545
///}
4646

offload/libomptarget/OpenMP/API.cpp

Lines changed: 0 additions & 23 deletions
Original file line numberDiff line numberDiff line change
@@ -48,29 +48,6 @@ void *targetLockExplicit(void *HostPtr, size_t Size, int DeviceNum,
4848
const char *Name);
4949
void targetUnlockExplicit(void *HostPtr, int DeviceNum, const char *Name);
5050

51-
// Implemented in libomp, they are called from within __tgt_* functions.
52-
extern "C" {
53-
int __kmpc_get_target_offload(void) __attribute__((weak));
54-
kmp_task_t *__kmpc_omp_task_alloc(ident_t *loc_ref, int32_t gtid, int32_t flags,
55-
size_t sizeof_kmp_task_t,
56-
size_t sizeof_shareds,
57-
kmp_routine_entry_t task_entry)
58-
__attribute__((weak));
59-
60-
kmp_task_t *
61-
__kmpc_omp_target_task_alloc(ident_t *loc_ref, int32_t gtid, int32_t flags,
62-
size_t sizeof_kmp_task_t, size_t sizeof_shareds,
63-
kmp_routine_entry_t task_entry, int64_t device_id)
64-
__attribute__((weak));
65-
66-
int32_t __kmpc_omp_task_with_deps(ident_t *loc_ref, int32_t gtid,
67-
kmp_task_t *new_task, int32_t ndeps,
68-
kmp_depend_info_t *dep_list,
69-
int32_t ndeps_noalias,
70-
kmp_depend_info_t *noalias_dep_list)
71-
__attribute__((weak));
72-
}
73-
7451
EXTERN int omp_get_num_devices(void) {
7552
TIMESCOPE();
7653
OMPT_IF_BUILT(ReturnAddressSetterRAII RA(__builtin_return_address(0)));

offload/libomptarget/OpenMP/InteropAPI.cpp

Lines changed: 0 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -18,14 +18,6 @@
1818
#include <cstdlib>
1919
#include <cstring>
2020

21-
extern "C" {
22-
23-
void __kmpc_omp_wait_deps(ident_t *loc_ref, int32_t gtid, int32_t ndeps,
24-
kmp_depend_info_t *dep_list, int32_t ndeps_noalias,
25-
kmp_depend_info_t *noalias_dep_list);
26-
27-
} // extern "C"
28-
2921
namespace {
3022
omp_interop_rc_t getPropertyErrorType(omp_interop_property_t Property) {
3123
switch (Property) {

0 commit comments

Comments
 (0)