[Openmp-commits] [PATCH] D108698: [libomptarget][amdgpu] Macro for accessing GPU variables from plugin

Jon Chesterfield via Phabricator via Openmp-commits openmp-commits at lists.llvm.org
Wed Aug 25 08:06:05 PDT 2021


JonChesterfield updated this revision to Diff 368640.
JonChesterfield added a comment.

- clang-format with a newer clang-format


Repository:
  rG LLVM Github Monorepo

CHANGES SINCE LAST ACTION
  https://reviews.llvm.org/D108698/new/

https://reviews.llvm.org/D108698

Files:
  openmp/libomptarget/deviceRTLs/amdgcn/src/target_impl.h
  openmp/libomptarget/deviceRTLs/common/src/omp_data.cu
  openmp/libomptarget/deviceRTLs/nvptx/src/target_impl.h


Index: openmp/libomptarget/deviceRTLs/nvptx/src/target_impl.h
===================================================================
--- openmp/libomptarget/deviceRTLs/nvptx/src/target_impl.h
+++ openmp/libomptarget/deviceRTLs/nvptx/src/target_impl.h
@@ -26,6 +26,7 @@
 #define INLINE inline __attribute__((always_inline))
 #define NOINLINE __attribute__((noinline))
 #define ALIGN(N) __attribute__((aligned(N)))
+#define PLUGIN_ACCESSIBLE /* no annotation needed for cuda plugin */
 
 #include "llvm/Frontend/OpenMP/OMPGridValues.h"
 
Index: openmp/libomptarget/deviceRTLs/common/src/omp_data.cu
===================================================================
--- openmp/libomptarget/deviceRTLs/common/src/omp_data.cu
+++ openmp/libomptarget/deviceRTLs/common/src/omp_data.cu
@@ -19,6 +19,7 @@
 // global device environment
 ////////////////////////////////////////////////////////////////////////////////
 
+PLUGIN_ACCESSIBLE
 omptarget_device_environmentTy omptarget_device_environment;
 
 ////////////////////////////////////////////////////////////////////////////////
Index: openmp/libomptarget/deviceRTLs/amdgcn/src/target_impl.h
===================================================================
--- openmp/libomptarget/deviceRTLs/amdgcn/src/target_impl.h
+++ openmp/libomptarget/deviceRTLs/amdgcn/src/target_impl.h
@@ -30,6 +30,10 @@
 #define INLINE inline
 #define NOINLINE __attribute__((noinline))
 #define ALIGN(N) __attribute__((aligned(N)))
+#define PLUGIN_ACCESSIBLE                                                      \
+  __attribute__((used)) /* Don't discard values the plugin reads */            \
+  __attribute__((visibility("default"))) /* Access via SHT_HASH */             \
+  __attribute__((section(".data")))      /* Not .bss, can write before load */
 
 #include "llvm/Frontend/OpenMP/OMPGridValues.h"
 


-------------- next part --------------
A non-text attachment was scrubbed...
Name: D108698.368640.patch
Type: text/x-patch
Size: 1837 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/openmp-commits/attachments/20210825/dcdd5bd5/attachment.bin>


More information about the Openmp-commits mailing list