-
Notifications
You must be signed in to change notification settings - Fork 15.2k
Description
I'm not sure whether this is a bug or a missing feature, but please look at https://github.com/littlewu2508/LLVMAMDGPUcodegenbug, which is the reproducing method.
The issue is, during codegen phase, some simple opencl program meets "Unsupported calling convention: AMDGPU_KERNEL", while using the ROCm-forked llvm, the issue does not exists. Using gdb, I found that with vanilla llvm, one of the instructions I in
| visit(I.getOpcode(), I); |
OpCode=56 and SubclassData=365, which leads to 91 (CallingConv::AMDGPU_KERNEL) in followed steps (LowerCallTo, LowerCall, CCAssignFnForCall, etc), and finally get Unsupported calling convention issue. Gdb trace:llvm-14.0.5-dbg-cmdline.log.gz
For ROCm forked llvm, there's no issue. My guess is that source1.cl is calling amdgpu kernel functions, but somehow it no I with 91 (CallingConv::AMDGPU_KERNEL) appearing, only 0 (CallingConv::C) is seen, so no unsupported calling convention issues (gdb trace:
ROCm-llvm-5.1.3-dbg-cmdline.log.gz). But I failed to find out which change they use to get things worked, due to lack of compiler knowledge, and inability to bisect ROCm forked llvm (encountered many build issues when bisecting).
Forgive me of using llvm-14 because I built the debug version of llvm/clang to start investigating th issue half a year earlier (original issue: https://github.com/RadeonOpenCompute/ROCm-CompilerSupport/issues/45). I can confirm that this situation still remains now for both llvm-15.0.7 and llvm-16