[clang] [clang][HIP] Set the kernel CC of HIPSPV kernels in CodeGen, not in the type (PR #246644)

Henry Linjamäki via cfe-commits cfe-commits at lists.llvm.org
Wed Dec 2 00:01:54 PST 2026


================
@@ -3894,11 +3894,15 @@ static CallingConv getCCForDeclaratorChunk(
   CallingConv CC = S.Context.getDefaultCallingConvention(FTI.isVariadic,
                                                          IsCXXInstanceMethod);
 
-  if (S.getLangOpts().CUDA) {
-    // If we're compiling CUDA/HIP code and targeting HIPSPV we need to make
-    // sure the kernels will be marked with the right calling convention so that
+  if (S.getLangOpts().CUDA && !S.getLangOpts().HIP) {
+    // If we're compiling CUDA code and targeting SPIR-V we need to make sure
+    // the kernels will be marked with the right calling convention so that
     // they will be visible by the APIs that ingest SPIR-V. We do not do this
-    // when targeting AMDGCNSPIRV, as it does not rely on OpenCL.
+    // when targeting AMDGCNSPIRV, as it does not rely on OpenCL. HIP kernels
+    // get the kernel calling convention in CodeGen instead
+    // (setCUDAKernelCallingConvention), as on AMDGPU: in the declared type it
----------------
linehill wrote:

Is it true that CUDA kernels don't get kernel CC in the CodeGen via setCUDAKernelCallingConvention?

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


More information about the cfe-commits mailing list