[llvm] [OFFLOAD] Extend olMemRegister API to handle cases when a memory block may have been mapped outside of liboffload. (PR #172226)
Kevin Sala Penades via llvm-commits
llvm-commits at lists.llvm.org
Fri Feb 13 05:07:50 PST 2026
================
@@ -738,21 +705,13 @@ class PinnedAllocationMapTy {
/// with an already existing one. A partial overlapping with extension is not
/// allowed. The function returns the device accessible pointer of the pinned
/// buffer. The buffer must be unlocked using the unlockHostBuffer function.
- Expected<void *> lockHostBuffer(void *HstPtr, size_t Size);
+ Expected<void *> registerMemory(void *HstPtr, size_t Size,
+ bool LockMemory = true);
/// Unlock the host buffer at \p HstPtr or unregister a user if other users
/// are still using the pinned allocation. If this was the last user, the
/// pinned allocation is removed from the map and the memory is unlocked.
- Error unlockHostBuffer(void *HstPtr);
-
- /// Lock or register a host buffer that was recently mapped by libomptarget.
- /// This behavior is applied if LIBOMPTARGET_LOCK_MAPPED_HOST_BUFFERS is
- /// enabled. Even if not enabled, externally locked buffers are registered
- /// in order to optimize their transfers.
- Error lockMappedHostBuffer(void *HstPtr, size_t Size);
-
- /// Unlock or unregister a host buffer that was unmapped by libomptarget.
- Error unlockUnmappedHostBuffer(void *HstPtr);
+ Error unregisterMemory(void *HstPtr, bool UnlockMemory = true);
----------------
kevinsala wrote:
`Unregisters and ...`
https://github.com/llvm/llvm-project/pull/172226
More information about the llvm-commits
mailing list