[OpenMP] Allow to explicitly deinitialize device resources
authorJohannes Doerfert <johannes@jdoerfert.de>
Thu, 17 Feb 2022 22:04:12 +0000 (16:04 -0600)
committerJohannes Doerfert <johannes@jdoerfert.de>
Tue, 8 Mar 2022 05:43:04 +0000 (23:43 -0600)
commit10aa83ff74b48d441aa2141047cf8674e069d4f6
treedf733886228286ea84d662d05996867bb52ffb42
parent307bbd3c82643139c8407a20b07b06f892764c4c
[OpenMP] Allow to explicitly deinitialize device resources

There are two problems this patch tries to address:
1) We currently free resources in a random order wrt. plugin and
   libomptarget destruction. This patch should ensure the CUDA plugin
   is less fragile if something during the deinitialization goes wrong.
2) We need to support (hard) pause runtime calls eventually. This patch
   allows us to free all associated resources, though we cannot
   reinitialize the device yet.

Follow up patch will associate one event pool per device/context.

Differential Revision: https://reviews.llvm.org/D120089
openmp/libomptarget/include/device.h
openmp/libomptarget/include/omptargetplugin.h
openmp/libomptarget/include/rtl.h
openmp/libomptarget/plugins/cuda/src/rtl.cpp
openmp/libomptarget/plugins/exports
openmp/libomptarget/src/device.cpp
openmp/libomptarget/src/rtl.cpp