[clang] [OpenCL][NVPTX] Don't set calling convention for OpenCL kernel (PR #170170)
Aniket Lal via cfe-commits
cfe-commits at lists.llvm.org
Mon Dec 1 22:48:10 PST 2025
================
@@ -277,7 +277,9 @@ void NVPTXTargetCodeGenInfo::setTargetAttributes(
}
}
// Attach kernel metadata directly if compiling for NVPTX.
- if (FD->hasAttr<DeviceKernelAttr>())
+ // NOTE: Don't set kernel calling convention for handled OpenCL kernel,
+ // otherwise the stub version of kernel would be incorrect.
+ if (FD->hasAttr<DeviceKernelAttr>() && !M.getLangOpts().OpenCL)
----------------
lalaniket8 wrote:
The calling convention for device function is set correctly at [CodeGenFunction.cpp](https://github.com/llvm/llvm-project/blob/main/clang/lib/CodeGen/CodeGenFunction.cpp#L1615) for the kernel stub, but is rewritten to PTX_KERNEL at NVPTX.cpp when setTargetAttributes() is called.
https://github.com/llvm/llvm-project/pull/170170
More information about the cfe-commits
mailing list