[llvm] [Offload] Update allocations to include device (PR #154733)

Ross Brunton via llvm-commits llvm-commits at lists.llvm.org
Mon Sep 1 03:25:48 PDT 2025


================
@@ -124,8 +125,8 @@ struct OffloadContext {
 
   bool TracingEnabled = false;
   bool ValidationEnabled = true;
-  DenseMap<void *, AllocInfo> AllocInfoMap{};
-  std::mutex AllocInfoMapMutex{};
+  SmallVector<AllocInfo> AllocInfoList{};
----------------
RossBrunton wrote:

In theory it's possible to allocate host memory which isn't tied to a specific device, although we don't expose that functionality in any liboffload entry points yet.

However, what we do allow is looking up host and managed allocations without providing a device. To do that where each device managed its own allocations we'd need to iterate (and lock) through each device and search its allocation list.

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


More information about the llvm-commits mailing list