Identify Unsupported Operators Using benchmark_model
When developers use the ncc-tflite tool for model conversion on Yocto platforms, the tool may output a vague “Fail to create tflite context” error without specifying the unsupported operator (OP). This document explains how to use the benchmark_model tool with stable_delegate to pinpoint unsupported operators for specific hardware architectures, such as the NP6.
Technical Background
On certain hardware platforms, such as the G700 with NP6, the ncc-tflite tool may not fully enable verbose logging. When model conversion fails with insufficient log information, developers can use the benchmark_model tool and mount the stable_delegate. This process triggers the PreOpCheck mechanism, which scans the model operators against the hardware support list and outputs the specific unsupported OP or OP version.
Diagnostic Steps
To analyze the model and identify the error, follow these steps:
- Execute the following
benchmark_modelcommand on the target device to simulate the execution environment:
benchmark_model \
--stable_delegate_settings_file=/usr/share/label_image/stable_delegate_settings.json \
--use_nnapi=false \
--use_xnnpack=false \
--use_gpu=false \
--min_secs=20 \
--graph=<model_name>.tflite
Note: Setting --use_nnapi=false, --use_xnnpack=false, and --use_gpu=false disables other delegates and ensures the test path goes through the Neuron Neural Processing Unit (NPU).
- Review the output logs for
PreOpCheckinformation. The tool outputs errors indicating unsupported OP versions or types.
Example of an unsupported OP version:
ERROR: PreOpCheck: OP TRANSPOSE_CONV (v4) is not supported ()
Example of an unsupported OP type:
ERROR: OP CONV_2D (v6) is not supported ()
ERROR: OP BATCH_MATMUL (v1) is not supported (Unsupported operation type.)
Recommended Solutions
Once the unsupported OP is identified, developers can take the following actions:
- Modify the Model Structure: Replace the unsupported OP with a hardware-supported operator, or downgrade the OP version.
- Verify Hardware Compatibility: Ensure the architecture specified during model conversion (for example,
-arch mdla3.0) matches the target hardware. Compiled.dlafiles for higher-version hardware (such as NP8) typically cannot run on lower-version hardware (such as NP6).