Skip to content

Commit

Permalink
Improve Win QNNEP pipeline (microsoft#17586)
Browse files Browse the repository at this point in the history
### Description
1. use standard win build template
2. enable compiler cache

### Motivation and Context
Make win build task easy to maintain and accelerate the pipeline.
  • Loading branch information
mszhanyi authored and kleiti committed Mar 22, 2024
1 parent 3d15b6a commit e520bf8
Show file tree
Hide file tree
Showing 3 changed files with 41 additions and 21 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,10 @@ parameters:
type: string
default: "$(Agent.TempDirectory)/ort_ccache"

- name: DebugCache
type: boolean
default: false

- name: AdditionalKey
type: string
default: ""
Expand Down Expand Up @@ -45,6 +49,18 @@ parameters:

steps:
- ${{ if eq(parameters.WithCache, true) }}:
- powershell: |
if ([string]::IsNullOrEmpty((Get-Command ccache -errorAction SilentlyContinue)))
{
choco install ccache -y --version 4.7.4
$ccache_path = (Get-Command ccache).Source
$ccache_parent_dir = (Split-Path -parent $ccache_path)
Copy-Item "C:\ProgramData\chocolatey\lib\ccache\tools\ccache-4.7.4-windows-x86_64\ccache.exe" -Destination "C:\ProgramData\chocolatey\bin\cl.exe"
Get-ChildItem $ccache_parent_dir
ccache --version
}
displayName: Install ccache
- task: Cache@2
inputs:
${{if eq(variables['Build.SourceBranchName'], 'merge')}}:
Expand Down Expand Up @@ -83,6 +99,11 @@ steps:
createLogFile: true
env:
CCACHE_DIR: ${{parameters.CacheDir}}
CCACHE_SLOPPINESS: file_macro,time_macros,include_file_mtime,include_file_ctime
CCACHE_COMPILERCHECK: content
${{if eq(parameters.DebugCache, true)}}:
CCACHE_DEBUG: 1
CCACHE_DEBUGDIR: $(Agent.TempDirectory)/cache_debug

- ${{ if eq(parameters.WithCache, true) }}:
- powershell: |
Expand All @@ -91,3 +112,10 @@ steps:
displayName: cache stat
env:
CCACHE_DIR: ${{parameters.CacheDir}}
- ${{if eq(parameters.DebugCache, true)}}:
- task: PublishPipelineArtifact@0
displayName: 'publish cache log'
inputs:
artifactName: 'cache-log'
targetPath: $(Agent.TempDirectory)/cache_debug
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
parameters:
- name: EnvSetupScript
type: string
default: setup_env.bat

- name: BuildConfig
type: string
Expand Down
33 changes: 12 additions & 21 deletions tools/ci_build/github/azure-pipelines/win-qnn-ci-pipeline.yml
Original file line number Diff line number Diff line change
Expand Up @@ -46,7 +46,8 @@ jobs:
BuildConfig: 'RelWithDebInfo'
ALLOW_RELEASED_ONNX_OPSET_ONLY: '1'
QNN_SDK_ROOT: 'C:\data\qnnsdk\${{parameters.QnnSdk}}'
timeoutInMinutes: 150
TODAY: $[format('{0:dd}{0:MM}{0:yyyy}', pipeline.startTime)]
timeoutInMinutes: 120
workspace:
clean: all
steps:
Expand All @@ -70,29 +71,19 @@ jobs:
# '_Ret &std::_Visit_strategy<1>::_Visit2<_Ret,_ListOfIndexVectors,_Callable,const
# std::variant<onnxruntime::OpSchemaKernelTypeStrResolver,onnxruntime::KernelTypeStrResolver>&>(size_t,_Callable &&,
# const std::variant<onnxruntime::OpSchemaKernelTypeStrResolver,onnxruntime::KernelTypeStrResolver> &)'
- task: PythonScript@0
displayName: 'Generate cmake config'
inputs:
scriptPath: '$(Build.SourcesDirectory)\tools\ci_build\build.py'
arguments: '--config $(BuildConfig) --build_dir $(Build.BinariesDirectory) --compile_no_warning_as_error --update --cmake_generator "Visual Studio 17 2022" --use_qnn --qnn_home $(QNN_SDK_ROOT) --parallel'
workingDirectory: '$(Build.BinariesDirectory)'

- task: VSBuild@1
displayName: 'Build'
inputs:
solution: '$(Build.BinariesDirectory)\$(BuildConfig)\onnxruntime.sln'
platform: 'x64'
configuration: $(BuildConfig)
msbuildArgs: $(MsbuildArguments)
msbuildArchitecture: $(buildArch)
maximumCpuCount: true
logProjectEvents: false
workingFolder: '$(Build.BinariesDirectory)\$(BuildConfig)'
createLogFile: true
- template: templates/jobs/win-ci-build-steps.yml
parameters:
WithCache: True
Today: $(TODAY)
AdditionalKey: "win-qnn | $(BuildConfig)"
BuildPyArguments: '--config $(BuildConfig) --build_dir $(Build.BinariesDirectory) --compile_no_warning_as_error --update --cmake_generator "Visual Studio 17 2022" --use_qnn --qnn_home $(QNN_SDK_ROOT) --parallel'
MsbuildArguments: $(MsbuildArguments)
BuildArch: $(buildArch)
Platform: 'x64'
BuildConfig: $(BuildConfig)

- powershell: |
python $(Build.SourcesDirectory)\tools\ci_build\build.py --config $(BuildConfig) --build_dir $(Build.BinariesDirectory) --skip_submodule_sync --test --cmake_generator "Visual Studio 17 2022" --enable_onnx_tests
workingDirectory: '$(Build.BinariesDirectory)\$(BuildConfig)\$(BuildConfig)'
displayName: 'Run unit tests'
Expand Down

0 comments on commit e520bf8

Please sign in to comment.