[Openmp-commits] [openmp] ae46cd7 - [OpenMP] Target memory allocator fallback to default when no device available
Nawrin Sultana via Openmp-commits
openmp-commits at lists.llvm.org
Wed Feb 22 10:03:41 PST 2023
Author: Nawrin Sultana
Date: 2023-02-22T12:02:02-06:00
New Revision: ae46cd72aa07f804ca6280a9bab04474a07c59f1
URL: https://github.com/llvm/llvm-project/commit/ae46cd72aa07f804ca6280a9bab04474a07c59f1
DIFF: https://github.com/llvm/llvm-project/commit/ae46cd72aa07f804ca6280a9bab04474a07c59f1.diff
LOG: [OpenMP] Target memory allocator fallback to default when no device available
Differential Revision: https://reviews.llvm.org/D144525
Added:
Modified:
openmp/runtime/src/i18n/en_US.txt
openmp/runtime/src/kmp_alloc.cpp
Removed:
################################################################################
diff --git a/openmp/runtime/src/i18n/en_US.txt b/openmp/runtime/src/i18n/en_US.txt
index fb7452b8bf06..228bcdb25a8e 100644
--- a/openmp/runtime/src/i18n/en_US.txt
+++ b/openmp/runtime/src/i18n/en_US.txt
@@ -479,6 +479,7 @@ AffHWSubsetAttrInvalid "KMP_HW_SUBSET ignored: %1$s: attribute value %2$s
AffHWSubsetAllFiltered "KMP_HW_SUBSET ignored: all hardware resources would be filtered, please reduce the filter."
AffHWSubsetAttrsNonHybrid "KMP_HW_SUBSET ignored: Too many attributes specified. This machine is not a hybrid architecutre."
AffHWSubsetIgnoringAttr "KMP_HW_SUBSET: ignoring %1$s attribute. This machine is not a hybrid architecutre."
+TargetMemNotAvailable "Target memory not available, will use default allocator."
# --------------------------------------------------------------------------------------------------
-*- HINTS -*-
diff --git a/openmp/runtime/src/kmp_alloc.cpp b/openmp/runtime/src/kmp_alloc.cpp
index bf1d0645856b..fb1b0eb5f0fe 100644
--- a/openmp/runtime/src/kmp_alloc.cpp
+++ b/openmp/runtime/src/kmp_alloc.cpp
@@ -1588,8 +1588,10 @@ void *__kmp_alloc(int gtid, size_t algn, size_t size,
ptr = kmp_target_alloc_shared(size, device);
else // allocator == llvm_omp_target_device_mem_alloc
ptr = kmp_target_alloc_device(size, device);
+ return ptr;
+ } else {
+ KMP_INFORM(TargetMemNotAvailable);
}
- return ptr;
}
if (allocator >= kmp_max_mem_alloc && KMP_IS_TARGET_MEM_SPACE(al->memspace)) {
@@ -1602,8 +1604,10 @@ void *__kmp_alloc(int gtid, size_t algn, size_t size,
ptr = kmp_target_alloc_shared(size, device);
else // al->memspace == llvm_omp_target_device_mem_space
ptr = kmp_target_alloc_device(size, device);
+ return ptr;
+ } else {
+ KMP_INFORM(TargetMemNotAvailable);
}
- return ptr;
}
if (__kmp_memkind_available) {
More information about the Openmp-commits
mailing list