[llvm-dev] SPIRV-LLVM as an external tool

ORiordan, Martin via llvm-dev llvm-dev at lists.llvm.org
Wed Feb 28 05:44:47 PST 2018


I expect that if the converter is formally added as an LLVM project, that it will always be able to accept and produce the version of LLVM-IR for the release of LLVM it is aligned with.

However, I would also like to know if it will be able to accept LLVM-IR from previous releases of LLVM, and if so, what is the earliest version that it is likely to accept?  We have some dependencies on accepting LLVM-IR previously generated by earlier versions of LLVM such as v3.4 and v3.7, so the ability of the tool to accept earlier versions is quite important.

The ability to emit older versions of LLVM-IR is not so important to us though, but it could be a useful capability.

Thanks,

    MartinO

-----Original Message-----
From: llvm-dev [mailto:llvm-dev-bounces at lists.llvm.org] On Behalf Of Tom Stellard via llvm-dev
Sent: Tuesday, February 27, 2018 6:25 PM
To: Anastasia Stulova <Anastasia.Stulova at arm.com>; Tomeu Vizoso <tomeu.vizoso at collabora.com>; llvm-dev at lists.llvm.org
Cc: nd <nd at arm.com>
Subject: Re: [llvm-dev] SPIRV-LLVM as an external tool

On 02/27/2018 05:07 AM, Anastasia Stulova wrote:
>> SPIR-V does not have to be a part of LLVM for you to do this.  You 
>> can add the SPIR-V target to clang and then define a SPIR-V toolchain 
>> (i.e. clang/Driver/Toolchains) that uses the external tool to translate LLVM IR to SPIR-V.
> 
> 
> Ok. I guess if Clang community accepts this way, it would be better to set up the SPIRV converter as a tool of LLVM.
> 
> So the question is are there any downsides of this? Or would anyone object if we add the converter to the LLVM project as an optional tool? We would of course take care of configuring and maintaining it ourselves.

There is no requirement that the tool needs to be an official part of the LLVM project to implement to use it this way  For example, the cuda toolchain in clang relies on a few proprietary tools from NVIDIA.

I think too much emphasis is being placed on having this tool be part of the LLVM project.  This is a fine goal, but at this point the focus should be on consolidating development on a single SPIR-V <-> LLVM code base.  Pierre has posted the link to one version of the tool, but it's still not clear, at least to me, if a) this is what is being proposed to be added as an official LLVM project and b) if this is the tool that Khronos members want to push forward.

-Tom

 

