diff options
author | Nawrin Sultana <nawrin.sultana@intel.com> | 2023-02-21 17:17:57 -0600 |
---|---|---|
committer | Nawrin Sultana <nawrin.sultana@intel.com> | 2023-02-22 12:02:02 -0600 |
commit | ae46cd72aa07f804ca6280a9bab04474a07c59f1 (patch) | |
tree | 74ce9b7596c4e8154119230fcb214562bf4f75f4 /openmp/runtime | |
parent | f5a656050a154e41c21ed60197ddd1811e36d14f (diff) | |
download | llvm-ae46cd72aa07f804ca6280a9bab04474a07c59f1.tar.gz |
[OpenMP] Target memory allocator fallback to default when no device available
Differential Revision: https://reviews.llvm.org/D144525
Diffstat (limited to 'openmp/runtime')
-rw-r--r-- | openmp/runtime/src/i18n/en_US.txt | 1 | ||||
-rw-r--r-- | openmp/runtime/src/kmp_alloc.cpp | 8 |
2 files changed, 7 insertions, 2 deletions
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) { |