Skip to content

Commit 0deaf27

Browse files
authored
Merge pull request #13 from GoodNotes/paco/ci_build_67bc9438d
[AANT-3779][AANT-3799] Upgrade ONNXRuntime to v1.19 and support Hanwang HWR
2 parents d8b475e + ef04ce3 commit 0deaf27

5 files changed

+156
-30
lines changed

.circleci/config.yml

+58
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,58 @@
1+
version: 2.1
2+
parameters:
3+
xcode-version:
4+
type: string
5+
default: "15.4.0"
6+
macos-resource-class:
7+
type: string
8+
default: macos.m1.medium.gen1
9+
10+
# Jobs -------------------------------------------------------------------------
11+
jobs:
12+
build-and-test-xcframework:
13+
macos:
14+
xcode: << pipeline.parameters.xcode-version >>
15+
resource_class: << pipeline.parameters.macos-resource-class >>
16+
17+
shell: /bin/bash --login -o pipefail
18+
19+
steps:
20+
- run:
21+
name: check Xcode version and Python 3
22+
command: |
23+
/usr/bin/xcodebuild -version
24+
python3 --version
25+
python --version
26+
which python3
27+
echo $CIRCLE_WORKING_DIRECTORY
28+
- checkout
29+
- run:
30+
name: create directory to store the library
31+
command: |
32+
mkdir -p $HOME/onnxlibrary/macabi_release_v20230327_2320
33+
- run:
34+
name: install tools for build
35+
command: |
36+
brew install cmake
37+
pip install -r ${CIRCLE_WORKING_DIRECTORY}/requirements-dev.txt
38+
- run:
39+
name: build with build_apple_framework.py
40+
command: |
41+
export PYTHONPATH=${CIRCLE_WORKING_DIRECTORY}/tools/python:$PYTHONPATH
42+
python3 ${CIRCLE_WORKING_DIRECTORY}/tools/ci_build/github/apple/build_apple_framework.py --config Release --build_dynamic_framework --build_dir=$HOME/onnxlibrary/macabi_release_v20230327_2320 \
43+
--include_ops_by_config=${CIRCLE_WORKING_DIRECTORY}/tools/ci_build/github/apple/hws_mobile_package.required_operators.config \
44+
${CIRCLE_WORKING_DIRECTORY}/tools/ci_build/github/apple/default_full_ios_framework_build_settings.json
45+
46+
- run:
47+
name: archive the build results
48+
command: |
49+
tar -cvf /Users/distiller/project/onnxruntime_xcf.tar -C $HOME/onnxlibrary/macabi_release_v20230327_2320/framework_out .
50+
51+
- store_artifacts:
52+
path: /Users/distiller/project/onnxruntime_xcf.tar
53+
destination: onnxruntime_xcf.tar
54+
workflows:
55+
version: 2
56+
build-and-test-xcframework:
57+
jobs:
58+
- build-and-test-xcframework

.github/workflows/generate-xcframework-maccatalyst.yml

+79-26
Original file line numberDiff line numberDiff line change
@@ -6,15 +6,19 @@ on:
66
#workflow_dispatch:
77
# branches: [main, develop]
88

9+
env:
10+
python_version: 3.11
911

1012
jobs:
1113
build_macabi_xcf:
12-
runs-on: macos-latest
14+
runs-on: macos-14
15+
env:
16+
xcode_version: 15
1317
steps:
1418
- name: install Python 3.10
15-
uses: actions/setup-python@v4
19+
uses: actions/setup-python@v5
1620
with:
17-
python-version: '3.10'
21+
python-version: ${{ env.python_version }}
1822

