[Openmp-commits] [PATCH] D109511: [libomptarget][amdgpu] Clean up destruction of hsa queue, signals

Jon Chesterfield via Phabricator via Openmp-commits openmp-commits at lists.llvm.org
Thu Sep 9 08:00:34 PDT 2021


JonChesterfield added inline comments.
Herald added a reviewer: jdoerfert.
Herald added a subscriber: sstefan1.


================
Comment at: openmp/libomptarget/plugins/amdgpu/src/rtl.cpp:834
+
     Err = hsa_shut_down();
     if (Err != HSA_STATUS_SUCCESS) {
----------------
Storing (most) state in a global variable that closes hsa in the destructor make it difficult to use raii classes to manage hsa resources.

We could change to using multiple calls to hsa_init/destroy, since it's internally reference counted, and that would give us the last one to destroy closes hsa.

Better is probably to nest the lifetime - would like hsa_init to occur before any other objects are constructed and hsa_shut_down after they've all been torn down. Will think about how best to represent that (separate to this patch)


Repository:
  rG LLVM Github Monorepo

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

https://reviews.llvm.org/D109511



More information about the Openmp-commits mailing list