Name
Last commit
Last update
..
bilateral Blessed are the cheesemakers!
core Blessed are the cheesemakers!
core1 Blessed are the cheesemakers!
coredepth Blessed are the cheesemakers!
image Blessed are the cheesemakers!
input Blessed are the cheesemakers!
processors Blessed are the cheesemakers!
render Blessed are the cheesemakers!
score Blessed are the cheesemakers!
CMakeLists.txt remove "external_deps" mode for LINUX
README.md Blessed are the cheesemakers!
allocStats.cpp Blessed are the cheesemakers!
allocator.cpp Blessed are the cheesemakers!
binaryCache.cpp Blessed are the cheesemakers!
binaryCache.hpp Blessed are the cheesemakers!
buffer.cpp Blessed are the cheesemakers!
cl_error.cpp Blessed are the cheesemakers!
cl_error.hpp Blessed are the cheesemakers!
context.cpp Blessed are the cheesemakers!
context.hpp Blessed are the cheesemakers!
device.cpp Blessed are the cheesemakers!
deviceBuffer.cpp Blessed are the cheesemakers!
deviceBuffer.hpp Blessed are the cheesemakers!
deviceBuffer2D.cpp Blessed are the cheesemakers!
deviceBuffer2D.hpp Blessed are the cheesemakers!
deviceEvent.cpp Blessed are the cheesemakers!
deviceEvent.hpp Blessed are the cheesemakers!
deviceHostBuffer.cpp Blessed are the cheesemakers!
deviceHostBuffer.hpp Blessed are the cheesemakers!
deviceStream.cpp Blessed are the cheesemakers!
deviceStream.hpp Blessed are the cheesemakers!
exampleKernel.cl Blessed are the cheesemakers!
exampleKernel.cpp Blessed are the cheesemakers!
gpuContext.cpp Blessed are the cheesemakers!
gpuKernelDef.h Blessed are the cheesemakers!
kernel.cpp Blessed are the cheesemakers!
kernel.hpp Blessed are the cheesemakers!
memcpy.cpp Blessed are the cheesemakers!
memset.cl Blessed are the cheesemakers!
opencl.h Blessed are the cheesemakers!
opencl_spir_wrapper.h Blessed are the cheesemakers!
opengl.cpp Blessed are the cheesemakers!
surface.cpp Blessed are the cheesemakers!
surface.hpp Blessed are the cheesemakers!
vectorTypes.cpp Blessed are the cheesemakers!
windows_opencl_compiler.cmake Blessed are the cheesemakers!

OpenCL GPGPU backend

OpenCL programs are written in OpenCL-C, compatible with OpenCL 1.2. Each program is stored in a .cl file, which can contain several kernel definitions and utility functions.

Code shared by OpenCL programs is put in header files (.h) and declared as inline functions. There is currently no linking of OpenCL programs against each other, every OpenCL program stands for itself.

Since OpenCL can target many different platforms, it is usually compiled just-in-time. We compile the .cl files into an intermediate representation (SPIR) to catch errors at compile time.

This is done in the compilation process (see backend/cl/CMakeLists.txt), creating kernel.spir from kernel.cl. The next step is to bake the binary file directly into libvideostitch, as not to drag around the binary kernels next to it. The tool xxd is used to create a file containing C code that defines the binary data as a C char array (kernel.xxd).

This xxd file can be included in the code (in the same file that calls the kernel to keep the dependencies) thus baking the binary representation directly into libvideostitch. On runtime, the binary will be read and compiled from the SPIR state directly into code the current GPU can run.

To add the program foo.cl to the compilation process, it has to be registered in this folder's CMakeLists.txt, and in the corresponding foo.cpp (that's launching the foo kernels), the following code has to be added, to make the OpenCL SPIR binary available:

namespace {
#include "foo.xxd"
}
INDIRECT_REGISTER_OPENCL_PROGRAM(foo, true);