Reputation: 21
Spir-v and LLVM IR have the same granularity and can be converted to each other. May I ask why SPir-V is still so popular with LLVM IR? The fundamental difference between the two?
Upvotes: 2
Views: 1220
Reputation: 19513
Unlike SPIR-V, LLVM IR is:
Many projects have tried to use LLVM bitcode as a “universal bytecode” and many have regretted it. SPIR-V itself was created to replace SPIR which was based on LLVM IR.
The most important difference though is that Vulkan and OpenGL can directly consume SPIR-V, and SPIR-V is usable for shaders, not just compute kernels.
Upvotes: 3
Reputation: 1709
LLVM-IR is a very coherent single IR threading through the majority layers of the compiler stack and the LLVM-IR focuses very much as a means for compiler transformations. SPIR-V is actually a mix of multiple things. For instance, the SPIR-V memory model was built on the foundation of the C++ memory model, but ended up diverging in a number of places. Hence, an obvious addition to the answer by Yugr is, beside instruction set, a fundamental difference is a memory model.
Upvotes: 1