[Openmp-commits] [PATCH] D111954: [OpenMP][Plugin] Introduce resouce manager

Shilei Tian via Phabricator via Openmp-commits openmp-commits at lists.llvm.org
Sat Oct 16 16:34:38 PDT 2021


tianshilei1992 created this revision.
tianshilei1992 added reviewers: ye-luo, jdoerfert, grokos, JonChesterfield.
Herald added subscribers: guansong, yaxunl.
tianshilei1992 requested review of this revision.
Herald added subscribers: openmp-commits, sstefan1.
Herald added a project: OpenMP.

Currently CUDA streams are managed by `StreamManagerTy`. It works very well. Now
we have the need that some resources, such as CUDA stream and event, will be
hold by `libomptarget`. It is always good to buffer those resources. What's more
important, given the way that `libomptarget` and plugins are connected, we cannot
make sure whether plugins are still alive when `libomptarget` is destroyed. That
leads to an issue that those resouces hold by `libomptarget` might not be
released correctly. As a result, we need an unified management of all the resources
that can be shared between `libomptarget` and plugins.

`ResourceManagerTy` is designed to manage the type of resource for one device.
It has to work with an allocator which is supposed to provide `allocate` and
`deallocate`. In this way, when the plugin is destroyed, we can make sure that
all resources allocated from native runtime library will be released correctly,
no matter whether `libomptarget` starts its destroy.


Repository:
  rG LLVM Github Monorepo

https://reviews.llvm.org/D111954

Files:
  openmp/libomptarget/plugins/cuda/src/rtl.cpp

-------------- next part --------------
A non-text attachment was scrubbed...
Name: D111954.380222.patch
Type: text/x-patch
Size: 9834 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/openmp-commits/attachments/20211016/402c90be/attachment.bin>


More information about the Openmp-commits mailing list