> 
> Cheers,
> Anastasia
> 
> ----------------------------------------------------------------------
> ----------------------------------------------------------------------
> ----------------------------------------------------------------------
> ----------------------------------------------------------------------
> ----------------------------------------------------------------------
> ----------------------------------------------------------------------
> ----------------------------------------------------------------------
> ----------------------------------------------------------------------
> ----------------------------------------------------------------------
> ----------------------------------------------------------------------
> ----------------------------------------------------------------------
> ----------------------------------------------------------------------
> ----------------------------------------------------------------------
> ----------------------------------------------------------------------
> ----------
> *From:* Tom Stellard <tstellar at redhat.com>
> *Sent:* 26 February 2018 17:37
> *To:* Anastasia Stulova; Tomeu Vizoso; llvm-dev at lists.llvm.org
> *Cc:* nd
> *Subject:* Re: [llvm-dev] SPIRV-LLVM as an external tool
>  
> On 02/26/2018 09:25 AM, Anastasia Stulova wrote:
>> 
>>> This is great to see.  Is this code the basis of the forks that 
>>> Anastasia
>> talked about or did those come from somewhere else?
>> 
>> 
>> Yes, indeed the base is https://github.com/KhronosGroup/SPIRV-LLVM/ and then there are multiple forks that include some rework as well (some of which were announced on the LLVM channels). I think the biggest problems we are trying to solve is:
>> 
>> 1. Keeping up to date with the LLVM code base development.
>> 
>> 2. Providing unified common place for everyone to contribute their changes.
>> 
>> Now there are two extra goals that are more related to Clang:
>> 
>> 3. Missing targets that can be used as an end binary (except for AMD GPU). Addind SPIRV to LLVM would allow Clang open source users to generate this portable binary format without going to any other toolchains that just integrate Clang. This is also a reason why we keep maintaining Clang in all the toolchains. Hopefully, people will start improving LLVM for GPU targets upstream because they will be able to use SPIRV available directly in LLVM to demonstate their issues/improvements.
>> 
> 
> SPIR-V does not have to be a part of LLVM for you to do this.  You can 
> add the SPIR-V target to clang and then define a SPIR-V toolchain 
> (i.e. clang/Driver/Toolchains) that uses the external tool to translate LLVM IR to SPIR-V.
> 
> -Tom
> 
>> 4. There is a plan for adding OpenCL C++ support that mandates 
>> generation of SPIRV. I started a thread on this last week: 
>> http://lists.llvm.org/pipermail/cfe-dev/2018-February/056972.html
>> 
>> So if for the goals (1) and (2) above, we could setup separate repository outside of LLVM and try to spread the information about it well enough that everyone starts using it. This won't help us with item (3) at all, and item (4) will be incomplete.
>> 
> 
> 
> 
>> Cheers,
>> Anastasia
>> 
>> 
>> 
>> ---------------------------------------------------------------------
>> ---------------------------------------------------------------------
>> ---------------------------------------------------------------------
>> ---------------------------------------------------------------------
>> ---------------------------------------------------------------------
>> ---------------------------------------------------------------------
>> ---------------------------------------------------------------------
>> ---------------------------------------------------------------------
>> ---------------------------------------------------------------------
>> ---------------------------------------------------------------------
>> ---------------------------------------------------------------------
>> ---------------------------------------------------------------------
>> ---------------------------------------------------------------------
>> ---------------------------------------------------------------------
>> ------------------------
>> *From:* llvm-dev <llvm-dev-bounces at lists.llvm.org> on behalf of Tom 
>> Stellard via llvm-dev <llvm-dev at lists.llvm.org>
>> *Sent:* 23 February 2018 20:28
>> *To:* Tomeu Vizoso; LLVM Developers
>> *Subject:* Re: [llvm-dev] SPIRV-LLVM as an external tool
>>  
>> On 02/21/2018 03:34 PM, Pierre Moreau wrote:
>>> On 2018-02-21 — 14:55, Tom Stellard via llvm-dev wrote:
>>>> On 02/21/2018 12:15 AM, Tomeu Vizoso via llvm-dev wrote:
>>>>> Hi,
>>>>>
>>>>> for a few months already I have been asking around for opinions on 
>>>>> how people could best work together on Khronos' SPIR-V <-> LLVM-IR 
>>>>> converter and some consensus seems to have formed.
>>>>>
>>>>> Most of the people I talked to favored having the converter become 
>>>>> an external tool within the LLVM project, similar to libclc. I 
>>>>> think that the LLVM project's processes, infrastructure and 
>>>>> community form the best place for this collaboration to happen.
>>>>>
>>>>> I hope that having the converter as part of LLVM can help expand 
>>>>> LLVM's value proposition in heterogeneous computing, in part by 
>>>>> complementing the OpenCL C backend in clang.
>>>>>
>>>>> Thus I would like to ask what the LLVM community needs to see from 
>>>>> us before SPIRV-LLVM can be accepted as an external tool, if at all.
>>>>>
>>>>
>>>> Does the external tool exist already?  I recommend starting by 
>>>> posting the code publicly and then ensuring that going forward all 
>>>> development and discussions about the tool are happening in a public space.
>>> 
>>> The code is publicly available at https://github.com/pierremoreau/llvm-spirv.
>>> It is based on https://github.com/KhronosGroup/SPIRV-LLVM/ and 
>>> https://github.com/thewilsonator/llvm-target-spirv/, stripped off of 
>>> everything not related to SPIR-V and updated to work with llvm HEAD.
>>> (Some of the commits were lost on the way, so we are in the process 
>>> of redoing the stripping and updating.)
>> 
>> This is great to see.  Is this code the basis of the forks that 
>> Anastasia talked about or did those come from somewhere else?
>> 
>> -Tom
>> 
>>> 
>>> One user of that external tool will be Mesa [1] (for its OpenCL 
>>> implementation named clover) for 1. enabling 
>>> clCreateProgramWithIL(KHR)? on AMD cards through clover, by
>>>    translating SPIR-V to LLVM IR; (patches under review [2]) 2. 
>>> allowing additional drivers (nouveau, freedreno, etnativ) to be supported by
>>>    clover, by compiling OpenCL C (via LLVM IR) to SPIR-V (and then translating
>>>    from SPIR-V to NIR).
>>> 
>>> Regards,
>>> Pierre
>>> 
>>> [1]: https://www.mesa3d.org/
>>> [2]: https://patchwork.freedesktop.org/series/38728/
>>> 
>>>> It's important to demonstrate that there is a developer community 
>>>> backing the tool and that it won't be abandoned if it is added as 
>>>> an llvm sub-project.
>>>>
>>>> -Tom
>>>>
>>>>> Thanks,
>>>>>
>>>>> Tomeu
>>>>> _______________________________________________
>>>>> LLVM Developers mailing list
>>>>> llvm-dev at lists.llvm.org
>>>>> http://lists.llvm.org/cgi-bin/mailman/listinfo/llvm-dev
>>>>
>>>> _______________________________________________
>>>> LLVM Developers mailing list
>>>> llvm-dev at lists.llvm.org
>>>> http://lists.llvm.org/cgi-bin/mailman/listinfo/llvm-dev
>> 
>> _______________________________________________
>> LLVM Developers mailing list
>> llvm-dev at lists.llvm.org
>> http://lists.llvm.org/cgi-bin/mailman/listinfo/llvm-dev
> 

_______________________________________________
LLVM Developers mailing list
llvm-dev at lists.llvm.org
http://lists.llvm.org/cgi-bin/mailman/listinfo/llvm-dev
--------------------------------------------------------------
Intel Research and Development Ireland Limited
Registered in Ireland
Registered Office: Collinstown Industrial Park, Leixlip, County Kildare
Registered Number: 308263


This e-mail and any attachments may contain confidential material for the sole
use of the intended recipient(s). Any review or distribution by others is
strictly prohibited. If you are not the intended recipient, please contact the
sender and delete all copies.


More information about the llvm-dev mailing list