mirror of
https://github.com/saymrwulf/onnxruntime.git
synced 2026-06-02 23:39:58 +00:00
[QNN EP] Download QNN SDK from azure blob in packaging pipelines (#20359)
### Description - Updates Windows QNN Nuget and Python packaging pipelines to download QNN SDK from blob storage. - Makes the QNN SDK version configurable when launching the python packaging pipeline. ### Motivation and Context Removes the need to rebuild images to update QNN SDK. Only applies to Windows pipelines. Linux pipelines still get the SDK from disk.
This commit is contained in:
parent
94c69f55d4
commit
e6a677f6b7
6 changed files with 73 additions and 30 deletions
|
|
@ -55,6 +55,12 @@ parameters:
|
|||
- RelWithDebInfo
|
||||
- MinSizeRel
|
||||
|
||||
# Only applies to QNN packages.
|
||||
- name: qnn_sdk_version
|
||||
type: string
|
||||
displayName: 'QNN SDK version. Only for QNN packages.'
|
||||
default: 2.19.2.240210
|
||||
|
||||
trigger: none
|
||||
|
||||
resources:
|
||||
|
|
@ -78,3 +84,4 @@ stages:
|
|||
enable_windows_x64_qnn: ${{ parameters.enable_windows_x64_qnn }}
|
||||
build_py_parameters: ${{ parameters.build_py_parameters }}
|
||||
cmake_build_type: ${{ parameters.cmake_build_type }}
|
||||
qnn_sdk_version: ${{ parameters.qnn_sdk_version }}
|
||||
|
|
|
|||
|
|
@ -2,7 +2,7 @@ parameters:
|
|||
- name: QnnSdk
|
||||
displayName: QNN SDK Version
|
||||
type: string
|
||||
default: qnn-v2.19.2.240210_win
|
||||
default: 2.19.2.240210
|
||||
|
||||
- name: build_config
|
||||
displayName: Build Configuration
|
||||
|
|
@ -37,7 +37,7 @@ jobs:
|
|||
buildArch: x64
|
||||
setVcvars: true
|
||||
ALLOW_RELEASED_ONNX_OPSET_ONLY: '1'
|
||||
commonBuildArgs: '--compile_no_warning_as_error --build_dir $(Build.BinariesDirectory)\Windows --skip_submodule_sync --build_shared_lib --cmake_generator "Visual Studio 17 2022" --config ${{ parameters.build_config }} --use_qnn --qnn_home C:\data\qnnsdk\${{parameters.QnnSdk}} --parallel --use_binskim_compliant_compile_flags '
|
||||
commonBuildArgs: '--compile_no_warning_as_error --build_dir $(Build.BinariesDirectory)\Windows --skip_submodule_sync --build_shared_lib --cmake_generator "Visual Studio 17 2022" --config ${{ parameters.build_config }} --parallel --use_binskim_compliant_compile_flags '
|
||||
|
||||
steps:
|
||||
- template: templates/set-version-number-variables-step.yml
|
||||
|
|
@ -51,24 +51,22 @@ jobs:
|
|||
versionSpec: '3.8'
|
||||
addToPath: true
|
||||
|
||||
- task: CmdLine@2
|
||||
displayName: 'Check available QNN SDK versions'
|
||||
inputs:
|
||||
script: |
|
||||
dir C:\data\qnnsdk\qnn*
|
||||
- template: templates/jobs/download_win_qnn_sdk.yml
|
||||
parameters:
|
||||
QnnSDKVersion: ${{ parameters.QnnSdk }}
|
||||
|
||||
- task: PythonScript@0
|
||||
displayName: 'Build onnxruntime for x64'
|
||||
inputs:
|
||||
scriptPath: '$(Build.SourcesDirectory)\tools\ci_build\build.py'
|
||||
arguments: '--skip_tests $(commonBuildArgs)'
|
||||
arguments: '--skip_tests --use_qnn --qnn_home $(QnnSDKRootDir) $(commonBuildArgs)'
|
||||
|
||||
- task: PythonScript@0
|
||||
displayName: 'Run unit tests'
|
||||
condition: and(succeeded(), eq('${{ parameters.runTests}}', true))
|
||||
inputs:
|
||||
scriptPath: '$(Build.SourcesDirectory)\tools\ci_build\build.py'
|
||||
arguments: '--test $(commonBuildArgs)'
|
||||
arguments: '--test --use_qnn --qnn_home $(QnnSDKRootDir) $(commonBuildArgs)'
|
||||
|
||||
- template: templates/win-esrp-dll.yml
|
||||
parameters:
|
||||
|
|
@ -80,7 +78,7 @@ jobs:
|
|||
displayName: 'Generating nuspec for the native Nuget package x64'
|
||||
inputs:
|
||||
script: |
|
||||
python "$(Build.SourcesDirectory)\tools\nuget\generate_nuspec_for_native_nuget.py" --package_version $(OnnxRuntimeVersion) --package_name Microsoft.ML.OnnxRuntime.QNN --target_architecture x64 --build_config ${{ parameters.build_config }} --native_build_path=$(Build.BinariesDirectory)\Windows\${{ parameters.build_config }}\${{ parameters.build_config }} --packages_path $(Build.BinariesDirectory)\Windows\packages --ort_build_path $(Build.BinariesDirectory)\Windows --sources_path $(Build.SourcesDirectory) --commit_id $(OnnxRuntimeGitCommitHash) --is_release_build ${{ parameters.IsReleaseBuild }} --sdk_info ${{ parameters.QnnSdk }}
|
||||
python "$(Build.SourcesDirectory)\tools\nuget\generate_nuspec_for_native_nuget.py" --package_version $(OnnxRuntimeVersion) --package_name Microsoft.ML.OnnxRuntime.QNN --target_architecture x64 --build_config ${{ parameters.build_config }} --native_build_path=$(Build.BinariesDirectory)\Windows\${{ parameters.build_config }}\${{ parameters.build_config }} --packages_path $(Build.BinariesDirectory)\Windows\packages --ort_build_path $(Build.BinariesDirectory)\Windows --sources_path $(Build.SourcesDirectory) --commit_id $(OnnxRuntimeGitCommitHash) --is_release_build ${{ parameters.IsReleaseBuild }} --sdk_info qnn-v${{ parameters.QnnSdk }}
|
||||
cd $(Build.BinariesDirectory)\Windows\${{ parameters.build_config }}\${{ parameters.build_config }}
|
||||
nuget pack NativeNuget.nuspec
|
||||
mkdir $(Build.ArtifactStagingDirectory)\x64
|
||||
|
|
@ -111,6 +109,10 @@ jobs:
|
|||
inputs:
|
||||
forceReinstallCredentialProvider: true
|
||||
|
||||
- template: templates/jobs/download_win_qnn_sdk.yml
|
||||
parameters:
|
||||
QnnSDKVersion: ${{ parameters.QnnSdk }}
|
||||
|
||||
- task: UsePythonVersion@0
|
||||
inputs:
|
||||
versionSpec: '3.8'
|
||||
|
|
@ -120,7 +122,7 @@ jobs:
|
|||
displayName: 'Generate CMake Configuration for arm64'
|
||||
inputs:
|
||||
scriptPath: '$(Build.SourcesDirectory)\tools\ci_build\build.py'
|
||||
arguments: '--update --arm64 --build_dir $(Build.BinariesDirectory)\Win_arm64 --skip_submodule_sync --skip_tests --build_shared_lib --cmake_generator "Visual Studio 17 2022" --config ${{ parameters.build_config }} --use_qnn --qnn_home C:\data\qnnsdk\${{parameters.QnnSdk}} --parallel'
|
||||
arguments: '--update --arm64 --build_dir $(Build.BinariesDirectory)\Win_arm64 --skip_submodule_sync --skip_tests --build_shared_lib --cmake_generator "Visual Studio 17 2022" --config ${{ parameters.build_config }} --use_qnn --qnn_home $(QnnSDKRootDir) --parallel'
|
||||
|
||||
- task: VSBuild@1
|
||||
displayName: 'Build onnxruntime arm64'
|
||||
|
|
@ -168,7 +170,7 @@ jobs:
|
|||
displayName: 'Generating nuspec for the native Nuget package arm64'
|
||||
inputs:
|
||||
script: |
|
||||
python "$(Build.SourcesDirectory)\tools\nuget\generate_nuspec_for_native_nuget.py" --package_version $(OnnxRuntimeVersion) --package_name Microsoft.ML.OnnxRuntime.QNN --target_architecture arm64 --build_config ${{ parameters.build_config }} --native_build_path=$(Build.BinariesDirectory)\Win_arm64\${{ parameters.build_config }}\${{ parameters.build_config }} --packages_path $(Build.BinariesDirectory)\Win_arm64\packages --ort_build_path $(Build.BinariesDirectory)\Win_arm64 --sources_path $(Build.SourcesDirectory) --commit_id $(OnnxRuntimeGitCommitHash) --is_release_build ${{ parameters.IsReleaseBuild }} --sdk_info ${{ parameters.QnnSdk }}
|
||||
python "$(Build.SourcesDirectory)\tools\nuget\generate_nuspec_for_native_nuget.py" --package_version $(OnnxRuntimeVersion) --package_name Microsoft.ML.OnnxRuntime.QNN --target_architecture arm64 --build_config ${{ parameters.build_config }} --native_build_path=$(Build.BinariesDirectory)\Win_arm64\${{ parameters.build_config }}\${{ parameters.build_config }} --packages_path $(Build.BinariesDirectory)\Win_arm64\packages --ort_build_path $(Build.BinariesDirectory)\Win_arm64 --sources_path $(Build.SourcesDirectory) --commit_id $(OnnxRuntimeGitCommitHash) --is_release_build ${{ parameters.IsReleaseBuild }} --sdk_info qnn-v${{ parameters.QnnSdk }}
|
||||
cd $(Build.BinariesDirectory)\Win_arm64\${{ parameters.build_config }}\${{ parameters.build_config }}
|
||||
nuget pack NativeNuget.nuspec
|
||||
mkdir $(Build.ArtifactStagingDirectory)\arm64
|
||||
|
|
|
|||
|
|
@ -0,0 +1,30 @@
|
|||
parameters:
|
||||
- name: QnnSDKVersion
|
||||
type: string
|
||||
default: '2.19.2.240210'
|
||||
|
||||
steps:
|
||||
- powershell: |
|
||||
azcopy.exe cp --recursive https://lotusscus.blob.core.windows.net/models/qnnsdk/qnn-v${{ parameters.QnnSDKVersion }}_win $(Agent.TempDirectory)
|
||||
displayName: 'Download QNN SDK v${{ parameters.QnnSDKVersion }}'
|
||||
|
||||
- powershell: |
|
||||
echo "##vso[task.setvariable variable=QnnSDKRootDir]$(Agent.TempDirectory)\qnn-v${{ parameters.QnnSDKVersion }}_win"
|
||||
displayName: Set QnnSDKRootDir
|
||||
|
||||
- task: CmdLine@2
|
||||
inputs:
|
||||
script: |
|
||||
echo $(QnnSDKRootDir)
|
||||
displayName: 'Print QnnSDKRootDir after downloading QNN SDK'
|
||||
|
||||
- powershell: |
|
||||
azcopy.exe cp --recursive 'https://lotusscus.blob.core.windows.net/models/qnnsdk/Qualcomm AI Hub Proprietary License.pdf' $(QnnSDKRootDir)
|
||||
displayName: 'Download Qualcomm AI Hub license'
|
||||
|
||||
- task: CmdLine@2
|
||||
displayName: 'Print contents of QNN SDK'
|
||||
inputs:
|
||||
script: |
|
||||
dir $(QnnSDKRootDir)
|
||||
|
||||
|
|
@ -56,6 +56,12 @@ parameters:
|
|||
- RelWithDebInfo
|
||||
- MinSizeRel
|
||||
|
||||
# Only applies to QNN packages.
|
||||
- name: qnn_sdk_version
|
||||
type: string
|
||||
displayName: 'QNN SDK version. Only for QNN packages.'
|
||||
default: 2.19.2.240210
|
||||
|
||||
stages:
|
||||
- ${{ if eq(parameters.enable_windows_cpu, true) }}:
|
||||
- stage: Python_Packaging_Windows_CPU
|
||||
|
|
@ -484,7 +490,7 @@ stages:
|
|||
- template: py-win-arm64-qnn.yml
|
||||
parameters:
|
||||
MACHINE_POOL: 'onnxruntime-qnn-windows-vs-2022-arm64'
|
||||
QNN_SDK: 'qnn-v2.19.2.240210_win'
|
||||
QNN_SDK: ${{ parameters.qnn_sdk_version }}
|
||||
PYTHON_VERSION: '3.11'
|
||||
NUMPY_VERSION: '1.26.4'
|
||||
|
||||
|
|
@ -495,4 +501,4 @@ stages:
|
|||
- template: py-win-x64-qnn.yml
|
||||
parameters:
|
||||
MACHINE_POOL: 'Onnxruntime-QNNEP-Windows-2022-CPU'
|
||||
QNN_SDK: 'qnn-v2.19.2.240210_win'
|
||||
QNN_SDK: ${{ parameters.qnn_sdk_version }}
|
||||
|
|
|
|||
|
|
@ -5,9 +5,9 @@ parameters:
|
|||
default: 'onnxruntime-qnn-windows-vs-2022-arm64'
|
||||
|
||||
- name: QNN_SDK
|
||||
displayName: QNN Windows SDK path
|
||||
displayName: QNN SDK Version
|
||||
type: string
|
||||
default: qnn-v2.19.2.240210_win
|
||||
default: 2.19.2.240210
|
||||
|
||||
- name: PYTHON_VERSION
|
||||
type: string
|
||||
|
|
@ -37,7 +37,6 @@ jobs:
|
|||
variables:
|
||||
GRADLE_OPTS: '-Dorg.gradle.daemon=false'
|
||||
VSGenerator: 'Visual Studio 17 2022'
|
||||
QNN_SDK_ROOTDIR: 'C:\data\qnnsdk\${{parameters.QNN_SDK}}'
|
||||
steps:
|
||||
- checkout: self
|
||||
clean: true
|
||||
|
|
@ -45,10 +44,6 @@ jobs:
|
|||
|
||||
- template: telemetry-steps.yml
|
||||
|
||||
- script: |
|
||||
DIR C:\data\qnnsdk
|
||||
displayName: Check available QNN SDKs
|
||||
|
||||
- script: |
|
||||
MKDIR $(Agent.ToolsDirectory)\Python\3.11.0\arm64
|
||||
XCOPY /s /y /h /e /c /q "C:\Python\Python311\*.*" $(Agent.ToolsDirectory)\Python\3.11.0\arm64\
|
||||
|
|
@ -81,6 +76,10 @@ jobs:
|
|||
|
||||
- template: set-nightly-build-option-variable-step.yml
|
||||
|
||||
- template: jobs/download_win_qnn_sdk.yml
|
||||
parameters:
|
||||
QnnSDKVersion: ${{ parameters.QNN_SDK }}
|
||||
|
||||
- task: PythonScript@0
|
||||
displayName: 'Generate cmake config'
|
||||
inputs:
|
||||
|
|
@ -91,7 +90,7 @@ jobs:
|
|||
--skip_submodule_sync
|
||||
--cmake_generator "$(VSGenerator)"
|
||||
--use_qnn
|
||||
--qnn_home $(QNN_SDK_ROOTDIR)
|
||||
--qnn_home $(QnnSDKRootDir)
|
||||
--enable_pybind
|
||||
--parallel --update
|
||||
--numpy_version ${{ parameters.NUMPY_VERSION }}
|
||||
|
|
|
|||
|
|
@ -5,9 +5,9 @@ parameters:
|
|||
default: 'Onnxruntime-QNNEP-Windows-2022-CPU'
|
||||
|
||||
- name: QNN_SDK
|
||||
displayName: QNN Windows SDK path
|
||||
displayName: QNN SDK Version
|
||||
type: string
|
||||
default: qnn-v2.19.2.240210_win
|
||||
default: 2.19.2.240210
|
||||
|
||||
- name: ENV_SETUP_SCRIPT
|
||||
type: string
|
||||
|
|
@ -41,7 +41,6 @@ jobs:
|
|||
variables:
|
||||
GRADLE_OPTS: '-Dorg.gradle.daemon=false'
|
||||
VSGenerator: 'Visual Studio 17 2022'
|
||||
QNN_SDK_ROOTDIR: 'C:\data\qnnsdk\${{parameters.QNN_SDK}}'
|
||||
steps:
|
||||
- checkout: self
|
||||
clean: true
|
||||
|
|
@ -49,10 +48,6 @@ jobs:
|
|||
|
||||
- template: telemetry-steps.yml
|
||||
|
||||
- script: |
|
||||
DIR C:\data\qnnsdk
|
||||
displayName: Check available QNN SDKs
|
||||
|
||||
- task: UsePythonVersion@0
|
||||
inputs:
|
||||
versionSpec: $(PythonVersion)
|
||||
|
|
@ -94,6 +89,10 @@ jobs:
|
|||
|
||||
- template: set-nightly-build-option-variable-step.yml
|
||||
|
||||
- template: jobs/download_win_qnn_sdk.yml
|
||||
parameters:
|
||||
QnnSDKVersion: ${{ parameters.QNN_SDK }}
|
||||
|
||||
- task: PythonScript@0
|
||||
displayName: 'Generate cmake config'
|
||||
inputs:
|
||||
|
|
@ -104,7 +103,7 @@ jobs:
|
|||
--skip_submodule_sync
|
||||
--cmake_generator "$(VSGenerator)"
|
||||
--use_qnn
|
||||
--qnn_home $(QNN_SDK_ROOTDIR)
|
||||
--qnn_home $(QnnSDKRootDir)
|
||||
--enable_pybind
|
||||
--parallel --update
|
||||
$(TelemetryOption) ${{ parameters.BUILD_PY_PARAMETERS }}
|
||||
|
|
|
|||
Loading…
Reference in a new issue