Optional Callbacks for Kernels Supporting Advanced Tiling
An advanced tiling kernel can optionally provide the following callback functions, which if set, are called by the OpenVX* runtime within
vxVerifyGraph
or vxProcessGraph
:- Initializetypedef vx_status (*vx_kernel_initialize_f)(vx_node node, const vx_reference *parameters, vx_uint32 num);If set, called once duringvxVerifyGraphafter all input and output parameters have been verified.
- De-Initializetypedef vx_status (*vx_kernel_deinitialize_f)(vx_node node, const vx_reference *parameters, vx_uint32 num);If set, this function is called during node destruction.The two functions above are regular callbacks required for any user kernel as defined by the OpenVX* 1.0.1/1.1 specifications. Refer to the standard specification from Khronos* for more details on usage and the Putting it all Together: Example Code section for a code example.
- Pre-Processtypedef vx_status (*vx_kernel_preprocess_intel_f)(vx_node node, const vx_reference *parameters, vx_uint32 num, void * tile_memory[], vx_uint32 num_tile_memory_elements,vx_size tile_memory_size);If set, this function is called once at the beginning of each user call tovxProcessGraph, before any nodes in the graph have started processing. It is intended to be used to perform any required per-vxProcessGraph initialization, which may be required for certain kernels.
- Post-Processtypedef vx_status (*vx_kernel_postprocess_intel_f)(vx_node node, const vx_reference *parameters, vx_uint32 num, void * tile_memory[], vx_uint32 num_tile_memory_elements,vx_size tile_memory_size);If set, this function is called once at the end of each user call tovxProcessGraph, after all nodes in the graph have completed processing. It is intended to be used to perform any required per-vxProcessGraph de-initialization or data aggregation that may be required for certain kernels.NOTE: As this function is called after all nodes in the graph have completed processing, it is not a good idea to set values of output parameters in this function, if the parameter is further used as an input parameter to another node in the same graph.
- Set Tile Dimensionstypedef vx_status (*vx_kernel_set_tile_dimensions_intel_f)(vx_node node, const vx_reference *parameters, vx_uint32 param_num, const vx_tile_block_size_intel_t *current_tile_dimensions, vx_tile_block_size_intel_t *updated_tile_dimensions);If set, this function is called withinvxVerifyGraphto give a kernel the ability to override the current output tile size chosen by the runtime with a custom tile size. For example, a kernel may be designed to work only with tile widths that equal the output image size. The function is required to set the updated tile dimensions using a combination of the kernel parameters and current tile dimensions, which is passed in as an input parameter.
- Initialize (as a function of tile dimensions)typedef vx_status (*vx_kernel_tile_dimensions_initialize_intel_f)(vx_node node, const vx_reference *parameters, vx_uint32 param_num, const vx_tile_block_size_intel_t *current_tile_dimensions);If set, this function is called withinvxVerifyGraphto give a kernel the ability to perform some initialization as a function of the currently set tile dimensions. For example, a kernel may want to set some node attribute, such asVX_KERNEL_TILE_MEMORY_SIZE_INTEL, as a function of the currently set tile dimensions.