[Openmp-commits] [PATCH] D142145: [OpenMP][libomptarget] Fix deinit of NextGen AMDGPU plugin

Joseph Huber via Phabricator via Openmp-commits openmp-commits at lists.llvm.org
Thu Jan 19 14:15:38 PST 2023

jhuber6 added a comment.

In D142145#4067086 <https://reviews.llvm.org/D142145#4067086>, @kevinsala wrote:

> In D142145#4066891 <https://reviews.llvm.org/D142145#4066891>, @jhuber6 wrote:
>> In D142145#4066841 <https://reviews.llvm.org/D142145#4066841>, @kevinsala wrote:
>>> Not sure if you refer to the `Initialized` variable. In this case it's not a global, it's a data member of the `AMDGPUPluginTy` class.
>> I mean when we link against HSA we have something like `hsa_deinit()` as a function with a valid address. When we load it dynamically it's just forward declared like `HSA_STATUS_T (hsa_deinit())(void);` which is initialized to zero.
> I'll update the patch with that change, thanks! We can avoid calling another HSA function and call directly `hsa_shut_down` ignoring the error code, right?
>   if (hsa_shut_down)
>     hsa_shut_down();

That would handle the case where HSA wasn't dynamically loaded successfully. If `hsa_init()` was never called but HSA was successfully loaded / linked, you'd get that `HSA_STATUS_ERROR_NOT_INITIALIZED` code returned instead.

  rG LLVM Github Monorepo



More information about the Openmp-commits mailing list