[llvm-dev] SPIR-V & LLVM JIT Compiler

Nicholas Wilson via llvm-dev llvm-dev at lists.llvm.org
Fri Apr 6 18:39:40 PDT 2018


In terms of something preexisting, Google’s clspv is the only library I know of that can produce Vulkan SPIR-V, but I believe it is limited to compute shaders. There are a few others that deal with OpenCL SPIR-V.

Assuming one of the above suits your need, in order to get JITable modules from LLMV modules you will at the very least need to:
- alter the target triple of the module to match your CPU/OS/Env
- translate the address spaces
- translate/implement the intrinsics/special functions (see libclc for an example for OpenCL)

I plan to get a more cohesive integration of SPIR-V and LLVM at IWOCL in May.

Nic

On 7 Apr 2018, at 6:42 am, Aaron T via llvm-dev <llvm-dev at lists.llvm.org<mailto:llvm-dev at lists.llvm.org>> wrote:

Hello,

I'm trying to build an application and would like to load SPIR-V binary files, and JIT Compile it via LLVM to run shaders on CPU.

I would like to use a library (or possibly build my own) that parses SPIR-V and JIT compiles via LLVM API. Then the library can provide C++ interface to compiled data in memory, and I can access resources or call shader methods via the interface.

The reason I'm looking for a C++ library is that I want the LLVM part isolated from my applications.

Steps In My Mind
- Load/Parse SPIR-V binary files.
- Generate LLVM IR with LLVM API to JIT Compile shaders in memory via the library.
- Use a C++ interface to access resources in memory and bind shader methods to call from an application.

Is there a C++ library or code example that I can use for this? Or could you please guide me by providing steps to achieve this in the shortest path?

Best,

Aaron

_______________________________________________
LLVM Developers mailing list
llvm-dev at lists.llvm.org<mailto: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/20180407/07ed4a36/attachment.html>


More information about the llvm-dev mailing list