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

Sean Silva
Mon, 18 May 2015 21:09:33 -0000

On Sun, May 17, 2015 at 12:13 AM, Owen Anderson <resistor at mac.com>
wrote:

>
> On May 16, 2015, at 12:21 PM, Liu, Yaxun (Sam) <Yaxun.Liu at amd.com>
wrote:
>
> I am thinking maybe the functionality of the bi-way conversion can be kept
> at llvm/lib/Bitcode/SPIRV, which will facilitate OpenCL vendors to do
> conversions between LLVM and SPIR-V. On the other hand, we create a
> llvm/Target/SPIR-V, which uses llvm/lib/Bitcode/SPIRV to generate SPIR-V.
> The SPIR-V target allows Clang and other LLVM front ends to target generic
> OpenCL/Vulkan platforms.
>
>
> I don’t think Chris was suggesting lib/Bitcode/SPIRV.  That wouldn’t make
> a lot of sense, since Bitcode != SPIR-V.
>
> FWIW, I agree with Chris that it makes sense as a parallel to
> lib/Bitcode.  SPIR-V is (almost) an alternate encoding of LLVM IR, with a
> few things added/removed, and it makes sense to treat it in a similar
> manner to our normal serialization format.
>
>
>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).

So it sounds like having some "target-like" component for SPIR-V will
be
necessary to ease integration with regular clang flow. It might be that we
have generic SPIR-V support factored out into lib/SPIRV, and then
lib/Target/SPIRV for the logic that integrates with clang.

-- Sean Silva


> —Owen
>
> _______________________________________________
> 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/20150518/4643dce5/attachment.html>