Hi, I wanted to ask whether there is ongoing effort (or an already established tool) that enables to convert CUDA kernels (that uses CUDA specific intrinsics, e.g., threadId.x, __syncthreads(), ...) to LLVM IR. I am aware that I can do this for OpenCL with the help of libclc but I can not find something similar for CUDA. Thanks -------------- next part -------------- An HTML attachment was scrubbed... URL: <http://lists.llvm.org/pipermail/llvm-dev/attachments/20150408/8d0c6590/attachment.html>
A tool of this kind here: https://github.com/apc-llc/nvcc-llvm-ir 2015-04-08 19:01 GMT+02:00 Ahmed ElTantawy <ahmede at ece.ubc.ca>:> Hi, > > I wanted to ask whether there is ongoing effort (or an already established > tool) that enables to convert CUDA kernels (that uses CUDA specific > intrinsics, e.g., threadId.x, __syncthreads(), ...) to LLVM IR. I am aware > that I can do this for OpenCL with the help of libclc but I can not find > something similar for CUDA. > > Thanks > > _______________________________________________ > LLVM Developers mailing list > LLVMdev at cs.uiuc.edu http://llvm.cs.uiuc.edu > http://lists.cs.uiuc.edu/mailman/listinfo/llvmdev > >-------------- next part -------------- An HTML attachment was scrubbed... URL: <http://lists.llvm.org/pipermail/llvm-dev/attachments/20150408/87e91b65/attachment.html>
There's been a discussion about it on the Clang mailing list (cfe-dev@) just this week - please take a look there Eli On Wed, Apr 8, 2015 at 10:01 AM, Ahmed ElTantawy <ahmede at ece.ubc.ca> wrote:> Hi, > > I wanted to ask whether there is ongoing effort (or an already established > tool) that enables to convert CUDA kernels (that uses CUDA specific > intrinsics, e.g., threadId.x, __syncthreads(), ...) to LLVM IR. I am aware > that I can do this for OpenCL with the help of libclc but I can not find > something similar for CUDA. > > Thanks > > _______________________________________________ > LLVM Developers mailing list > LLVMdev at cs.uiuc.edu http://llvm.cs.uiuc.edu > http://lists.cs.uiuc.edu/mailman/listinfo/llvmdev > >-------------- next part -------------- An HTML attachment was scrubbed... URL: <http://lists.llvm.org/pipermail/llvm-dev/attachments/20150408/76e982fc/attachment.html>
On Wed, Apr 8, 2015 at 10:12 AM, Dmitry Mikushin <dmitry at kernelgen.org> wrote:> A tool of this kind here: https://github.com/apc-llc/nvcc-llvm-ir > > 2015-04-08 19:01 GMT+02:00 Ahmed ElTantawy <ahmede at ece.ubc.ca>: > >> Hi, >> >> I wanted to ask whether there is ongoing effort (or an already >> established tool) that enables to convert CUDA kernels (that uses CUDA >> specific intrinsics, e.g., threadId.x, __syncthreads(), ...) to LLVM IR. I >> am aware that I can do this for OpenCL with the help of libclc but I can >> not find something similar for CUDA. >> >> Thanks >> >> _______________________________________________ >> LLVM Developers mailing list >> LLVMdev at cs.uiuc.edu http://llvm.cs.uiuc.edu >> http://lists.cs.uiuc.edu/mailman/listinfo/llvmdev >> >> > > _______________________________________________ > > >There is no any "License" file in your GitHub repository . Will it be included ? Thank you very much . Mehmet Erol Sanliturk -------------- next part -------------- An HTML attachment was scrubbed... URL: <http://lists.llvm.org/pipermail/llvm-dev/attachments/20150408/79e6dd21/attachment.html>
Hi Eli, Could you please point me to the exact thread ? I skimmed through the titles sent on April and nothing looked related. Thanks a lot On Wed, Apr 8, 2015 at 10:19 AM, Eli Bendersky <eliben at google.com> wrote:> There's been a discussion about it on the Clang mailing list (cfe-dev@) > just this week - please take a look there > > Eli > > On Wed, Apr 8, 2015 at 10:01 AM, Ahmed ElTantawy <ahmede at ece.ubc.ca> > wrote: > >> Hi, >> >> I wanted to ask whether there is ongoing effort (or an already >> established tool) that enables to convert CUDA kernels (that uses CUDA >> specific intrinsics, e.g., threadId.x, __syncthreads(), ...) to LLVM IR. I >> am aware that I can do this for OpenCL with the help of libclc but I can >> not find something similar for CUDA. >> >> Thanks >> >> _______________________________________________ >> LLVM Developers mailing list >> LLVMdev at cs.uiuc.edu http://llvm.cs.uiuc.edu >> http://lists.cs.uiuc.edu/mailman/listinfo/llvmdev >> >> >-------------- next part -------------- An HTML attachment was scrubbed... URL: <http://lists.llvm.org/pipermail/llvm-dev/attachments/20150408/23972145/attachment.html>
Hi Dmitry,
I tried using the tool you pointed me to and run into a problem, you may be
able to help.
Here is what I did:
- I installed (i.e., downloaded and built) LLVM 3.2 as it seems that this
is the version that is compatible with the tool.
- I changed the hard-coded paths in the nvcc-llvm-ir/makefile as follows
(changes are in bold)
libcicc.so: cicc.cpp
g++ -g -O3 -D__STDC_LIMIT_MACROS -D__STDC_CONSTANT_MACROS
*-I/$LLVM_BUILD_DIR/include/
-I/$CUDA_5.5_BUILD_DIR/nvvm/include/* -fPIC $< -shared -o $@ -ldl
*-L/$LLVM_BUILD_DIR/Release+Asserts/lib/
*-Wl,--start-group -lLLVMCore -lLLVMSupport -lLLVMipo -lLLVMipa
-lLLVMAnalysis -lLLVMTarget -lLLVMScalarOpts -lLLVMTransformUtils
-lLLVMInstCombine -Wl,--end-group -lpthread
libnvcc.so: nvcc.cpp
g++ -g -O3 -I/*$CUDA_5.5_BUILD_DIR*/nvvm/include/ -fPIC $< -shared
-o $@ -ldl
-I noticed that some of the required header files from LLVM exists in
*-I/$LLVM_SRC_DIR/include/
*and others are auto-generated into *-I/$LLVM_BUILD_DIR/include/ *so I had
to manually move them to one folder for the make to compiler properly (I
moved them to the build directory).
-It compiles fine and both libcicc.so and libnvcc.so are generated.
- Finally, when I try to run 'CICC_MODIFY_UNOPT_MODULE=1
LD_PRELOAD=./libnvcc.so nvcc -arch=sm_23 test1.cu -c -keep' , it gives
a *Segmentation
fault*.
In fact doing "export LD_PRELOAD=./libnvcc.so" was enough to make the
terminal Segfault with any other command !!! (e.g., it segfault when
simply doing "ls" if LD_PRELOAD is exported)
Any idea what is the problem ?
This is my OS info:
Distributor ID: SUSE LINUX
Description: openSUSE 11.4 (x86_64)
Release: 11.4
Codename: Celadon
On Wed, Apr 8, 2015 at 10:12 AM, Dmitry Mikushin <dmitry at kernelgen.org>
wrote:
> A tool of this kind here: https://github.com/apc-llc/nvcc-llvm-ir
>
> 2015-04-08 19:01 GMT+02:00 Ahmed ElTantawy <ahmede at ece.ubc.ca>:
>
>> Hi,
>>
>> I wanted to ask whether there is ongoing effort (or an already
>> established tool) that enables to convert CUDA kernels (that uses CUDA
>> specific intrinsics, e.g., threadId.x, __syncthreads(), ...) to LLVM
IR. I
>> am aware that I can do this for OpenCL with the help of libclc but I
can
>> not find something similar for CUDA.
>>
>> Thanks
>>
>> _______________________________________________
>> LLVM Developers mailing list
>> LLVMdev at cs.uiuc.edu http://llvm.cs.uiuc.edu
>> http://lists.cs.uiuc.edu/mailman/listinfo/llvmdev
>>
>>
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL:
<http://lists.llvm.org/pipermail/llvm-dev/attachments/20150408/98f77392/attachment.html>