[Openmp-commits] [openmp] [OpenMP][NFC] Replace unnecessary typedefs (PR #73815)

via Openmp-commits openmp-commits at lists.llvm.org
Wed Nov 29 08:37:26 PST 2023


llvmbot wrote:


<!--LLVM PR SUMMARY COMMENT-->

@llvm/pr-subscribers-openmp

Author: Johannes Doerfert (jdoerfert)

<details>
<summary>Changes</summary>



---
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
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));
 
 /**

``````````

</details>


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


More information about the Openmp-commits mailing list