Summary:
Change Clang calling convention SpirKernel to OpenCLKernel.
Set calling convention OpenCLKernel for amdgcn as well.
Add virtual method .getOpenCLKernelCallingConv() to TargetCodeGenInfo
and use it to set target calling convention for AMDGPU and SPIR.
Update tests.
Details
Diff Detail
- Repository
- rL LLVM
Event Timeline
I am wondering what's the difference between this calling convention and spir_kernel.
spir_kernel has only effect and was created only for SPIR target. In theory it could perhaps be reused for AMDGPU target, however it seems not very clear to me.
If the new calling convention is to indicate a function is an OpenCL kernel, then it has exactly the same meaning as spir_kernel. Can we just use it in AMDGPU target?
spir_kernel has only effect and was created only for SPIR target. In theory it could perhaps be reused for AMDGPU target, however it seems not very clear to me.
This looks like a hack to me. Calling conventions in LLVM IR are really target specific. spir_kernel really doesn't make sense for anything other than SPIR.
Maybe we can use the fact that calling conventions are separate in AST and in LLVM IR. So in AST maybe we can have opencl_kernel and in LLVM it can map to spir_kernel for SPIR and amdgpu_kernel for AMDGPU.
lib/Basic/Targets.cpp | ||
---|---|---|
2122 ↗ | (On Diff #61247) | One extra line? |
Maybe we can use the fact that calling conventions are separate in AST and in LLVM IR. So in AST maybe we can have opencl_kernel and in LLVM it can map to spir_kernel for SPIR and amdgpu_kernel for AMDGPU.
This approach looks good to me. Thanks.