[llvm] [Offload] Allow allocations to be freed without knowing their type (PR #140889)

Callum Fare via llvm-commits llvm-commits at lists.llvm.org
Wed May 21 05:55:26 PDT 2025


================
@@ -639,6 +636,44 @@ struct CUDADeviceTy : public GenericDeviceTy {
     return OFFLOAD_SUCCESS;
   }
 
+  int free_non_blocking(void *TgtPtr) override {
----------------
callumfare wrote:

Note that this code is the same as the existing code for `TARGET_ALLOC_DEVICE_NON_BLOCKING`, but there were a bunch of unchecked CUDA calls that I've changed to properly catch the errors. It's a bit repetitive so I wonder if the CUDA plugin could do with a macro or something to hide some of this logic. It's outside the scope of this PR anyway.

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


More information about the llvm-commits mailing list