Skip to content

Commit

Permalink
Enable Qnn nuget nightly (#20662)
Browse files Browse the repository at this point in the history
### Description
Enable Qnn nuget nightly
  • Loading branch information
HectorSVC authored May 14, 2024
1 parent c131ea8 commit 0e11d0c
Show file tree
Hide file tree
Showing 5 changed files with 349 additions and 262 deletions.
4 changes: 2 additions & 2 deletions cmake/onnxruntime_unittests.cmake
Original file line number Diff line number Diff line change
Expand Up @@ -876,9 +876,9 @@ if (MSVC)
"$<$<NOT:$<COMPILE_LANGUAGE:CUDA>>:/wd26451>")
target_compile_options(onnxruntime_test_all PRIVATE "$<$<COMPILE_LANGUAGE:CUDA>:SHELL:--compiler-options /wd4244>"
"$<$<NOT:$<COMPILE_LANGUAGE:CUDA>>:/wd4244>")
# Avoid the error for Win arm64 Release build. error C1128: number of sections exceeded object file format limit: compile with /bigobj
# Avoid the error for Win arm64 build. error C1128: number of sections exceeded object file format limit: compile with /bigobj
string(TOLOWER ${onnxruntime_target_platform} GEN_PLATFORM)
if (${GEN_PLATFORM} STREQUAL "arm64" AND "${CMAKE_BUILD_TYPE}" STREQUAL "Release")
if (${GEN_PLATFORM} STREQUAL "arm64")
target_compile_options(onnxruntime_test_all PRIVATE "/bigobj")
endif()
else()
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -68,6 +68,11 @@ parameters:
- 11.8
- 12.2

- name: QnnSdk
displayName: QNN SDK Version
type: string
default: 2.21.0.240401

resources:
repositories:
- repository: onnxruntime-inference-examples # The name used to reference this repository in the checkout step
Expand Down Expand Up @@ -768,4 +773,95 @@ stages:
targetPath: '$(Build.ArtifactStagingDirectory)'
- template: templates/component-governance-component-detection-steps.yml
parameters:
condition: 'succeeded'
condition: 'succeeded'

- template: templates/qnn-ep-win.yml
parameters:
qnn_ep_build_pool_name: 'Onnxruntime-QNNEP-Windows-2022-CPU'
QnnSdk: ${{ parameters.QnnSdk }}
IsReleaseBuild: ${{ parameters.IsReleaseBuild }}
DoEsrp: ${{ parameters.DoEsrp }}
ArtifactName: 'drop-nuget-qnn-x64'
StageName: 'OnnxRuntime_QNN_Nuget_Win_x64'
build_config: 'RelWithDebInfo'
- template: templates/qnn-ep-win.yml
parameters:
qnn_ep_build_pool_name: 'Onnxruntime-QNNEP-Windows-2022-CPU'
QnnSdk: ${{ parameters.QnnSdk }}
IsReleaseBuild: ${{ parameters.IsReleaseBuild }}
DoEsrp: ${{ parameters.DoEsrp }}
ArtifactName: 'drop-nuget-qnn-arm64'
buildParameter: '--arm64'
buildPlatform: 'ARM64'
buildArch: 'ARM64'
StageName: 'OnnxRuntime_QNN_Nuget_Win_Arm64'
build_config: 'RelWithDebInfo'

- stage: NuGet_Packaging_QNN
pool: 'Onnxruntime-QNNEP-Windows-2022-CPU'
dependsOn:
- OnnxRuntime_QNN_Nuget_Win_x64
- OnnxRuntime_QNN_Nuget_Win_Arm64
condition: succeeded()
jobs:
- job:
workspace:
clean: all
steps:
- task: DownloadPipelineArtifact@0
displayName: 'Download Pipeline Artifact - QNN NuGet x64'
inputs:
artifactName: 'drop-nuget-qnn-x64'
targetPath: '$(Build.BinariesDirectory)/nuget-artifact-x64'

