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

Kevin Sala Penades via llvm-commits llvm-commits at lists.llvm.org
Tue Sep 2 12:20:32 PDT 2025


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

Thanks for the clarification. I would use a map here instead of the vector, as @pbalcer said.

If you need lookups using non-base pointers (e.g., for a `olGetMemInfo`), you could use `std::map` with a base pointer + size as the key, and use `lower_bound`/`upper_bound` functions.

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


More information about the llvm-commits mailing list