[Openmp-commits] [PATCH] D111673: [OpenMP] Add GOMP allocator functions

Nawrin Sultana via Phabricator via Openmp-commits openmp-commits at lists.llvm.org
Wed Oct 20 09:41:04 PDT 2021


This revision was automatically updated to reflect the committed changes.
Closed by commit rG99d1ce4a621a: [OpenMP] Add GOMP allocator functions (authored by Nawrin).

Repository:
  rG LLVM Github Monorepo

CHANGES SINCE LAST ACTION
  https://reviews.llvm.org/D111673/new/

https://reviews.llvm.org/D111673

Files:
  openmp/runtime/src/exports_so.txt
  openmp/runtime/src/kmp_ftn_os.h
  openmp/runtime/src/kmp_gsupport.cpp


Index: openmp/runtime/src/kmp_gsupport.cpp
===================================================================
--- openmp/runtime/src/kmp_gsupport.cpp
+++ openmp/runtime/src/kmp_gsupport.cpp
@@ -2456,6 +2456,26 @@
   }
 }
 
+// allocator construct
+void *KMP_EXPAND_NAME(KMP_API_NAME_GOMP_ALLOC)(size_t alignment, size_t size,
+                                               uintptr_t allocator) {
+  int gtid = __kmp_entry_gtid();
+  KA_TRACE(20, ("GOMP_alloc: T#%d\n", gtid));
+#if OMPT_SUPPORT && OMPT_OPTIONAL
+  OMPT_STORE_RETURN_ADDRESS(gtid);
+#endif
+  return __kmp_alloc(gtid, alignment, size, (omp_allocator_handle_t)allocator);
+}
+
+void KMP_EXPAND_NAME(KMP_API_NAME_GOMP_FREE)(void *ptr, uintptr_t allocator) {
+  int gtid = __kmp_entry_gtid();
+  KA_TRACE(20, ("GOMP_free: T#%d\n", gtid));
+#if OMPT_SUPPORT && OMPT_OPTIONAL
+  OMPT_STORE_RETURN_ADDRESS(gtid);
+#endif
+  return ___kmpc_free(gtid, ptr, (omp_allocator_handle_t)allocator);
+}
+
 /* The following sections of code create aliases for the GOMP_* functions, then
    create versioned symbols using the assembler directive .symver. This is only
    pertinent for ELF .so library. The KMP_VERSION_SYMBOL macro is defined in
@@ -2644,6 +2664,10 @@
 KMP_VERSION_SYMBOL(KMP_API_NAME_GOMP_SECTIONS2_START, 50, "GOMP_5.0");
 KMP_VERSION_SYMBOL(KMP_API_NAME_GOMP_WORKSHARE_TASK_REDUCTION_UNREGISTER, 50,
                    "GOMP_5.0");
+
+// GOMP_5.0.1 versioned symbols
+KMP_VERSION_SYMBOL(KMP_API_NAME_GOMP_ALLOC, 501, "GOMP_5.0.1");
+KMP_VERSION_SYMBOL(KMP_API_NAME_GOMP_FREE, 501, "GOMP_5.0.1");
 #endif // KMP_USE_VERSION_SYMBOLS
 
 #ifdef __cplusplus
Index: openmp/runtime/src/kmp_ftn_os.h
===================================================================
--- openmp/runtime/src/kmp_ftn_os.h
+++ openmp/runtime/src/kmp_ftn_os.h
@@ -712,5 +712,6 @@
 #define KMP_API_NAME_GOMP_SECTIONS2_START GOMP_sections2_start
 #define KMP_API_NAME_GOMP_WORKSHARE_TASK_REDUCTION_UNREGISTER                  \
   GOMP_workshare_task_reduction_unregister
-
+#define KMP_API_NAME_GOMP_ALLOC GOMP_alloc
+#define KMP_API_NAME_GOMP_FREE GOMP_free
 #endif /* KMP_FTN_OS_H */
Index: openmp/runtime/src/exports_so.txt
===================================================================
--- openmp/runtime/src/exports_so.txt
+++ openmp/runtime/src/exports_so.txt
@@ -122,5 +122,7 @@
 } GOMP_4.0;
 GOMP_5.0 {
 } GOMP_4.5;
+GOMP_5.0.1 {
+} GOMP_5.0;
 
 # end of file #


-------------- next part --------------
A non-text attachment was scrubbed...
Name: D111673.381000.patch
Type: text/x-patch
Size: 2419 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/openmp-commits/attachments/20211020/1b8bc05b/attachment.bin>


More information about the Openmp-commits mailing list