On 11/13/2015 02:46 PM, Hans de Goede wrote:
Hi All,

Hey Hans,


So as discussed I've started working on a TGSI backend for
llvm to use as a way to get compute going on nouveau (and other gpu-s).

I'm still learning all the ins and outs of llvm so I do not have
much to show yet.

I've rebased Francisco's (curro's) latest version on top of llvm
trunk, and added a commit on top to actual get it build with the
latest trunk. So currently I'm at the point where I've just
taken Francisco's code, and made it compile, no more and no less.

I have a git repo with this work available here:

http://cgit.freedesktop.org/~jwrdegoede/llvm/

Thanks for sharing your work. :-)


So the next step would be to test this and see if it actually
does anything, questions:

1) Does anyone have a simple test case / command where I can
invoke just llvm and get TGSI asm output to check ?

2) Assuming I get the above to (somewhat) work, is there a
way to make llvm show the output of the various intermediate
passes in a human readable form ?

Basically, you need to ask Clang to emit LLVM code for you, for example, this command will emit LLVM IR:

clang -cc1 -cl-std=CL1.2 -emit-llvm -triple spir64-unknown-unknown kernel.cl

Note that this command only works with an old LLVM version (I don't remember exactly).

But in your case, and for that TGSI backend, I don't think there is a -emit-tgsi option which can directly output TGSI from OpenCL.

The other way, and in my opinion the best, is to write a little C++ program based on Clang/LLVM API for generating TGSI code. To do that, you can have a look at src/gallium/state_trackers/clover/llvm/invocation.cpp which contains an example (but it seems to be outdated).

Basically, you need to call that CompilerInvocation object with some parameters and all the stuff around. This should not take more than 100LOC in my opinion. I think the first step should be to emit LLVM IR before trying to get TGSI working.

I could write that program for you if you want but I don't think to have time to do it during this weekend.

Thanks.


Regards,

Hans

--
-Samuel
_______________________________________________
mesa-dev mailing list
mesa-dev@lists.freedesktop.org
http://lists.freedesktop.org/mailman/listinfo/mesa-dev

Reply via email to