• This repository has been archived on 10/Oct/2019
  • Stars
    star
    259
  • Rank 152,497 (Top 4 %)
  • Language
    C++
  • License
    Other
  • Created over 8 years ago
  • Updated over 4 years ago

Reviews

There are no reviews yet. Be the first to send feedback to the community and the maintainers!

Repository Details

This project is no longer active. Please join us at

LLVM/SPIR-V Bi-Directional Translator

Build Status

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.

Directory Structure

The files/directories are related to the translator:

Build Instructions

Follow the build instructions of Khronos OpenCL C compiler for SPIR-V.

Alternatively,

  1. Clone the khronos/spirv-3.6.1 branch.
  2. Follow LLVM build instructions.

Test instructions

All tests related to the translator are placed in test/SPIRV.

Execute the following command to run translator tests:

llvm-lit test/SPIRV

Run Instructions for 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:

  1. 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.

  2. Execute the following command to translate input.bc to input.spv

    llvm-spirv input.bc
    
  3. Execute the following command to translate input.spv to input.bc

    llvm-spirv -r input.spv
    
  4. 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.

More Repositories

1

glTF

glTF – Runtime 3D Asset Delivery
HTML
6,939
star
2

MoltenVK

MoltenVK is a Vulkan Portability implementation. It layers a subset of the high-performance, industry-standard Vulkan graphics and compute API over Apple's Metal graphics framework, enabling Vulkan applications to run on macOS, iOS and tvOS.
Objective-C++
4,550
star
3

Vulkan-Samples

One stop solution for all Vulkan samples
C++
3,848
star
4

glslang

Khronos-reference front end for GLSL/ESSL, partial front end for HLSL, and a SPIR-V generator.
C++
2,819
star
5

Vulkan-Hpp

Open-Source Vulkan C++ API
C++
2,691
star
6

glTF-Sample-Models

glTF Sample Models
Mathematica
2,593
star
7

WebGL

The Official Khronos WebGL Repository
HTML
2,566
star
8

Vulkan-Docs

The Vulkan API Specification and related tools
JavaScript
2,527
star
9

SPIRV-Cross

SPIRV-Cross is a practical tool and library for performing reflection on SPIR-V and disassembling SPIR-V back to high level languages.
GLSL
1,748
star
10

UnityGLTF

Runtime glTF 2.0 Loader for Unity3D
C#
1,710
star
11

Vulkan-Guide

One stop shop for getting started with the Vulkan API
Makefile
1,586
star
12

glTF-Blender-IO

Blender glTF 2.0 importer and exporter
Python
1,431
star
13

glTF-Sample-Viewer

Physically-Based Rendering in glTF 2.0 using WebGL
JavaScript
1,084
star
14

SPIRV-Tools

C++
999
star
15

glTF-Tutorials

glTF Tutorials
Python
951
star
16

glTF-Blender-Exporter

Moved to https://github.com/KhronosGroup/glTF-Blender-IO.
Python
836
star
17

KTX-Software

KTX (Khronos Texture) Library and Tools
C++
791
star
18

Vulkan-Headers

Vulkan header files and API registry
C++
772
star
19

Khronosdotorg

Website resource pages for Khronos.org. Community is encouraged to help keep up-to-date
HTML
716
star
20

OpenXR-SDK

Generated headers and sources for OpenXR loader.
C++
688
star
21

Vulkan-ValidationLayers

Vulkan Validation Layers (VVL)
C++
682
star
22

OpenCOLLADA

C++
648
star
23

OpenCL-Headers

Khronos OpenCL-Headers
C
620
star
24

SPIRV-Reflect

SPIRV-Reflect is a lightweight library that provides a C/C++ reflection API for SPIR-V shader bytecode in Vulkan applications.
C
593
star
25

OpenGL-Registry

OpenGL, OpenGL ES, and OpenGL ES-SC API and Extension Registry
C
576
star
26

OpenXR-SDK-Source

Sources for OpenXR loader, basic API layers, and example code.
Python
518
star
27

SyclParallelSTL

Open Source Parallel STL implementation
C++
512
star
28

COLLADA2GLTF

COLLADA to glTF converter
C++
499
star
29

VK-GL-CTS

Khronos Vulkan, OpenGL, and OpenGL ES Conformance Tests
C++
464
star
30

Vulkan-Loader

Vulkan Loader
C
463
star
31

OpenCL-SDK

OpenCL SDK
C++
461
star
32

Vulkan-Samples-Deprecated

Vulkan sample code
454
star
33

SPIRV-LLVM-Translator

A tool and a library for bi-directional translation between SPIR-V and LLVM IR
LLVM
422
star
34

Vulkan-LoaderAndValidationLayers

**Deprecated repository** for Vulkan loader and validation layers
C++
416
star
35

OpenGL-Refpages

OpenGL and OpenGL ES reference page sources, and generated HTML used as backing store for khronos.org
HTML
392
star
36

OpenCL-CLHPP

Khronos OpenCL-CLHPP
C++
329
star
37

glTF-Validator

Tool to validate glTF assets.
Dart
321
star
38

OpenCL-Docs

OpenCL API, OpenCL C, Extensions, SPIR-V Environment Specs, Ref page, and C++ for OpenCL doc sources.
Python
296
star
39

OpenCL-Guide

A guide to help developers get up and running quickly with the OpenCL programming framework
CMake
295
star
40

GLSL

GLSL Shading Language Issue Tracker
282
star
41

Vulkan-Tools

Vulkan Utilities and Tools
C++
270
star
42

