Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[AANT-3779][AANT-3799] Upgrade ONNXRuntime to v1.19 and support Hanwang HWR #13

Merged
merged 39 commits into from
Oct 21, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
39 commits
Select commit Hold shift + click to select a range
e55f724
Update operator sets
Apr 11, 2024
1645c21
Never search for packages in the system
Apr 11, 2024
2d44550
Merge branch 'develop' into paco/support_hanwang
pacowong Oct 14, 2024
cd75b17
Minimal change
pacowong Oct 14, 2024
b9b6f78
Use official build script build.py
pacowong Oct 14, 2024
296b5e6
Do not set version
pacowong Oct 14, 2024
5918efd
Remove pip install
pacowong Oct 14, 2024
1bf923e
Use build_apple_framework instead
pacowong Oct 14, 2024
886c429
Update generate-xcframework-maccatalyst.yml
pacowong Oct 14, 2024
505b743
Update generate-xcframework-maccatalyst.yml
pacowong Oct 14, 2024
9ecdba4
Update generate-xcframework-maccatalyst.yml
pacowong Oct 14, 2024
95f97cf
Update generate-xcframework-maccatalyst.yml
pacowong Oct 14, 2024
e5aebfb
Update generate-xcframework-maccatalyst.yml
pacowong Oct 14, 2024
483f7b7
Add circleci job
pacowong Oct 15, 2024
99a4aa4
Merge branch 'paco/ci_build_67bc9438d' of github.com:GoodNotes/onnxru…
pacowong Oct 15, 2024
95c0ba4
Rename config.yaml to config.yml
pacowong Oct 15, 2024
7489ecd
Update .circleci config.yaml
pacowong Oct 15, 2024
084ec39
Fix lipo path
pacowong Oct 15, 2024
fcad764
Store artifacts
pacowong Oct 15, 2024
5553884
Remove config.yaml
pacowong Oct 15, 2024
3e7b44b
store_artifacts tar
pacowong Oct 15, 2024
cd791f2
Update config.yml
pacowong Oct 15, 2024
a6b610b
Update config.yml
pacowong Oct 15, 2024
5331cb8
Update config.yml
pacowong Oct 15, 2024
5d05a19
Update config.yml
pacowong Oct 15, 2024
9acb8e0
Update hws_mobile_package.required_operators.config
pacowong Oct 15, 2024
a64ff1a
Update hws_mobile_package.required_operators.config
pacowong Oct 15, 2024
03fde6c
Merge branch 'develop' into paco/ci_build_67bc9438d
pacowong Oct 15, 2024
b88643e
Merge branch 'paco/ci_build_67bc9438d' into paco/support_hanwang
pacowong Oct 15, 2024
775daca
Merge pull request #10 from GoodNotes/paco/support_hanwang
pacowong Oct 15, 2024
e442185
Merge branch 'develop' into paco/ci_build_67bc9438d
pacowong Oct 16, 2024
11a7090
Update hws_mobile_package.required_operators.config
pacowong Oct 16, 2024
f0cc105
Merge branch 'develop' into paco/ci_build_67bc9438d
pacowong Oct 16, 2024
432a98e
Update hws_mobile_package.required_operators.config
pacowong Oct 16, 2024
0239ac6
Update hws_mobile_package.required_operators.config
pacowong Oct 16, 2024
a02789b
Update hws_mobile_package.required_operators.config
pacowong Oct 16, 2024
be09afe
Update hws_mobile_package.required_operators.config
pacowong Oct 16, 2024
ef050e8
Update hws_mobile_package.required_operators.config
pacowong Oct 17, 2024
ef04ce3
Change directory with tar
pacowong Oct 18, 2024
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
58 changes: 58 additions & 0 deletions .circleci/config.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,58 @@
version: 2.1
parameters:
xcode-version:
type: string
default: "15.4.0"
macos-resource-class:
type: string
default: macos.m1.medium.gen1

# Jobs -------------------------------------------------------------------------
jobs:
build-and-test-xcframework:
macos:
xcode: << pipeline.parameters.xcode-version >>
resource_class: << pipeline.parameters.macos-resource-class >>

shell: /bin/bash --login -o pipefail

