[clang] [clang][SPIR-V] Set the kernel CC of CUDA/HIP kernels in CodeGen, not in the type (PR #246644)

Henry Linjamäki via cfe-commits cfe-commits at lists.llvm.org
Thu Dec 3 23:07:04 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:

I think we can move forward without the split.

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


More information about the cfe-commits mailing list