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

refactor: use neon-rs to create binding #1

Merged
merged 26 commits into from
Sep 26, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
26 commits
Select commit Hold shift + click to select a range
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
21 changes: 12 additions & 9 deletions .github/workflows/ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -3,14 +3,22 @@ name: CI

jobs:
build:
timeout-minutes: 60
runs-on: ubuntu-latest

steps:
- uses: actions/checkout@v4
- name: Use Node.js 20.x
with:
submodules: recursive
- name: Use Rust
uses: raftario/setup-rust-action@v1
with:
rust-channel: nightly
rust-host: x86_64-unknown-linux-gnu
- name: Use Node.js 22.x
uses: actions/setup-node@v4
with:
node-version: 20.x
node-version: 22.x
- name: Use Python 3.10
uses: actions/setup-python@v5
with:
Expand All @@ -20,11 +28,6 @@ jobs:
with:
path: .venv
key: ${{ runner.os }}-venv-3_10
- uses: actions/checkout@v4
with:
repository: pytorch/executorch
path: executorch
submodules: recursive
- name: Cached build
uses: actions/cache@v2
with:
Expand All @@ -51,6 +54,6 @@ jobs:
- name: Install dependencies
run: yarn install
- name: Build
run: yarn build --CDCMAKE_PREFIX_PATH=$(realpath executorch/cmake-out) --CDEXECUTORCH_SRC_ROOT=$(realpath executorch)
run: yarn build
- name: Run tests
run: yarn test
run: yarn test-all
112 changes: 112 additions & 0 deletions .github/workflows/release.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,112 @@
name: Release
on:
push:
tags:
- 'v*'
workflow_dispatch:

concurrency:
group: ${{ github.workflow }}-${{ github.event.repository.name }}-${{ github.ref_name }}
cancel-in-progress: true

jobs:
build:
timeout-minutes: 120
strategy:
matrix:
os: [ubuntu-latest, windows-latest, macos-latest]
arch: [x86_64, aarch64]
runs-on: ${{ matrix.os }}

steps:
- uses: actions/checkout@v4
with:
submodules: recursive
- name: Use Rust
uses: raftario/setup-rust-action@v1
with:
rust-channel: nightly
rust-host: ${{ matrix.arch }}-${{ matrix.os == 'windows-latest' && 'pc-windows-gnullvm' || matrix.os == 'macos-latest' && 'apple-darwin' || 'unknown-linux-gnu' }}
- name: Use Node.js 22.x
uses: actions/setup-node@v4
with:
node-version: 22.x
- name: Use Python 3.10
uses: actions/setup-python@v5
with:
python-version: '3.10'
- name: Cached pip
uses: actions/cache@v2
with:
path: .venv
key: ${{ runner.os }}-venv-3_10
- name: Download QNN SDK
if: ${{ matrix.os == 'windows-latest' }}
shell: bash
env:
QNN_VERSION: '2.26.0.240828'
run: |
curl -L -o qnn_sdk.zip https://softwarecenter.qualcomm.com/api/download/software/qualcomm_neural_processing_sdk/v${QNN_VERSION}.zip
unzip qnn_sdk.zip
rm qnn_sdk.zip
- name: Build executorch
shell: bash
env:
QNN_SDK_ROOT: ${{ github.workspace }}/qairt
OS: ${{ matrix.os }}
ARCH: ${{ matrix.arch }}
run: |
python -m venv .venv
source .venv/bin/activate
cd executorch
pip install tomli zstd setuptools wheel
pip install --pre torch torchvision torchaudio --index-url https://download.pytorch.org/whl/nightly/cpu
if [ ! -d cmake-out ]; then
./install_requirements.sh
EXTRA_CMAKE_ARGS=""
if [[ "$OS" == "windows-latest" ]]; then
EXTRA_CMAKE_ARGS="-DCMAKE_TOOLCHAIN_FILE=../cmake/mingw-w64-${ARCH}.clang.toolchain.cmake"
if [[ "$ARCH" == "aarch64" ]]; then
EXTRA_CMAKE_ARGS="${EXTRA_CMAKE_ARGS} -DEXECUTORCH_BUILD_QNN=ON"
fi
elif [[ "$OS" == "macos-latest" ]]; then
if [[ "$ARCH" == "x86_64" ]]; then
EXTRA_CMAKE_ARGS="-DCMAKE_OSX_ARCHITECTURES=x86_64"
else
EXTRA_CMAKE_ARGS="-DCMAKE_OSX_ARCHITECTURES=arm64"
fi
EXTRA_CMAKE_ARGS="${EXTRA_CMAKE_ARGS} -DEXECUTORCH_BUILD_COREML=ON"
elif [[ "$OS" == "ubuntu-latest" ]] && [[ "$ARCH" == "aarch64" ]]; then
EXTRA_CMAKE_ARGS="-DCMAKE_TOOLCHAIN_FILE=../cmake/aarch64-linux-gnu.clang.toolchain.cmake"
fi
cmake \
-S . \
-B cmake-out \
-DCMAKE_INSTALL_PREFIX=cmake-out \
-DEXECUTORCH_BUILD_XNNPACK=ON \
-DEXECUTORCH_BUILD_EXTENSION_DATA_LOADER=ON \
-DEXECUTORCH_BUILD_EXTENSION_MODULE=ON \
-DEXECUTORCH_BUILD_KERNELS_CUSTOM=ON \
-DEXECUTORCH_BUILD_KERNELS_QUANTIZED=ON \
-DEXECUTORCH_BUILD_KERNELS_OPTIMIZED=ON \
-DEXECUTORCH_BUILD_EXTENSION_TENSOR=ON \
-DQNN_SDK_ROOT=$QNN_SDK_ROOT \
-DEXECUTORCH_BUILD_CPUINFO=ON \
-DEXECUTORCH_BUILD_XNNPACK=ON \
-DEXECUTORCH_BUILD_PTHREADPOOL=ON \
-DEXECUTORCH_BUILD_SDK=ON \
$EXTRA_CMAKE_ARGS
cmake --build cmake-out --target install --config Release -j$(nproc)
fi
- name: Install dependencies
run: yarn install
- name: Build
shell: bash
env:
TARGET: ${{ matrix.arch }}-${{ matrix.os == 'windows-latest' && 'pc-windows-gnullvm' || matrix.os == 'macos-latest' && 'apple-darwin' || 'unknown-linux-gnu' }}
run: yarn build --target $TARGET
- name: Upload build artifacts
uses: actions/upload-artifact@v4
with:
name: bin
path: bin
17 changes: 11 additions & 6 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -1,6 +1,11 @@
node_modules/
build/
bin/
executorch/
*.js
.venv/
target
*.node
*.dll
*.dylib
**/node_modules
**/.DS_Store
npm-debug.log
cargo.log
cross.log
lib/*.js
bin/**/*
4 changes: 4 additions & 0 deletions .gitmodules
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
[submodule "executorch"]
path = executorch
url = https://github.com/mybigday/executorch.git
branch = windows-qnn
Loading
Loading