mirror of
https://github.com/saymrwulf/onnxruntime.git
synced 2026-07-03 03:58:54 +00:00
Add Compliation Cache in CoreML pipeline (#15259)
### Description 1. move the cache task definition into template 2. In debug mode, the compiler mtime is different in different machine. So, change the CCACHE_COMPILERCHECK to content. ### Motivation and Context 1. Accelerate the CoreML pipeline. Test run: https://dev.azure.com/onnxruntime/onnxruntime/_build/results?buildId=938040&view=logs&j=1ac7588f-a5bd-5ff7-4a8a-a34869d50220 With Cache, the run can be finished in 12 minutes. Without cache, it takes about 1 hour. 3. Make the cache function easy to use and maintain. --------- Co-authored-by: Edward Chen <18449977+edgchen1@users.noreply.github.com>
This commit is contained in:
parent
2928fda490
commit
aab3c15585
2 changed files with 65 additions and 10 deletions
|
|
@ -1,21 +1,34 @@
|
|||
jobs:
|
||||
- job: CoreML_CI
|
||||
workspace:
|
||||
clean: all
|
||||
pool:
|
||||
vmImage: 'macOS-12'
|
||||
variables:
|
||||
MACOSX_DEPLOYMENT_TARGET: '10.14'
|
||||
TODAY: $[format('{0:dd}{0:MM}{0:yyyy}', pipeline.startTime)]
|
||||
CCACHE_DIR: '$(Pipeline.Workspace)/ccache'
|
||||
timeoutInMinutes: 120
|
||||
steps:
|
||||
- script: brew install coreutils ninja
|
||||
displayName: Install coreutils and ninja
|
||||
|
||||
- script: |
|
||||
python3 tools/ci_build/build.py \
|
||||
--build_dir build \
|
||||
--skip_submodule_sync \
|
||||
--cmake_generator=Ninja \
|
||||
--parallel \
|
||||
--build_shared_lib \
|
||||
--config Debug \
|
||||
--use_coreml
|
||||
displayName: CoreML EP, Build and Test on macOS
|
||||
- template: templates/mac-build-step-with-cache.yml
|
||||
parameters:
|
||||
TODAY: $(TODAY)
|
||||
AdditionalKey: coreml
|
||||
CACHE_DIR: $(CCACHE_DIR)
|
||||
BuildStep:
|
||||
- script: |
|
||||
python3 tools/ci_build/build.py \
|
||||
--build_dir build \
|
||||
--skip_submodule_sync \
|
||||
--cmake_generator=Ninja \
|
||||
--parallel \
|
||||
--build_shared_lib \
|
||||
--config Debug \
|
||||
--use_cache \
|
||||
--use_coreml
|
||||
displayName: CoreML EP, Build and Test on macOS
|
||||
env:
|
||||
CCACHE_COMPILERCHECK: content
|
||||
|
|
|
|||
|
|
@ -0,0 +1,42 @@
|
|||
# It's used for compilation with cache in Mac Host.
|
||||
|
||||
parameters:
|
||||
- name: TODAY
|
||||
type: string
|
||||
|
||||
- name: BuildStep
|
||||
type: stepList
|
||||
|
||||
- name: AdditionalKey
|
||||
type: string
|
||||
|
||||
- name: CACHE_DIR
|
||||
type: string
|
||||
|
||||
steps:
|
||||
- script: |
|
||||
brew install ccache
|
||||
echo "##vso[task.prependpath]/usr/local/opt/ccache/libexec"
|
||||
mkdir -p "${{ parameters.CACHE_DIR }}"
|
||||
displayName: Install ccache and update PATH to use linked versions of gcc, cc, etc
|
||||
|
||||
- task: Cache@2
|
||||
inputs:
|
||||
key: ' "${{parameters.TODAY}}" | ${{parameters.AdditionalKey}} | "$(Build.SourceVersion)" '
|
||||
path: ${{ parameters.CACHE_DIR }}
|
||||
restoreKeys: |
|
||||
"${{parameters.TODAY}}" | ${{parameters.AdditionalKey}}
|
||||
displayName: ccache task
|
||||
|
||||
- ${{ parameters.BuildStep }}
|
||||
|
||||
- script: |
|
||||
set -ex
|
||||
ccache -s
|
||||
ccache -z
|
||||
ls -l "${{ parameters.CACHE_DIR }}"
|
||||
du -sh "${{ parameters.CACHE_DIR }}"
|
||||
displayName: Show Cache stats and Clear stats.
|
||||
env:
|
||||
CCACHE_DIR: ${{parameters.CACHE_DIR}}
|
||||
condition: always()
|
||||
Loading…
Reference in a new issue