commit | 91585d9acd75a2bdbfd177bf56c8b9436f442152 | [log] [tgz] |
---|---|---|
author | Yang Ni <yangni@google.com> | Mon Nov 07 13:48:38 2016 -0800 |
committer | Yang Ni <yangni@google.com> | Tue Nov 08 21:55:43 2016 +0000 |
tree | 67590d968ee34b877145e836972d66332e80703a | |
parent | 4265a672f58c4faf2a0bdbde5e4a9f3b34fb9ef7 [diff] |
Initial import of Khronos LLVM-SPIRV from github URL: https://github.com/KhronosGroup/SPIRV-LLVM.git Upstream branch khronos/spirv-3.8 Upstream commit c24897cf4f7b6e38448175219e15429dd2e7b53c
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.