1923
- name: check Xcode version and Python 3
2024
run: |
@@ -23,34 +27,83 @@ jobs:
2327
python --version
2428
which python3
2529
30+
# - name: Use Xcode ${{ env.xcode_version }}
31+
# shell: bash
32+
# run: |
33+
# XCODE_DEVELOPER_DIR="/Applications/Xcode_${{ env.xcode_version }}.app/Contents/Developer"
34+
# sudo xcode-select --switch "${XCODE_DEVELOPER_DIR}"
35+
2636
- name: checkout repository
27-
uses: actions/checkout@v3
28-
29-
- name: install protoc
30-
run : |
31-
mkdir -p $HOME/Downloads
32-
cd $HOME/Downloads
33-
curl -LJO https://github.com/protocolbuffers/protobuf/releases/download/v21.12/protoc-21.12-osx-universal_binary.zip
34-
unzip protoc-21.12-osx-universal_binary.zip -d protoc-21.12-osx-universal_binary
35-
mv protoc-21.12-osx-universal_binary/bin/protoc /usr/local/bin/protoc-3.21.12.0
36-
mv protoc-21.12-osx-universal_binary/include/* /usr/local/include/
37-
37+
uses: actions/checkout@v4
38+
39+
# - name: install protoc
40+
# run : |
41+
# mkdir -p $HOME/Downloads
42+
# cd $HOME/Downloads
43+
# curl -LJO https://github.com/protocolbuffers/protobuf/releases/download/v21.12/protoc-21.12-osx-universal_binary.zip
44+
# unzip protoc-21.12-osx-universal_binary.zip -d protoc-21.12-osx-universal_binary
45+
# mv protoc-21.12-osx-universal_binary/bin/protoc /usr/local/bin/protoc-3.21.12.0
46+
# mv protoc-21.12-osx-universal_binary/include/* /usr/local/include/
47+
3848
- name: create directory to store the library
3949
run: mkdir -p $HOME/onnxlibrary/macabi_release_v20230327_2320
4050

41-
- name: create release build
51+
# - name: create release build
52+
# run: |
53+
# # Since Python 3.12, distutils is removed
54+
# # pip3 install setuptools
55+
# export PYTHONPATH=${{ github.workspace }}/tools/python:$PYTHONPATH
56+
# cd ${{ github.workspace }}/tools/python
57+
# ls ${{ github.workspace }}/tools/python
58+
# # pip install -r ${{ github.workspace }}/requirements-dev.txt
59+
# # pip install -r ${{ github.workspace }}/tools/ci_build/requirements.txt
60+
# #Deal with lSystem
61+
# export SDKROOT=$(xcrun --sdk macosx --show-sdk-path)
62+
# export LIBRARY_PATH="$LIBRARY_PATH:$SDKROOT/usr/lib"
63+
# #Build command
64+
# python tools/ci_build/github/apple/build_apple_framework.py --config Release --build_dir /Users/goodnotesci/onnxlibrary/ios_release_v20240405_onnx116 --include_ops_by_config tools/ci_build/github/apple/hws_mobile_package.required_operators.config tools/ci_build/github/apple/default_full_ios_framework_build_settings.json
65+
66+
# python ${{ github.workspace }}/tools/ci_build/github/apple/build_apple_framework.py --config=Release --build_dir=$HOME/onnxlibrary/macabi_release_v20230327_2320 \
67+
# --include_ops_by_config=${{ github.workspace }}/tools/ci_build/github/apple/hws_mobile_package.required_operators.config \
68+
# --path_to_protoc_exe=/usr/local/bin/protoc-3.21.12.0 ${{ github.workspace }}/tools/ci_build/github/apple/hws_mobile_package.required_operators.config
69+
70+
- name: create releae build
4271
run: |
43-
# Since Python 3.12, distutils is removed
44-
# pip3 install setuptools
4572
export PYTHONPATH=${{ github.workspace }}/tools/python:$PYTHONPATH
46-
cd ${{ github.workspace }}/tools/python
47-
ls ${{ github.workspace }}/tools/python
4873
pip install -r ${{ github.workspace }}/requirements-dev.txt
49-
pip install -r ${{ github.workspace }}/tools/ci_build/requirements.txt
50-
#Deal with lSystem
51-
export SDKROOT=$(xcrun --sdk macosx --show-sdk-path)
52-
export LIBRARY_PATH="$LIBRARY_PATH:$SDKROOT/usr/lib"
53-
#Build command
54-
python ${{ github.workspace }}/tools/ci_build/github/apple/build_macabi_framework.py --config=Release --build_dir=$HOME/onnxlibrary/macabi_release_v20230327_2320 \
74+
python3 ${{ github.workspace }}/tools/ci_build/github/apple/build_apple_framework.py --config Release --build_dynamic_framework --build_dir=$HOME/onnxlibrary/macabi_release_v20230327_2320 \
5575
--include_ops_by_config=${{ github.workspace }}/tools/ci_build/github/apple/hws_mobile_package.required_operators.config \
56-
--path_to_protoc_exe=/usr/local/bin/protoc-3.21.12.0 ${{ github.workspace }}/tools/ci_build/github/apple/default_full_macabi_framework_build_settings.json
76+
${{ github.workspace }}/tools/ci_build/github/apple/default_full_ios_framework_build_settings.json
77+
78+
# python ./tools/ci_build/build.py \
79+
# --build_dir $HOME/onnxlibrary/macabi_release_v20230327_2320 \
80+
# --update \
81+
# --build --parallel \
82+
# --test \
83+
# --build_shared_lib \
84+
# --build_objc \
85+
# --use_coreml \
86+
# --use_xnnpack \
87+
# --use_binskim_compliant_compile_flags \
88+
# --include_ops_by_config=${{ github.workspace }}/tools/ci_build/github/apple/default_full_macabi_framework_build_settings.json
89+
90+
91+
- name: create release build 2
92+
run: |
93+
python ./tools/ci_build/build.py \
94+
--build_dir $HOME/onnxlibrary/macabi_release_v20230327_2320 \
95+
--update \
96+
--build --parallel \
97+
--skip_tests \
98+
--build_apple_framework \
99+
--use_xcode \
100+
--use_coreml \
101+
--use_xnnpack \
102+
--use_binskim_compliant_compile_flags \
103+
--ios \
104+
--apple_deploy_target=16.0 \
105+
--apple_sysroot=iphonesimulator \
106+
--osx_arch=x86_64 \
107+
--cmake_extra_defines=onnxruntime_BUILD_UNIT_TESTS=OFF \
108+
--include_ops_by_config=${{ github.workspace }}/tools/ci_build/github/apple/hws_mobile_package.required_operators.config
109+

tools/ci_build/github/apple/build_apple_framework.py

+5-1
Original file line numberDiff line numberDiff line change
@@ -66,7 +66,11 @@ def _build_for_apple_sysroot(
6666
framework_dir = os.path.join(
6767
build_dir_current_arch,
6868
build_config,
69-
build_config + "-" + sysroot,
69+
(
70+
''
71+
if sysroot == "macabi"
72+
else build_config + "-" + sysroot
73+
),
7074
(
7175
"onnxruntime.framework"
7276
if build_dynamic_framework

tools/ci_build/github/apple/default_full_ios_framework_build_settings.json

+3-3
Original file line numberDiff line numberDiff line change
@@ -24,17 +24,17 @@
2424
"--ios",
2525
"--use_xcode",
2626
"--use_xnnpack",
27-
"--apple_deploy_target=13.0"
27+
"--apple_deploy_target=16.6"
2828
],
2929
"iphonesimulator": [
3030
"--ios",
3131
"--use_xcode",
3232
"--use_xnnpack",
33-
"--apple_deploy_target=13.0"
33+
"--apple_deploy_target=16.6"
3434
],
3535
"macabi":[
3636
"--macos=Catalyst",
37-
"--apple_deploy_target=14.0"
37+
"--apple_deploy_target=16.6"
3838
]
3939
}
4040
}

tools/ci_build/github/apple/hws_mobile_package.required_operators.config

+11
Original file line numberDiff line numberDiff line change
@@ -11,5 +11,16 @@ com.microsoft;1;DynamicQuantizeMatMul,FusedConv,FusedGemm,FusedMatMul,Gelu,MatMu
1111
# NHWC transformer also uses this, so assuming it's valuable enough to include
1212
com.microsoft;1;QLinearLeakyRelu
1313

14+
# Hanwang HWR operators
15+
ai.onnx;1;ConvTranspose
16+
ai.onnx;6;Relu
17+
ai.onnx;7;AveragePool
18+
ai.onnx;8;Min,Max
19+
ai.onnx;10;ConvInteger
20+
ai.onnx;11;AveragePool,ConvTranspose,Split,ReduceMin,ReduceMean,ReduceMax,ReduceSum,ReduceProd,Clip,Ceil,Round
21+
com.microsoft;1;DynamicQuantizeLSTM
22+
com.microsoft;1;NhwcConv
23+
com.microsoft.nchwc;1;AveragePool,ReorderInput,Conv,ReorderOutput
24+
1425
# Voice activity detector
1526
ai.onnx;16;Add,Cast,Concat,ConstantOfShape,Conv,Equal,Gather,Identity,If,LSTM,Log,Mul,Neg,Pad,Pow,ReduceMean,Relu,Reshape,Shape,Sigmoid,Slice,Sqrt,Squeeze,Transpose,Unsqueeze

0 commit comments

Comments
 (0)