Build PTX samples with LLVM/Clang/libclc

Previous Topic Next Topic
 
classic Classic list List threaded Threaded
3 messages Options
Reply | Threaded
Open this post in threaded view
|

Build PTX samples with LLVM/Clang/libclc

陳韋任 (Wei-Ren Chen)
Hi Justin,

  I download llvm-ptx-samples [1] and try to build them. I found it seems lack
of a complete document on how to build them with LLVM/Clang/libclc. Do you think
it's a good idea to put a complete document/tutorial in _one_ place? Currently,
there are your website [2], LLVM [3], Clang and libclc websites [5] over there.
I feel people might get lost among those websites. ;-)

  Here are my flows, hope it's useful to you. (At least [1] should be updated to
include libclc)

1. Build LLVM/Clang with PTX support.

2. Download your PTX samples and libclc, then build them. I guess you want to
   pull libclc under llvm-ptx-samples/libclc/, right?

---
$ git clone git://github.com/jholewinski/llvm-ptx-samples.git
$ cd llvm-ptx-samples; rm -rf libclc/
$ git clone git://git.pcc.me.uk/~peter/libclc.git
# Build libclc first
$ cd libclc/
$ ./configure.py --with-llvm-config=/path/to/llvm-config && make
# Then build your PTX samples
$ cd ../; make build; cd build
$ cmake ../
$ make
---

  O.K., I have a problem here.

[ 12%] Compiling blur2d_kernel.cl -> blur2d_kernel.ll
clang: error: no such file or directory: 'ptx32'
make[2]: *** [bin/blur2d_kernel.ll] Error 1
make[1]: *** [opencl/blur2d/CMakeFiles/blur2d_kernel.ptx.dir/all] Error 2

  Do you know how to fix it? Thanks.

[1] https://github.com/jholewinski/llvm-ptx-samples
[2] http://sites.google.com/site/justinholewinski/projects/llvm-ptx-back-end
[3] http://llvm.org/docs/ReleaseNotes.html#whatsnew
[4] http://clang.llvm.org/docs/ReleaseNotes.html#opencl
[5] http://www.pcc.me.uk/~peter/libclc/

Regards,
chenwj

--
Wei-Ren Chen (陳韋任)
Computer Systems Lab, Institute of Information Science,
Academia Sinica, Taiwan (R.O.C.)
Tel:886-2-2788-3799 #1667
Homepage: http://people.cs.nctu.edu.tw/~chenwj

_______________________________________________
LLVM Developers mailing list
[hidden email]         http://llvm.cs.uiuc.edu
http://lists.cs.uiuc.edu/mailman/listinfo/llvmdev
Reply | Threaded
Open this post in threaded view
|

Re: Build PTX samples with LLVM/Clang/libclc

Justin Holewinski-2
On Tue, Dec 6, 2011 at 10:17 PM, 陳韋任 <[hidden email]> wrote:
Hi Justin,

 I download llvm-ptx-samples [1] and try to build them. I found it seems lack
of a complete document on how to build them with LLVM/Clang/libclc. Do you think
it's a good idea to put a complete document/tutorial in _one_ place? Currently,
there are your website [2], LLVM [3], Clang and libclc websites [5] over there.
I feel people might get lost among those websites. ;-)

I agree.  I'm just not sure how these projects fit in with LLVM as a whole.  LLVM does not really have a "samples" project, and these are very specific in their use-case.
 

 Here are my flows, hope it's useful to you. (At least [1] should be updated to
include libclc)

1. Build LLVM/Clang with PTX support.

2. Download your PTX samples and libclc, then build them. I guess you want to
  pull libclc under llvm-ptx-samples/libclc/, right?

---
$ git clone git://github.com/jholewinski/llvm-ptx-samples.git
$ cd llvm-ptx-samples; rm -rf libclc/
$ git clone git://git.pcc.me.uk/~peter/libclc.git
# Build libclc first
$ cd libclc/
$ ./configure.py --with-llvm-config=/path/to/llvm-config && make
# Then build your PTX samples
$ cd ../; make build; cd build
$ cmake ../
$ make
---


