Developer(s) | Khronos Group |
---|---|
Initial release | January 2014 |
Operating system | Cross-platform |
Platform | Cross-platform |
Type | Intermediate language |
Website | www |
Standard Portable Intermediate Representation (SPIR) is an intermediate language for parallel compute and graphics by Khronos Group, originally developed for use with OpenCL. The current version, SPIR-V, was announced in March 2015.
OpenCL uses just-in-time compilation (JIT), necessitating one of two software distribution patterns: developers can distribute device-specific pre-compiled binaries, or they can distribute relevant source code, which is limited by the desire to protect intellectual property. SPIR enables the creation and distribution of device-independent binaries within the OpenCL stack.
SPIR was originally introduced in 2011, the current version SPIR-V having been introduced in 2015.
SPIR prior to the 2015 SPIR-V release was based on the LLVM Intermediate Representation. A provisional specification for SPIR 1.0 was announced in 2012. Version 1.2 was announced at SIGGRAPH 2013, with version 2.0 following at the same conference a year later.
SPIR-V is a rewritten version of SPIR announced in March 2015, and released on Nov. 16 2015. The SPIR family now includes a true cross-API standard that is fully defined by Khronos with native support for shader and kernel features.
Support for ingestion of SPIR-V will be incorporated in the core specification of both OpenCL 2.1 and the new Vulkan API for graphics and compute.
SPIR-V is a high-level intermediate language, exchanged in binary form. Functions are represented by a control flow graph of basic blocks, using static single assignment (SSA) form. Data structures retain high-level hierarchical representation. It is not lossy like previous byte-code or virtual machine-like intermediate representations used for graphical shaders. This allows higher performance lowering to target devices.