All Projects → google → Clspv

google / Clspv

Licence: apache-2.0
Clspv is a prototype compiler for a subset of OpenCL C to Vulkan compute shaders

Programming Languages

c
50402 projects - #5 most used programming language

Projects that are alternatives of or similar to Clspv

Rspirv
Rust implementation of SPIR-V module processing functionalities
Stars: ✭ 332 (-12.86%)
Mutual labels:  vulkan, opencl
Soul Engine
Physically based renderer and simulation engine for real-time applications.
Stars: ✭ 37 (-90.29%)
Mutual labels:  vulkan, opencl
Silk.net
The high-speed OpenAL, OpenGL, Vulkan, and GLFW bindings library your mother warned you about.
Stars: ✭ 534 (+40.16%)
Mutual labels:  vulkan, opencl
Tvm
Open deep learning compiler stack for cpu, gpu and specialized accelerators
Stars: ✭ 7,494 (+1866.93%)
Mutual labels:  vulkan, opencl
Floor
A C++ Compute/Graphics Library and Toolchain enabling same-source CUDA/Host/Metal/OpenCL/Vulkan C++ programming and execution.
Stars: ✭ 166 (-56.43%)
Mutual labels:  vulkan, opencl
Spvgentwo
SpvGenTwo is a SPIR-V building and parsing library written in plain C++17 without any dependencies. No STL or other 3rd-Party library needed.
Stars: ✭ 74 (-80.58%)
Mutual labels:  vulkan, opencl
Ktt
Kernel Tuning Toolkit
Stars: ✭ 33 (-91.34%)
Mutual labels:  vulkan, opencl
hpc
Learning and practice of high performance computing (CUDA, Vulkan, OpenCL, OpenMP, TBB, SSE/AVX, NEON, MPI, coroutines, etc. )
Stars: ✭ 39 (-89.76%)
Mutual labels:  vulkan, opencl
Clvk
Experimental implementation of OpenCL on Vulkan
Stars: ✭ 158 (-58.53%)
Mutual labels:  vulkan, opencl
Gpu Viewer
A front-end to glxinfo, vulkaninfo, clinfo and es2_info - Linux
Stars: ✭ 129 (-66.14%)
Mutual labels:  vulkan, opencl
Gpu performance api
GPU Performance API for AMD GPUs
Stars: ✭ 170 (-55.38%)
Mutual labels:  vulkan, opencl
Lwjgl3
LWJGL is a Java library that enables cross-platform access to popular native APIs useful in the development of graphics (OpenGL, Vulkan), audio (OpenAL), parallel computing (OpenCL, CUDA) and XR (OpenVR, LibOVR) applications.
Stars: ✭ 3,540 (+829.13%)
Mutual labels:  vulkan, opencl
Bayadera
High-performance Bayesian Data Analysis on the GPU in Clojure
Stars: ✭ 342 (-10.24%)
Mutual labels:  opencl
Arrayfire Python
Python bindings for ArrayFire: A general purpose GPU library.
Stars: ✭ 358 (-6.04%)
Mutual labels:  opencl
Magnum
Lightweight and modular C++11 graphics middleware for games and data visualization
Stars: ✭ 3,728 (+878.48%)
Mutual labels:  vulkan
Kiero
Universal graphical hook for a D3D9-D3D12, OpenGL and Vulkan based games.
Stars: ✭ 374 (-1.84%)
Mutual labels:  vulkan
Realsr Ncnn Vulkan
RealSR super resolution implemented with ncnn library
Stars: ✭ 357 (-6.3%)
Mutual labels:  vulkan
Arrayfire
ArrayFire: a general purpose GPU library.
Stars: ✭ 3,693 (+869.29%)
Mutual labels:  opencl
Agi
Android GPU Inspector
Stars: ✭ 327 (-14.17%)
Mutual labels:  vulkan
Sdaccel examples
SDAccel Examples
Stars: ✭ 325 (-14.7%)
Mutual labels:  opencl

clspv

Clspv is a prototype compiler for a subset of OpenCL C to Vulkan compute shaders.

It consists of:

  • A set of LLVM Module passes to transform a dialect of LLVM IR into a SPIR-V module containing Vulkan compute shaders.
  • A command line compiler tool called 'clspv' to compile a subset of OpenCL C into a Vulkan compute shader.

Clspv depends on external projects:

Legal

Clspv is licensed under the terms of the Apache 2.0 license. The AUTHORS file lists the copyright owners, while individual credit is given in the CONTRIBUTORS file. To contribute, see CONTRIBUTING.md.

Materials in projects Clspv depends on are licensed under their own terms.

Clspv is not an official Google product.

Status

The compiler is an incomplete prototype, with many rough edges.

The input language is a subset of OpenCL C version 1.2. The OpenCL C on Vulkan Specification describes the specific subset, and also the mapping into Vulkan compute shaders.

Examples

Compile a set of kernels into a SPIR-V binary module:

clspv foo.cl -o foo.spv

Emit the binary as a C initializer list, for easy embedding of a shader in in a C or C++ program source:

clspv -mfmt=c foo.cl -o -

Predefine some preprocessor symbols:

clspv -DWIDTH=32 -DHEIGHT=64 foo.cl -o foo.spv

Use OpenCL compiler options:

clspv -cl-fast-relaxed-math -cl-single-precision-constant foo.cl -o foo.spv

Show help:

clspv -help

Build

Tools

You will need:

  • CMake
  • Python3
  • A C++ compiler
  • git

Getting sources for dependencies

Clspv depends on the sources for other projects, at specific commits. Run the following command to download those dependencies, and place them in the third_party directory:

python3 utils/fetch_sources.py

Building

Then, create a build directory:

cd <clspv-dir>
mkdir build
cd build

Then configure and build the code:

cmake <clspv-dir>
cmake --build .

This will build the clspv command line compiler and place it in location bin/clspv under the build directory.

Using Ninja to build, and other build options

We recommend you use the Ninja build tool if it's available. To do so, replace the last two commands with:

cmake -G Ninja <clspv-dir>
ninja

Other useful configuration options (the first cmake command):

  • -DCMAKE_BUILD_TYPE=RelWithDebInfo : Build in release mode, with debugging information. Default is a debug build.

See the CMake documentation for more generic options.

Test

To run the test suite from within the build directory:

cmake --build . --target check-spirv

Or if you are using Ninja:

ninja check-spirv

Builtin Library

Clspv includes an LLVM IR library (cmake/clspv--.bc) containing implementations of some OpenCL builtin functions. This file is distributed under the LLVM license (included in LICENSE) as it is generated from the LLVM sub-project libclc. Refer to the source for the relevant copyrights.

Rebuilding the Library

Required Tools

You will need a pre-built version of LLVM for your system, CMake, and (optionally) Ninja.

Build

To rebuild the library run the following commands:

cmake -GNinja -DLIBCLC_TARGETS_TO_BUILD="clspv--" -DLLVM_CONFIG= ninja

Copy the resulting clspv--.bc into the cmake/ directory and rebuild clspv.

Note that the project description data, including the texts, logos, images, and/or trademarks, for each open source project belongs to its rightful owner. If you wish to add or remove any projects, please contact us at [email protected].