libclc is a submodule of the llvm-ptx-samples repo.  Therefore, the flow is simple:

$ cd llvm-ptx-samples
$ git submodule init
$ git submodule update

I'll update the documentation to reflect this.

Also, the libclc configuration is not necessary.  Only some header files are pulled in by the samples.
 
 O.K., I have a problem here.

[ 12%] Compiling blur2d_kernel.cl -> blur2d_kernel.ll
clang: error: no such file or directory: 'ptx32'
make[2]: *** [bin/blur2d_kernel.ll] Error 1
make[1]: *** [opencl/blur2d/CMakeFiles/blur2d_kernel.ptx.dir/all] Error 2

 Do you know how to fix it? Thanks.

That's a new one.  I just tried a fresh clone and build, and did not experience this issue.

Can you run "make VERBOSE=1" and post the compiler command-line?


[1] https://github.com/jholewinski/llvm-ptx-samples
[2] http://sites.google.com/site/justinholewinski/projects/llvm-ptx-back-end
[3] http://llvm.org/docs/ReleaseNotes.html#whatsnew
[4] http://clang.llvm.org/docs/ReleaseNotes.html#opencl
[5] http://www.pcc.me.uk/~peter/libclc/

Regards,
chenwj

--
Wei-Ren Chen (陳韋任)
Computer Systems Lab, Institute of Information Science,
Academia Sinica, Taiwan (R.O.C.)
Tel:886-2-2788-3799 #1667
Homepage: http://people.cs.nctu.edu.tw/~chenwj



--

Thanks,

Justin Holewinski


_______________________________________________
LLVM Developers mailing list
[hidden email]         http://llvm.cs.uiuc.edu
http://lists.cs.uiuc.edu/mailman/listinfo/llvmdev
Reply | Threaded
Open this post in threaded view
|

Re: Build PTX samples with LLVM/Clang/libclc

陳韋任 (Wei-Ren Chen)
> I agree.  I'm just not sure how these projects fit in with LLVM as a whole.
>  LLVM does not really have a "samples" project, and these are very specific
> in their use-case.

  I mean maintaining a document about PTX and its samples in one place so that
people won't get lost among those website.

> libclc is a submodule of the llvm-ptx-samples repo.  Therefore, the flow is
> simple:
>
> $ git clone git://github.com/jholewinski/llvm-ptx-samples
> $ cd llvm-ptx-samples
> $ git submodule init
> $ git submodule update

  That's simple. I'm still learning how to git. :)

> >  O.K., I have a problem here.
> >
> > [ 12%] Compiling blur2d_kernel.cl -> blur2d_kernel.ll
> > clang: error: no such file or directory: 'ptx32'
> > make[2]: *** [bin/blur2d_kernel.ll] Error 1
> > make[1]: *** [opencl/blur2d/CMakeFiles/blur2d_kernel.ptx.dir/all] Error 2
> >
> >  Do you know how to fix it? Thanks.
> >
>
> That's a new one.  I just tried a fresh clone and build, and did not
> experience this issue.
>
> Can you run "make VERBOSE=1" and post the compiler command-line?

  Sorry, I delete the problematic source directory and cannot reproduce it. :/
`git submodule` works fine. Thanks! :)

Regards,
chenwj

--
Wei-Ren Chen (陳韋任)
Computer Systems Lab, Institute of Information Science,
Academia Sinica, Taiwan (R.O.C.)
Tel:886-2-2788-3799 #1667
Homepage: http://people.cs.nctu.edu.tw/~chenwj

_______________________________________________
LLVM Developers mailing list
[hidden email]         http://llvm.cs.uiuc.edu
http://lists.cs.uiuc.edu/mailman/listinfo/llvmdev