[llvm-dev] LLVM/CUDA generate LLVM IR

157 views
Skip to first unread message

Gurunath Kadam via llvm-dev

unread,
Oct 13, 2016, 4:13:39 PM10/13/16
to llvm...@lists.llvm.org
So for a c program we do:

        clang -O3 -emit-llvm hello.c -c -o hello.bc

But how to generate an LLVM IR when working with CUDA.

for normal compilation:
         clang++ axpy.cu -o axpy --cuda-gpu-arch=<GPU arch> -L<CUDA install path>/<lib64 or lib> -lcudart_static -ldl -lrt -pthread

I tried adding -S -emit-llvm and changed the output file name, but I keep getting following error:

clang++: /stor/gakadam/llvm_projects/llvm/tools/clang/lib/Driver/Driver.cpp:1618: virtual {anonymous}::OffloadingActionBuilder::DeviceActionBuilder::ActionBuilderReturnCode {anonymous}::OffloadingActionBuilder::CudaActionBuilder::getDeviceDepences(clang::driver::OffloadAction::DeviceDependences&, clang::driver::phases::ID, clang::driver::phases::ID, {anonymous}::OffloadingActionBuilder::DeviceActionBuilder::PhasesTy&): Assertion `CurPhase < phases::Backend && "Generating single CUDA " "instructions should only occur " "before the backend phase!"' failed.

I tried several combinations but no avail!

Any suggestions?

Thank you.

Sincerely,
Guru

Reid Kleckner via llvm-dev

unread,
Oct 13, 2016, 5:29:58 PM10/13/16
to Gurunath Kadam, cfe-dev, Justin Lebar, Artem Belevich
Moving to cfe-dev

+Art and Justin

_______________________________________________
LLVM Developers mailing list
llvm...@lists.llvm.org
http://lists.llvm.org/cgi-bin/mailman/listinfo/llvm-dev


Reply all
Reply to author
Forward
0 new messages