Skip to content

Commit

Permalink
Merge branch 'release/1.0' into feature/auto_select_qtmtd
Browse files Browse the repository at this point in the history
  • Loading branch information
curioyang committed Nov 6, 2023
2 parents 7397d80 + 583b64b commit f463285
Show file tree
Hide file tree
Showing 197 changed files with 14,298 additions and 4,060 deletions.
221 changes: 88 additions & 133 deletions .github/workflows/compiler-build.yml
Original file line number Diff line number Diff line change
Expand Up @@ -2,206 +2,161 @@ name: compiler-build

on: [push, pull_request]

env:
BUILD_TYPE: Release

jobs:
build:
runs-on: ${{ matrix.os }}
name: build-${{matrix.config.name}}
runs-on: ${{matrix.config.os}}
strategy:
matrix:
os: [ubuntu-18.04,windows-2019,macos-10.15]
config:
- {name: x86_64-macos, os: macos-11, cmakeArgs: '', buildType: Release}
- {name: x86_64-linux, os: ubuntu-20.04, cmakeArgs: '', buildType: Release}
- {name: x86_64-windows, os: windows-latest, arch: x64, cmakeArgs: '', buildType: Release}

steps:
- uses: actions/checkout@v2
- uses: actions/checkout@v3
- uses: seanmiddleditch/gha-setup-ninja@master

- name: Install System Requirements
if: runner.os == 'Macos'
shell: bash
run: |
brew install sunnycase/core/[email protected]
- name: Add msbuild to PATH
- name: Set up build environment (Windows, Visual Studio)
uses: ilammy/msvc-dev-cmd@v1
with:
arch: ${{matrix.config.arch}}
if: runner.os == 'Windows'
uses: ilammy/[email protected]

- name: Set up build environment (Macos)
run: |
brew install sunnycase/core/[email protected]
if: runner.os == 'Macos'

- name: Setup Python
uses: actions/setup-python@v2.2.1
uses: actions/setup-python@v4
with:
python-version: 3.7

- name: Install Conan
shell: bash
run: |
pip install conan
run: pip install conan==1.59.0

- name: Configure Conan
if: runner.os == 'Linux'
shell: bash
- name: Configure Conan (Linux)
run: |
conan profile new default --detect
conan profile update settings.compiler.libcxx=libstdc++11 default
- name: Create Build Environment
run: cmake -E make_directory ${{github.workspace}}/build

- name: Configure CMake
env:
CC: gcc-10
CXX: g++-10
echo "CC=gcc-10" >> $GITHUB_ENV
echo "CXX=g++-10" >> $GITHUB_ENV
if: runner.os == 'Linux'
shell: bash
working-directory: ${{github.workspace}}/build
run: cmake -G Ninja $GITHUB_WORKSPACE -DCMAKE_BUILD_TYPE=$BUILD_TYPE -DBUILD_TESTING=ON -DPython3_ROOT_DIR=${pythonLocation}


- name: Configure CMake
if: runner.os != 'Linux'
shell: bash
working-directory: ${{github.workspace}}/build
run: cmake -G Ninja $GITHUB_WORKSPACE -DCMAKE_BUILD_TYPE=$BUILD_TYPE -DBUILD_TESTING=ON -DPython3_ROOT_DIR=${pythonLocation}

- name: Build
shell: bash
working-directory: ${{github.workspace}}/build
run: |
cmake --build . --config $BUILD_TYPE
cmake -B build -G Ninja -DCMAKE_BUILD_TYPE=${{matrix.config.buildType}} ${{matrix.config.cmakeArgs}} -DBUILD_TESTING=ON -DPython3_ROOT_DIR=${pythonLocation}
- name: Install
shell: bash
working-directory: ${{github.workspace}}/build
run: cmake --install . --prefix ../install
- name: Build & Install
run: |
cmake --build build --config ${{matrix.config.buildType}}
cmake --install build --prefix install
- name: CTest
shell: bash
working-directory: ${{github.workspace}}/build/tests/kernels
run: ctest -C $BUILD_TYPE
run: ctest -C ${{matrix.config.buildType}}

- name: Upload a Build Artifact
uses: actions/upload-artifact@v2.2.2
- name: Upload nncase Build Artifact
uses: actions/upload-artifact@v3
with:
name: nncase-${{matrix.os}}-x86_64
name: nncase-${{matrix.config.name}}
path: ${{github.workspace}}/install
if-no-files-found: error

