mirror of
https://github.com/saymrwulf/onnxruntime.git
synced 2026-07-13 18:08:13 +00:00
### Description Enable Qnn Context cache feature to save model initialization time Provider options: qnn_context_cache_enable|1 to enable the cache feature qnn_context_cache_path to set the cache path. It is set to model_file.onnx.bin by default. ### Motivation and Context Model initialization time takes long because the cost of conversion from Onnx model to Qnn model. Qnn have feature to serialize the Qnn context to file, then next time user can load it from the cache context and execute the graph to save the cost. --------- Co-authored-by: Adrian Lizarraga <adlizarraga@microsoft.com>
93 lines
3.1 KiB
YAML
93 lines
3.1 KiB
YAML
parameters:
|
|
|
|
- name: QnnSdk
|
|
displayName: QNN SDK version
|
|
type: string
|
|
default: qnn-v2.10.0.230425122932_54038
|
|
|
|
jobs:
|
|
- job: Build_QNN_EP
|
|
pool: onnxruntime-qnn-ubuntu-2004-cpu
|
|
timeoutInMinutes: 60
|
|
workspace:
|
|
clean: all
|
|
|
|
variables:
|
|
- name: QNN_SDK_ROOT
|
|
value: /data/qnnsdk/${{parameters.QnnSdk}}
|
|
|
|
steps:
|
|
- script: |
|
|
ls /data/qnnsdk
|
|
ls -R /data/qnn_test_data
|
|
displayName: Check QNN test data
|
|
|
|
- task: UsePythonVersion@0
|
|
displayName: Use Python $(pythonVersion)
|
|
inputs:
|
|
versionSpec: $(pythonVersion)
|
|
|
|
- script: sudo apt-get update -y && sudo apt-get install -y coreutils ninja-build
|
|
displayName: Install coreutils and ninja
|
|
|
|
- script: |
|
|
python3 tools/ci_build/build.py \
|
|
--build_dir build \
|
|
--config Release \
|
|
--parallel \
|
|
--use_qnn \
|
|
--qnn_home $(QNN_SDK_ROOT) \
|
|
--cmake_generator=Ninja \
|
|
--skip_tests
|
|
displayName: Build QNN EP
|
|
|
|
- script: |
|
|
python3 tools/ci_build/build.py \
|
|
--build_dir build \
|
|
--config Release \
|
|
--test \
|
|
--qnn_home $(QNN_SDK_ROOT) \
|
|
--cmake_generator=Ninja \
|
|
--skip_submodule_sync \
|
|
--ctest_path ""
|
|
displayName: Run unit tests
|
|
|
|
- task: CmdLine@2
|
|
displayName: Run ONNX tests
|
|
inputs:
|
|
script: |
|
|
./build/Release/onnx_test_runner -e qnn \
|
|
-v -j 1 -c 1 -i "backend_path|$(QNN_SDK_ROOT)/target/x86_64-linux-clang/lib/libQnnCpu.so" \
|
|
cmake/external/onnx/onnx/backend/test/data/node
|
|
|
|
- task: CmdLine@2
|
|
displayName: Run float32 model tests
|
|
inputs:
|
|
script: |
|
|
./build/Release/onnx_test_runner -e qnn \
|
|
-v -j 1 -c 1 -i "backend_path|$(QNN_SDK_ROOT)/target/x86_64-linux-clang/lib/libQnnCpu.so" \
|
|
/data/float32_models
|
|
|
|
- task: CmdLine@2
|
|
displayName: Run QDQ model tests
|
|
inputs:
|
|
script: |
|
|
./build/Release/onnx_test_runner -e qnn \
|
|
-v -j 1 -c 1 -i "backend_path|$(QNN_SDK_ROOT)/target/x86_64-linux-clang/lib/libQnnHtp.so" \
|
|
/data/qdq_models
|
|
|
|
- task: CmdLine@2
|
|
displayName: Run QDQ model tests with context cache enabled
|
|
inputs:
|
|
script: |
|
|
./build/Release/onnx_test_runner -e qnn \
|
|
-v -j 1 -c 1 -i "backend_path|$(QNN_SDK_ROOT)/target/x86_64-linux-clang/lib/libQnnHtp.so qnn_context_cache_enable|1 qnn_context_cache_path|./build/Release/mobilenet_qdq.bin" \
|
|
/data/qdq_models/mobilenetv2-1.0_add_transpose_quant
|
|
|
|
- task: CmdLine@2
|
|
displayName: Run QDQ model tests with load from cached context
|
|
inputs:
|
|
script: |
|
|
./build/Release/onnx_test_runner -e qnn \
|
|
-v -j 1 -c 1 -i "backend_path|$(QNN_SDK_ROOT)/target/x86_64-linux-clang/lib/libQnnHtp.so qnn_context_cache_enable|1 qnn_context_cache_path|./build/Release/mobilenet_qdq.bin" \
|
|
/data/qdq_models/mobilenetv2-1.0_add_transpose_quant
|