[llvm] [offload] add context to olMemAlloc* (PR #222677)
Jan Trusiłło via llvm-commits
llvm-commits at lists.llvm.org
Fri Sep 11 04:17:55 PDT 2026
================
@@ -273,6 +273,31 @@ Error LevelZeroPluginContextTy::deinit() {
return Plugin::success();
}
+Expected<PluginAllocInfoTy>
+LevelZeroPluginContextTy::getAllocInfo(const void *Ptr) {
+ void *Raw = const_cast<void *>(Ptr);
+
+ // Try each device's device-scope allocator first, then the driver-scoped
+ // host pool via the first device's L0 context.
+ for (auto *D : Devices) {
+ auto &L0Device = static_cast<L0DeviceTy &>(*D);
+ if (auto *Info = L0Device.getDeviceMemAllocator().getAllocInfo(Raw))
----------------
311Volt wrote:
Per-context tracking would be good since this is an `std::map` lookup for potentially each device in the context.
I don't know the plans regarding `MemAllocatorTy`, though. For one, I remember a discussion about how its `MemPoolTy` is redundant given the presence of `MemoryManagerTy` in the plugin interface. If that's due for a cleanup soon, then this optimization should be done in that cleanup IMO
https://github.com/llvm/llvm-project/pull/222677
More information about the llvm-commits
mailing list