[llvm] [Offload] Allow allocations to be freed without knowing their type (PR #140889)
Matt Arsenault via llvm-commits
llvm-commits at lists.llvm.org
Wed May 21 06:36:46 PDT 2025
================
@@ -1495,6 +1495,29 @@ Error GenericDeviceTy::dataDelete(void *TgtPtr, TargetAllocTy Kind) {
return Plugin::success();
}
+Error GenericDeviceTy::dataDelete(void *TgtPtr) {
+ // Try to free via the memory manager if it exists. If the allocation isn't
+ // managed by the memory manager it will fall back to the device allocator
+ // which should succeed.
+ int Res;
+ if (MemoryManager) {
+ Res = MemoryManager->free(TgtPtr);
+ if (Res)
+ return Plugin::error(
+ ErrorCode::UNKNOWN,
+ "Failure to deallocate device pointer %p via memory manager", TgtPtr);
----------------
arsenm wrote:
error messages should start with a lowercase letter
https://github.com/llvm/llvm-project/pull/140889
More information about the llvm-commits
mailing list