[Openmp-commits] [PATCH] D141227: [OpenMP][libomptarget] Implement memory lock/unlock API in NextGen plugins

Thorsten via Phabricator via Openmp-commits openmp-commits at lists.llvm.org
Sun Jan 8 09:43:59 PST 2023


tschuett added a comment.

https://github.com/openucx/ucx/blob/master/src/ucs/datastruct/pgtable.h super optimized page table for a similar use case.



================
Comment at: openmp/libomptarget/plugins-nextgen/common/PluginInterface/PluginInterface.h:288
+  /// Find an allocation that intersects with a specific buffer pointer.
+  const EntryTy *findIntersecting(void *Buffer) const {
+    if (Allocs.empty())
----------------
I would return `std::optional<const EntryTy*>` to avoid using `nullptr` to model failure.


================
Comment at: openmp/libomptarget/plugins-nextgen/common/PluginInterface/PluginInterface.h:321
+  /// for async memory copies.
+  bool isHostPinnedBuffer(void *HstPtr, void **DevPtr = nullptr) const {
+    std::shared_lock<std::shared_mutex> Lock(Mutex);
----------------
I would return `std::optional<void *>` to avoid passing mutable pointers.


Repository:
  rG LLVM Github Monorepo

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

https://reviews.llvm.org/D141227



More information about the Openmp-commits mailing list