This is an archive of the discontinued LLVM Phabricator instance.

[OpenMP][2/2] Make device functions have hidden visibility
ClosedPublic

Authored by jdoerfert on Dec 28 2022, 11:38 AM.

Details

Reviewers
jhuber6
Summary

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.

Diff Detail

Event Timeline

jdoerfert created this revision.Dec 28 2022, 11:38 AM
Herald added a project: Restricted Project. · View Herald TranscriptDec 28 2022, 11:38 AM
jdoerfert requested review of this revision.Dec 28 2022, 11:38 AM
jhuber6 accepted this revision.Dec 28 2022, 11:42 AM

LG, thanks.

This revision is now accepted and ready to land.Dec 28 2022, 11:42 AM