commit | e61cf40df0d115e0dcb151b8906633b7855b9ca5 | [log] [tgz] |
---|---|---|
author | Yang Ni <yangni@google.com> | Fri Nov 11 17:46:40 2016 +0000 |
committer | android-build-merger <android-build-merger@google.com> | Fri Nov 11 17:46:40 2016 +0000 |
tree | 67590d968ee34b877145e836972d66332e80703a | |
parent | 4265a672f58c4faf2a0bdbde5e4a9f3b34fb9ef7 [diff] | |
parent | 49f49b4f4cb13f8efe61174bf0587cfb0ab47046 [diff] |
Initial import of Khronos LLVM-SPIRV from github am: 91585d9acd am: 578927f666 am: cdbbc8ab72 am: 49f49b4f4c Change-Id: I72ec8fee5ae77ddfca8a7f62976f12af918afdd2
The khronos/spirv-3.6.1
branch of this repository contains source code for the LLVM/SPIR-V Bi-Directional Translator, a library for translating between LLVM and SPIR-V.
The LLVM/SPIR-V Bi-Directional Translator is open source software. You may freely distribute it under the terms of the license agreement found in LICENSE.txt.
Currently it accepts LLVM bitcodes compatible with SPIR 1.2/2.0 standards, and SPIR-V friendly format.
It also works together with Khronos OpenCL C compiler for SPIR-V to compile OpenCL C source code to SPIR-V.
The files/directories are related to the translator:
Follow the build instructions of Khronos OpenCL C compiler for SPIR-V.
Alternatively,
khronos/spirv-3.6.1
branch.llvm-spirv
llvm-spirv
only accepts SPIR 1.2/2.0 or LLVM bitcode following a SPIR-V friendly format.
The Khronos OpenCL C compiler can be used to compile OpenCL 1.2/2.0 C source code to SPIR 1.2/2.0 or SPIR-V. It has three branches: spir_12
, spir_20_provisional
, and spirv-1.0
, corresponding to SPIR 1.2, SPIR 2.0, and SPIR-V, respectively. The spirv-1.0
branch emits SPIR-V directly. It is recommended to use the spirv-1.0
branch since SPIR 1.2/2.0 have limitations for representing sampler types and access qualifier of image and pipe types, which may result in incorrect SPIR-V in certain cases.
To translate between SPIR 1.2/2.0 and SPIR-V:
Follow the instructions provided by the Khronos OpenCL C compiler website to use clang to compile OpenCL C source code to SPIR 1.2/2.0 binary.
Execute the following command to translate input.bc
to input.spv
llvm-spirv input.bc
Execute the following command to translate input.spv
to input.bc
llvm-spirv -r input.spv
Other options accepted by llvm-spirv
-o file_name
- to specify output name-spirv-debug
- output debugging information-spirv-text
- read/write SPIR-V in an internal textual format for debugging purpose. The textual format is not defined by SPIR-V spec.