Status
VC4C
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.
Required software
- A C++11 capable compiler
- CMake in version >= 3.1
- A suitable OpenCL 1.2 compiler. Supported versions are the "original" LLVM/CLang (version 3.9 and up), which can be found in the Raspbian repositories, and Khronos SPIRV-LLVM with the Khronos SPIR-V compiler front-end (only the tools clang and llvm-spirv need to be built, using this one is recommended).
- The source-code for VC4CLStdLib for the GPU-side standard-library
Build
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 front-end, 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/raspberrypi/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 front-end, requires SPIRV-LLVMSPIRV_COMPILER_ROOT
sets the root-path to binaries of the SPIRV-LLVM compiler, defaults to/opt/SPIRV-LLVM/build/bin/
LLVMLIB_FRONTEND
enables the LLVM library front-end which uses the LLVM library to parse the LLVM IR module generated by the pre-compilationBUILD_DEB_PACKAGE
toggles whether to create the necessary configuration to buildvc4c-xxx.deb
package for installation on Raspbian. The actual packaging is started withcpack -G DEB
Known Issues
If the VC4CLStdLib is updated, the LLVM pre-compiled header (PCH) needs to be rebuilt. For this to happen, simply delete the file VC4CLStdLib.h.pch
(located in the source/installation directory of the VC4CLStdLib project, depending on whether it was installed) and rebuild the VC4C compiler (or just the vc4cl-stdlib
target).