Skip to main content
The LiteRT open-source framework provides the benchmark_model tool to measure model execution performance on hardware using delegates. This tool is installed on the target device along with other LiteRT artifacts. The tool measures and reports the following performance metrics:
  • Initialization time
  • Inference time (warm-up and steady state)
  • Memory usage during initialization
  • Overall memory usage

Prerequisites

Before running the benchmark, ensure you have the following:
  • An Ubuntu 22.04 host computer
  • A Qualcomm development kit

Set up model files

  1. Download the sample model, label files, and a test image:
  2. On the host computer, download and extract the MobileNet model archives:
  3. On the target device, create the artifacts directory:
  4. From the host computer, copy the model, image, and label files to the device:
  5. On the target device, set up the GPU libraries:
The sample applications use the MobileNet v1 model, trained on the ImageNet dataset with 1000 classes, as an example classification model.

Benchmark on CPU

The label_image sample application is cross-compiled with the LiteRT library and installed on the target device. The source code is available on the TensorFlow GitHub repository. To benchmark using the XNNPACK delegate on the CPU:
Example output for LiteRT CPU benchmark

Example output for LiteRT CPU benchmark

Benchmark on GPU

To benchmark using the GPU delegate:
Example output for LiteRT GPU benchmark

Example output for LiteRT GPU benchmark

Benchmark on NPU using the QAIRT delegate

The Qualcomm AI Runtime delegate uses the Qualcomm AI Runtime API and its backends to accelerate models on the Adreno GPU and the Hexagon Tensor Processor. To use the QAIRT external delegate, ensure the following libraries are available on the device:
  • libQnnTFLiteDelegate.so — QNN delegate library
  • Libraries from the Qualcomm AI Engine Direct SDK
You can customize model execution to use a specific backend through external delegate options:
  • libQnnGpu.so — Run the QNN delegate on the GPU
  • libQnnHtp.so — Run the QNN delegate on the Hexagon Tensor Processor
  • libQnnDsp.so — Run the QNN delegate on the DSP
To benchmark on the Hexagon Tensor Processor using the QNN external delegate:
The benchmark output includes the following statistics:
  • Delegate creation status
  • Average inference time on the hardware using the delegate
  • Memory footprint of the model execution
benchmark_model tool output showing delegate status, inference time, and memory footprint

benchmark_model tool statistics