DSP Libraries

HiFi 5 NatureDSP Signal Library

Introduction

The HiFi 5 NatureDSP (NDSP) Library, or NatureDSP Signal Processing Library, is a collection of number highly optimized DSP functions for the HiFi 5 DSP.

The source code library includes C-callable functions (ANSI-C language compatible) for general signal processing (filtering, correlation, convolution), math and vector functions specially optimized for high-density signal processing. Library supports both fixed-point and single precision floating data types.

The precompiled HiFi 5 NatureDSP library is available in {DSP_SDK}/lib/lib_hifi5. The library can also be built from source by code downloaded from the official repository.

More Information

Function Support

NDSP library includes implementations of the following functions:

  • FIR filters and related functions

  • IIR filters

  • Mathematics

  • Complex Mathematics

  • Vector operations

  • Matrix operations

  • Matrix Decomposition and Inversion Functions

  • Fitting/Interpolation

  • Fast Fourier Transforms

  • Mel frequency cepstrum coefficients functions

  • Image processing

For more information, refer to Cadence official document for details.

HiFi 5 Neural Network Library

Introduction

The HiFi 5 Neural Network (NN) Library is a HiFi-optimized implementation of various NN layers and low-level NN kernels. The library is designed with speech and audio neural network domain focus.

The low-level NN kernels are HiFi-optimized building blocks for NN layer implementation with a generic and simple interface. The NN layers are built using low-level kernels and accept input in the form of shapes (up to four dimensions) and produce the output, in the form of shapes.

The layers use the weights or coefficients and biases stored externally for their operation. The shape of the input, output, weights, and biases are as per the layer’s design.

The precompiled HiFi 5 Neural Network library is available in {DSP_SDK}/lib/xa_nnlib. The library can also be built from source by code downloaded from the official repository.

Operator Support

  • Low-Level Kernels

    • Matrix-vector multiplication kernels

    • Convolution kernels

    • Activation kernels

    • Pooling kernels

    • Basic operations kernels

    • Fully connected kernels

    • Normalization kernels

    • Reorg kernels

    These kernels support fixed point 8-bit, 16-bit, single precision floating point (float32/f32), and half precision floating point (float16/f16) data types for weights or coefficients, biases, input, and output.

    Additionally, 8-bit and 16-bit quantized datatypes as defined in TensorFlow (TF), TensorFlowLite-Micro (TFLM) are also supported for select kernels. These datatypes use 8-bit/16-bit quantized values (asym8u – asymmetric 8-bit unsigned, asym8s – asymmetric 8-bit signed, sym8s – symmetric 8-bit signed) for weights or coefficients, input, and output. Biases are 32-bit quantized values.

  • Layers

    • GRU layer (8x16, 16x16 precision)

    • LSTM layer (8x16, 16x16 precision)

    • CNN layer (8x8, 8x16, 16x16, and float32xfloat32 precision)

  • TensorFlow Lite Micro Operators

    The HiFi 5 NN Library low-level kernels can be used to implement some operators of TensorFlow Lite Micro. HiFi5 NN Library supports both rounding modes available in TensorFlow Lite Micro for applicable operators.

For more information, refer to Cadence official document for details.

Performance Improvement

Leveraging the HiFi5 Neural Network library significantly enhances neural network inference speed.

Taking {DSP_SDK}/example/tflite_micro/tflm_mnist as an example:

Example

Time taken without nnlib (ms)

Time taken with nnlib (ms)

Optimize ratio

tflm_mnist

2378

72

33