[llvm-dev] SPIRV-LLVM as an external tool
Anastasia Stulova via llvm-dev
llvm-dev at lists.llvm.org
Tue Feb 27 05:07:43 PST 2018
> 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.
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
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.llvm.org/pipermail/llvm-dev/attachments/20180227/bffdd226/attachment.html>
More information about the llvm-dev
mailing list