Forums - QNN-SDK-2.6.0 HTPMCP backend execution failed with qnn-net-run

6 posts / 0 new
Last post
QNN-SDK-2.6.0 HTPMCP backend execution failed with qnn-net-run
raganit
Join Date: 28 Mar 22
Posts: 4
Posted: Fri, 2023-02-17 04:45

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:

0.0ms [ INFO ] QnnDsp <I> QnnContext_setConfig context 1
 
0.0ms [ ERROR ] QnnDsp <E> qnn::contextSetConfigDsp not yet implemented for HTP MCP Backend
 
0.0ms [ ERROR ] QnnDsp <E> Skel side setting the context failed
 
0.0ms [ ERROR ] QnnDsp <E> Context set config failed with err 5000
 
0.0ms [ INFO ] QnnDsp <I> Context free contextId 1
 
0.0ms [ ERROR ] QnnDsp <E> Context create from binary failed with err 5000
 
6008.8ms [ ERROR ] Could not create context from binary.
6017.8ms [ ERROR ] Create From Binary failure
0.0ms [ ERROR ] QnnDsp <E> Invalid context handle
 
6017.8ms [ ERROR ] Could not free context
 
 
"please provide information how to resolve this error.
 Also where can we find reference documents for HTPMCP backend execution"

 

 



 

  • Up1
  • Down0
weihuan
Join Date: 12 Apr 20
Posts: 270
Posted: Sat, 2023-02-18 06:54

Dear developer,

You need to input a confile file and settings to QNN serialization step as below.

config.json

{
  "backend_extensions": {
    "shared_library_path": "libQnnHtpNetRunExtensions.so",
    "config_file_path": "PerfSettings.conf"
  }
}

 

PerfSettings.conf

{
  "graphs": {
  "graph_names":["graph_name"],
  "vtcm_mb":8
  },

  "devices": [
  {
    "dsp_arch": "v69",
    "cores":[{
    "rpc_control_latency": 100,
    "perf_profile": "burst"
    }]
  }
  ]
}

 

QNN serialization commands,

    qnn-context-binary-generator --model qnn/x86_64-linux-clang/lib${MODEL_NAME}_quant_${W_BW}w${A_BW}a${B_BW}b.so \
        --backend ${QNN_SDK_ROOT}/target/x86_64-linux-clang/lib/libQnnHtp.so \
        --binary_file ${MODEL_NAME}_quant_${W_BW}w${A_BW}a${B_BW}b_serialized \
        --config_file local_config.json \
        --output_dir qnn

 

BR.

Wei

 

 

  • Up0
  • Down0
raganit
Join Date: 28 Mar 22
Posts: 4
Posted: Sun, 2023-02-19 22:11

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.

 

 

  • Up0
  • Down0
weihuan
Join Date: 12 Apr 20
Posts: 270
Posted: Sun, 2023-02-19 23:11

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

  • Up0
  • Down0
raganit
Join Date: 28 Mar 22
Posts: 4
Posted: Mon, 2023-02-20 02:02

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.

  • Up0
  • Down0
raganit
Join Date: 28 Mar 22
Posts: 4
Posted: Thu, 2023-02-23 05:38

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.
 

  • Up0
  • Down0
or Register

Opinions expressed in the content posted here are the personal opinions of the original authors, and do not necessarily reflect those of Qualcomm Incorporated or its subsidiaries (“Qualcomm”). The content is provided for informational purposes only and is not meant to be an endorsement or representation by Qualcomm or any other party. This site may also provide links or references to non-Qualcomm sites and resources. Qualcomm makes no representations, warranties, or other commitments whatsoever about any non-Qualcomm sites or third-party resources that may be referenced, accessible from, or linked to this site.