How to generate binary executable from linked LLVM IR of CUDA files?

47 Views Asked by At

I am writing an LLVM pass to analyze the LLVM IR of CUDA files generated using clang. However, I needed to analyze both the CPU and GPU function calls. Hence, I linked two IR files using llvm-link and created a new LLVM IR file. However, I cannot generate a binary executable upon analyzing the linked IR using the opt tool. I get the following error when I try to generate a binary executable using clang.

'sm_35' is not a recognized processor for this target (ignoring processor)
'+ptx75' is not a recognized feature for this target (ignoring feature)
'+sm_35' is not a recognized feature for this target (ignoring feature)
'sm_35' is not a recognized processor for this target (ignoring processor)
'sm_35' is not a recognized processor for this target (ignoring processor)
'+ptx75' is not a recognized feature for this target (ignoring feature)
'+sm_35' is not a recognized feature for this target (ignoring feature)
'sm_35' is not a recognized processor for this target (ignoring processor)
fatal error: error in backend: 64-bit code requested on a subtarget that doesn't support it!
clang-14: error: clang frontend command failed with exit code 70 (use -v to see invocation)
clang version 14.0.6 (https://github.com/llvm/llvm-project.git f28c006a5895fc0e329fe15fead81e37457cb1d1)
Target: x86_64-unknown-linux-gnu

Can someone help me with it?

I tried to run my pass using Clang also, but it runs the pass before the host-side and device-side code even links. Hence, my analysis throws an error. I am trying to register the pass in the Clang pipeline now, so that I can run it using Clang without dumping intermediate representations.

P.S. I am using the following command to generate the binary executable:

./bin/clang++ -I ../../../../common/ -flegacy-pass-manager  <linked_llvm_ir>.ll -L /usr/local/cuda/lib64 -lcudart_static -ldl -lrt -pthread -std=c++14 -Xclang -disable-O0-optnone
0

There are 0 best solutions below