Jump to content

Standard Portable Intermediate Representation

From Wikipedia, the free encyclopedia

This is an old revision of this page, as edited by ZBalling (talk | contribs) at 20:30, 10 October 2018 (See also). The present address (URL) is a permanent link to this revision, which may differ significantly from the current revision.

SPIR
Developer(s)Khronos Group
Initial releaseJanuary 2014 (2014-01)
Operating systemCross-platform
PlatformCross-platform
TypeIntermediate language
Websitewww.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 the OpenCL stack.[1]

Versions

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

  • SPIR 1.2 based on LLVM IR version 3.2; part of OpenCL 1.2 Extension
  • SPIR 2.0 based on LLVM IR version 3.4; part of OpenCL 2.0 Extension
  • SPIR-V not based on LLVM IR; part of OpenCL 2.1 core as well as Vulkan core

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] and released on Nov. 16 2015.[6] 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 is incorporated in the core specification of OpenCL 2.1, the Vulkan API, and OpenGL version 4.6.

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.[7]

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. Retrieved 25 July 2015.
  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. ^ "Khronos Releases OpenCL 2.1 and SPIR-V 1.0 Specifications for Heterogeneous Parallel Programming". www.Khronos.org. 16 November 2015. Retrieved 16 November 2015.
  7. ^ Kessenich, John. "An Introduction to SPIR-V" (PDF). Khronos. Retrieved 25 July 2015.