steps:
- run:
name: check Xcode version and Python 3
command: |
/usr/bin/xcodebuild -version
python3 --version
python --version
which python3
echo $CIRCLE_WORKING_DIRECTORY
- checkout
- run:
name: create directory to store the library
command: |
mkdir -p $HOME/onnxlibrary/macabi_release_v20230327_2320
- run:
name: install tools for build
command: |
brew install cmake
pip install -r ${CIRCLE_WORKING_DIRECTORY}/requirements-dev.txt
- run:
name: build with build_apple_framework.py
command: |
export PYTHONPATH=${CIRCLE_WORKING_DIRECTORY}/tools/python:$PYTHONPATH
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 \
--include_ops_by_config=${CIRCLE_WORKING_DIRECTORY}/tools/ci_build/github/apple/hws_mobile_package.required_operators.config \
${CIRCLE_WORKING_DIRECTORY}/tools/ci_build/github/apple/default_full_ios_framework_build_settings.json

- run:
name: archive the build results
command: |
tar -cvf /Users/distiller/project/onnxruntime_xcf.tar -C $HOME/onnxlibrary/macabi_release_v20230327_2320/framework_out .

- store_artifacts:
path: /Users/distiller/project/onnxruntime_xcf.tar
destination: onnxruntime_xcf.tar
workflows:
version: 2
build-and-test-xcframework:
jobs:
- build-and-test-xcframework
105 changes: 79 additions & 26 deletions .github/workflows/generate-xcframework-maccatalyst.yml
Original file line number Diff line number Diff line change
Expand Up @@ -6,15 +6,19 @@ on:
#workflow_dispatch:
# branches: [main, develop]

env:
python_version: 3.11

jobs:
build_macabi_xcf:
runs-on: macos-latest
runs-on: macos-14
env:
xcode_version: 15
steps:
- name: install Python 3.10
uses: actions/setup-python@v4
uses: actions/setup-python@v5
with:
python-version: '3.10'
python-version: ${{ env.python_version }}

- name: check Xcode version and Python 3
run: |
Expand All @@ -23,34 +27,83 @@ jobs:
python --version
which python3

# - name: Use Xcode ${{ env.xcode_version }}
# shell: bash
# run: |
# XCODE_DEVELOPER_DIR="/Applications/Xcode_${{ env.xcode_version }}.app/Contents/Developer"
# sudo xcode-select --switch "${XCODE_DEVELOPER_DIR}"

- name: checkout repository
uses: actions/checkout@v3

