[Openmp-commits] [PATCH] D113119: [OpenMP] Introduce asynchronous malloc and free

George Rokos via Phabricator via Openmp-commits openmp-commits at lists.llvm.org
Sat Nov 20 15:22:41 PST 2021


grokos added inline comments.


================
Comment at: openmp/libomptarget/plugins/common/MemoryManager/MemoryManager.h:146-148
+  int deleteOnDevice(void *Ptr) const {
+    return DeviceAllocator.free(Ptr, /* AsyncInfo */ nullptr);
+  }
----------------
We aren't we passing an `AsyncInfo` object as an extra argument to `deleteOnDevice` and subsequently call `DeviceAllocator.free()` with that `AsyncInfo` instead of `nullptr`? I suspect it's because we need to make room for subsequent allocations before attempting to re-allocate, if that's the case can you add a comment to make it clearer?


================
Comment at: openmp/libomptarget/plugins/common/MemoryManager/MemoryManager.h:293
   /// Deallocate memory pointed by \p TgtPtr
-  int free(void *TgtPtr) {
+  int free(void *TgtPtr, __tgt_async_info *AsyncInfo) {
     DP("MemoryManagerTy::free: target memory " DPxMOD ".\n", DPxPTR(TgtPtr));
----------------
If there is a reason why `deleteOnDevice()` cannot be called with an extra `AsyncInfo` argument, we are we adding it here? It's not used anywhere in the body of `free()`.


Repository:
  rG LLVM Github Monorepo

CHANGES SINCE LAST ACTION
  https://reviews.llvm.org/D113119/new/

https://reviews.llvm.org/D113119



More information about the Openmp-commits mailing list