[all-commits] [llvm/llvm-project] 9ab0d4: [OpenMP][2/2] Make device functions have hidden v...

Johannes Doerfert via All-commits all-commits at lists.llvm.org
Tue Jan 3 12:19:02 PST 2023


  Branch: refs/heads/main
  Home:   https://github.com/llvm/llvm-project
  Commit: 9ab0d4d66fa14a9c57864fea72590886ace6d9ee
      https://github.com/llvm/llvm-project/commit/9ab0d4d66fa14a9c57864fea72590886ace6d9ee
  Author: Johannes Doerfert <johannes at jdoerfert.de>
  Date:   2023-01-03 (Tue, 03 Jan 2023)

  Changed paths:
    M clang/lib/AST/Decl.cpp
    A clang/test/OpenMP/target_visibility.cpp

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

Similar to https://reviews.llvm.org/D136111, this time for class
methods.

D136111 summary:

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 class methods 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.




More information about the All-commits mailing list