- name: install protoc
run : |
mkdir -p $HOME/Downloads
cd $HOME/Downloads
curl -LJO https://github.com/protocolbuffers/protobuf/releases/download/v21.12/protoc-21.12-osx-universal_binary.zip
unzip protoc-21.12-osx-universal_binary.zip -d protoc-21.12-osx-universal_binary
mv protoc-21.12-osx-universal_binary/bin/protoc /usr/local/bin/protoc-3.21.12.0
mv protoc-21.12-osx-universal_binary/include/* /usr/local/include/
uses: actions/checkout@v4

# - name: install protoc
# run : |
# mkdir -p $HOME/Downloads
# cd $HOME/Downloads
# curl -LJO https://github.com/protocolbuffers/protobuf/releases/download/v21.12/protoc-21.12-osx-universal_binary.zip
# unzip protoc-21.12-osx-universal_binary.zip -d protoc-21.12-osx-universal_binary
# mv protoc-21.12-osx-universal_binary/bin/protoc /usr/local/bin/protoc-3.21.12.0
# mv protoc-21.12-osx-universal_binary/include/* /usr/local/include/

- name: create directory to store the library
run: mkdir -p $HOME/onnxlibrary/macabi_release_v20230327_2320

- name: create release build
# - name: create release build
# run: |
# # Since Python 3.12, distutils is removed
# # pip3 install setuptools
# export PYTHONPATH=${{ github.workspace }}/tools/python:$PYTHONPATH
# cd ${{ github.workspace }}/tools/python
# ls ${{ github.workspace }}/tools/python
# # pip install -r ${{ github.workspace }}/requirements-dev.txt
# # pip install -r ${{ github.workspace }}/tools/ci_build/requirements.txt
# #Deal with lSystem
# export SDKROOT=$(xcrun --sdk macosx --show-sdk-path)
# export LIBRARY_PATH="$LIBRARY_PATH:$SDKROOT/usr/lib"
# #Build command
# 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

# python ${{ github.workspace }}/tools/ci_build/github/apple/build_apple_framework.py --config=Release --build_dir=$HOME/onnxlibrary/macabi_release_v20230327_2320 \
# --include_ops_by_config=${{ github.workspace }}/tools/ci_build/github/apple/hws_mobile_package.required_operators.config \
# --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

- name: create releae build
run: |
# Since Python 3.12, distutils is removed
# pip3 install setuptools
export PYTHONPATH=${{ github.workspace }}/tools/python:$PYTHONPATH
cd ${{ github.workspace }}/tools/python
ls ${{ github.workspace }}/tools/python
pip install -r ${{ github.workspace }}/requirements-dev.txt
pip install -r ${{ github.workspace }}/tools/ci_build/requirements.txt
#Deal with lSystem
export SDKROOT=$(xcrun --sdk macosx --show-sdk-path)
export LIBRARY_PATH="$LIBRARY_PATH:$SDKROOT/usr/lib"
#Build command
python ${{ github.workspace }}/tools/ci_build/github/apple/build_macabi_framework.py --config=Release --build_dir=$HOME/onnxlibrary/macabi_release_v20230327_2320 \
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 \
--include_ops_by_config=${{ github.workspace }}/tools/ci_build/github/apple/hws_mobile_package.required_operators.config \
--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
${{ github.workspace }}/tools/ci_build/github/apple/default_full_ios_framework_build_settings.json

# python ./tools/ci_build/build.py \
# --build_dir $HOME/onnxlibrary/macabi_release_v20230327_2320 \
# --update \
# --build --parallel \
# --test \
# --build_shared_lib \
# --build_objc \
# --use_coreml \
# --use_xnnpack \
# --use_binskim_compliant_compile_flags \
# --include_ops_by_config=${{ github.workspace }}/tools/ci_build/github/apple/default_full_macabi_framework_build_settings.json


- name: create release build 2
run: |
python ./tools/ci_build/build.py \
--build_dir $HOME/onnxlibrary/macabi_release_v20230327_2320 \
--update \
--build --parallel \
--skip_tests \
--build_apple_framework \
--use_xcode \
--use_coreml \
--use_xnnpack \
--use_binskim_compliant_compile_flags \
--ios \
--apple_deploy_target=16.0 \
--apple_sysroot=iphonesimulator \
--osx_arch=x86_64 \
--cmake_extra_defines=onnxruntime_BUILD_UNIT_TESTS=OFF \
--include_ops_by_config=${{ github.workspace }}/tools/ci_build/github/apple/hws_mobile_package.required_operators.config

6 changes: 5 additions & 1 deletion tools/ci_build/github/apple/build_apple_framework.py
Original file line number Diff line number Diff line change
Expand Up @@ -66,7 +66,11 @@ def _build_for_apple_sysroot(
framework_dir = os.path.join(
build_dir_current_arch,
build_config,
build_config + "-" + sysroot,
(
''
if sysroot == "macabi"
else build_config + "-" + sysroot
),
(
"onnxruntime.framework"
if build_dynamic_framework
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -24,17 +24,17 @@
"--ios",
"--use_xcode",
"--use_xnnpack",
"--apple_deploy_target=13.0"
"--apple_deploy_target=16.6"
],
"iphonesimulator": [
"--ios",
"--use_xcode",
"--use_xnnpack",
"--apple_deploy_target=13.0"
"--apple_deploy_target=16.6"
],
"macabi":[
"--macos=Catalyst",
"--apple_deploy_target=14.0"
"--apple_deploy_target=16.6"
]
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -11,5 +11,16 @@ com.microsoft;1;DynamicQuantizeMatMul,FusedConv,FusedGemm,FusedMatMul,Gelu,MatMu
# NHWC transformer also uses this, so assuming it's valuable enough to include
com.microsoft;1;QLinearLeakyRelu

# Hanwang HWR operators
ai.onnx;1;ConvTranspose
ai.onnx;6;Relu
ai.onnx;7;AveragePool
ai.onnx;8;Min,Max
ai.onnx;10;ConvInteger
ai.onnx;11;AveragePool,ConvTranspose,Split,ReduceMin,ReduceMean,ReduceMax,ReduceSum,ReduceProd,Clip,Ceil,Round
com.microsoft;1;DynamicQuantizeLSTM
com.microsoft;1;NhwcConv
com.microsoft.nchwc;1;AveragePool,ReorderInput,Conv,ReorderOutput

# Voice activity detector
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
Loading