================ @@ -103,11 +103,11 @@ TargetCodeGenInfo::getDependentLibraryOption(llvm::StringRef Lib, Opt += Lib; } -unsigned TargetCodeGenInfo::getOpenCLKernelCallingConv() const { - // OpenCL kernels are called via an explicit runtime API with arguments - // set with clSetKernelArg(), not as normal sub-functions. +unsigned TargetCodeGenInfo::getDeviceKernelCallingConv() const { + // Device kernels are called via an explicit runtime API with arguments, + // such as set with clSetKernelArg() for OpenCL, not as normal sub-functions. // Return SPIR_KERNEL by default as the kernel calling convention to ---------------- bader wrote:
I think, technically, there is a functional change to the logic of lowering `CC_DeviceKernel`. Before the patch: ```c++ if (CGM.getLangOpts().OpenCL) return CGM.getTargetCodeGenInfo().getOpenCLKernelCallingConv(); if (CGM.getTriple().isSPIROrSPIRV()) return llvm::CallingConv::SPIR_KERNEL; if (CGM.getTriple().isAMDGPU()) return llvm::CallingConv::AMDGPU_KERNEL; if (CGM.getTriple().isNVPTX()) return llvm::CallingConv::PTX_Kernel; llvm_unreachable("Unknown kernel calling convention"); ``` after the patch (pseudo-code): ```c++ if (CGM.getTriple().isSPIR()) // do we override `getDeviceKernelCallingConv` for SPIR-V target or use the default? return llvm::CallingConv::SPIR_KERNEL; if (CGM.getTriple().isAMDGPU()) return llvm::CallingConv::AMDGPU_KERNEL; if (CGM.getTriple().isNVPTX()) return llvm::CallingConv::PTX_Kernel; // by default, return SPIR_KERNEL return llvm::CallingConv::SPIR_KERNEL; ``` But anyway, the new logic seems "okay" to me. We can be stricter to `getDeviceKernelCallingConv` users and put something like `llvm_unreachable("Unknown kernel calling convention");` in the base class definition, but your version looks okay to me too. https://github.com/llvm/llvm-project/pull/144728 _______________________________________________ cfe-commits mailing list cfe-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits