Skip to content

Commit

Permalink
Add QNN nuget package and fix nuget packaging pipeline (#1220)
Browse files Browse the repository at this point in the history
  • Loading branch information
baijumeswani authored Feb 3, 2025
1 parent 8846d0b commit 728cc93
Show file tree
Hide file tree
Showing 3 changed files with 45 additions and 3 deletions.
6 changes: 6 additions & 0 deletions .pipelines/nuget-publishing.yml
Original file line number Diff line number Diff line change
Expand Up @@ -48,6 +48,11 @@ parameters:
type: boolean
default: false

- name: enable_win_qnn
displayName: 'Whether QNN nuget package should be built.'
type: boolean
default: false

- name: ort_version
displayName: 'OnnxRuntime version'
type: string
Expand Down Expand Up @@ -122,6 +127,7 @@ stages:
ort_cuda_version: ${{ parameters.ort_cuda_version }}
ort_dml_version: ${{ parameters.ort_dml_version }}
build_config: ${{ parameters.build_config }}
enable_win_qnn: ${{ parameters.enable_win_qnn }}

- ${{ if eq(parameters.enable_post_packaging_validation, true) }}:
- template: stages/nuget-validation-stage.yml
Expand Down
24 changes: 21 additions & 3 deletions .pipelines/stages/jobs/nuget-packaging-job.yml
Original file line number Diff line number Diff line change
Expand Up @@ -47,6 +47,11 @@ parameters:
type: boolean
default: false

- name: enable_win_qnn
displayName: 'Whether QNN nuget package should be built.'
type: boolean
default: false

- name: ort_version
type: string

Expand All @@ -55,7 +60,7 @@ parameters:
default: 'release'

jobs:
- job: nuget_${{ parameters.ep }}_packaging
- job: nuget_${{ parameters.ep }}_packaging_dep_qnn_${{ parameters.enable_win_qnn }}
pool: 'onnxruntime-Win-CPU-2022'
variables:
- name: ep
Expand All @@ -81,20 +86,24 @@ jobs:
value: 'onnxruntime-genai-${{ parameters.ep }}'

- name: genai_nuget_package_name
${{ if eq(parameters.ep, 'cpu') }}:
${{ if and(eq(parameters.ep, 'cpu'), eq(parameters.enable_win_qnn, false)) }}:
value: 'Microsoft.ML.OnnxRuntimeGenAI'
${{ if eq(parameters.ep, 'cuda') }}:
value: 'Microsoft.ML.OnnxRuntimeGenAI.Cuda'
${{ if eq(parameters.ep, 'directml') }}:
value: 'Microsoft.ML.OnnxRuntimeGenAI.DirectML'
${{ if and(eq(parameters.ep, 'cpu'), eq(parameters.enable_win_qnn, true)) }}:
value: 'Microsoft.ML.OnnxRuntimeGenAI.QNN'

- name: ort_nuget_package_name
${{ if eq(parameters.ep, 'cpu') }}:
${{ if and(eq(parameters.ep, 'cpu'), eq(parameters.enable_win_qnn, false)) }}:
value: 'Microsoft.ML.OnnxRuntime'
${{ if eq(parameters.ep, 'cuda') }}:
value: 'Microsoft.ML.OnnxRuntime.Gpu'
${{ if eq(parameters.ep, 'directml') }}:
value: 'Microsoft.ML.OnnxRuntime.DirectML'
${{ if and(eq(parameters.ep, 'cpu'), eq(parameters.enable_win_qnn, true)) }}:
value: 'Microsoft.ML.OnnxRuntime.QNN'

steps:
- ${{ if and(eq(parameters.enable_win_cpu, true), eq(parameters.ep, 'cpu')) }}:
Expand Down Expand Up @@ -181,6 +190,15 @@ jobs:

- task: NuGetAuthenticate@1

- powershell: |
dotnet --info
dotnet workload install android
dotnet workload install ios
dotnet workload install maccatalyst
dotnet workload install macos
displayName: 'Install dependencies'
workingDirectory: '$(Build.Repository.LocalPath)\src\csharp'
- powershell: |
dotnet --info
dotnet build Microsoft.ML.OnnxRuntimeGenAI.csproj -p:Configuration="$(buildConfig)" -p:IncludeMobileTargets=true --verbosity normal
Expand Down
18 changes: 18 additions & 0 deletions .pipelines/stages/nuget-packaging-stage.yml
Original file line number Diff line number Diff line change
Expand Up @@ -44,6 +44,11 @@ parameters:
type: boolean
default: true

- name: enable_win_qnn
displayName: Whether QNN nuget package should be built.'
type: boolean
default: true

- name: ort_version
type: string
- name: ort_cuda_version
Expand Down Expand Up @@ -85,3 +90,16 @@ stages:
build_config: ${{ parameters.build_config }}
enable_win_dml: ${{ parameters.enable_win_dml }}
enable_win_arm64: ${{ parameters.enable_win_arm64 }}
- ${{ if eq(parameters.enable_win_qnn, true) }}:
- template: jobs/nuget-packaging-job.yml
parameters:
ep: 'cpu'
ort_version: ${{ parameters.ort_version }}
build_config: ${{ parameters.build_config }}
enable_linux_cpu: false
enable_win_cpu: false
enable_win_arm64: true
enable_macos_cpu: false
enable_android: false
enable_apple_framework: false
enable_win_qnn: true

0 comments on commit 728cc93

Please sign in to comment.