[all-commits] [llvm/llvm-project] 410bfa: [openmp] Introduce optional plugin init/deinit fun...

Joseph Huber via All-commits all-commits at lists.llvm.org
Mon Aug 8 11:01:54 PDT 2022


  Branch: refs/heads/release/15.x
  Home:   https://github.com/llvm/llvm-project
  Commit: 410bfa00a68b9876381aa1d3d48a2a4f5ee35e2c
      https://github.com/llvm/llvm-project/commit/410bfa00a68b9876381aa1d3d48a2a4f5ee35e2c
  Author: Jon Chesterfield <jonathanchesterfield at gmail.com>
  Date:   2022-08-08 (Mon, 08 Aug 2022)

  Changed paths:
    M openmp/libomptarget/include/omptargetplugin.h
    M openmp/libomptarget/include/rtl.h
    M openmp/libomptarget/plugins/amdgpu/src/rtl.cpp
    M openmp/libomptarget/plugins/exports
    M openmp/libomptarget/src/rtl.cpp

  Log Message:
  -----------
  [openmp] Introduce optional plugin init/deinit functions

Will allow plugins to migrate away from using global variables to
manage lifetime, which will fix a segfault discovered in relation to D127432

Reviewed By: jhuber6

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

(cherry picked from commit 1f9d3974e444f95ddb600a6964ed14ded559e89c)


  Commit: b5151c32f9aab3e9c61e622db9ec671dbd2331d9
      https://github.com/llvm/llvm-project/commit/b5151c32f9aab3e9c61e622db9ec671dbd2331d9
  Author: Jon Chesterfield <jonathanchesterfield at gmail.com>
  Date:   2022-08-08 (Mon, 08 Aug 2022)

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

  Log Message:
  -----------
  [openmp][amdgpu] Move global DeviceInfo behind call syntax prior to using D130712

(cherry picked from commit 75aa52106452a1d15ca487af7b408a812012e133)


  Commit: 087d9bb226995073051ba2035f3aba7575cbd1e1
      https://github.com/llvm/llvm-project/commit/087d9bb226995073051ba2035f3aba7575cbd1e1
  Author: Jon Chesterfield <jonathanchesterfield at gmail.com>
  Date:   2022-08-08 (Mon, 08 Aug 2022)

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

  Log Message:
  -----------
  [amdgpu][openmp][nfc] Restore stb_local on DeviceInfo symbol

(cherry picked from commit c214cb6a689581c1b7f3b702b5da6d68de6eaf3f)


  Commit: cb24013bce01ac135b27cd2a69858e95bcd177c2
      https://github.com/llvm/llvm-project/commit/cb24013bce01ac135b27cd2a69858e95bcd177c2
  Author: Jon Chesterfield <jonathanchesterfield at gmail.com>
  Date:   2022-08-08 (Mon, 08 Aug 2022)

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

  Log Message:
  -----------
  [openmp][amdgpu] Tear down amdgpu plugin accurately

Moves DeviceInfo global to heap to accurately control lifetime.
Moves calls from libomptarget to deinit_plugin later, plugins need to stay
alive until very shortly before libomptarget is destructed.

Leaving the deinit_plugin calls where initially inserted hits use after
free from the dynamic_module.c offloading test (verified with valgrind
 that the new location is sound with respect to this)

Reviewed By: tianshilei1992

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

(cherry picked from commit ed0f21811544320f829124efbb6a38ee12eb9155)


  Commit: 207f96e8fac08db23bd2a8edc700e162f135ef62
      https://github.com/llvm/llvm-project/commit/207f96e8fac08db23bd2a8edc700e162f135ef62
  Author: Joseph Huber <jhuber6 at vols.utk.edu>
  Date:   2022-08-08 (Mon, 08 Aug 2022)

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

  Log Message:
  -----------
  [Libomptarget] Deinitialize AMDGPU global state more intentionally

A previous patch made the destruction of the HSA plugin more
deterministic. However, there were still other global values that are not
handled this way. When attempting to call a destructor kernel, the
device would have already been uninitialized and we could not find the
appropriate kernel to call. This is because they were stored in global
containers that had their destructors called already. Merges this global
state into the rest of the info state by putting those global values
inside of the global pointer already allocated and deallocated by the
constructor and destructor. This should allow the AMDGPU plugin to
correctly identify the destructors if we were to run them.

Reviewed By: JonChesterfield

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

(cherry picked from commit 2b7203a35972e98b8521f92d2791043dc539ae88)


Compare: https://github.com/llvm/llvm-project/compare/e4ec381f2cf5...207f96e8fac0


More information about the All-commits mailing list