[Openmp-commits] [PATCH] D139376: [OpenMP] Let predefined allocator fallback to default instead of returning null
Nawrin Sultana via Phabricator via Openmp-commits
openmp-commits at lists.llvm.org
Mon Dec 5 16:01:43 PST 2022
Nawrin created this revision.
Nawrin added reviewers: tlwilmar, jlpeyton.
Nawrin added a project: OpenMP.
Herald added subscribers: guansong, yaxunl.
Herald added a project: All.
Nawrin requested review of this revision.
Herald added a reviewer: jdoerfert.
Herald added a subscriber: sstefan1.
Repository:
rG LLVM Github Monorepo
https://reviews.llvm.org/D139376
Files:
openmp/runtime/src/kmp_alloc.cpp
Index: openmp/runtime/src/kmp_alloc.cpp
===================================================================
--- openmp/runtime/src/kmp_alloc.cpp
+++ openmp/runtime/src/kmp_alloc.cpp
@@ -1561,6 +1561,9 @@
desc.size_orig = size;
desc.size_a = size + sz_desc + align;
+ // Use default allocator if libmemkind is not available
+ int use_default_allocator = (__kmp_memkind_available) ? false : true;
+
if (__kmp_memkind_available) {
if (allocator < kmp_max_mem_alloc) {
// pre-defined allocator
@@ -1639,11 +1642,26 @@
// pre-defined allocator
if (allocator == omp_high_bw_mem_alloc) {
- // ptr = NULL;
+ KMP_WARNING(OmpNoAllocator, "omp_high_bw_mem_alloc");
} else if (allocator == omp_large_cap_mem_alloc) {
- // warnings?
- } else {
+ KMP_WARNING(OmpNoAllocator, "omp_large_cap_mem_alloc");
+ } else if (allocator == omp_const_mem_alloc) {
+ KMP_WARNING(OmpNoAllocator, "omp_const_mem_alloc");
+ } else if (allocator == omp_low_lat_mem_alloc) {
+ KMP_WARNING(OmpNoAllocator, "omp_low_lat_mem_alloc");
+ } else if (allocator == omp_cgroup_mem_alloc) {
+ KMP_WARNING(OmpNoAllocator, "omp_cgroup_mem_alloc");
+ } else if (allocator == omp_pteam_mem_alloc) {
+ KMP_WARNING(OmpNoAllocator, "omp_pteam_mem_alloc");
+ } else if (allocator == omp_thread_mem_alloc) {
+ KMP_WARNING(OmpNoAllocator, "omp_thread_mem_alloc");
+ } else { // default allocator requested
+ ptr = __kmp_thread_malloc(__kmp_thread_from_gtid(gtid), desc.size_a);
+ use_default_allocator = false;
+ }
+ if (use_default_allocator) {
ptr = __kmp_thread_malloc(__kmp_thread_from_gtid(gtid), desc.size_a);
+ use_default_allocator = false;
}
} else if (KMP_IS_TARGET_MEM_SPACE(al->memspace)) {
if (__kmp_target_mem_available) {
-------------- next part --------------
A non-text attachment was scrubbed...
Name: D139376.480270.patch
Type: text/x-patch
Size: 1834 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/openmp-commits/attachments/20221206/b885074f/attachment.bin>
More information about the Openmp-commits
mailing list