[Openmp-commits] [PATCH] D81054: [OpenMP] Introduce target memory manager

Shilei Tian via Phabricator via Openmp-commits openmp-commits at lists.llvm.org
Wed Aug 12 10:26:10 PDT 2020


tianshilei1992 added inline comments.


================
Comment at: openmp/libomptarget/src/MemoryManager.h:26
+class MemoryManagerTy {
+  std::unique_ptr<impl::MemoryManagerImplTy> Impl;
+
----------------
ye-luo wrote:
> tianshilei1992 wrote:
> > ye-luo wrote:
> > > Why is the pointer needed?
> > > What is the design logic behind MemoryManagerTy and MemoryManagerImplTy layers? Can we just have one?
> > Pimpl. Like my previous comments mentioned before, this header will be included by others, I don't want unnecessary headers/declarations/definitions to be included to pollute others.
> That is the job of header and cpp files.
No. You can refer to https://en.cppreference.com/w/cpp/language/pimpl for more details.


================
Comment at: openmp/libomptarget/src/device.h:150
+  /// Memory manager
+  std::shared_ptr<memory::MemoryManagerTy> MemoryManager;
+
----------------
ye-luo wrote:
> tianshilei1992 wrote:
> > ye-luo wrote:
> > > Could you explain why shared_ptr is needed?
> > Such that I don't need to include `MemoryManager.h` in the header, and it doesn't hurt anything.
> This is obviously a wrong way. Move the constructor and destructor to cpp.
Why is it a wrong way? Is there any drawback?


Repository:
  rG LLVM Github Monorepo

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

https://reviews.llvm.org/D81054



More information about the Openmp-commits mailing list