1 unstable release

0.1.1 May 15, 2023
0.1.0 May 15, 2023

#344 in Machine learning

MIT license

575KB
6.5K SLoC

OpenVX 1.3 meets Rust

This repo consists of the following parts:

  • openvx-sys is the bindgen-generated Rust wrapper around OpenVX,
  • openvx contains a Rust-y wrapper around the sys crate.

Test applications:

Here's an example input and output of the Canny Edge Detection sample.

VX_TYPE_GRAPH: CANNY_GRAPH, 3 nodes, VX_GRAPH_STATE_COMPLETED, avg perf 0.044175636, 0 parameters, 1 refs
VX_TYPE_NODE: RGB_TO_YUV, 2 params, avg perf 0.002818527, VX_SUCCESS, 1 refs
VX_TYPE_NODE: EXTRACT_LUMA, 3 params, avg perf 0.002013746, VX_SUCCESS, 1 refs
VX_TYPE_NODE: CANNY_EDGE, 5 params, avg perf 0.039333154, VX_SUCCESS, 1 refs

Note that for some reason the graph release operation

vxReleaseGraph(&mut graph);

currently produces the following log messages with the associated status VX_ERROR_INVALID_REFERENCE:

Failed to remove kernel[0]=org.khronos.extra.edge_trace
Failed to remove kernel[1]=org.khronos.extra.euclidean_nonmaxsuppression_harris
Failed to remove kernel[2]=org.khronos.extras.harris_score
Failed to remove kernel[3]=org.khronos.extras.laplacian3x3
Failed to remove kernel[4]=org.khronos.extras.image_to_list
Failed to remove kernel[5]=org.khronos.extra.nonmaximasuppression
Failed to remove kernel[6]=org.khronos.extra.elementwise_norm
Failed to remove kernel[7]=org.khronos.extras.scharr3x3
Failed to remove kernel[8]=org.khronos.extras.sobelMxN

The OpenVX 1.3 Quick Reference Guide was added here for convenience.

WIP

To install Intel OpenCL on Ubuntu 20.04, run

sudo apt-get install ocl-icd-opencl-dev intel-opencl-icd

Test using clinfo.

Install the Khronos OpenVX Sample Implementation

git clone --recursive https://github.com/KhronosGroup/OpenVX-sample-impl

I built from commit 63ced2f by using

python Build.py \
    --os=Linux --arch=64 --conf=Release \
    --c=clang --cpp=clang \
    --conf_vision --conf_nn \
    --opencl_interop --enh_vision --ix \
    --streaming --pipelining

The commit was added as a git submodule at vendor/openvx-sample-impl for convenience.

Building using --conf_nnef (the Neural Network Exchange Format) didn't work for some reason, and specifying --opencl always targeted NEON architecture, so didn't work.

To build the Rust projects, make sure the OpenVX library and headers are in scope:

export OPENVX_DIR=/path/to/OpenVX-sample-impl/install/Linux/x64/Release
export LIBRARY_PATH=$LIBRARY_PATH:$OPENVX_DIR/bin
export LD_LIBRARY_PATH=$LD_LIBRARY_PATH:$OPENVX_DIR/bin

Further reading

Dependencies

~0–2.5MB
~36K SLoC