May 28, 2015

Tutorial 03: Modify kernel implementation

The archive OpenVX kernels for CMA contains the source code of OpenVX kernels executed on the many-core accelerator.
To recompile the code:

  • To recompile all kernels, use make all FABRIC_ARCHI=pulp3 FABRIC_FPU=1
  • To install the binaries into the ADRENALINE SDK, execute ./install.sh

This is the source code of threshold kernel (src/threshold.cl):

The code parallelization is based on these principles:

  • for each kernel, the kernel signature is fixed on the basis of image parameters
  • the identifier of the current executing core (in range 0..numCores) is retrieved by get_id()
  • bandwidth contains the number of elements that should be computed by each core
  • width and height contain the dimension of current image tile
  • upBorder, downBorder, leftBorder, rightBorder, firstTile, lastTile parameters provide information on the position of the current tile
  • params is a pointer to a memory buffer containing kernel parameters that are not images
  • srcType and dstType declare the type of images (not used in this kernel)
  • srcStride and dstStride contain the image row stride