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

SPIR-V Transforms the Language Ecosystem

Cross vendor intermediate representation

  • Language front-ends can easily access multiple hardware run-times
  • Acceleration hardware can leverage multiple language front-ends
  • Encourages tools for program analysis and optimization in SPIR form

SPIR-V - first multi-API, intermediate language for parallel compute and graphics

  • Native representation for Vulkan shader and OpenCL kernel source languages

Evolution of SPIR Family

SPIR–V is first fully specified Khronos-defined SPIR standard

  • Does not use LLVM to isolate from LLVM roadmap changes
  • Includes full flow control, graphics and parallel constructs beyond LLVM
  • Khronos will open source SPIR-V <-> LLVM conversion tools

SPIR-V at the Center of Language Ecosystem

SPIR-V Advantages for Developers

Developers can use same front-end compiler across multiple platforms

  • Eliminating major source of cross-vendor portability

Reduces runtime shader/kernel compilation time

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

Don’t have to ship shader/kernel source code

  • Provides a measure of IP protection

Drivers are simpler and more reliable

  • No need to include front-end compilers

SPIR-V Whitepaper

New OpenCL 2.1 Compiler Ecosystem