I am already successfully generating SPIR-V with a forward port of Khronos’ SPIR-V LLVM. What does one need in order to generate SPIR? From what I gather it is based on a specific LLVM IR version (3.4?) with a bunch of metadata. Is it possible to generate SPIR from LLVM trunk? If so how? Thanks Nic -------------- next part -------------- An HTML attachment was scrubbed... URL: <http://lists.llvm.org/pipermail/llvm-dev/attachments/20171202/df1a67bf/attachment.html>
For SPIR 1.2 you can use this repo + the instructions in it https://github.com/KhronosGroup/SPIR I don't believe there is a way to generate SPIR from LLVM trunk. Cheers, -Neil. On 2017-12-02 00:23, Nicholas Wilson via llvm-dev wrote:> I am already successfully generating SPIR-V with a forward port of > Khronos’ SPIR-V LLVM. What does one need in order to generate SPIR? > > From what I gather it is _based on_ a specific LLVM IR version (3.4?) > with a bunch of metadata. > Is it possible to generate SPIR from LLVM trunk? If so how? > > Thanks > Nic > _______________________________________________ > LLVM Developers mailing list > llvm-dev at lists.llvm.org > http://lists.llvm.org/cgi-bin/mailman/listinfo/llvm-dev
That really should change, at least for SPIR-V. Cheers, Jakob. On Tue, Dec 19, 2017 at 2:03 PM, Neil Henning via llvm-dev <llvm-dev at lists.llvm.org> wrote:> For SPIR 1.2 you can use this repo + the instructions in it > https://github.com/KhronosGroup/SPIR > > I don't believe there is a way to generate SPIR from LLVM trunk. > > Cheers, > -Neil. > > On 2017-12-02 00:23, Nicholas Wilson via llvm-dev wrote: >> >> I am already successfully generating SPIR-V with a forward port of >> Khronos’ SPIR-V LLVM. What does one need in order to generate SPIR? >> >> From what I gather it is _based on_ a specific LLVM IR version (3.4?) >> with a bunch of metadata. >> Is it possible to generate SPIR from LLVM trunk? If so how? >> >> Thanks >> Nic >> _______________________________________________ >> 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
>>>>> On Tue, 19 Dec 2017 14:03:01 +0000, Neil Henning via llvm-dev <llvm-dev at lists.llvm.org> said:Neil> For SPIR 1.2 you can use this repo + the instructions in it Neil> https://github.com/KhronosGroup/SPIR Neil> I don't believe there is a way to generate SPIR from LLVM Neil> trunk. Well, I guess there are some companies like Codeplay with this in house, but it is not open-source... If you use the current Clang/LLVM to generate SPIR from OpenCL, it will generate actualy a SPIR-ish output (what I call SPIR "de facto"), basically something that looks like SPIR but that is actually not compliant, since SPIR 1.2 standard states that it has to be based on LLVM 3.2 IR and SPIR 2.0 has to be based on LLVM 3.4 IR. Interestingly, the LLVM metadata are generated by... Clang in tools/clang/lib/CodeGen/CodeGenFunction.cpp by clang::CodeGen::CodeGenFunction::EmitOpenCLKernelMetadata when compiling OpenCL. Inside triSYCL https://github.com/triSYCL/triSYCL (a prototype for SYCL, the single-source modern C++ standard from Khronos on top of OpenCL) I have a hack for LLVM 3.9 to generate some SPIR "de-facto" directly at the LLVM level, since I do not use the Clang OpenCL front-end. Look at https://github.com/triSYCL/llvm/blob/ronan/sycl/lib/SYCL/inSPIRation.cpp In my case, even if it is not compliant, it seems to work with PoCL or Xilinx SDx/xocc for FPGA. It should not be difficult to migrate this to ToT if it can help your use case. Then remains the question about how to generate real compliant SPIR from both possible paths. There are some open-source LLVM IR downgrading writer around as already discussed on this mailing list http://lists.llvm.org/pipermail/llvm-dev/2016-August/103395.html So to conclude, the big picture is a little bit messy for now... :-( -- Ronan KERYELL