[all-commits] [llvm/llvm-project] bb3c90: [OpenMP] Make device functions have hidden visibility

Joseph Huber via All-commits all-commits at lists.llvm.org
Tue Oct 18 06:15:56 PDT 2022


  Branch: refs/heads/main
  Home:   https://github.com/llvm/llvm-project
  Commit: bb3c90d3ecd142e60cf994338bdd4b59d8788cd3
      https://github.com/llvm/llvm-project/commit/bb3c90d3ecd142e60cf994338bdd4b59d8788cd3
  Author: Joseph Huber <jhuber6 at vols.utk.edu>
  Date:   2022-10-18 (Tue, 18 Oct 2022)

  Changed paths:
    M clang/lib/AST/Decl.cpp
    M clang/test/OpenMP/nvptx_declare_target_var_ctor_dtor_codegen.cpp
    M clang/test/OpenMP/nvptx_unsupported_type_codegen.cpp
    M clang/test/OpenMP/target_attribute_convergent.cpp

  Log Message:
  -----------
  [OpenMP] Make device functions have hidden visibility

In OpenMP target offloading an in other offloading languages, we
maintain a difference between device functions and kernel functions.
Kernel functions must be visible to the host and act as the entry point
to the target device. Device functions however cannot be called directly
by the host and must be called by a kernel function. Currently, we make
all definitions on the device protected by default. Because device
functions cannot be called or used by the host they should have hidden
visibility. This allows for the definitions to be better optimized via
LTO or other passes.

This patch marks every device function in the AST as having `hidden`
visibility. The kernel function is generated later at code-gen and we
set its visibility explicitly so it should not be affected. This
prevents the user from overriding the visibility, but since the user
can't do anything with these symbols anyway there is no point exporting
them right now.

Reviewed By: jdoerfert

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




More information about the All-commits mailing list