[Openmp-commits] [PATCH] D144525: [OpenMP] Target memory allocator fallback to default when no device available

Nawrin Sultana via Phabricator via Openmp-commits openmp-commits at lists.llvm.org
Tue Feb 21 15:29:10 PST 2023


Nawrin created this revision.
Nawrin added reviewers: hbae, jlpeyton, tlwilmar.
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/D144525

Files:
  openmp/runtime/src/i18n/en_US.txt
  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
@@ -1588,8 +1588,10 @@
         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 @@
         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) {
Index: openmp/runtime/src/i18n/en_US.txt
===================================================================
--- openmp/runtime/src/i18n/en_US.txt
+++ openmp/runtime/src/i18n/en_US.txt
@@ -479,6 +479,7 @@
 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 -*-


-------------- next part --------------
A non-text attachment was scrubbed...
Name: D144525.499312.patch
Type: text/x-patch
Size: 1677 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/openmp-commits/attachments/20230221/2a72ef5b/attachment.bin>


More information about the Openmp-commits mailing list