Standard Portable Intermediate Representation

SPIR
Original author(s) Khronos Group
Developer(s) Khronos Group
Initial release January 2014
Operating system Cross-platform
Platform Cross-platform
Type intermediate language
Website khronos.org/spir

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.

Purpose

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 in the OpenCL stack.[1]

Versions

SPIR was originally introduced in 2011, the current version SPIR-V having been introduced in 2015.

LLVM-based versions

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.[2] Version 1.2 was announced at SIGGRAPH 2013, [3] with version 2.0 following at the same conference a year later.[4]

SPIR-V

SPIR-V is a rewritten version of SPIR announced in March 2015.[5] 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.[6]

See also

References

  1. Farber, Rob (11 August 2014). "Commercial OpenCL! SPIR 2.0 Protects IP Yet Allows Powerful, Portable, Source Code Free Kernels". TechEnablement. Retrieved 5 April 2015.
  2. Larabel, Michael (12 September 2012). "Khronos SPIR For OpenCL Brings Binary Compatibility". Phoronix.
  3. Smith, Ryan (22 July 2013). "Khronos @ SIGGRAPH 2013: OpenGL 4.4, OpenCL 2.0, & OpenCL 1.2 SPIR Announced". Anandtech. Retrieved 5 April 2015.
  4. Smith, Ryan (11 August 2014). "Khronos Announces OpenCL SPIR 2.0". Anandtech. Retrieved 5 April 2015.
  5. Parkerson, Stuart (4 March 2015). "Khronos Group Introduces New Vulkan Hardware Driver API and SPIR-V Intermediate Language Shared by Vulkan and OpenCL 2.1". App Developer Magazine. Retrieved 5 April 2015.
  6. Kessenich, John. "An Introduction to SPIR-V" (PDF). Khronos.

External links