<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8">
</head>
<body style="word-wrap: break-word; -webkit-nbsp-mode: space; -webkit-line-break: after-white-space;" class="">
<div class="">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.</div>
<div class=""><br class="">
</div>
<div class="">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:</div>
<div class="">- alter the target triple of the module to match your CPU/OS/Env</div>
<div class="">- translate the address spaces</div>
<div class="">- translate/implement the intrinsics/special functions (see libclc for an example for OpenCL)</div>
<div class=""><br class="">
</div>
<div class="">I plan to get a more cohesive integration of SPIR-V and LLVM at IWOCL in May.</div>
<div class=""><br class="">
</div>
<div class="">Nic</div>
<div class=""><br class="">
<div>
<blockquote type="cite" class="">
<div class="">On 7 Apr 2018, at 6:42 am, Aaron T via llvm-dev <<a href="mailto:llvm-dev@lists.llvm.org" class="">llvm-dev@lists.llvm.org</a>> wrote:</div>
<br class="Apple-interchange-newline">
<div class="">
<div dir="ltr" class="">
<div style="font-size:12.800000190734863px" class="">
<div class="">
<div class="">Hello,</div>
<div class=""><br class="">
</div>
<div class="">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.</div>
<div class=""><br class="">
</div>
<div class="">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.</div>
<div class=""><br class="">
</div>
<div class="">The reason I'm looking for a C++ library is that I want the LLVM part isolated from my applications.</div>
<div class=""><br class="">
</div>
<div class=""><b class="">Steps In My Mind</b></div>
<div class="">- Load/Parse SPIR-V binary files.</div>
<div class="">- Generate LLVM IR with LLVM API to JIT Compile shaders in memory via the library.</div>
<div class="">- Use a C++ interface to access resources in memory and bind shader methods to call from an application.</div>
<div class=""><br class="">
</div>
<div class="">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?</div>
<div class=""><br class="">
</div>
<div class="">Best,</div>
<div class=""><br class="">
</div>
<div class="">Aaron</div>
</div>
<div class=""><br class="">
</div>
</div>
<div class="gmail-yj6qo" style="font-size:12.800000190734863px"></div>
</div>
_______________________________________________<br class="">
LLVM Developers mailing list<br class="">
<a href="mailto:llvm-dev@lists.llvm.org" class="">llvm-dev@lists.llvm.org</a><br class="">
http://lists.llvm.org/cgi-bin/mailman/listinfo/llvm-dev<br class="">
</div>
</blockquote>
</div>
<br class="">
</div>
</body>
</html>