The first open standard intermediate language for parallel compute and graphics

SPIR (Standard Portable Intermediate Representation) was initially developed for use by OpenCL and SPIR versions 1.2 and 2.0 were based on LLVM. SPIR has now evolved into a true cross-API standard that is fully defined by Khronos with native support for shader and kernel features – called SPIR-V.

SPIR-V is the first open standard, cross-API intermediate language for natively representing parallel compute and graphics and will be incorporated as part of the core specification of both OpenCL 2.1 and the new Vulkan graphics and compute API. SPIR-V exposes the machine model for OpenCL 1.2, 2.0, 2.1 and Vulkan - including full flow control, and graphics and parallel constructs not supported in LLVM. SPIR-V also supports OpenCL 1.2, 2.0, 2.1 kernel languages as well as the GLSL shader language for Vulkan (under development).

SPIR-V will catalyze a revolution in the language compiler ecosystem - it can split the compiler chain across multiple vendors’ products, enabling high-level language front-ends to emit programs in a standardized intermediate form to be ingested by Vulkan or OpenCL drivers.   For hardware vendors, ingesting SPIR-V eliminate the need to build a high-level language source compiler into device drivers, significantly reducing driver complexity, and will enable a broad range of language and framework front-ends to run on diverse hardware architectures.

For developers, using SPIR-V means that kernel source code no longer has to be directly exposed, kernel load times can be accelerated and developers can choose the use of a common language front-end, improving kernel reliability and portability across multiple hardware implementations.

SPIR–V Resources

SPIR 1.2/2.0 Resources

SPIR 2.0 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. SPIR 2.0 supports all core features and KHR extensions for version 2.0 of OpenCL C

Vulkan Language Ecosystem

SPIR-V for Developers

Developers can use same front-end compiler across multiple platforms

  • Eliminating major source of cross-vendor portability

Reduces runtime shader compilation time

  • Driver only has to process SPIR-V not full source language

Don’t have to ship shader source code

  • Provides a measure of IP protection

SPIR-V is core in OpenCL 2.1 AND Vulkan

  • Exposes machine model for OpenCL 1.2, 2.0, 2.1 and Vulkan
  • Supports OpenCL 1.2, 2.0, 2.1 kernel languages
  • Supports GLSL shader language (under development)

New OpenCL 2.1 Compiler Ecosystem

New OpenCL 2.1 Compiler Ecosystem