[Openmp-commits] [openmp] 99d1ce4 - [OpenMP] Add GOMP allocator functions
Nawrin Sultana via Openmp-commits
openmp-commits at lists.llvm.org
Wed Oct 20 09:40:49 PDT 2021
Author: Nawrin Sultana
Date: 2021-10-20T11:37:29-05:00
New Revision: 99d1ce4a621aff2871f64c856545545f112051dc
URL: https://github.com/llvm/llvm-project/commit/99d1ce4a621aff2871f64c856545545f112051dc
DIFF: https://github.com/llvm/llvm-project/commit/99d1ce4a621aff2871f64c856545545f112051dc.diff
LOG: [OpenMP] Add GOMP allocator functions
This patch adds GOMP_alloc and GOMP_free functions of LIBGOMP.
Differential revision: https://reviews.llvm.org/D111673
Added:
Modified:
openmp/runtime/src/exports_so.txt
openmp/runtime/src/kmp_ftn_os.h
openmp/runtime/src/kmp_gsupport.cpp
Removed:
################################################################################
diff --git a/openmp/runtime/src/exports_so.txt b/openmp/runtime/src/exports_so.txt
index 8d8453d709d6f..e891b32740598 100644
--- a/openmp/runtime/src/exports_so.txt
+++ b/openmp/runtime/src/exports_so.txt
@@ -122,5 +122,7 @@ GOMP_4.5 {
} GOMP_4.0;
GOMP_5.0 {
} GOMP_4.5;
+GOMP_5.0.1 {
+} GOMP_5.0;
# end of file #
diff --git a/openmp/runtime/src/kmp_ftn_os.h b/openmp/runtime/src/kmp_ftn_os.h
index 5b9e396e3dd91..fc2bff595d7c2 100644
--- a/openmp/runtime/src/kmp_ftn_os.h
+++ b/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 */
diff --git a/openmp/runtime/src/kmp_gsupport.cpp b/openmp/runtime/src/kmp_gsupport.cpp
index d40022c04199f..d800a5184d008 100644
--- a/openmp/runtime/src/kmp_gsupport.cpp
+++ b/openmp/runtime/src/kmp_gsupport.cpp
@@ -2456,6 +2456,26 @@ void KMP_EXPAND_NAME(KMP_API_NAME_GOMP_WORKSHARE_TASK_REDUCTION_UNREGISTER)(
}
}
+// 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_LOOP_ULL_ORDERED_START, 50, "GOMP_5.0");
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
More information about the Openmp-commits
mailing list