Compiler for the VC4CL OpenCL-implementation. This compiler supports OpenCL C (via LLVM or SPIRV-LLVM), LLVM-IR and SPIR-V code, depending on the build configuration.
- A C++11 capable compiler
- CMake in version >= 3.1
- A suitable OpenCL 1.2 compiler. Supported versions are the "original" LLVM/CLang, which can be found in the Raspbian repositories, and Khronos SPIRV-LLVM with the Khronos SPIR-V compiler frontend (only the tools clang and llvm-spirv need to be built).
- The source-code for VC4CLStdLib for the GPU-side standard-library
The following configuration variables can be set in CMake:
BUILD_TESTING
toggles building of test programBUILD_DEBUG
toggles building debug or release programMULTI_THREADED
toggles building with multi-threaded supportVERIFY_OUTPUT
toggles the usage of vc4asm to validate the generated machine codeLLVMIR_FRONTEND
toggles building of the LLVM-IR frontend, requires an installed CLang compiler (LLVM or SPIRV-LLVM)VC4CL_STDLIB_HEADER_SOURCE
sets the headers for the GPU-side VC4CLStdLib, defaults to../VC4CLStdLib/include/VC4CLStdLib.h
CROSS_COMPILE
toggles whether to cross-compile for the Raspberry Pi, requires the Raspberry Pi cross-compiler to be installedCROSS_COMPILER_PATH
sets the root path to the Raspberry Pi cross compiler, defaults to/opt/rasperrypi/tools/arm-bcm2708/gcc-linaro-arm-linux-gnueabihf-raspbian-x64
(e.g. for the cross compiler cloned into the directory/opt/raspberrypi/tools/
)SPIRV_FRONTEND
toggles building of the SPIR-V frontend, requires SPIRV-LLVMSPIRV_COMPILER_ROOT
sets the root-path to binaries of the SPIRV-LLVM compiler, defaults to/opt/SPIRV-LLVM/build/bin/
If the VC4CLStdLib is updated, the LLVM precompiled header (PCH) needs to be rebuilt. For this to happen, simply delete the file include/VC4CLStdLib.h.pch
and rebuild the VC4C compiler (or just the vc4cl-stdlib
target).
Sometimes, at least on my Raspberry Pi, if a compilation fails, it somehow removes the symbolic /dev/stdout
to the current process' standard output, resulting in no program can write to stdout anymore!! To remedy, restart the Pi.