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

Conversation

jdoerfert
Copy link
Member

No description provided.

@jdoerfert jdoerfert added openmp openmp:libomptarget OpenMP offload runtime labels Nov 29, 2023
@jdoerfert jdoerfert requested a review from jhuber6 November 29, 2023 16:37
@llvmbot
Copy link
Member

llvmbot commented Nov 29, 2023

@llvm/pr-subscribers-openmp

Author: Johannes Doerfert (jdoerfert)

Changes

Full diff: https://github.com/llvm/llvm-project/pull/73815.diff

3 Files Affected:

  • (modified) openmp/libomptarget/include/OpenMP/InternalTypes.h (+1-3)
  • (modified) openmp/libomptarget/src/api.cpp (+4-4)
  • (modified) openmp/libomptarget/src/private.h (+15-18)
diff --git a/openmp/libomptarget/include/OpenMP/InternalTypes.h b/openmp/libomptarget/include/OpenMP/InternalTypes.h
index feb6db16ba591c2..861e382f964c7c9 100644
--- a/openmp/libomptarget/include/OpenMP/InternalTypes.h
+++ b/openmp/libomptarget/include/OpenMP/InternalTypes.h
@@ -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;
diff --git a/openmp/libomptarget/src/api.cpp b/openmp/libomptarget/src/api.cpp
index 7fc13cb698213b9..e02ca4ada7349cd 100644
--- a/openmp/libomptarget/src/api.cpp
+++ b/openmp/libomptarget/src/api.cpp
@@ -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;
 
@@ -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;
 
@@ -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;
 
diff --git a/openmp/libomptarget/src/private.h b/openmp/libomptarget/src/private.h
index 0730a1ea0fd4b44..2e1e495a544404d 100644
--- a/openmp/libomptarget/src/private.h
+++ b/openmp/libomptarget/src/private.h
@@ -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 */
@@ -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));
 
 /**

@jdoerfert jdoerfert merged commit fd2d0bf into llvm:main Nov 29, 2023
@jdoerfert jdoerfert deleted the offload_prep2 branch November 29, 2023 16:40
@jdoerfert jdoerfert restored the offload_prep2 branch November 29, 2023 23:24
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
openmp:libomptarget OpenMP offload runtime openmp
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants