Skip to content

[OpenMP][NFC] Replace unnecessary typedefs #73815

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 1 commit into from
Nov 29, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 1 addition & 3 deletions openmp/libomptarget/include/OpenMP/InternalTypes.h
Original file line number Diff line number Diff line change
Expand Up @@ -16,13 +16,11 @@
#include <cstddef>
#include <cstdint>

typedef intptr_t kmp_intptr_t;

extern "C" {

// Compiler sends us this info:
typedef struct kmp_depend_info {
kmp_intptr_t base_addr;
intptr_t base_addr;
size_t len;
struct {
bool in : 1;
Expand Down
8 changes: 4 additions & 4 deletions openmp/libomptarget/src/api.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -212,7 +212,7 @@ EXTERN int omp_target_memcpy(void *Dst, const void *Src, size_t Length,
}

// The helper function that calls omp_target_memcpy or omp_target_memcpy_rect
static int libomp_target_memcpy_async_task(kmp_int32 Gtid, kmp_task_t *Task) {
static int libomp_target_memcpy_async_task(int32_t Gtid, kmp_task_t *Task) {
if (Task == nullptr)
return OFFLOAD_FAIL;

Expand Down Expand Up @@ -243,7 +243,7 @@ static int libomp_target_memcpy_async_task(kmp_int32 Gtid, kmp_task_t *Task) {
return Rc;
}

static int libomp_target_memset_async_task(kmp_int32 Gtid, kmp_task_t *Task) {
static int libomp_target_memset_async_task(int32_t Gtid, kmp_task_t *Task) {
if (!Task)
return OFFLOAD_FAIL;

Expand All @@ -270,13 +270,13 @@ convertDepObjVector(llvm::SmallVector<kmp_depend_info_t> &Vec, int DepObjCount,

template <class T>
static inline int
libomp_helper_task_creation(T *Args, int (*Fn)(kmp_int32, kmp_task_t *),
libomp_helper_task_creation(T *Args, int (*Fn)(int32_t, kmp_task_t *),
int DepObjCount, omp_depend_t *DepObjList) {
// Create global thread ID
int Gtid = __kmpc_global_thread_num(nullptr);

// Setup the hidden helper flags
kmp_int32 Flags = 0;
int32_t Flags = 0;
kmp_tasking_flags_t *InputFlags = (kmp_tasking_flags_t *)&Flags;
InputFlags->hidden_helper = 1;

Expand Down
33 changes: 15 additions & 18 deletions openmp/libomptarget/src/private.h
Original file line number Diff line number Diff line change
Expand Up @@ -110,16 +110,13 @@ extern "C" {
* The struct is identical to the one in the kmp.h file.
* We maintain the same data structure for compatibility.
*/
typedef int kmp_int32;
typedef int64_t kmp_int64;

typedef void *omp_depend_t;
struct kmp_task;
typedef kmp_int32 (*kmp_routine_entry_t)(kmp_int32, struct kmp_task *);
typedef int32_t (*kmp_routine_entry_t)(int32_t, struct kmp_task *);
typedef struct kmp_task {
void *shareds;
kmp_routine_entry_t routine;
kmp_int32 part_id;
int32_t part_id;
} kmp_task_t;

typedef struct kmp_tasking_flags { /* Total struct must be exactly 32 bits */
Expand Down Expand Up @@ -157,26 +154,26 @@ typedef struct kmp_tasking_flags { /* Total struct must be exactly 32 bits */

int32_t __kmpc_global_thread_num(void *) __attribute__((weak));
int __kmpc_get_target_offload(void) __attribute__((weak));
void **__kmpc_omp_get_target_async_handle_ptr(kmp_int32 gtid)
void **__kmpc_omp_get_target_async_handle_ptr(int32_t gtid)
__attribute__((weak));
bool __kmpc_omp_has_task_team(kmp_int32 gtid) __attribute__((weak));
kmp_task_t *__kmpc_omp_task_alloc(ident_t *loc_ref, kmp_int32 gtid,
kmp_int32 flags, size_t sizeof_kmp_task_t,
bool __kmpc_omp_has_task_team(int32_t gtid) __attribute__((weak));
kmp_task_t *__kmpc_omp_task_alloc(ident_t *loc_ref, int32_t gtid, int32_t flags,
size_t sizeof_kmp_task_t,
size_t sizeof_shareds,
kmp_routine_entry_t task_entry)
__attribute__((weak));

kmp_task_t *
__kmpc_omp_target_task_alloc(ident_t *loc_ref, kmp_int32 gtid, kmp_int32 flags,
__kmpc_omp_target_task_alloc(ident_t *loc_ref, int32_t gtid, int32_t flags,
size_t sizeof_kmp_task_t, size_t sizeof_shareds,
kmp_routine_entry_t task_entry,
kmp_int64 device_id) __attribute__((weak));

kmp_int32 __kmpc_omp_task_with_deps(ident_t *loc_ref, kmp_int32 gtid,
kmp_task_t *new_task, kmp_int32 ndeps,
kmp_depend_info_t *dep_list,
kmp_int32 ndeps_noalias,
kmp_depend_info_t *noalias_dep_list)
kmp_routine_entry_t task_entry, int64_t device_id)
__attribute__((weak));

int32_t __kmpc_omp_task_with_deps(ident_t *loc_ref, int32_t gtid,
kmp_task_t *new_task, int32_t ndeps,
kmp_depend_info_t *dep_list,
int32_t ndeps_noalias,
kmp_depend_info_t *noalias_dep_list)
__attribute__((weak));

/**
Expand Down