[all-commits] [llvm/llvm-project] 676023: [libomptarget][amdgpu] Precisely manage hsa lifetime

Jon Chesterfield via All-commits all-commits at lists.llvm.org
Thu Sep 9 09:28:27 PDT 2021


  Branch: refs/heads/main
  Home:   https://github.com/llvm/llvm-project
  Commit: 6760234e8d59ef22b816eef087d82f2e116eab08
      https://github.com/llvm/llvm-project/commit/6760234e8d59ef22b816eef087d82f2e116eab08
  Author: Jon Chesterfield <jonathanchesterfield at gmail.com>
  Date:   2021-09-09 (Thu, 09 Sep 2021)

  Changed paths:
    M openmp/libomptarget/plugins/amdgpu/src/rtl.cpp

  Log Message:
  -----------
  [libomptarget][amdgpu] Precisely manage hsa lifetime

The hsa library must be initialized before any calls into it and
destructed after the last call into it. There have been a number of bugs in
this area related to member variables which would like to use raii to manage
resources acquired from hsa.

This patch moves the init/shutdown of hsa into a class, such that when used as
the first member variable (could be a base), the lifetime of other member
variables are reliably scoped within it. This will allow other classes to use
raii reliably when used as member variables within the global.

Reviewed By: pdhaliwal

Differential Revision: https://reviews.llvm.org/D109512




More information about the All-commits mailing list