The Standard Portable Intermediate Representation for Device Programs

SPIR (Standard Portable Intermediate Representation) is a portable, non-source representation for devices programs. It enables application developers to avoid shipping kernel source and to manage the proliferation of devices and drivers from multiple vendors. SPIR enables the consumption of code from third party compiler front-ends for alternative languages to C, such as C++. SPIR 2.0 supports OpenCL C as defined in the OpenCL 2.0 specification.

SPIR 2.0
SPIR is a mapping from the OpenCL C programming language into LLVM IR. This version of the SPIR is based on LLVM 3.2 and OpenCL C as defined in the OpenCL 2.0 specification.  The goal of SPIR is to provide a portable interchange format for partly compiled OpenCL C programs.  A secondary goal of SPIR is to provide a useful target format for compilers of other programming languages.  SPIR is:

  • Vendor neutral
  • Is not C source code
  • Supports all core features and KHR extensions for version 2.0 of OpenCL C
  • Is designed to support vendor extensions.
  • Is compact.
  • Is designed to be efficiently loaded by an OpenCL implementation.



  • Press Release:  Khronos Launches Final SPIR Specification 21st Jan 2014

The following diagram provides a high-level summary of SPIR. A more in-depth overview is found in the SPIR presentation in the resources section above.