[clang] [HIP][CUDA] Apply protected visibility to kernels and globals (PR #187784)

Nick Sarnie via cfe-commits cfe-commits at lists.llvm.org
Mon Mar 23 07:18:17 PDT 2026


================
@@ -1899,6 +1899,27 @@ void CodeGenModule::setGlobalVisibility(llvm::GlobalValue *GV,
     return;
   }
 
+  // CUDA/HIP device kernels and global variables must be visible to the host
+  // so they can be registered / initialized. We require protected visibility
+  // unless the user explicitly requested hidden via an attribute.
+  if (Context.getLangOpts().CUDAIsDevice &&
----------------
sarnex wrote:

Maybe @tahonermann or @Fznamznon can chime in to see if something similar makes sense for SYCL.

https://github.com/llvm/llvm-project/pull/187784


More information about the cfe-commits mailing list