[llvm-branch-commits] [llvm] [Offload] `olGetMemInfo` (PR #157651)

Joseph Huber via llvm-branch-commits llvm-branch-commits at lists.llvm.org
Tue Sep 9 06:06:20 PDT 2025


================
@@ -614,6 +614,21 @@ TargetAllocTy convertOlToPluginAllocTy(ol_alloc_type_t Type) {
   }
 }
 
+ol_alloc_type_t convertPluginToOlAllocTy(TargetAllocTy Type) {
+  switch (Type) {
+  case TARGET_ALLOC_DEVICE:
+    return OL_ALLOC_TYPE_DEVICE;
+  case TARGET_ALLOC_HOST:
+    return OL_ALLOC_TYPE_HOST;
+  case TARGET_ALLOC_SHARED:
+    return OL_ALLOC_TYPE_MANAGED;
+  default:
+    // Seems a reasonable default, although this default should never get hit
+    // with allocations made through liboffload
+    return OL_ALLOC_TYPE_MANAGED;
----------------
jhuber6 wrote:

When would we hit this default? I'm wondering if it'd be better as an unreachable, otherwise I'd expect device allocations to be more common.

https://github.com/llvm/llvm-project/pull/157651


More information about the llvm-branch-commits mailing list