Che-Liang Chiou
2010-Aug-06 22:47 UTC
[LLVMdev] Upstream PTX backend that uses target independent code generator if possible
Hi there, I have a working prototype of PTX backend, and I would like to upstream it if possible. This backend is implemented by LLVM's target independent code generator framework; I think this will make it easier to maintain. I have tested this backend to translate a work-efficient parallel scan kernel ( http://http.developer.nvidia.com/GPUGems3/gpugems3_ch39.html ) into PTX code. The generated PTX code was then executed on real hardware, and the result is correct. So far I have to hack clang to generate bitcode for this backend, but I will try to patch clang to parse CUDA (or OpenCL) while I am upstreaming this backend. I am new to LLVM. Any comments are welcome. Regards, Che-Liang
Michael Spencer
2010-Aug-07 09:57 UTC
[LLVMdev] Upstream PTX backend that uses target independent code generator if possible
On Fri, Aug 6, 2010 at 6:47 PM, Che-Liang Chiou <clchiou at gmail.com> wrote:> Hi there, > > I have a working prototype of PTX backend, and I would like to > upstream it if possible. This backend is implemented by LLVM's target > independent code generator framework; I think this will make it easier > to maintain. > > I have tested this backend to translate a work-efficient parallel scan > kernel ( http://http.developer.nvidia.com/GPUGems3/gpugems3_ch39.html > ) into PTX code. The generated PTX code was then executed on real > hardware, and the result is correct. > > So far I have to hack clang to generate bitcode for this backend, but > I will try to patch clang to parse CUDA (or OpenCL) while I am > upstreaming this backend.Clang already has an OpenCL front end, but I don't know what it would take to make it work with your backend (I'm assuming there're quite a few intrinsics that have to be dealt with).> I am new to LLVM. Any comments are welcome.The GPU and multiprocessor possibilities are one of the many things that have interested me in LLVM, and it's great to see someone working on that. I'm rather new here my self, so really the only other question I have is is the code currently hosted anywhere to look at?> Regards, > Che-Liang
Che-Liang Chiou
2010-Aug-09 18:48 UTC
[LLVMdev] Upstream PTX backend that uses target independent code generator if possible
Hi Michael, Sorry for late reply. I didn't check mail on last weekend. On Sat, Aug 7, 2010 at 2:57 AM, Michael Spencer <bigcheesegs at gmail.com> wrote:> Clang already has an OpenCL front end, but I don't know what it would > take to make it work with your backend (I'm assuming there're quite a > few intrinsics that have to be dealt with).Cool. I will try that later.> The GPU and multiprocessor possibilities are one of the many things > that have interested me in LLVM, and it's great to see someone working > on that.Thanks.> I'm rather new here my self, so really the only other question I have > is is the code currently hosted anywhere to look at?I didn't put code on the web. Sorry. Regards. Che-Liang
David A. Greene
2010-Aug-09 22:25 UTC
[LLVMdev] Upstream PTX backend that uses target independent code generator if possible
Che-Liang Chiou <clchiou at gmail.com> writes:> Hi there, > > I have a working prototype of PTX backend, and I would like to > upstream it if possible. This backend is implemented by LLVM's target > independent code generator framework; I think this will make it easier > to maintain.How does this relate, at all, to the backend here: http://sourceforge.net/projects/llvmptxbackend/ If they are unrelated, can you do a comparison of the two? Perhaps there are holes in each that can be filled by the other. It would be a shame to have two completely different PTX backends.> I have tested this backend to translate a work-efficient parallel scan > kernel ( http://http.developer.nvidia.com/GPUGems3/gpugems3_ch39.html > ) into PTX code. The generated PTX code was then executed on real > hardware, and the result is correct.How much of the LLVM IR does this support? What's missing?> So far I have to hack clang to generate bitcode for this backend, but > I will try to patch clang to parse CUDA (or OpenCL) while I am > upstreaming this backend.I think it's a lot of work to do CUDA support for not much benefit. The OpenMP committee is working on accelerator directives and that's the better long-term approach, IMHO. Clang/LLVM would be a great vehicle to generate/test ideas for such directives. http://openmp.org/wp/ http://www.pgroup.com/lit/articles/insider/v2n2a5.htm -Dave
Che-Liang Chiou
2010-Aug-10 00:01 UTC
[LLVMdev] Upstream PTX backend that uses target independent code generator if possible
Hi David, Thanks for asking. On Mon, Aug 9, 2010 at 3:25 PM, David A. Greene <greened at obbligato.org> wrote:> Che-Liang Chiou <clchiou at gmail.com> writes: > >> Hi there, >> >> I have a working prototype of PTX backend, and I would like to >> upstream it if possible. This backend is implemented by LLVM's target >> independent code generator framework; I think this will make it easier >> to maintain. > > How does this relate, at all, to the backend here: > > http://sourceforge.net/projects/llvmptxbackend/ > > If they are unrelated, can you do a comparison of the two? Perhaps > there are holes in each that can be filled by the other. It would be > a shame to have two completely different PTX backends. >I surfed their code, and it seems that they didn't use code generator. That means there design should be similar to CBackend or CPPBackend. So I guess it can't generate some machine instructions like MAD, and there are some PTX instruction set features that are hard to exploit if not using code generator. But I didn't study their code thoroughly, so I might be wrong about this.>> I have tested this backend to translate a work-efficient parallel scan >> kernel ( http://http.developer.nvidia.com/GPUGems3/gpugems3_ch39.html >> ) into PTX code. The generated PTX code was then executed on real >> hardware, and the result is correct. > > How much of the LLVM IR does this support? What's missing?Have to add some intrinsics, calling conventions, and address spaces. I would say these are relatively small changes.>> So far I have to hack clang to generate bitcode for this backend, but >> I will try to patch clang to parse CUDA (or OpenCL) while I am >> upstreaming this backend. > > I think it's a lot of work to do CUDA support for not much benefit. > The OpenMP committee is working on accelerator directives and that's > the better long-term approach, IMHO. Clang/LLVM would be a great > vehicle to generate/test ideas for such directives.Thanks for suggestion.> http://openmp.org/wp/ > http://www.pgroup.com/lit/articles/insider/v2n2a5.htm > > -DaveRegards, Che-Liang
Seemingly Similar Threads
- [LLVMdev] Upstream PTX backend that uses target independent code generator if possible
- [LLVMdev] Upstream PTX backend that uses target independent code generator if possible
- [LLVMdev] Upstream PTX backend that uses target independent code generator if possible
- [LLVMdev] Upstream PTX backend that uses target independent code generator if possible
- [LLVMdev] PTX backend, BSD license