Arm NN optimization

Arm NN uses Arm Compute Library (ACL) to provide a set of optimized operators, for example convolution and pooling, that target Arm-specific accelerators like the DSP (Neon) or the Mali GPU. ACL also provides a GPU tuner tool called CLTuner. CLTuner tunes a set of hardware knobs to fully utilize all the computational horsepower that the GPU provides.

Because Arm NN implements the Android NNAPI interface, developers only need to install the driver. Your Android application will seamlessly interact with the driver to exploit these accelerations.

This part of the code is illustrated in the TensorFlowImageStyleTranfer() function in TensorFlowImageStyleTransfer.java. To install the driver, the code performs the following steps:

  1. Check the Android OS version.
  2. Determine whether NNAPI can be enabled on the device.
  3. Create a delegate, if NNAPI can be supported:
    if (enableNNAPI && TensorFlowHelper.canNNAPIEnabled()){
        delegate = new NnApiDelegate();
        this.tfLiteOptions.addDelegate(delegate);
        this.tfLite = new 
    Interpreter(TensorFlowHelper.loadModelFile(context, mModelFile), tfLiteOptions); } else { this.tfLite = new
    Interpreter(TensorFlowHelper.loadModelFile(context, mModelFile)); }

Arm NN implements the Android NNAPI interface. This means that, when developers have the driver installed, your Android application will seamlessly interact with the underlying APIs. This will allow you to exploit the accelerators.

Toggle the NNAPI checkbox to experience the performance enhancement that NNAPI provides.

The NN driver is not bundled with Android releases. Instead, the NN driver is shipped by OEMs like Samsung, HiSilicon, and MTK. For example, all Samsung devices with Android O MR1 or later firmware releases have pre-installed the Arm NN driver.

If your Android device does not have an Arm NN driver pre-installed, or if you want to build your own Arm NN driver, Next steps provides information on how to manually install the driver.

Use the Android app to see whether you can create your own art piece. The following generated image of Cambridge is created in La Muse style and built with Arm NN:

Generated ArmNN

Generated image

Previous Next