[Mesa-dev] llvm TGSI backend (WIP) questions

Hans de Goede hdegoede at redhat.com
Mon Nov 16 06:33:30 PST 2015


Hi,

On 13-11-15 19:51, Tom Stellard wrote:
> On Fri, Nov 13, 2015 at 02:46:52PM +0100, Hans de Goede wrote:
>> Hi All,
>>
>> 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/
>>
>> 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 ?
>>
>
> The easiest way to do this is with the llc tool which ships with llvm.
> It compiles LLVM IR to target code, which in this case is tgsi.
> I would recommend taking one of the simple examples from
> test/CodeGen/AMDGPU (you may need to get these from llvm trunk, not sure
> what llvm version you are using).
>
> To use llc:
>
> llc -march=tgsi input.ll -o -
>
>
> This will output TGSI.
>
>
> If you want to use clang to compile OpenCL C kernels to clang you will
> need to teach clang about the TGSI target by implementing the a
> sub-class of TargetInfo in lib/Basic/Targets.cpp.  Look at the
> AMDGPU target for examples, but I recommend starting with llc.
>
>> 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 ?
>>
>
> You can pass -print-before-all or -print-after-all to dump the
> intermediate forms.

Thanks this is exactly what I was looking for. I'll send another
status update when I've something worthwhile to report :)

Regards,

Hans


More information about the mesa-dev mailing list