[clang] [clang] Fix inconsistencies with the device_kernel attr on different targets (PR #161905)

Joseph Huber via cfe-commits cfe-commits at lists.llvm.org
Fri Oct 3 14:51:33 PDT 2025


================
@@ -419,9 +419,11 @@ void AMDGPUTargetCodeGenInfo::setTargetAttributes(
     return;
 
   const FunctionDecl *FD = dyn_cast_or_null<FunctionDecl>(D);
-  if (FD)
+  if (FD) {
     setFunctionDeclAttributes(FD, F, M);
-
+    if (FD->hasAttr<DeviceKernelAttr>() && !M.getLangOpts().OpenCL)
+      F->setCallingConv(llvm::CallingConv::AMDGPU_KERNEL);
----------------
jhuber6 wrote:

Does OpenCL use a different kernel calling convention? I remember there was something different for Mesa or something but I don't know why OpenCL wouldn't work here.

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


More information about the cfe-commits mailing list