Status of PTX Backend

I read on the archives that a PTX back-end was discussed around August and I see that some initial code has been checked into LLVM trunk. What is the status of this project? Is it being actively worked on?

I am ultimately interested in using LLVM for GPU code optimization/generation and am very interested in this particular project.

Hi Justin,

I am upstreaming the PTX backend.
My plan is to have a working prototype (that mean you may compile
non-trivial code with some workarounds) by the end of this year or by
January 2011.
I hope I could catch up next release of LLVM (version 2.9), so I will
adjust my plan according to the release schedule once it is announced.



The PTX backend we developed (CBackend approach, does not use the target independent code generator) is already more advanced.
An older version is published here: PTX Backend for LLVM download |

We recently eliminated a bug which increased the number of required registers per thread. Surprisingly, without that bug the generated code is already comparable to code generated by the official nvcc copiler. Of cause the nvcc compiler is superior in a lot of cases, however only by a small margin. And there are even cases(e.g. a phong surface shader) where our PTX backend is faster, without any particular optimization! It seems like the NVIDIA driver does a good job at late optimizations liker register allocation etc. I can give you some numbers if you are intrested.
I'll push the newest version of the backend to sourceforge during the next days.

What kind of optimizations are you planning to do? If you want to apply high level (on llvm bitcode) optimizations, you can start with our PTX backend and shwitch over to the new backend approach later on (If it turns out that the new approach is really faster).

best, Helge


Thanks for the link. I was able to get it to build against the LLVM SVN revision listed in the README file. I’ve only run some simple tests through it, but it seems to be working. Is this backend still being actively worked on? Is there an effort to get it to work with LLVM 2.8?


I am very interested in this project. Are you re-coding and upstreaming an existing version, or is it currently being written from scratch? If you would like some help, I would be willing to put some time into this.


Justin Holewinski