SPIRV-Headers

SPIRV-Headers
C++
229
star
43

OpenCL-ICD-Loader

The OpenCL ICD Loader project.
C
226
star
44

NNEF-Tools

The NNEF Tools repository contains tools to generate and consume NNEF documents
Python
217
star
45

WebGLDeveloperTools

JavaScript
193
star
46

glTF-CSharp-Loader

C# Reference Loader for glTF
C#
193
star
47

SPIR

C++
176
star
48

ANARI-SDK

ANARI SDK
C++
171
star
49

glTF-Asset-Generator

Tool for generating various glTF assets for importer validation
C#
158
star
50

OpenCL-CTS

The OpenCL Conformance Tests
C++
149
star
51

Vulkan-Ecosystem

Public repository for Vulkan Ecosystem issues
134
star
52

WebGLNext-Proposals

Proposals for the design of the WebGL Next API.
WebIDL
131
star
53

OpenXR-Docs

OpenXR Specification sources and related material
Python
128
star
54

Vulkan-ExtensionLayer

Layer providing Vulkan features when native support is unavailable
C
115
star
55

libclcxx

OpenCL specific C++ libraries implemented in C++ for OpenCL kernel language published in releases of OpenCL-Docs
109
star
56

SYCL-Docs

SYCL Open Source Specification
JavaScript
105
star
57

SPIRV-Guide

One stop shop for getting started with SPIR-V.
104
star
58

OpenCL-Registry

OpenCL API and Extension Registry.
HTML
100
star
59

openvx-samples

OpenVX Samples to use with any conformant implementation of OpenVX
C++
99
star
60

Vulkan-MemoryModel

Vulkan Memory Model
C++
98
star
61

3D-Formats-Guidelines

Guidelines for artists and developers using Khronos Group 3D formats.
98
star
62

EGL-Registry

EGL API and Extension Registry
HTML
98
star
63

SPIRV-Registry

SPIR-V specs
HTML
97
star
64

glTF-IBL-Sampler

Sampler to create the glTF sample environments
C++
89
star
65

LLVM-SPIRV-Backend

An LLVM backend generating SPIR-V binary.
86
star
66

Vulkan-Profiles

Vulkan Profiles Tools
C++
84
star
67

Basis-Universal-Transcoders

A collection of optimized WebAssembly transcoders for Basis Universal compressed GPU texture formats.
WebAssembly
72
star
68

OpenXR-Registry

Registry of OpenXR Specifications and related material
HTML
70
star
69

glXF

glTF Experience Format (glXF)
68
star
70

glTF-Sample-Environments

glTF sample environments for the glTF Sample Viewer
Batchfile
68
star
71

KTX-Specification

KTX file format source
CSS
67
star
72

glTF-Project-Explorer

Tool to provide a filterable registry of glTF community projects.
TypeScript
67
star
73

3DC-Asset-Creation

Asset creation guidelines and workflows to streamline the creation of 3D digital content for use in e-commerce
Shell
66
star
74

Vulkan-Samples-Assets

Vulkan Samples Assets
62
star
75

SYCL-CTS

SYCL Conformance Tests
C++
59
star
76

OpenXR-CTS

Conformance test suite for OpenXR
C++
56
star
77

siggraph2012course

Presentations for SIGGRAPH 2012 course "Graphics Programming on the Web" covering HTML5 technologies (Canvas, CSS, etc.), WebGL and WebCL
HTML
53
star
78

WebCL

The Official Khronos WebCL Repository
HTML
50
star
79

OpenVX-Registry

OpenVX API and Extension Registry.
HTML
44
star
80

SPIR-Tools

SPIR-Tools
C
44
star
81

Vulkan-Utility-Libraries

Utility libraries for Vulkan developers
C++
42
star
82

Vulkan-Portability

41
star
83

OpenCL-CXX

OpenCL C++ Kernel Language Spec sources.
TeX
39
star
84

webcl-validator

WebCL Validator
C++
38
star
85

DataFormat

Khronos Data Format Specification
C
37
star
86

OpenXR-Hpp

Open-Source OpenXR C++ language projection
C++
36
star
87

OpenXR-Tutorials

OpenXR Tutorials [Work in progress, do not use to study OpenXR yet]
C++
32
star
88

COLLADA-CTS

Welcome to the COLLADA Conformance Test Suite
Python
32
star
89

WebGLPerf

WebGL performance regression tests
HTML
31
star
90

OpenCL-TTL

Tensor Tiling Library
C
30
star
91

glTF-Compressonator

Fork of AMD GPUOpen Compressonator tool , for the purpose of further enhancing glTF support. and prototyping for ETC1S CRN, CTTF_128 Universal Formats, Transcoders, and Supercompression
C++
30
star
92

Education-Forum

content to support educators developing courses on Khronos technologies
29
star
93

ANARI-Docs

ANARI Documentation
JavaScript
28
star
94

khronosgroup.github.io

Visit https://github.khronos.org for a directory of all our GitHub Repositories
HTML
27
star
95

SPIRV-Visualizer

Client side only Javascript to visualize a SPIR-V Module binary
JavaScript
26
star
96

OpenVG-Docs

OpenVG Specification source
C
25
star
97

glTF-Generator-Registry

An open registry of tools that create glTF assets.
25
star
98

3DC-Certification

3DC Certification documents
Python
23
star
99

SYCL_Reference

SYCL Reference Manual
C++
22
star
100

WebCL-conformance

WebCL conformance tests
HTML
20
star