- task: DownloadPipelineArtifact@0
displayName: 'Download Pipeline Artifact - QNN NuGet arm64'
inputs:
artifactName: 'drop-nuget-qnn-arm64'
targetPath: '$(Build.BinariesDirectory)/nuget-artifact-arm64'

- task: PowerShell@2
displayName: 'Bundle NuGet'
inputs:
targetType: 'inline'
script: |
$x64_nupkgs = (Get-ChildItem $(Build.BinariesDirectory)/nuget-artifact-x64 -Filter Microsoft.ML.OnnxRuntime.QNN*.nupkg -Recurse)
$nuget_package_name = $x64_nupkgs[0].Name
$x64_nuget_package = $x64_nupkgs[0].FullName
$nupkg_unzipped_directory = [System.IO.Path]::Combine($Env:BUILD_ARTIFACTSTAGINGDIRECTORY, 'nuget_unzip_merged', [System.IO.Path]::GetFileNameWithoutExtension($nuget_package_name))
$x64_unzip_cmd = "7z.exe x $x64_nuget_package -y -o$nupkg_unzipped_directory"
Invoke-Expression -Command $x64_unzip_cmd
$arm64_nupkgs = (Get-ChildItem $(Build.BinariesDirectory)/nuget-artifact-arm64 -Filter Microsoft.ML.OnnxRuntime.QNN*.nupkg -Recurse)
$arm64_nuget_package = $arm64_nupkgs[0].FullName
$arm64_unzip_cmd = "7z.exe x $arm64_nuget_package -y -o$nupkg_unzipped_directory"
Invoke-Expression -Command $arm64_unzip_cmd
$merged_nuget_path = [System.IO.Path]::Combine($Env:BUILD_ARTIFACTSTAGINGDIRECTORY, 'nuget-artifact-merged')
if (!(Test-Path $merged_nuget_path)) {
New-Item -Path $merged_nuget_path -ItemType Directory
}
$merged_zip = [System.IO.Path]::Combine($merged_nuget_path, 'qnn_nuget.zip')
$zip_cmd = "7z.exe a -r $merged_zip $nupkg_unzipped_directory/*"
Invoke-Expression -Command $zip_cmd
$merged_nuget = [System.IO.Path]::Combine($merged_nuget_path, $nuget_package_name)
move $merged_zip $merged_nuget
workingDirectory: $(Build.BinariesDirectory)

- template: templates/esrp_nuget.yml
parameters:
DisplayName: 'ESRP - sign NuGet package'
FolderPath: '$(Build.ArtifactStagingDirectory)/nuget-artifact-merged'
DoEsrp: ${{ parameters.DoEsrp }}

- task: PublishPipelineArtifact@0
displayName: 'Publish Pipeline NuGet Artifact'
inputs:
artifactName: 'drop-signed-nuget-qnn'
targetPath: '$(Build.ArtifactStagingDirectory)/nuget-artifact-merged'
5 changes: 5 additions & 0 deletions tools/ci_build/github/azure-pipelines/publish-nuget.yml
Original file line number Diff line number Diff line change
Expand Up @@ -101,6 +101,11 @@ stages:
artifact: 'drop-signed-nuget-ROCm'
- script: move "$(Pipeline.Workspace)\build\drop-signed-nuget-ROCm\*" $(Build.BinariesDirectory)\nuget-artifact\final-package

- download: build
displayName: 'Download Pipeline Artifact - Signed NuGet Qnn Package'
artifact: 'drop-signed-nuget-qnn'
- script: move "$(Pipeline.Workspace)\build\drop-signed-nuget-qnn\*" $(Build.BinariesDirectory)\nuget-artifact\final-package

- script: |
dir $(Build.BinariesDirectory)\nuget-artifact\final-package
cd $(Build.BinariesDirectory)\nuget-artifact\final-package
Expand Down
Loading

0 comments on commit 0e11d0c

Please sign in to comment.