[LLVMdev] [RFC] Upstreaming LLVM/SPIR-V converter

Pierre-Andre Saulais pasaulais at gmail.com
Tue May 19 02:45:21 PDT 2015


Indeed, SPIR-V not being a target would prevent using clang to generate 
SPIR-V (which target triple would be used?) On the other hand, maybe it 
would be possible to have a clang target without a corresponding LLVM 
target. I'm not familiar with the target machinery in clang so I don't 
know if it would work or not.

Either way, I don't think any LLVM tool should output SPIR-V directly, 
except maybe a simple conversion tool between the two IRs.

Pierre-Andre

On 19/05/15 09:25, Neil Henning wrote:
> The problem is - as Sean and Pete (and others before) have pointed 
> out, from a users perspective they'll want to say 'clang make me 
> SPIR-V'. There are things in SPIR-V that are not representable by the 
> LLVM IR, so we'd have to add SPIR-V specific intrinsics for this 
> (again making the case for having it as a target more palatable), and 
> also there are things in the IR that won't be allowed when producing 
> SPIR-V (off the top of my head, in a graphics shader with logical 
> addressing mode a ton of pointer use is banned).
>
> I think what Sean suggested of having a very thin backend that 
> satisfies what a user will want when producing SPIR-V + setting up the 
> target specific intrinsics, and then the majority of the actual SPIR-V 
> production code being in lib/SPIRV sounds like a good approach to me!
>
> Cheers,
> -Neil.
>
> On 19/05/15 00:24, Owen Anderson wrote:
>>
>>> On May 18, 2015, at 2:09 PM, Sean Silva <chisophugis at gmail.com 
>>> <mailto:chisophugis at gmail.com>> wrote:
>>>
>>> From an end-user's perspective it sounds like the use case for 
>>> SPIR-V though is a lot more similar to a target though. E.g. the 
>>> user is notionally telling clang "target SPIR-V" (including doing 
>>> any IR optimizations, any special "codegenprepare" special passes, 
>>> etc.), rather than "act like you're targeting X, but 
>>> -emit-llvm/-emit-spirv instead" (which is what I imagine from a 
>>> component purely in lib/SPIRV).
>>>
>>
>> SPIR-V is a serialization format between the user’s frontend and the 
>> vendor’s backend.  From the user’s perspective, it looks like a 
>> target.  From the vendor’s perspective, it looks like a frontend.  In 
>> this sense, it is very comparable to LLVM bitcode itself.
>>
>> —Owen
>>
>>
>> _______________________________________________
>> LLVM Developers mailing list
>> LLVMdev at cs.uiuc.edu          http://llvm.cs.uiuc.edu
>> http://lists.cs.uiuc.edu/mailman/listinfo/llvmdev
>
>
>
> _______________________________________________
> LLVM Developers mailing list
> LLVMdev at cs.uiuc.edu         http://llvm.cs.uiuc.edu
> http://lists.cs.uiuc.edu/mailman/listinfo/llvmdev

-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.llvm.org/pipermail/llvm-dev/attachments/20150519/da0d8dd8/attachment.html>


More information about the llvm-dev mailing list