[all-commits] [llvm/llvm-project] 3c6d32: [OpenMP] Make Ctor / Dtor functions have external ...

Joseph Huber via All-commits all-commits at lists.llvm.org
Fri Mar 25 19:44:40 PDT 2022


  Branch: refs/heads/main
  Home:   https://github.com/llvm/llvm-project
  Commit: 3c6d32ec6cdb426d531e0a3b3aa4449ff6e4d75c
      https://github.com/llvm/llvm-project/commit/3c6d32ec6cdb426d531e0a3b3aa4449ff6e4d75c
  Author: Joseph Huber <jhuber6 at vols.utk.edu>
  Date:   2022-03-25 (Fri, 25 Mar 2022)

  Changed paths:
    M clang/lib/CodeGen/CGDeclCXX.cpp
    M clang/lib/CodeGen/CGOpenMPRuntime.cpp
    M clang/lib/CodeGen/CodeGenModule.h
    M clang/test/OpenMP/amdgcn_target_global_constructor.cpp
    M clang/test/OpenMP/declare_target_codegen.cpp
    M clang/test/OpenMP/nvptx_declare_target_var_ctor_dtor_codegen.cpp

  Log Message:
  -----------
  [OpenMP] Make Ctor / Dtor functions have external visibility

The default construction of constructor functions by LLVM tends to make
them have internal linkage. When we call a ctor / dtor function in the
target region we are actually creating a kernel that is called at
registration. Because the ctor is a kernel we need to make sure it's
externally visible so we can actually call it. This prevented AMDGPU
from correctly using constructors while NVPTX could use them simply
because it ignored internal visibility.

Reviewed By: JonChesterfield

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


  Commit: 9d3550c5173373305c10a5a471a935be205191a2
      https://github.com/llvm/llvm-project/commit/9d3550c5173373305c10a5a471a935be205191a2
  Author: Joseph Huber <jhuber6 at vols.utk.edu>
  Date:   2022-03-25 (Fri, 25 Mar 2022)

  Changed paths:
    M clang/lib/CodeGen/CGOpenMPRuntime.cpp
    M clang/test/OpenMP/amdgcn_target_global_constructor.cpp
    M openmp/libomptarget/test/offloading/global_constructor.cpp

  Log Message:
  -----------
  [OpenMP] Add AMDGPU calling convention to ctor / dtor functions

This patch adds the necessary AMDGPU calling convention to the ctor /
dtor kernels. These are fundamentally device kenels called by the host
on image load. Without this calling convention information the AMDGPU
plugin is unable to identify them.

Depends on D122504

Fixes #54091

Reviewed By: jdoerfert

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


Compare: https://github.com/llvm/llvm-project/compare/e13faa40cf0a...9d3550c51733


More information about the All-commits mailing list