[Openmp-commits] [PATCH] D141227: [OpenMP][libomptarget] Implement memory lock/unlock API in NextGen plugins
Johannes Doerfert via Phabricator via Openmp-commits
openmp-commits at lists.llvm.org
Sun Jan 8 11:51:44 PST 2023
jdoerfert added inline comments.
================
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())
----------------
tschuett wrote:
> I would return `std::optional<const EntryTy*>` to avoid using `nullptr` to model failure.
Why would we want that? It seems to me null is a fine, didn't find the entry response. We don't need to box things just to have boxed them.
================
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);
----------------
tschuett wrote:
> I would return `std::optional<void *>` to avoid passing mutable pointers.
This makes more sense. Though, again, why boxing. Returning the devptr content avoids mutable arguments just fine
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