test-compiler:
needs: [build]
runs-on: ${{ matrix.os }}
name: test-${{matrix.config.name}}
runs-on: ${{matrix.config.os}}
strategy:
matrix:
os: [ubuntu-18.04,windows-2019,macos-10.15]
config:
- {name: x86_64-macos, os: macos-11, shell: bash}
- {name: x86_64-linux, os: ubuntu-20.04, shell: bash}
- {name: x86_64-windows, os: windows-latest, shell: bash}

steps:
- uses: actions/checkout@v2
env:
VULKANSDK_VER: 1.2.182.0

- name: Install System Requirements
if: runner.os == 'Macos'
shell: bash
steps:
- uses: actions/checkout@v3

- name: Set up test environment (macOS)
run: |
brew install sunnycase/core/[email protected]
- name: Install Vulkan SDK
if: runner.os == 'Linux'
shell: bash
env:
VULKANSDK_VER: 1.2.182.0
brew install sunnycase/core/[email protected]
aria2c --parameterized-uri=true https://{sdk.lunarg.com/sdk/download/${VULKANSDK_VER}/mac,distfiles.macports.org/MoltenVK}/vulkansdk-macos-${VULKANSDK_VER}.dmg
hdiutil attach ./vulkansdk-macos-*.dmg
sudo /Volumes/vulkansdk-macos-*/InstallVulkan.app/Contents/MacOS/InstallVulkan --root $HOME/VulkanSDK --accept-licenses --default-answer --confirm-command install
hdiutil detach /Volumes/vulkansdk-macos-*
echo "VULKAN_SDK=$HOME/VulkanSDK/macOS" >> $GITHUB_ENV
wget https://github.com/sunnycase/swiftshader/releases/download/v1.0/swiftshader-macos-10.15-x86_64.zip -O swiftshader.zip
unzip swiftshader.zip
sudo cmake -E make_directory /usr/local/share/vulkan/icd.d
sudo cp lib/* /usr/local/share/vulkan/icd.d
echo "PYTHONPATH=$GITHUB_WORKSPACE/install/lib:$GITHUB_WORKSPACE/install/python:$GITHUB_WORKSPACE/tests" >> $GITHUB_ENV
if: runner.os == 'macOS'

- name: Set up test environment (Linux)
run: |
wget https://sdk.lunarg.com/sdk/download/1.2.182.0/linux/vulkansdk-linux-x86_64-${VULKANSDK_VER}.tar.gz -O vulkansdk.tar.gz
wget https://sdk.lunarg.com/sdk/download/${VULKANSDK_VER}/linux/vulkansdk-linux-x86_64-${VULKANSDK_VER}.tar.gz -O vulkansdk.tar.gz
tar xf vulkansdk.tar.gz
sudo cp -P ${VULKANSDK_VER}/x86_64/lib/libvulkan.so* /usr/local/lib/
- name: Install Vulkan SDK
if: runner.os == 'Windows'
shell: pwsh
run: |
Invoke-WebRequest -Uri https://sdk.lunarg.com/sdk/download/1.2.182.0/windows/VulkanSDK-1.2.182.0-Installer.exe -O VulkanSDK-Installer.exe
.\VulkanSDK-Installer.exe /S
- name: Install SwiftShader
if: runner.os != 'Windows'
shell: bash
run: |
wget https://github.com/sunnycase/swiftshader/releases/download/v1.0/swiftshader-${{matrix.os}}-x86_64.zip -O swiftshader.zip
wget https://github.com/sunnycase/swiftshader/releases/download/v1.0/swiftshader-ubuntu-18.04-x86_64.zip -O swiftshader.zip
unzip swiftshader.zip
sudo cmake -E make_directory /usr/local/share/vulkan/icd.d
sudo cp lib/* /usr/local/share/vulkan/icd.d
- name: Install SwiftShader
if: runner.os == 'Windows'
echo "PYTHONPATH=$GITHUB_WORKSPACE/install/lib:$GITHUB_WORKSPACE/install/python:$GITHUB_WORKSPACE/tests" >> $GITHUB_ENV
if: runner.os == 'Linux'

- name: Set up test environment (Windows)
shell: pwsh
run: |
Invoke-WebRequest -Uri https://github.com/sunnycase/swiftshader/releases/download/v1.0/swiftshader-${{matrix.os}}-x86_64.zip -OutFile swiftshader.zip
Invoke-WebRequest -Uri https://sdk.lunarg.com/sdk/download/${env:VULKANSDK_VER}/windows/VulkanSDK-${env:VULKANSDK_VER}-Installer.exe -O VulkanSDK-Installer.exe
.\VulkanSDK-Installer.exe /S
Invoke-WebRequest -Uri https://github.com/sunnycase/swiftshader/releases/download/v1.0/swiftshader-windows-2019-x86_64.zip -OutFile swiftshader.zip
Expand-Archive swiftshader.zip
Copy-Item swiftshader\lib\vk_swiftshader_icd.json swiftshader\bin\
echo "VK_ICD_FILENAMES=${env:GITHUB_WORKSPACE}/swiftshader/bin/vk_swiftshader_icd.json" >> $env:GITHUB_ENV
echo "PYTHONPATH=${env:GITHUB_WORKSPACE}/install/lib;${env:GITHUB_WORKSPACE}/install/python;${env:GITHUB_WORKSPACE}/tests" >> $env:GITHUB_ENV
if: runner.os == 'Windows'

- name: Setup Python
uses: actions/setup-python@v2.2.1
uses: actions/setup-python@v4
with:
python-version: 3.7

- name: Install Python Packages
if: runner.os == 'Linux'
shell: bash
run: |
pip install conan tensorflow==2.5.0 matplotlib pillow onnx==1.9.0 onnx-simplifier==0.3.6 onnxoptimizer==0.2.6 onnxruntime==1.8.0 opencv-python
pip install torch==1.9.0+cpu torchvision==0.10.0+cpu -f https://download.pytorch.org/whl/torch_stable.html
pip install imageio==2.15.0
pip install https://github.com/kendryte/caffe/releases/download/v1.0.0.20210829/kendryte_caffe-1.0.0.20210829-cp37-cp37m-manylinux_2_24_x86_64.whl
pip install pytest
- name: Install Python Packages
if: runner.os == 'Windows'
shell: bash
run: |
pip install conan tensorflow==2.5.0 matplotlib pillow onnx==1.9.0 onnx-simplifier==0.3.6 onnxoptimizer==0.2.6 onnxruntime==1.8.0 opencv-python
pip install torch==1.9.0+cpu torchvision==0.10.0+cpu -f https://download.pytorch.org/whl/torch_stable.html
pip install imageio==2.15.0
pip install https://github.com/kendryte/caffe/releases/download/v1.0.0.20210829/kendryte_caffe-1.0.0.20210829-cp37-cp37m-win_amd64.whl
pip install pytest
- name: Install Python Packages
if: runner.os == 'Macos'
shell: bash
run: |
pip install conan tensorflow==2.5.0 matplotlib pillow onnx==1.9.0 onnx-simplifier==0.3.6 onnxoptimizer==0.2.6 onnxruntime==1.8.0 opencv-python
pip install torch==1.9.0 torchvision==0.10.0 -f https://download.pytorch.org/whl/torch_stable.html
pip install imageio==2.15.0
pip install https://github.com/kendryte/caffe/releases/download/v1.0.0.20210829/kendryte_caffe-1.0.0.20210829-cp37-cp37m-macosx_10_9_x86_64.whl
pip install pytest
run: pip install -r requirements.test.txt

- name: Create Test Environment
working-directory: ${{github.workspace}}
shell: bash
run: |
mkdir test_results
run: mkdir test_results

- name: Download nncase Artifact
uses: actions/download-artifact@v2.0.9
- name: Install nncase
uses: actions/download-artifact@v3
with:
name: nncase-${{matrix.os}}-x86_64
name: nncase-${{matrix.config.name}}
path: ${{github.workspace}}/install

- name: Test
working-directory: ${{github.workspace}}
if: runner.os != 'Windows'
shell: bash
- name: Generate benchmark kmodels
working-directory: ${{github.workspace}}/benchmark
env:
PYTHONPATH: ${{github.workspace}}/install/lib:${{github.workspace}}/install/python:${{github.workspace}}/tests
PATH: ${{github.workspace}}/install/bin
run: |
pytest tests/other --doctest-modules --junitxml=test_results/other.xml
pytest tests/importer --doctest-modules --junitxml=test_results/importer.xml
pytest tests/schedule --doctest-modules --junitxml=test_results/schedule.xml
pytest tests/graph_partition --doctest-modules --junitxml=test_results/graph_partition.xml
pytest tests/examples --doctest-modules --junitxml=test_results/examples.xml
python gen_kmodel.py
if: matrix.config.name == 'x86_64-linux'

- uses: stefanzweifel/git-auto-commit-action@v4
with:
commit_message: Update benchmark kmodels
file_pattern: 'benchmark/models/*'
if: matrix.config.name == 'x86_64-linux'

- name: Test
working-directory: ${{github.workspace}}
if: runner.os == 'Windows'
shell: bash
env:
PATH: ${{github.workspace}}/install/bin
PYTHONPATH: ${{github.workspace}}/install/lib;${{github.workspace}}/install/python;${{github.workspace}}/tests
VK_ICD_FILENAMES: ${{github.workspace}}/swiftshader/bin/vk_swiftshader_icd.json
run: |
pytest tests/other --doctest-modules --junitxml=test_results/other.xml
pytest tests/importer --doctest-modules --junitxml=test_results/importer.xml
Expand All @@ -210,7 +165,7 @@ jobs:
pytest tests/examples --doctest-modules --junitxml=test_results/examples.xml
- name: Publish Test Results
uses: EnricoMi/publish-unit-test-result-action@v1
if: always() && runner.os == 'Linux'
uses: EnricoMi/publish-unit-test-result-action@v2
if: always() && matrix.config.name == 'x86_64-linux'
with:
files: test_results/*.xml
71 changes: 34 additions & 37 deletions .github/workflows/compiler-python-release.yml
Original file line number Diff line number Diff line change
Expand Up @@ -5,61 +5,58 @@ on:
tags:
- '*'

env:
BUILD_TYPE: Release

jobs:
build:
runs-on: ${{ matrix.os }}
name: ${{matrix.config.name}}
runs-on: ${{matrix.config.os}}
strategy:
matrix:
os: [ubuntu-18.04,windows-2019,macos-10.15]
config:
- {name: x86_64-macos, os: macos-11}
- {name: x86_64-linux, os: ubuntu-20.04}
- {name: x86_64-windows, os: windows-latest, arch: x64}

env:
VULKANSDK_VER: 1.2.182.0

steps:
- uses: actions/checkout@v2
- uses: actions/checkout@v3
- uses: seanmiddleditch/gha-setup-ninja@master

- name: Set up build environment (Windows, Visual Studio)
uses: ilammy/msvc-dev-cmd@v1
with:
arch: ${{matrix.config.arch}}
if: runner.os == 'Windows'

- name: Set up build environment (Macos)
run: |
brew install sunnycase/core/[email protected]
aria2c --parameterized-uri=true https://{sdk.lunarg.com/sdk/download/${VULKANSDK_VER}/mac,distfiles.macports.org/MoltenVK}/vulkansdk-macos-${VULKANSDK_VER}.dmg
hdiutil attach ./vulkansdk-macos-*.dmg
sudo /Volumes/vulkansdk-macos-*/InstallVulkan.app/Contents/MacOS/InstallVulkan --root $HOME/VulkanSDK --accept-licenses --default-answer --confirm-command install
hdiutil detach /Volumes/vulkansdk-macos-*
echo "VULKAN_SDK=$HOME/VulkanSDK/macOS" >> $GITHUB_ENV
wget https://github.com/sunnycase/swiftshader/releases/download/v1.0/swiftshader-macos-10.15-x86_64.zip -O swiftshader.zip
unzip swiftshader.zip
sudo cmake -E make_directory /usr/local/share/vulkan/icd.d
sudo cp lib/* /usr/local/share/vulkan/icd.d
if: runner.os == 'Macos'

- name: Setup Python
uses: actions/setup-python@v2.2.1
uses: actions/setup-python@v4
with:
python-version: 3.7

- name: Install cibuildwheel
run: pip install cibuildwheel

- name: Install System Requirements
if: runner.os == 'Macos'
shell: bash
run: |
brew install sunnycase/core/[email protected]
- name: Add msbuild to PATH
if: runner.os == 'Windows'
uses: ilammy/[email protected]

- name: Build wheel
run: python -m cibuildwheel --output-dir wheelhouse

- name: Upload a Build Artifact
uses: actions/[email protected]
if: runner.os == 'Windows'
with:
name: nncase-python-windows
path: ${{github.workspace}}/wheelhouse
if-no-files-found: error

- name: Upload a Build Artifact
uses: actions/[email protected]
if: runner.os == 'Linux'
with:
name: nncase-python-linux
path: ${{github.workspace}}/wheelhouse
if-no-files-found: error

- name: Upload a Build Artifact
uses: actions/[email protected]
if: runner.os == 'Macos'
- name: Upload nncase-python Build Artifact
uses: actions/upload-artifact@v3
with:
name: nncase-python-macos
name: nncase-python-${{matrix.config.name}}
path: ${{github.workspace}}/wheelhouse
if-no-files-found: error
Loading

0 comments on commit f463285

Please sign in to comment.