[PATCH] D129694: [OPENMP] Make declare target static global externally visible

Sunil Shrestha via Phabricator via cfe-commits cfe-commits at lists.llvm.org
Wed Jul 13 14:04:32 PDT 2022


ssquare08 created this revision.
ssquare08 added a reviewer: jhuber6.
Herald added subscribers: mattd, asavonic, guansong, yaxunl.
Herald added a project: All.
ssquare08 requested review of this revision.
Herald added a reviewer: jdoerfert.
Herald added subscribers: cfe-commits, sstefan1.
Herald added a project: clang.

This is to support cases where static globals are marked declare
target. By default these file static globals are not externally
visible but in order for OpenMP runtime to access these symbols,
this changes here makes them externally visisble unless they
have "hidden" visibility attribute.
Making them externally visible, however, leads to symbol conflict
when two files have variables with the same name. Thus, these
symbols needs to be mangled on the device side of the compilation.
In order to do so, the host side mangles the symbol names and
passes that metadata information to the device side. It also uses
these mangled names if offload entry table so that the OPenMP
runtime can find these symbols during registration.


Repository:
  rG LLVM Github Monorepo

https://reviews.llvm.org/D129694

Files:
  clang/lib/CodeGen/CGOpenMPRuntime.cpp
  clang/lib/CodeGen/CGOpenMPRuntime.h
  clang/lib/CodeGen/CGOpenMPRuntimeGPU.cpp
  clang/lib/CodeGen/CGOpenMPRuntimeGPU.h
  clang/lib/CodeGen/CodeGenModule.cpp
  clang/lib/CodeGen/TargetInfo.cpp
  clang/lib/Sema/SemaOpenMP.cpp
  clang/test/OpenMP/declare_target_codegen.cpp
  clang/test/OpenMP/declare_target_link_codegen.cpp
  clang/test/OpenMP/declare_target_visibility_codegen.cpp
  clang/test/OpenMP/nvptx_allocate_codegen.cpp
  clang/test/OpenMP/nvptx_declare_target_var_ctor_dtor_codegen.cpp
  clang/test/OpenMP/target_update_messages.cpp

-------------- next part --------------
A non-text attachment was scrubbed...
Name: D129694.444415.patch
Type: text/x-patch
Size: 23853 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/cfe-commits/attachments/20220713/44bfe5b9/attachment-0001.bin>


More information about the cfe-commits mailing list