[Openmp-commits] [PATCH] D117526: [Libomptarget] Fix external visibility for internal variables

Joseph Huber via Phabricator via Openmp-commits openmp-commits at lists.llvm.org
Mon Jan 17 16:57:07 PST 2022

jhuber6 created this revision.
jhuber6 added reviewers: tianshilei1992, jdoerfert.
jhuber6 requested review of this revision.
Herald added a project: OpenMP.
Herald added a subscriber: openmp-commits.

After the changes in D117362 <https://reviews.llvm.org/D117362> made variables declared inside of a target
declare directive visible outside the plugin, some variables inside the
runtime were given visiblity that conflicted with their address space
type. This caused problems when shared or local memory was made
externally visible. This patch fixes this issue by making these
varialbes static within the module, therefore limiting their visibility
to being internal.

  rG LLVM Github Monorepo



Index: openmp/libomptarget/DeviceRTL/src/Workshare.cpp
--- openmp/libomptarget/DeviceRTL/src/Workshare.cpp
+++ openmp/libomptarget/DeviceRTL/src/Workshare.cpp
@@ -46,7 +46,7 @@
 #pragma omp declare target
 // TODO: This variable is a hack inherited from the old runtime.
-uint64_t SHARED(Cnt);
+static uint64_t SHARED(Cnt);
 template <typename T, typename ST> struct omptarget_nvptx_LoopSupport {
@@ -443,7 +443,7 @@
 // TODO: This is a stopgap. We probably want to expand the dispatch API to take
 //       an DST pointer which can then be allocated properly without malloc.
-DynamicScheduleTracker *THREAD_LOCAL(ThreadDSTPtr);
+static DynamicScheduleTracker *THREAD_LOCAL(ThreadDSTPtr);
 // Create a new DST, link the current one, and define the new as current.
 static DynamicScheduleTracker *pushDST() {

-------------- next part --------------
A non-text attachment was scrubbed...
Name: D117526.400675.patch
Type: text/x-patch
Size: 968 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/openmp-commits/attachments/20220118/51a4e4df/attachment.bin>

More information about the Openmp-commits mailing list