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

Reid Kleckner rnk at google.com
Fri May 15 12:53:32 PDT 2015


On Fri, May 15, 2015 at 11:50 AM, David Chisnall <
David.Chisnall at cl.cam.ac.uk> wrote:

> On 15 May 2015, at 17:53, Chris Bieneman <beanz at apple.com> wrote:
> >
> > +1 to lib/Target/SPIRV/(Reader|Writer)
> >
> > I really like this idea. I’ve talked with some people on both the LLVM
> and Khronos sides and I really think adding SPIR-V support to LLVM as an
> optional program serialization format would be fantastic. I think it would
> make it even easier for LLVM-based tools to be integrated into GPU
> authoring and execution pipelines.
>
> Agreed.  Unlike HSAIL, SPIR-V looks like a very sane design and having an
> in-tree serialisation format that’s stable across LLVM versions is likely
> to make SPIR-V useful for a number of things outside of its initial scope.
>

I want to point out that being stable across LLVM versions means that LLVM
will be able to express things that SPIRV cannot. Any new IR feature we add
to LLVM may not be expressable in SPIRV. EH landingpads, for example, are
probably not supported by SPIRV and must be stripped or rejected.

So, the process of writing SPIRV will strip, lower, or reject some LLVM IR
bits. However, roundtripping IR through SPIRV should probably be
idempotent. The first translation will change the program, but repeating
the roundtrip should produce the same IR and SPIRV from then on. If that's
achievable, then I agree, this is definitely a serialization format and not
something lower-level (x86) or higher-level (C).

Sounds useful. :)
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.llvm.org/pipermail/llvm-dev/attachments/20150515/940fe2b9/attachment.html>


More information about the llvm-dev mailing list