[clang] [clang][NFCI] Use TargetInfo to determine device kernel calling convention (PR #144728)
Nick Sarnie via cfe-commits
cfe-commits at lists.llvm.org
Wed Jun 18 10:50:28 PDT 2025
================
@@ -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
----------------
sarnex wrote:
> do we override `getDeviceKernelCallingConv` for SPIR-V target or use the default?
`SPIRVABIInfo`'s base class is `CommonSPIRTargetCodeGenInfo` and `CommonSPIRTargetCodeGenInfo` has the override, so I think it's fine.
> there is a functional change to the logic of lowering CC_DeviceKernel
Thanks, I'll remove `NFCI` to be safe.
> We can be stricter to getDeviceKernelCallingConv users and put something like llvm_unreachable("Unknown kernel calling convention"); in the base class definition
I'll try this and do it if nothing expodes
https://github.com/llvm/llvm-project/pull/144728
More information about the cfe-commits
mailing list