QNN model building steps:
1) setup completed as mentioned in the document for tensorflow model conversion
${QNN_SDK_ROOT}/target/x86_64-linux-clang/bin/qnn-tensorflow-converter \ --input_network ${QNN_SDK_ROOT}/examples/Models/InceptionV3/tensorflow/inception_v3_2016_08_28_frozen.pb \ --input_dim input 1,299,299,3 \ --out_node InceptionV3/Predictions/Reshape_1 \ --output_path ${QNN_SDK_ROOT}/examples/Models/InceptionV3/model/Inception_v3_quantized.cpp \ --input_list ${QNN_SDK_ROOT}/examples/Models/InceptionV3/data/cropped/raw_list.txt
2) The generated .bin and .cpp file is build using model-lib-generator
${QNN_SDK_ROOT}/target/x86_64-linux-clang/bin/qnn-model-lib-generator \
-c ${QNN_SDK_ROOT}/examples/Models/InceptionV3/model/Inception_v3_quantized.cpp \
-b ${QNN_SDK_ROOT}/examples/Models/InceptionV3/model/Inception_v3_quantized.bin \
-o ${QNN_SDK_ROOT}/examples/Models/InceptionV3/model_libs \
-t x86_64-linux-clang
3) Context binary creation
$export QNN_TARGET_ARCH=aarch64-qnx
$ cd ${QNN_SDK_ROOT}/examples/Models/InceptionV3 $ cp ${QNN_SDK_ROOT}/target/hexagon-v68/lib/unsigned/libQnnHtpMcpV68.elf network.elf $ ${QNN_SDK_ROOT}/target/x86_64-linux-clang/bin/qnn-context-binary-generator \ --backend ${QNN_SDK_ROOT}/target/x86_64-linux-clang/lib/libQnnHtpMcp.so \ --model ${QNN_SDK_ROOT}/examples/Models/InceptionV3/model_libs/x86_64-linux-clang/libInception_v3_quantized.so \ --binary_file Inception_v3_quantized_qpc.serialized
4) Execution on hardware
All the necessary artifacts were transferred to hardware
$ cd /data/local/tmp/inception_v3 $ export VENDOR_LIB=/mnt/lib64/
$ ./qnn-net-run --backend libQnnHtpMcp.so --input_list target_raw_list.txt --retrieve_context Inception_v3_quantized_qpc.serialized.bin
ERROR occured after execution:
qnn-net-run pid:3162185
0.0ms [ ERROR ] QnnDsp <E> Failed executing graph Inception_v3_quantized, error: 40
6050.7ms [ ERROR ] Execution of Graph: 0 failed!
6050.7ms [ ERROR ] Graph Execution failure
similarly the sample API application also gives error with HTPMCP backend.
The error generated is as follows:
6017.8ms [ ERROR ] Create From Binary failure
0.0ms [ ERROR ] QnnDsp <E> Invalid context handle
Dear developer,
You need to input a confile file and settings to QNN serialization step as below.
config.json
PerfSettings.conf
QNN serialization commands,
BR.
Wei
Hi weihuan,
can you also provide all the parameters which we can set using "PerfSettings.conf" file ?
example: how to set device id , how to set number of cores, etc,.
As the documentation gives information about setting the graph parameters, but not for device id and other parameters.
Thank you.
Dear developer,
You can take a look at the confie file shared to you above. That's the template file for you. For distinguish platform, you can replace with below arch.
v68 SM8350
v69 SM8450
v73 SM8550
Other required parameter is the graph name. This name was the tag from .cpp generated by QNN.
BR.
Wei
Hi weihuan
If possible can you provide us the details of how to execute qnn-net-run inference on SA9000 platform using HTPMCP backend?
This query is related to SA9000 as target with HTPMCP backend.
Thank you.
Hi weihuan,
we tried giving the config.json file as mentioned for SA9000 target( snapdragon-ride3) with HTPMCP backend on QNN-SDK version 2.7.0 .
configfile.json
{
"backend_extensions": {
"shared_library_path": "/path/to/libQnnHtpMcpNetRunExtensions.so",
"config_file_path": "/path/to/PerfSetting.conf"
}
}
PerfSetting.conf
{
"graphs":{
"graph_names":["graph_name"],
"vtcm_mb":8
},
"devices":[
{
"dsp_arch":"v68",
"cores":[{
"rpc_control_latency":100,
"perf_profile":"burst"
}]
}
]
}
When we pass this above config file with qnn-net-run with generated conext binary ,using command
./qnn-net-run --backend libQnnHtpMcp.so --input_list target_raw_list.txt --retrieve_context Inception_v3_quantized_qpc.serialized.bin --config_file configfile.json
we get the following error:
qnn-net-run pid:12202063
0.0ms [ ERROR ] Unknown key: graphs/graph_names/0
0.0ms [ ERROR ] Unknown key: graphs/vtcm_mb
0.0ms [ ERROR ] Unknown key: devices/0/dsp_arch
0.0ms [ ERROR ] Unknown key: devices/0/cores/0/rpc_control_latency
0.0ms [ ERROR ] Unknown key: devices/0/cores/0/perf_profile
0.0ms [ ERROR ] QnnDsp <E> Invalid number of cores passed: 0
0.0ms [ ERROR ] QnnDsp <E> Failed to parse default platform info: 1004
0.0ms [ ERROR ] QnnDsp <E> Failed to parse platform config: 1004
1142.4ms [ ERROR ] Failed to create device: 1004
1142.4ms [ ERROR ] Device Creation failure
Can we give the configfile with HtpMcp backend?
While running the qnn-net-run without the config file for quantized model with HTPMCP backend
./qnn-net-run --backend libQnnHtpMcp.so --input_list target_raw_list.txt --retrieve_context Inception_v3_quantized_qpc.serialized.bin
we get the error as follows:
qnn-net-run pid:11857996
0.0ms [ ERROR ] QnnDsp <E> Invalid number of cores passed: 0
0.0ms [ ERROR ] QnnDsp <E> Failed to parse default platform info: 1004
0.0ms [ ERROR ] QnnDsp <E> Failed to load default platform info: 1004
0.0ms [ ERROR ] QnnDsp <E> Failed to parse platform config: 1004
1153.3ms [ ERROR ] Failed to create device: 1004
1153.3ms [ ERROR ] Device Creation failure
we would like to know how to resolve this error.
waiting for your response,
Thank you.