diff --git a/.github/workflows/compiler-build.yml b/.github/workflows/compiler-build.yml
index d6c526e4f8..d34934dd55 100644
--- a/.github/workflows/compiler-build.yml
+++ b/.github/workflows/compiler-build.yml
@@ -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/libomp@11.1.0
-
- - 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/msvc-dev-cmd@v1.10.0
+
+ - name: Set up build environment (Macos)
+ run: |
+ brew install sunnycase/core/libomp@14.0.6
+ 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/libomp@11.1.0
-
- - name: Install Vulkan SDK
- if: runner.os == 'Linux'
- shell: bash
- env:
- VULKANSDK_VER: 1.2.182.0
+ brew install sunnycase/core/libomp@14.0.6
+ 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
@@ -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
diff --git a/.github/workflows/compiler-python-release.yml b/.github/workflows/compiler-python-release.yml
index 8b8b7fdaf5..6ac04e6a27 100644
--- a/.github/workflows/compiler-python-release.yml
+++ b/.github/workflows/compiler-python-release.yml
@@ -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/libomp@14.0.6
+ 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/libomp@11.1.0
-
- - name: Add msbuild to PATH
- if: runner.os == 'Windows'
- uses: ilammy/msvc-dev-cmd@v1.10.0
-
- name: Build wheel
run: python -m cibuildwheel --output-dir wheelhouse
-
- - name: Upload a Build Artifact
- uses: actions/upload-artifact@v2.2.2
- 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/upload-artifact@v2.2.2
- 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/upload-artifact@v2.2.2
- 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
diff --git a/.github/workflows/compiler-test.yml b/.github/workflows/compiler-test.yml
index 623b778646..45a84fc791 100644
--- a/.github/workflows/compiler-test.yml
+++ b/.github/workflows/compiler-test.yml
@@ -2,112 +2,96 @@ name: compiler-test
on: [push, pull_request]
-env:
- BUILD_TYPE: Release
-
jobs:
build:
+ name: build-${{matrix.config.name}}
runs-on: [self-hosted]
+ strategy:
+ matrix:
+ config:
+ - {name: x86_64-linux, shell: bash, cmakeArgs: '', buildType: Release}
steps:
- - uses: actions/checkout@v2
+ - uses: actions/checkout@v3
- 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 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}
+ cmake --build build --config ${{matrix.config.buildType}}
- name: Install
- shell: bash
- working-directory: ${{github.workspace}}/build
- run: cmake --install . --prefix /tmp/nncase
+ run: cmake --install build --prefix /tmp/nncase
- name: CTest
- shell: bash
working-directory: ${{github.workspace}}/build/tests/kernels
- run: ctest -C $BUILD_TYPE
+ run: ctest -C ${{matrix.config.buildType}}
test-compiler:
needs: [build]
+ name: test-${{matrix.config.name}}
runs-on: [self-hosted]
+ strategy:
+ matrix:
+ config:
+ - {name: x86_64-linux, shell: bash}
steps:
- - uses: actions/checkout@v2
+ - uses: actions/checkout@v3
- 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 != '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+cpu torchvision==0.10.0+cpu -f https://download.pytorch.org/whl/torch_stable.html
- pip install imageio==2.15.0
- pip install kendryte_caffe
- pip install pytest
+ run: pip install -r requirements.test.txt
- name: Create Test Environment
- working-directory: ${{github.workspace}}
- shell: bash
- run: |
- pip install pytest pytest-xdist
- mkdir test_results
+ run: mkdir test_results
- name: Test
working-directory: ${{github.workspace}}
- if: runner.os != 'Windows'
- shell: bash
env:
PYTHONPATH: /tmp/nncase/lib:/tmp/nncase/python:${{github.workspace}}/tests
ONNX_MODELS_DIR: /compiler/github-runner/onnx-models
TFLITE_MODELS_DIR: /compiler/github-runner/tflite-models
DATASET_DIR: /compiler/share
run: |
-
pytest -n 50 --dist=load tests/other --doctest-modules --junitxml=test_results/other.xml
pytest -n 50 --dist=load tests/importer --doctest-modules --junitxml=test_results/importer.xml
pytest -n 50 --dist=load tests/schedule --doctest-modules --junitxml=test_results/schedule.xml
pytest -n 50 --dist=load tests/graph_partition --doctest-modules --junitxml=test_results/graph_partition.xml
pytest -n 50 --dist=load tests/transform --doctest-modules --junitxml=test_results/transform.xml
- pytest -n 8 tests/models/onnx-model-zoo --doctest-modules --junitxml=test_results/models.xml
+ pytest -n 8 tests/models/onnx-model-zoo --doctest-modules --junitxml=test_results/onnx-models.xml
pytest tests/examples --doctest-modules --junitxml=test_results/examples.xml
for dir in `ls dataset_tests_output`; do cat dataset_tests_output/$dir/dataset_test_result.txt; done
-
+ if: runner.os != 'Windows'
+
+ - name: Upload Test Results
+ uses: actions/upload-artifact@v3
+ with:
+ name: nncase-test_results-${{matrix.config.name}}
+ path: ${{github.workspace}}/test_results
+ if-no-files-found: error
+
+ - name: Upload Dataset Test Results
+ uses: actions/upload-artifact@v3
+ with:
+ name: nncase-dataset_test_results-${{matrix.config.name}}
+ path: ${{github.workspace}}/dataset_tests_output
+ if-no-files-found: error
diff --git a/.github/workflows/dataset-test.yml b/.github/workflows/dataset-test.yml
index 1ce1cbbbe5..5c81bcee83 100644
--- a/.github/workflows/dataset-test.yml
+++ b/.github/workflows/dataset-test.yml
@@ -5,99 +5,72 @@ on:
- cron: '0 17 * * 6'
# 1:00 am
-env:
- BUILD_TYPE: Release
-
jobs:
build:
+ name: build-${{matrix.config.name}}
runs-on: [self-hosted]
+ strategy:
+ matrix:
+ config:
+ - {name: x86_64-linux, shell: bash, cmakeArgs: '', buildType: Release}
steps:
- - uses: actions/checkout@v2
+ - uses: actions/checkout@v3
- 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 update settings.compiler.libcxx=libstdc++11 default
+ if: runner.os == 'Linux'
- - name: Create Build Environment
- run: cmake -E make_directory ${{github.workspace}}/build
-
- - name: Configure CMake
+ - name: Build
env:
CC: gcc-10
CXX: g++-10
- 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}
+ cmake --build build --config ${{matrix.config.buildType}}
- name: Install
- shell: bash
- working-directory: ${{github.workspace}}/build
- run: cmake --install . --prefix /tmp/nncase
+ run: cmake --install build --prefix /tmp/nncase
- name: CTest
- shell: bash
working-directory: ${{github.workspace}}/build/tests/kernels
- run: ctest -C $BUILD_TYPE
+ run: ctest -C ${{matrix.config.buildType}}
dataset-test:
needs: [build]
+ name: test-${{matrix.config.name}}
runs-on: [self-hosted]
timeout-minutes: 4320
+ strategy:
+ matrix:
+ config:
+ - {name: x86_64-linux, shell: bash}
steps:
- - uses: actions/checkout@v2
+ - uses: actions/checkout@v3
- 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 != '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+cpu torchvision==0.10.0+cpu -f https://download.pytorch.org/whl/torch_stable.html
- pip install imageio==2.15.0
- pip install kendryte_caffe
- pip install pytest
+ run: pip install -r requirements.test.txt
- name: Create Test Environment
- working-directory: ${{github.workspace}}
- shell: bash
- run: |
- pip install pytest pytest-xdist
- mkdir test_results
+ run: mkdir test_results
- name: Test
working-directory: ${{github.workspace}}
- if: runner.os != 'Windows'
shell: bash
env:
PYTHONPATH: /tmp/nncase/lib:/tmp/nncase/python:${{github.workspace}}/tests
@@ -105,6 +78,13 @@ jobs:
TFLITE_MODELS_DIR: /compiler/github-runner/tflite-models
DATASET_DIR: /compiler/share
run: |
-
- pytest -n 8 tests/models/tflite-model-zoo --doctest-modules --junitxml=test_results/models-dataset.xml
+ pytest -n 8 tests/models/tflite-model-zoo --doctest-modules --junitxml=test_results/tflite-models.xml
for dir in `ls dataset_tests_output`; do cat dataset_tests_output/$dir/dataset_test_result.txt; done
+ if: runner.os != 'Windows'
+
+ - name: Upload Dataset Test Results
+ uses: actions/upload-artifact@v3
+ with:
+ name: nncase-dataset_test_results-${{matrix.config.name}}
+ path: ${{github.workspace}}/dataset_tests_output
+ if-no-files-found: error
diff --git a/.github/workflows/presubmit.yml b/.github/workflows/presubmit.yml
index cb2ccbcaa1..41417d9ffc 100644
--- a/.github/workflows/presubmit.yml
+++ b/.github/workflows/presubmit.yml
@@ -5,25 +5,12 @@ on:
pull_request:
types: [opened, synchronize, reopened]
paths:
- - '**.h'
- - '**.c'
- - '**.cpp'
- '**.py'
jobs:
- check_clang_format:
- name: Check clang-format
- runs-on: ubuntu-18.04
- steps:
- - uses: actions/checkout@v2
- - uses: DoozyX/clang-format-lint-action@v0.11
- with:
- source: 'tests src include modules python targets'
- extensions: 'h,c,cc,cxx,cpp,hpp,cppm'
- clangFormatVersion: 11
check_autopep8_format:
name: Check autopep8-format
- runs-on: ubuntu-18.04
+ runs-on: ubuntu-latest
steps:
- name: autopep8
id: autopep8
@@ -33,4 +20,4 @@ jobs:
- name: Fail if autopep8 made changes
if: steps.autopep8.outputs.exit-code == 2
- run: exit 1
\ No newline at end of file
+ run: exit 1
diff --git a/.github/workflows/runtime-build.yml b/.github/workflows/runtime-build.yml
new file mode 100644
index 0000000000..331040e40b
--- /dev/null
+++ b/.github/workflows/runtime-build.yml
@@ -0,0 +1,124 @@
+name: runtime-build
+
+on: [push, pull_request]
+
+jobs:
+ build-native:
+ name: ${{matrix.config.name}}
+ runs-on: ${{matrix.config.os}}
+ strategy:
+ matrix:
+ config:
+ - {name: x86_64-macos, os: macos-11, cmakeArgs: -G Ninja, buildType: Release}
+ - {name: x86_64-linux, os: ubuntu-20.04, cmakeArgs: -G Ninja, buildType: Release}
+ - {name: x86_64-windows, os: windows-latest, arch: x64, cmakeArgs: -G Ninja, buildType: Release}
+
+ steps:
+ - 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/libomp@14.0.6
+ if: runner.os == 'Macos'
+
+ - name: Setup Python
+ uses: actions/setup-python@v4
+ with:
+ python-version: 3.7
+
+ - name: Install Conan
+ run: pip install conan==1.59.0
+
+ - name: Configure Conan (Linux)
+ run: |
+ conan profile new default --detect
+ conan profile update settings.compiler.libcxx=libstdc++11 default
+ echo "CC=gcc-10" >> $GITHUB_ENV
+ echo "CXX=g++-10" >> $GITHUB_ENV
+ if: runner.os == 'Linux'
+
+ - name: Configure CMake
+ shell: bash
+ run: |
+ cmake -B build -G Ninja -DCMAKE_BUILD_TYPE=${{matrix.config.buildType}} ${{matrix.config.cmakeArgs}} -DBUILDING_RUNTIME=TRUE -DBUILD_PYTHON_BINDING=OFF -DPython3_ROOT_DIR=${pythonLocation}
+
+ - name: Build & Install
+ run: |
+ cmake --build build --config ${{matrix.config.buildType}}
+ cmake --install build --prefix install
+
+ - name: Benchmark
+ run: |
+ ${{github.workspace}}/install/bin/benchnncase > benchnncase.log
+ cat benchnncase.log
+
+ - name: Upload nncaseruntime Build Artifact
+ uses: actions/upload-artifact@v3
+ with:
+ name: nncaseruntime-${{matrix.config.name}}
+ path: ${{github.workspace}}/install
+ if-no-files-found: error
+
+ - name: Upload nncaseruntime Benchmark
+ uses: actions/upload-artifact@v3
+ with:
+ name: nncaseruntime-benchmark-${{matrix.config.name}}
+ path: ${{github.workspace}}/benchnncase.log
+ if-no-files-found: error
+
+ build-cross:
+ name: ${{matrix.config.name}}
+ runs-on: ubuntu-latest
+ strategy:
+ matrix:
+ config:
+ - {name: riscv64-none-k210, shell: bash, toolchain: k210, cmakeArgs: -DK210_SDK_DIR=$GITHUB_WORKSPACE/kendryte-standalone-sdk-develop, buildType: Release}
+
+ steps:
+ - uses: actions/checkout@v3
+ - uses: seanmiddleditch/gha-setup-ninja@master
+
+ - name: Setup Python
+ uses: actions/setup-python@v4
+ with:
+ python-version: 3.7
+
+ - name: Install K210 Baremetal SDK
+ shell: bash
+ run: |
+ wget https://github.com/kendryte/kendryte-gnu-toolchain/releases/download/v8.2.0-20190409/kendryte-toolchain-ubuntu-amd64-8.2.0-20190409.tar.xz -O $GITHUB_WORKSPACE/kendryte-toolchain.tar.xz
+ sudo tar xf $GITHUB_WORKSPACE/kendryte-toolchain.tar.xz -C $GITHUB_WORKSPACE
+ wget https://github.com/kendryte/kendryte-standalone-sdk/archive/refs/heads/develop.tar.gz -O $GITHUB_WORKSPACE/k210-sdk.tar.gz
+ sudo tar xf $GITHUB_WORKSPACE/k210-sdk.tar.gz -C $GITHUB_WORKSPACE
+ echo "RISCV_ROOT_PATH=$GITHUB_WORKSPACE/kendryte-toolchain" >> $GITHUB_ENV
+ if: matrix.config.name == 'riscv64-none-k210'
+
+ - name: Install Conan
+ run: pip install conan==1.59.0
+
+ - name: Configure Conan (Linux)
+ run: |
+ conan profile new default --detect
+ conan profile update settings.compiler.libcxx=libstdc++11 default
+
+ - name: Build
+ run: |
+ cmake -B build -G Ninja -DCMAKE_TOOLCHAIN_FILE=$GITHUB_WORKSPACE/toolchains/${{matrix.config.toolchain}}.toolchain.cmake -DCMAKE_BUILD_TYPE=${{matrix.config.buildType}} ${{matrix.config.cmakeArgs}} -DBUILDING_RUNTIME=TRUE -DBUILD_PYTHON_BINDING=OFF -DPython3_ROOT_DIR=${pythonLocation}
+ cmake --build build --config ${{matrix.config.buildType}}
+
+ - name: Install
+ run: cmake --install build --prefix install
+
+ - name: Upload nncaseruntime Build Artifact
+ uses: actions/upload-artifact@v3
+ with:
+ name: nncaseruntime-${{matrix.config.name}}
+ path: ${{github.workspace}}/install
+ if-no-files-found: error
diff --git a/.github/workflows/runtime-k210.yml b/.github/workflows/runtime-k210.yml
deleted file mode 100644
index cc98ee8c3b..0000000000
--- a/.github/workflows/runtime-k210.yml
+++ /dev/null
@@ -1,80 +0,0 @@
-name: runtime-k210
-
-on: [push, pull_request]
-
-env:
- BUILD_TYPE: Release
-
-jobs:
- build:
- runs-on: ${{ matrix.os }}
- strategy:
- matrix:
- os: [ubuntu-18.04]
-
- steps:
- - uses: actions/checkout@v2
- - uses: seanmiddleditch/gha-setup-ninja@master
-
- - name: Download K210 Toolchains
- if: runner.os == 'Linux'
- shell: bash
- run: |
- wget https://github.com/kendryte/kendryte-gnu-toolchain/releases/download/v8.2.0-20190409/kendryte-toolchain-ubuntu-amd64-8.2.0-20190409.tar.xz -O $GITHUB_WORKSPACE/kendryte-toolchain.tar.xz
-
- - name: Install K210 Toolchains
- shell: bash
- run: |
- sudo tar xf $GITHUB_WORKSPACE/kendryte-toolchain.tar.xz -C $GITHUB_WORKSPACE
-
- - name: Download K210 SDK
- shell: bash
- run: |
- wget https://github.com/kendryte/kendryte-standalone-sdk/archive/refs/heads/develop.tar.gz -O $GITHUB_WORKSPACE/k210-sdk.tar.gz
-
- - name: Install K210 SDK
- shell: bash
- run: |
- sudo tar xf $GITHUB_WORKSPACE/k210-sdk.tar.gz -C $GITHUB_WORKSPACE
-
- - name: Setup Python
- uses: actions/setup-python@v2.2.1
- with:
- python-version: 3.7
-
- - name: Install Conan
- run: |
- pip install conan
-
- - name: Configure Conan
- shell: bash
- 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:
- RISCV_ROOT_PATH: ${{github.workspace}}/kendryte-toolchain
- shell: bash
- working-directory: ${{github.workspace}}/build
- run: cmake -G Ninja $GITHUB_WORKSPACE -DCMAKE_BUILD_TYPE=$BUILD_TYPE -DK210_SDK_DIR=$GITHUB_WORKSPACE/kendryte-standalone-sdk-develop -DBUILDING_RUNTIME=TRUE -DBUILD_PYTHON_BINDING=OFF -DCMAKE_TOOLCHAIN_FILE=$GITHUB_WORKSPACE/toolchains/k210.toolchain.cmake -DPython3_ROOT_DIR=${pythonLocation}
-
- - name: Build
- working-directory: ${{github.workspace}}/build
- shell: bash
- run: cmake --build . --config $BUILD_TYPE
-
- - name: Install
- working-directory: ${{github.workspace}}/build
- shell: bash
- run: cmake --install . --prefix ../install
-
- - name: Upload a Build Artifact
- uses: actions/upload-artifact@v2.2.2
- with:
- name: nncaseruntime-k210
- path: ${{github.workspace}}/install
- if-no-files-found: error
diff --git a/.github/workflows/runtime-linux-x64-gcc.yml b/.github/workflows/runtime-linux-x64-gcc.yml
deleted file mode 100644
index fe755cd81a..0000000000
--- a/.github/workflows/runtime-linux-x64-gcc.yml
+++ /dev/null
@@ -1,72 +0,0 @@
-name: runtime-linux-x64-gcc
-
-on: [push, pull_request]
-
-env:
- BUILD_TYPE: Release
-
-jobs:
- build:
- runs-on: ${{ matrix.os }}
- strategy:
- matrix:
- os: [ubuntu-18.04]
-
- steps:
- - uses: actions/checkout@v2
- - uses: seanmiddleditch/gha-setup-ninja@master
-
- - name: Setup Python
- uses: actions/setup-python@v2.2.1
- with:
- python-version: 3.7
-
- - name: Install Conan
- run: |
- pip install conan
-
- - name: Configure Conan
- shell: bash
- 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-7
- CXX: g++-7
- shell: bash
- working-directory: ${{github.workspace}}/build
- run: cmake -G Ninja $GITHUB_WORKSPACE -DCMAKE_BUILD_TYPE=$BUILD_TYPE -DBUILDING_RUNTIME=TRUE -DPython3_ROOT_DIR=${pythonLocation}
-
- - name: Build
- shell: bash
- working-directory: ${{github.workspace}}/build
- run: cmake --build . --config $BUILD_TYPE
-
- - name: Install
- shell: bash
- working-directory: ${{github.workspace}}/build
- run: cmake --install . --prefix ../install
-
- - name: Benchmark
- shell: bash
- working-directory: ${{github.workspace}}
- run: ${{github.workspace}}/install/bin/benchnncase > benchnncase.log
-
- - name: Upload a Build Artifact
- uses: actions/upload-artifact@v2.2.2
- with:
- name: nncaseruntime-linux-x64-gcc
- path: ${{github.workspace}}/install
- if-no-files-found: error
-
- - name: Upload Benchmark Result
- uses: actions/upload-artifact@v2.2.2
- with:
- name: nncasebenchmark-linux-x64-gcc
- path: ${{github.workspace}}/benchnncase.log
- if-no-files-found: error
diff --git a/.github/workflows/runtime-macos-x64-appleclang.yml b/.github/workflows/runtime-macos-x64-appleclang.yml
deleted file mode 100644
index 45b4a489dc..0000000000
--- a/.github/workflows/runtime-macos-x64-appleclang.yml
+++ /dev/null
@@ -1,69 +0,0 @@
-name: runtime-macos-x64-appleclang
-
-on: [push, pull_request]
-
-env:
- BUILD_TYPE: Release
-
-jobs:
- build:
- runs-on: ${{ matrix.os }}
- strategy:
- matrix:
- os: [macos-10.15]
-
- steps:
- - uses: actions/checkout@v2
- - uses: seanmiddleditch/gha-setup-ninja@master
-
- - name: Install System Requirements
- shell: bash
- run: |
- brew install sunnycase/core/libomp@11.1.0
-
- - name: Setup Python
- uses: actions/setup-python@v2.2.1
- with:
- python-version: 3.7
-
- - name: Install Conan
- shell: bash
- run: |
- pip install conan
-
- - name: Create Build Environment
- run: cmake -E make_directory ${{github.workspace}}/build
-
- - name: Configure CMake
- shell: bash
- working-directory: ${{github.workspace}}/build
- run: cmake -G Ninja $GITHUB_WORKSPACE -DCMAKE_BUILD_TYPE=$BUILD_TYPE -DBUILDING_RUNTIME=TRUE -DPython3_ROOT_DIR=${pythonLocation}
-
- - name: Build
- shell: bash
- working-directory: ${{github.workspace}}/build
- run: cmake --build . --config $BUILD_TYPE
-
- - name: Install
- shell: bash
- working-directory: ${{github.workspace}}/build
- run: cmake --install . --prefix ../install
-
- - name: Benchmark
- shell: bash
- working-directory: ${{github.workspace}}
- run: ${{github.workspace}}/install/bin/benchnncase > benchnncase.log
-
- - name: Upload a Build Artifact
- uses: actions/upload-artifact@v2.2.2
- with:
- name: nncaseruntime-macos-x64-appleclang
- path: ${{github.workspace}}/install
- if-no-files-found: error
-
- - name: Upload Benchmark Result
- uses: actions/upload-artifact@v2.2.2
- with:
- name: nncasebenchmark-macos-x64-appleclang
- path: ${{github.workspace}}/benchnncase.log
- if-no-files-found: error
diff --git a/.github/workflows/runtime-win-x64-msvc.yml b/.github/workflows/runtime-win-x64-msvc.yml
deleted file mode 100644
index 5cef593961..0000000000
--- a/.github/workflows/runtime-win-x64-msvc.yml
+++ /dev/null
@@ -1,68 +0,0 @@
-name: runtime-win-x64-msvc
-
-on: [push, pull_request]
-
-env:
- BUILD_TYPE: Release
-
-jobs:
- build:
- runs-on: ${{ matrix.os }}
- strategy:
- matrix:
- os: [windows-2019]
-
- steps:
- - uses: actions/checkout@v2
- - uses: seanmiddleditch/gha-setup-ninja@master
-
- - name: Add msbuild to PATH
- if: runner.os == 'Windows'
- uses: ilammy/msvc-dev-cmd@v1.10.0
-
- - name: Setup Python
- uses: actions/setup-python@v2.2.1
- with:
- python-version: 3.7
-
- - name: Install Conan
- shell: bash
- run: |
- pip install conan
-
- - name: Create Build Environment
- run: cmake -E make_directory ${{github.workspace}}/build
-
- - name: Configure CMake
- shell: bash
- working-directory: ${{github.workspace}}/build
- run: cmake -G Ninja $GITHUB_WORKSPACE -DCMAKE_BUILD_TYPE=$BUILD_TYPE -DBUILDING_RUNTIME=TRUE -DPython3_ROOT_DIR=${pythonLocation}
-
- - name: Build
- shell: bash
- working-directory: ${{github.workspace}}/build
- run: cmake --build . --config $BUILD_TYPE
-
- - name: Install
- shell: bash
- working-directory: ${{github.workspace}}/build
- run: cmake --install . --prefix ../install
-
- - name: Benchmark
- shell: pwsh
- working-directory: ${{github.workspace}}
- run: .\install\bin\benchnncase.exe > benchnncase.log
-
- - name: Upload a Build Artifact
- uses: actions/upload-artifact@v2.2.2
- with:
- name: nncaseruntime-win-x64-msvc
- path: ${{github.workspace}}/install
- if-no-files-found: error
-
- - name: Upload Benchmark Result
- uses: actions/upload-artifact@v2.2.2
- with:
- name: nncasebenchmark-win-x64-msvc
- path: ${{github.workspace}}/benchnncase.log
- if-no-files-found: error
diff --git a/CMakeLists.txt b/CMakeLists.txt
index e7d77a2090..275db97f00 100644
--- a/CMakeLists.txt
+++ b/CMakeLists.txt
@@ -1,31 +1,31 @@
-cmake_minimum_required(VERSION 3.13)
+cmake_minimum_required(VERSION 3.13)
list(APPEND CMAKE_MODULE_PATH ${CMAKE_CURRENT_LIST_DIR}/cmake/Modules)
if(NOT DEFINED NNCASE_VERSION)
- set(NNCASE_VERSION "1.0.0")
+ set(NNCASE_VERSION "1.9.0")
endif()
if(DEFINED ENV{NNCASE_VERSION_SUFFIX})
- set(NNCASE_VERSION_SUFFIX $ENV{NNCASE_VERSION_SUFFIX})
+ set(NNCASE_VERSION_SUFFIX $ENV{NNCASE_VERSION_SUFFIX})
endif()
if(NOT DEFINED NNCASE_VERSION_SUFFIX)
- find_package (Git)
- execute_process(
- COMMAND ${GIT_EXECUTABLE} describe --always --dirty
- WORKING_DIRECTORY ${CMAKE_SOURCE_DIR}
- OUTPUT_VARIABLE GIT_DESC
- OUTPUT_STRIP_TRAILING_WHITESPACE)
- set(NNCASE_VERSION_SUFFIX "-${GIT_DESC}")
+ find_package(Git)
+ execute_process(
+ COMMAND ${GIT_EXECUTABLE} describe --always --dirty
+ WORKING_DIRECTORY ${CMAKE_SOURCE_DIR}
+ OUTPUT_VARIABLE GIT_DESC
+ OUTPUT_STRIP_TRAILING_WHITESPACE)
+ set(NNCASE_VERSION_SUFFIX "-${GIT_DESC}")
endif()
-if (NOT PACKAGE_VERSION)
- set(PACKAGE_VERSION
- "${NNCASE_VERSION}${NNCASE_VERSION_SUFFIX}")
+if(NOT PACKAGE_VERSION)
+ set(PACKAGE_VERSION "${NNCASE_VERSION}${NNCASE_VERSION_SUFFIX}")
endif()
-project(nncase
+project(
+ nncase
VERSION ${NNCASE_VERSION}
LANGUAGES C CXX ASM)
@@ -35,208 +35,259 @@ option(BUILD_PYTHON_BINDING "Build python binding" ON)
option(BUILD_BENCHMARK "Build benchmark programs" ON)
option(BUILD_TESTING "Build test programs" OFF)
option(ENABLE_OP_PROFILE "Profile ops cast time" OFF)
-if (ENABLE_OP_PROFILE)
- add_definitions(-DENABLE_OP_PROFILE)
+if(ENABLE_OP_PROFILE)
+ add_definitions(-DENABLE_OP_PROFILE)
endif()
-if (BUILDING_RUNTIME)
- option(ENABLE_VULKAN_RUNTIME "Enable Vulkan runtime" ON)
- option(ENABLE_K210_RUNTIME "Enable k210 runtime" OFF)
- option(DEFAULT_BUILTIN_RUNTIMES "Use default builtin runtimes" ON)
- option(DEFAULT_SHARED_RUNTIME_TENSOR_PLATFORM_IMPL "Use default shared memory platform impl" ON)
+if(${CMAKE_SYSTEM_PROCESSOR} MATCHES
+ "(x86)|(X86)|(amd64)|(AMD64)|(x86_64)|(X86_64)")
+ if(NOT TURNOFF_SIMD_OPTIMIZE)
+ include(toolchains/x86_64.toolchain.cmake)
+ endif()
+endif()
+
+if(BUILDING_RUNTIME)
+ option(ENABLE_VULKAN_RUNTIME "Enable Vulkan runtime" ON)
+ option(ENABLE_K210_RUNTIME "Enable k210 runtime" OFF)
+ option(DEFAULT_BUILTIN_RUNTIMES "Use default builtin runtimes" ON)
+ option(DEFAULT_SHARED_RUNTIME_TENSOR_PLATFORM_IMPL
+ "Use default shared memory platform impl" ON)
endif()
include(cmake/configure-conan.cmake)
include(cmake/conan.cmake)
-if(NOT CONAN_EXPORTED)
- conan_check()
- conan_add_remote(NAME sunnycase URL https://conan.sunnycase.moe INDEX 0)
+if(NOT CONAN_EXPORTED)
+ conan_check()
+ conan_add_remote(NAME sunnycase URL https://conan.sunnycase.moe INDEX 0)
endif()
if(CONAN_EXPORTED) # in conan local cache
- message(STATUS "Standard Conan Installation")
- include(${CMAKE_BINARY_DIR}/conanbuildinfo.cmake)
- conan_basic_setup() # NOTE need manmul set cppstd in conanfile.py
+ message(STATUS "Standard Conan Installation")
+ include(${CMAKE_BINARY_DIR}/conanbuildinfo.cmake)
+ conan_basic_setup() # NOTE need manmul set cppstd in conanfile.py
else() # in user space
- message(STATUS "Auto Cmake Conan Installation")
- include(${CMAKE_SOURCE_DIR}/cmake/conan.cmake)
- conan_cmake_run(CONANFILE conanfile.py
- BASIC_SETUP
- OPTIONS ${CONAN_OPTS}
- SETTINGS ${CONAN_SETTINGS}
- BUILD missing)
+ message(STATUS "Auto Cmake Conan Installation")
+ include(${CMAKE_SOURCE_DIR}/cmake/conan.cmake)
+ conan_cmake_run(
+ CONANFILE
+ conanfile.py
+ BASIC_SETUP
+ OPTIONS
+ ${CONAN_OPTS}
+ SETTINGS
+ ${CONAN_SETTINGS}
+ BUILD
+ missing)
endif()
include(${CMAKE_BINARY_DIR}/conan_paths.cmake)
include(cmake/dependencies.cmake)
-if (BUILDING_RUNTIME)
- set(NNCASE_MAIN_INCLUDE_DIR ${CMAKE_CURRENT_LIST_DIR}/include)
- set(NNCASE_INCLUDE_DIR ${CMAKE_CURRENT_BINARY_DIR}/include)
- set(THIRD_PARTY ${CMAKE_CURRENT_LIST_DIR}/third_party)
- set_property(GLOBAL PROPERTY POSITION_INDEPENDENT_CODE ON)
-
- if (MSVC)
- add_definitions(/D_CRT_SECURE_NO_WARNINGS /DNOMINMAX)
- add_compile_options(/wd4267 /wd4251 /wd4244 /FC /utf-8 /W3 /WX)
+if(BUILDING_RUNTIME)
+ set(NNCASE_MAIN_INCLUDE_DIR ${CMAKE_CURRENT_LIST_DIR}/include)
+ set(NNCASE_INCLUDE_DIR ${CMAKE_CURRENT_BINARY_DIR}/include)
+ set(THIRD_PARTY ${CMAKE_CURRENT_LIST_DIR}/third_party)
+ set_property(GLOBAL PROPERTY POSITION_INDEPENDENT_CODE ON)
+
+ if(MSVC)
+ add_definitions(/D_CRT_SECURE_NO_WARNINGS /DNOMINMAX)
+ add_compile_options(
+ /wd4267
+ /wd4251
+ /wd4244
+ /FC
+ /utf-8
+ /W3
+ /WX)
+ else()
+ add_compile_options(
+ -Wall
+ -Wextra
+ -pedantic
+ -Werror
+ -Wno-multichar
+ -Wno-missing-field-initializers
+ -Wno-unused-function
+ -Wno-type-limits)
+ if(APPLE)
+ add_compile_options(-Wno-four-char-constants -Wno-sometimes-uninitialized)
+ elseif(CMAKE_CXX_COMPILER_ID STREQUAL "Clang")
+ add_compile_options(-Wno-uninitialized -Wno-unused-private-field)
else()
- add_compile_options(-Wall -Wextra -pedantic -Werror -Wno-multichar -Wno-missing-field-initializers -Wno-unused-function -Wno-type-limits)
- if (APPLE)
- add_compile_options(-Wno-four-char-constants -Wno-sometimes-uninitialized)
- elseif (CMAKE_CXX_COMPILER_ID STREQUAL "Clang")
- add_compile_options(-Wno-uninitialized -Wno-unused-private-field)
- else ()
- add_compile_options(-Wno-maybe-uninitialized -Wno-unused-private-field)
- endif()
- endif()
-
- include_directories(${NNCASE_MAIN_INCLUDE_DIR})
- include_directories(${NNCASE_INCLUDE_DIR})
-
- add_subdirectory(include/nncase)
- add_subdirectory(src/kernels)
- add_subdirectory(src/runtime)
- add_subdirectory(src/functional)
- if(BUILD_BENCHMARK)
- add_subdirectory(benchmark)
+ add_compile_options(-Wno-maybe-uninitialized -Wno-unused-private-field)
endif()
-
- # Python binding
- if(BUILD_PYTHON_BINDING)
- add_subdirectory(python/nncaseruntime/native)
- endif()
-
- install(DIRECTORY ${NNCASE_INCLUDE_DIR}/nncase
- DESTINATION include
- COMPONENT nncase-headers
- FILES_MATCHING
- PATTERN "*version.h"
- PATTERN "CMakeFiles" EXCLUDE
- )
-
- install(DIRECTORY include/nncase/kernels
- DESTINATION include/nncase
- COMPONENT nncase-headers
- FILES_MATCHING
- PATTERN "*.def"
- PATTERN "*.h"
- PATTERN "*.hpp"
- PATTERN "*.td"
- PATTERN "*.inc"
- PATTERN "LICENSE.TXT"
- )
-
- install(DIRECTORY include/nncase/runtime
- DESTINATION include/nncase
- COMPONENT nncase-headers
- FILES_MATCHING
- PATTERN "*.def"
- PATTERN "*.h"
- PATTERN "*.hpp"
- PATTERN "*.td"
- PATTERN "*.inc"
- PATTERN "LICENSE.TXT"
- )
+ endif()
+
+ include_directories(${NNCASE_MAIN_INCLUDE_DIR})
+ include_directories(${NNCASE_INCLUDE_DIR})
+
+ add_subdirectory(include/nncase)
+ add_subdirectory(src/kernels)
+ add_subdirectory(src/runtime)
+ add_subdirectory(src/functional)
+ if(BUILD_BENCHMARK)
+ add_subdirectory(benchmark)
+ endif()
+
+ # Python binding
+ if(BUILD_PYTHON_BINDING)
+ add_subdirectory(python/nncaseruntime/native)
+ endif()
+
+ install(
+ DIRECTORY ${NNCASE_INCLUDE_DIR}/nncase
+ DESTINATION include
+ COMPONENT nncase-headers
+ FILES_MATCHING
+ PATTERN "*version.h"
+ PATTERN "CMakeFiles" EXCLUDE)
+
+ install(
+ DIRECTORY include/nncase/kernels
+ DESTINATION include/nncase
+ COMPONENT nncase-headers
+ FILES_MATCHING
+ PATTERN "*.def"
+ PATTERN "*.h"
+ PATTERN "*.hpp"
+ PATTERN "*.td"
+ PATTERN "*.inc"
+ PATTERN "LICENSE.TXT")
+
+ install(
+ DIRECTORY include/nncase/runtime
+ DESTINATION include/nncase
+ COMPONENT nncase-headers
+ FILES_MATCHING
+ PATTERN "*.def"
+ PATTERN "*.h"
+ PATTERN "*.hpp"
+ PATTERN "*.td"
+ PATTERN "*.inc"
+ PATTERN "LICENSE.TXT")
else()
- set(CMAKE_SKIP_RPATH OFF)
-
- set(NNCASE_MAIN_INCLUDE_DIR ${CMAKE_CURRENT_LIST_DIR}/include)
- set(NNCASE_INCLUDE_DIR ${CMAKE_CURRENT_BINARY_DIR}/include)
- set(THIRD_PARTY ${CMAKE_CURRENT_LIST_DIR}/third_party)
- set_property(GLOBAL PROPERTY POSITION_INDEPENDENT_CODE ON)
- if (APPLE)
- set(CMAKE_MACOSX_RPATH TRUE)
- set(CMAKE_INSTALL_RPATH "@loader_path")
- set(CMAKE_INSTALL_NAME_DIR "@rpath")
- else ()
- set(CMAKE_INSTALL_RPATH "$ORIGIN")
- endif()
-
- if (MSVC)
- add_definitions(/D_SILENCE_ALL_CXX17_DEPRECATION_WARNINGS /D_CRT_SECURE_NO_WARNINGS /DNOMINMAX)
- add_compile_options(/wd4267 /wd4251 /wd4244 /FC /utf-8 /W3 /WX)
- set(PYBIND11_CPP_STANDARD "/std:c++latest")
+ set(CMAKE_SKIP_RPATH OFF)
+
+ set(NNCASE_MAIN_INCLUDE_DIR ${CMAKE_CURRENT_LIST_DIR}/include)
+ set(NNCASE_INCLUDE_DIR ${CMAKE_CURRENT_BINARY_DIR}/include)
+ set(THIRD_PARTY ${CMAKE_CURRENT_LIST_DIR}/third_party)
+ set_property(GLOBAL PROPERTY POSITION_INDEPENDENT_CODE ON)
+ if(APPLE)
+ set(CMAKE_MACOSX_RPATH TRUE)
+ set(CMAKE_INSTALL_RPATH "@loader_path")
+ set(CMAKE_INSTALL_NAME_DIR "@rpath")
+ else()
+ set(CMAKE_INSTALL_RPATH "$ORIGIN")
+ endif()
+
+ if(MSVC)
+ add_definitions(/D_SILENCE_ALL_CXX17_DEPRECATION_WARNINGS
+ /D_CRT_SECURE_NO_WARNINGS /DNOMINMAX)
+ add_compile_options(
+ /wd4267
+ /wd4251
+ /wd4244
+ /FC
+ /utf-8
+ /W3
+ /WX)
+ set(PYBIND11_CPP_STANDARD "/std:c++latest")
+ else()
+ add_compile_options(-fvisibility=hidden)
+ add_compile_options(
+ -Wall
+ -Wextra
+ -pedantic
+ -Werror
+ -Wno-multichar
+ -Wno-missing-field-initializers
+ -Wno-unused-function
+ -Wno-type-limits
+ -Wno-unused-local-typedefs
+ -Wno-sign-compare)
+ if(APPLE)
+ add_compile_options(-Wno-four-char-constants -Wno-sometimes-uninitialized
+ -Wno-deprecated)
+ elseif(CMAKE_CXX_COMPILER_ID STREQUAL "Clang")
+ add_compile_options(-Wno-uninitialized)
else()
- add_compile_options(-fvisibility=hidden)
- add_compile_options(-Wall -Wextra -pedantic -Werror -Wno-multichar -Wno-missing-field-initializers -Wno-unused-function -Wno-type-limits -Wno-unused-local-typedefs -Wno-sign-compare)
- if (APPLE)
- add_compile_options(-Wno-four-char-constants -Wno-sometimes-uninitialized -Wno-deprecated)
- elseif (CMAKE_CXX_COMPILER_ID STREQUAL "Clang")
- add_compile_options(-Wno-uninitialized)
- else ()
- add_compile_options(-Wno-maybe-uninitialized -Wno-deprecated-copy)
- add_link_options(-Wl,--exclude-libs,ALL)
- endif()
- endif()
-
- include_directories(${NNCASE_MAIN_INCLUDE_DIR})
- include_directories(${NNCASE_INCLUDE_DIR})
-
- add_subdirectory(include/nncase)
- add_subdirectory(src/nncase)
- add_subdirectory(src/data)
- add_subdirectory(src/ir)
- add_subdirectory(src/importer)
- add_subdirectory(src/schedule)
- add_subdirectory(src/evaluator)
- add_subdirectory(src/functional)
- add_subdirectory(src/transforms)
- add_subdirectory(src/codegen)
- add_subdirectory(src/kernels)
- add_subdirectory(src/runtime)
- add_subdirectory(src/targets)
- add_subdirectory(src/plugin)
- add_subdirectory(src/cli)
-
- if(BUILD_TESTING)
- add_subdirectory(tests/kernels)
- endif()
-
- # Python binding
- if(BUILD_PYTHON_BINDING)
- add_subdirectory(python/nncase/native)
+ add_compile_options(-Wno-maybe-uninitialized -Wno-deprecated-copy)
+ if(CMAKE_CXX_COMPILER_VERSION GREATER_EQUAL "12.0")
+ add_compile_options(-Wno-array-bounds -Wno-deprecated-declarations
+ -Wno-restrict)
+ endif()
+ add_link_options(-Wl,--exclude-libs,ALL)
endif()
-
- # Thrid party
- add_subdirectory(third_party/onnx)
-
- install(DIRECTORY include/nncase
- DESTINATION include
- COMPONENT nncase-headers
- FILES_MATCHING
- PATTERN "*.def"
- PATTERN "*.h"
- PATTERN "*.hpp"
- PATTERN "*.td"
- PATTERN "*.inc"
- PATTERN "LICENSE.TXT"
- )
-
- install(DIRECTORY ${NNCASE_INCLUDE_DIR}/nncase
- DESTINATION include
- COMPONENT nncase-headers
- FILES_MATCHING
- PATTERN "*.def"
- PATTERN "*.h"
- PATTERN "*.hpp"
- PATTERN "*.td"
- PATTERN "*.inc"
- PATTERN "CMakeFiles" EXCLUDE
- PATTERN "config.h" EXCLUDE
- )
-
- install(DIRECTORY python/nncase
- DESTINATION python
- COMPONENT nncase-python
- FILES_MATCHING
- PATTERN "*.py"
- )
-
- # Targets
- add_subdirectory(targets/cpu)
- add_subdirectory(targets/k210)
- add_subdirectory(targets/vulkan)
+ endif()
+
+ include_directories(${NNCASE_MAIN_INCLUDE_DIR})
+ include_directories(${NNCASE_INCLUDE_DIR})
+
+ add_subdirectory(include/nncase)
+ add_subdirectory(src/nncase)
+ add_subdirectory(src/data)
+ add_subdirectory(src/ir)
+ add_subdirectory(src/importer)
+ add_subdirectory(src/schedule)
+ add_subdirectory(src/evaluator)
+ add_subdirectory(src/functional)
+ add_subdirectory(src/transforms)
+ add_subdirectory(src/codegen)
+ add_subdirectory(src/kernels)
+ add_subdirectory(src/runtime)
+ add_subdirectory(src/targets)
+ add_subdirectory(src/plugin)
+ add_subdirectory(src/cli)
+
+ if(BUILD_TESTING)
+ add_subdirectory(tests/kernels)
+ endif()
+
+ # Python binding
+ if(BUILD_PYTHON_BINDING)
+ add_subdirectory(python/nncase/native)
+ endif()
+
+ # Thrid party
+ add_subdirectory(third_party/onnx)
+
+ install(
+ DIRECTORY include/nncase
+ DESTINATION include
+ COMPONENT nncase-headers
+ FILES_MATCHING
+ PATTERN "*.def"
+ PATTERN "*.h"
+ PATTERN "*.hpp"
+ PATTERN "*.td"
+ PATTERN "*.inc"
+ PATTERN "LICENSE.TXT")
+
+ install(
+ DIRECTORY ${NNCASE_INCLUDE_DIR}/nncase
+ DESTINATION include
+ COMPONENT nncase-headers
+ FILES_MATCHING
+ PATTERN "*.def"
+ PATTERN "*.h"
+ PATTERN "*.hpp"
+ PATTERN "*.td"
+ PATTERN "*.inc"
+ PATTERN "CMakeFiles" EXCLUDE
+ PATTERN "config.h" EXCLUDE)
+
+ install(
+ DIRECTORY python/nncase
+ DESTINATION python
+ COMPONENT nncase-python
+ FILES_MATCHING
+ PATTERN "*.py")
+
+ # Targets
+ add_subdirectory(targets/cpu)
+ add_subdirectory(targets/k210)
+ add_subdirectory(targets/vulkan)
endif()
# Modules
diff --git a/benchmark/gen_kmodel.py b/benchmark/gen_kmodel.py
index 3f5765b89e..6068ea5563 100644
--- a/benchmark/gen_kmodel.py
+++ b/benchmark/gen_kmodel.py
@@ -31,12 +31,12 @@
MODELS = {
"mnist": {
- "url": "https://media.githubusercontent.com/media/onnx/models/master/vision/classification/mnist/model/mnist-8.onnx",
+ "url": "https://github.com/onnx/models/raw/main/vision/classification/mnist/model/mnist-8.onnx",
"in_shapes": {"Input3": [1, 1, 28, 28]}
},
"mobilenet_v2": {
- "url": "https://github.com/onnx/models/raw/master/vision/classification/mobilenet/model/mobilenetv2-7.onnx",
- "in_shapes": {"input": [1, 3, 224, 224]}
+ "url": "https://github.com/onnx/models/raw/main/vision/classification/mobilenet/model/mobilenetv2-7.onnx",
+ "in_shapes": {"data": [1, 3, 224, 224]}
}
}
@@ -47,7 +47,7 @@ def _download(url, name, in_shapes):
req = requests.get(url)
onnx_model, check = onnxsim.simplify(
onnx.load_model(BytesIO(req.content)), check_n=3, input_shapes=in_shapes)
- assert check, "Simplified ONNX model could not be validated"
+ # assert check, "Simplified ONNX model could not be validated"
onnx.save(onnx_model, filename)
with open(filename, "rb") as file:
@@ -65,10 +65,10 @@ def _make_module(name, target):
compile_options.input_layout = "NCHW"
compile_options.output_layout = "NCHW"
compile_options.dump_dir = os.path.join(TEMP_DIR, name)
- compile_options.dump_ir = True
- compile_options.dump_asm = True
- compile_options.dump_quant_error = True
- compile_options.dump_import_op_range = True
+ compile_options.dump_ir = False
+ compile_options.dump_asm = False
+ compile_options.dump_quant_error = False
+ compile_options.dump_import_op_range = False
compile_options.use_mse_quant_w = True
compile_options.split_w_to_act = False
compile_options.benchmark_only = True
diff --git a/benchmark/models/cpu/mnist.kmodel b/benchmark/models/cpu/mnist.kmodel
index bc3ec30a86..2e7a5e1db9 100644
Binary files a/benchmark/models/cpu/mnist.kmodel and b/benchmark/models/cpu/mnist.kmodel differ
diff --git a/benchmark/models/cpu/mobilenet_v2.kmodel b/benchmark/models/cpu/mobilenet_v2.kmodel
index d070a1c43a..8aec579391 100644
Binary files a/benchmark/models/cpu/mobilenet_v2.kmodel and b/benchmark/models/cpu/mobilenet_v2.kmodel differ
diff --git a/cmake/conan.cmake b/cmake/conan.cmake
index 208ce24855..66b381dbfd 100644
--- a/cmake/conan.cmake
+++ b/cmake/conan.cmake
@@ -33,7 +33,7 @@
# but it is only necessary on the end-user side. It is not necessary to create conan
# packages, in fact it shouldn't be use for that. Check the project documentation.
-# version: 0.18.0-dev
+# version: 0.19.0-dev
include(CMakeParseArguments)
@@ -95,7 +95,7 @@ macro(_conan_check_system_name)
endif()
if(${CMAKE_SYSTEM_NAME} STREQUAL "QNX")
set(CONAN_SYSTEM_NAME Neutrino)
- endif()
+ endif()
set(CONAN_SUPPORTED_PLATFORMS Windows Linux Macos Android iOS FreeBSD WindowsStore WindowsCE watchOS tvOS FreeBSD SunOS AIX Arduino Emscripten Neutrino)
list (FIND CONAN_SUPPORTED_PLATFORMS "${CONAN_SYSTEM_NAME}" _index)
if (${_index} GREATER -1)
@@ -132,18 +132,28 @@ macro(_conan_detect_compiler)
set(_CONAN_SETTING_COMPILER_CPPSTD ${CMAKE_CXX_STANDARD})
endif()
- if (${CMAKE_${LANGUAGE}_COMPILER_ID} STREQUAL GNU)
- # using GCC
+ if (${CMAKE_${LANGUAGE}_COMPILER_ID} STREQUAL GNU OR ${CMAKE_${LANGUAGE}_COMPILER_ID} STREQUAL QCC)
+ # using GCC or QCC
# TODO: Handle other params
string(REPLACE "." ";" VERSION_LIST ${CMAKE_${LANGUAGE}_COMPILER_VERSION})
list(GET VERSION_LIST 0 MAJOR)
list(GET VERSION_LIST 1 MINOR)
- set(COMPILER_VERSION ${MAJOR}.${MINOR})
- if(${MAJOR} GREATER 4)
- set(COMPILER_VERSION ${MAJOR})
- endif()
- set(_CONAN_SETTING_COMPILER gcc)
+
+ if (${CMAKE_${LANGUAGE}_COMPILER_ID} STREQUAL GNU)
+ set(_CONAN_SETTING_COMPILER gcc)
+ # mimic Conan client autodetection
+ if (${MAJOR} GREATER_EQUAL 5)
+ set(COMPILER_VERSION ${MAJOR})
+ else()
+ set(COMPILER_VERSION ${MAJOR}.${MINOR})
+ endif()
+ elseif (${CMAKE_${LANGUAGE}_COMPILER_ID} STREQUAL QCC)
+ set(_CONAN_SETTING_COMPILER qcc)
+ set(COMPILER_VERSION ${MAJOR}.${MINOR})
+ endif ()
+
set(_CONAN_SETTING_COMPILER_VERSION ${COMPILER_VERSION})
+
if (USING_CXX)
conan_cmake_detect_unix_libcxx(_LIBCXX)
set(_CONAN_SETTING_COMPILER_LIBCXX ${_LIBCXX})
@@ -152,7 +162,7 @@ macro(_conan_detect_compiler)
string(REPLACE "." ";" VERSION_LIST ${CMAKE_${LANGUAGE}_COMPILER_VERSION})
list(GET VERSION_LIST 0 MAJOR)
list(GET VERSION_LIST 1 MINOR)
- set(COMPILER_VERSION ${MAJOR}.${MINOR})
+ set(COMPILER_VERSION ${MAJOR})
set(_CONAN_SETTING_COMPILER intel)
set(_CONAN_SETTING_COMPILER_VERSION ${COMPILER_VERSION})
if (USING_CXX)
@@ -164,18 +174,39 @@ macro(_conan_detect_compiler)
string(REPLACE "." ";" VERSION_LIST ${CMAKE_${LANGUAGE}_COMPILER_VERSION})
list(GET VERSION_LIST 0 MAJOR)
list(GET VERSION_LIST 1 MINOR)
+
+ # mimic Conan client autodetection
+ if (${MAJOR} GREATER_EQUAL 13)
+ set(COMPILER_VERSION ${MAJOR})
+ else()
+ set(COMPILER_VERSION ${MAJOR}.${MINOR})
+ endif()
+
+ set(_CONAN_SETTING_COMPILER_VERSION ${COMPILER_VERSION})
+
set(_CONAN_SETTING_COMPILER apple-clang)
- set(_CONAN_SETTING_COMPILER_VERSION ${MAJOR}.${MINOR})
if (USING_CXX)
conan_cmake_detect_unix_libcxx(_LIBCXX)
set(_CONAN_SETTING_COMPILER_LIBCXX ${_LIBCXX})
endif ()
- elseif (${CMAKE_${LANGUAGE}_COMPILER_ID} STREQUAL Clang)
+ elseif (${CMAKE_${LANGUAGE}_COMPILER_ID} STREQUAL Clang
+ AND NOT "${CMAKE_${LANGUAGE}_COMPILER_FRONTEND_VARIANT}" STREQUAL "MSVC"
+ AND NOT "${CMAKE_${LANGUAGE}_SIMULATE_ID}" STREQUAL "MSVC")
+
string(REPLACE "." ";" VERSION_LIST ${CMAKE_${LANGUAGE}_COMPILER_VERSION})
list(GET VERSION_LIST 0 MAJOR)
list(GET VERSION_LIST 1 MINOR)
set(_CONAN_SETTING_COMPILER clang)
- set(_CONAN_SETTING_COMPILER_VERSION ${MAJOR}.${MINOR})
+
+ # mimic Conan client autodetection
+ if (${MAJOR} GREATER_EQUAL 8)
+ set(COMPILER_VERSION ${MAJOR})
+ else()
+ set(COMPILER_VERSION ${MAJOR}.${MINOR})
+ endif()
+
+ set(_CONAN_SETTING_COMPILER_VERSION ${COMPILER_VERSION})
+
if(APPLE)
cmake_policy(GET CMP0025 APPLE_CLANG_POLICY)
if(NOT APPLE_CLANG_POLICY STREQUAL NEW)
@@ -183,14 +214,15 @@ macro(_conan_detect_compiler)
set(_CONAN_SETTING_COMPILER apple-clang)
endif()
endif()
- if(${_CONAN_SETTING_COMPILER} STREQUAL clang AND ${MAJOR} GREATER 7)
- set(_CONAN_SETTING_COMPILER_VERSION ${MAJOR})
- endif()
if (USING_CXX)
conan_cmake_detect_unix_libcxx(_LIBCXX)
set(_CONAN_SETTING_COMPILER_LIBCXX ${_LIBCXX})
endif ()
- elseif(${CMAKE_${LANGUAGE}_COMPILER_ID} STREQUAL MSVC)
+ elseif(${CMAKE_${LANGUAGE}_COMPILER_ID} STREQUAL MSVC
+ OR (${CMAKE_${LANGUAGE}_COMPILER_ID} STREQUAL Clang
+ AND "${CMAKE_${LANGUAGE}_COMPILER_FRONTEND_VARIANT}" STREQUAL "MSVC"
+ AND "${CMAKE_${LANGUAGE}_SIMULATE_ID}" STREQUAL "MSVC"))
+
set(_VISUAL "Visual Studio")
_get_msvc_ide_version(_VISUAL_VERSION)
if("${_VISUAL_VERSION}" STREQUAL "")
@@ -281,7 +313,7 @@ function(conan_cmake_settings result)
string(REGEX MATCH "[^=]*" MANUAL_SETTING "${ARG}")
message(STATUS "Conan: ${MANUAL_SETTING} was added as an argument. Not using the autodetected one.")
list(REMOVE_ITEM ARGUMENTS_PROFILE_AUTO "${MANUAL_SETTING}")
- endforeach()
+ endforeach()
# Automatic from CMake
foreach(ARG ${ARGUMENTS_PROFILE_AUTO})
@@ -398,7 +430,7 @@ function(conan_cmake_detect_vs_runtime result)
if(build_type)
string(TOUPPER "${build_type}" build_type)
- endif()
+ endif()
set(variables CMAKE_CXX_FLAGS_${build_type} CMAKE_C_FLAGS_${build_type} CMAKE_CXX_FLAGS CMAKE_C_FLAGS)
foreach(variable ${variables})
if(NOT "${${variable}}" STREQUAL "")
@@ -443,17 +475,18 @@ function(conan_cmake_autodetect detected_settings)
endfunction()
macro(conan_parse_arguments)
- set(options BASIC_SETUP CMAKE_TARGETS UPDATE KEEP_RPATHS NO_LOAD NO_OUTPUT_DIRS OUTPUT_QUIET NO_IMPORTS SKIP_STD)
- set(oneValueArgs CONANFILE ARCH BUILD_TYPE INSTALL_FOLDER CONAN_COMMAND)
- set(multiValueArgs DEBUG_PROFILE RELEASE_PROFILE RELWITHDEBINFO_PROFILE MINSIZEREL_PROFILE
- PROFILE REQUIRES OPTIONS IMPORTS SETTINGS BUILD ENV GENERATORS PROFILE_AUTO
- INSTALL_ARGS CONFIGURATION_TYPES PROFILE_BUILD BUILD_REQUIRES)
- cmake_parse_arguments(ARGUMENTS "${options}" "${oneValueArgs}" "${multiValueArgs}" ${ARGN})
+ set(options BASIC_SETUP CMAKE_TARGETS UPDATE KEEP_RPATHS NO_LOAD NO_OUTPUT_DIRS
+ OUTPUT_QUIET NO_IMPORTS SKIP_STD)
+ set(oneValueArgs CONANFILE ARCH BUILD_TYPE INSTALL_FOLDER OUTPUT_FOLDER CONAN_COMMAND)
+ set(multiValueArgs DEBUG_PROFILE RELEASE_PROFILE RELWITHDEBINFO_PROFILE MINSIZEREL_PROFILE
+ PROFILE REQUIRES OPTIONS IMPORTS SETTINGS BUILD ENV GENERATORS PROFILE_AUTO
+ INSTALL_ARGS CONFIGURATION_TYPES PROFILE_BUILD BUILD_REQUIRES)
+ cmake_parse_arguments(ARGUMENTS "${options}" "${oneValueArgs}" "${multiValueArgs}" ${ARGN})
endmacro()
function(old_conan_cmake_install)
# Calls "conan install"
- # Argument BUILD is equivalant to --build={missing, PkgName,...} or
+ # Argument BUILD is equivalent to --build={missing, PkgName,...} or
# --build when argument is 'BUILD all' (which builds all packages from source)
# Argument CONAN_COMMAND, to specify the conan path, e.g. in case of running from source
# cmake does not identify conan as command, even if it is +x and it is in the path
@@ -502,6 +535,10 @@ function(old_conan_cmake_install)
if(ARGUMENTS_INSTALL_FOLDER)
set(CONAN_INSTALL_FOLDER -if=${ARGUMENTS_INSTALL_FOLDER})
endif()
+ set(CONAN_OUTPUT_FOLDER "")
+ if(ARGUMENTS_OUTPUT_FOLDER)
+ set(CONAN_OUTPUT_FOLDER -of=${ARGUMENTS_OUTPUT_FOLDER})
+ endif()
foreach(ARG ${ARGUMENTS_GENERATORS})
set(CONAN_GENERATORS ${CONAN_GENERATORS} -g=${ARG})
endforeach()
@@ -539,9 +576,9 @@ function(conan_cmake_install)
endif()
set(installOptions UPDATE NO_IMPORTS OUTPUT_QUIET ERROR_QUIET)
- set(installOneValueArgs PATH_OR_REFERENCE REFERENCE REMOTE LOCKFILE LOCKFILE_OUT LOCKFILE_NODE_ID INSTALL_FOLDER)
+ set(installOneValueArgs PATH_OR_REFERENCE REFERENCE REMOTE LOCKFILE LOCKFILE_OUT LOCKFILE_NODE_ID INSTALL_FOLDER OUTPUT_FOLDER)
set(installMultiValueArgs GENERATOR BUILD ENV ENV_HOST ENV_BUILD OPTIONS_HOST OPTIONS OPTIONS_BUILD PROFILE
- PROFILE_HOST PROFILE_BUILD SETTINGS SETTINGS_HOST SETTINGS_BUILD)
+ PROFILE_HOST PROFILE_BUILD SETTINGS SETTINGS_HOST SETTINGS_BUILD CONF CONF_HOST CONF_BUILD)
cmake_parse_arguments(ARGS "${installOptions}" "${installOneValueArgs}" "${installMultiValueArgs}" ${ARGN})
foreach(arg ${installOptions})
if(ARGS_${arg})
@@ -560,6 +597,8 @@ function(conan_cmake_install)
set(flag "--lockfile-node-id")
elseif("${arg}" STREQUAL "INSTALL_FOLDER")
set(flag "--install-folder")
+ elseif("${arg}" STREQUAL "OUTPUT_FOLDER")
+ set(flag "--output-folder")
endif()
set(${arg} ${${arg}} ${flag} ${ARGS_${arg}})
endif()
@@ -594,6 +633,12 @@ function(conan_cmake_install)
set(flag "--settings:host")
elseif("${arg}" STREQUAL "SETTINGS_BUILD")
set(flag "--settings:build")
+ elseif("${arg}" STREQUAL "CONF")
+ set(flag "--conf")
+ elseif("${arg}" STREQUAL "CONF_HOST")
+ set(flag "--conf:host")
+ elseif("${arg}" STREQUAL "CONF_BUILD")
+ set(flag "--conf:build")
endif()
list(LENGTH ARGS_${arg} numargs)
foreach(item ${ARGS_${arg}})
@@ -611,13 +656,16 @@ function(conan_cmake_install)
if(DEFINED NO_IMPORTS)
set(NO_IMPORTS --no-imports)
endif()
- set(install_args install ${PATH_OR_REFERENCE} ${REFERENCE} ${UPDATE} ${NO_IMPORTS} ${REMOTE} ${LOCKFILE} ${LOCKFILE_OUT} ${LOCKFILE_NODE_ID} ${INSTALL_FOLDER}
- ${GENERATOR} ${BUILD} ${ENV} ${ENV_HOST} ${ENV_BUILD} ${OPTIONS} ${OPTIONS_HOST} ${OPTIONS_BUILD}
- ${PROFILE} ${PROFILE_HOST} ${PROFILE_BUILD} ${SETTINGS} ${SETTINGS_HOST} ${SETTINGS_BUILD})
+ set(install_args install ${PATH_OR_REFERENCE} ${REFERENCE} ${UPDATE} ${NO_IMPORTS} ${REMOTE}
+ ${LOCKFILE} ${LOCKFILE_OUT} ${LOCKFILE_NODE_ID} ${INSTALL_FOLDER}
+ ${OUTPUT_FOLDER} ${GENERATOR} ${BUILD} ${ENV} ${ENV_HOST} ${ENV_BUILD}
+ ${OPTIONS} ${OPTIONS_HOST} ${OPTIONS_BUILD} ${PROFILE} ${PROFILE_HOST}
+ ${PROFILE_BUILD} ${SETTINGS} ${SETTINGS_HOST} ${SETTINGS_BUILD}
+ ${CONF} ${CONF_HOST} ${CONF_BUILD})
string(REPLACE ";" " " _install_args "${install_args}")
message(STATUS "Conan executing: ${CONAN_CMD} ${_install_args}")
-
+
if(ARGS_OUTPUT_QUIET)
set(OUTPUT_OPT OUTPUT_QUIET)
endif()
@@ -641,6 +689,109 @@ function(conan_cmake_install)
endfunction()
+function(conan_cmake_lock_create)
+ if(DEFINED CONAN_COMMAND)
+ set(CONAN_CMD ${CONAN_COMMAND})
+ else()
+ conan_check(REQUIRED)
+ endif()
+
+ set(lockCreateOptions UPDATE BASE OUTPUT_QUIET ERROR_QUIET)
+ set(lockCreateOneValueArgs PATH REFERENCE REMOTE LOCKFILE LOCKFILE_OUT)
+ set(lockCreateMultiValueArgs BUILD ENV ENV_HOST ENV_BUILD OPTIONS_HOST OPTIONS OPTIONS_BUILD PROFILE
+ PROFILE_HOST PROFILE_BUILD SETTINGS SETTINGS_HOST SETTINGS_BUILD)
+ cmake_parse_arguments(ARGS "${lockCreateOptions}" "${lockCreateOneValueArgs}" "${lockCreateMultiValueArgs}" ${ARGN})
+ foreach(arg ${lockCreateOptions})
+ if(ARGS_${arg})
+ set(${arg} ${${arg}} ${ARGS_${arg}})
+ endif()
+ endforeach()
+ foreach(arg ${lockCreateOneValueArgs})
+ if(DEFINED ARGS_${arg})
+ if("${arg}" STREQUAL "REMOTE")
+ set(flag "--remote")
+ elseif("${arg}" STREQUAL "LOCKFILE")
+ set(flag "--lockfile")
+ elseif("${arg}" STREQUAL "LOCKFILE_OUT")
+ set(flag "--lockfile-out")
+ endif()
+ set(${arg} ${${arg}} ${flag} ${ARGS_${arg}})
+ endif()
+ endforeach()
+ foreach(arg ${lockCreateMultiValueArgs})
+ if(DEFINED ARGS_${arg})
+ if("${arg}" STREQUAL "BUILD")
+ set(flag "--build")
+ elseif("${arg}" STREQUAL "ENV")
+ set(flag "--env")
+ elseif("${arg}" STREQUAL "ENV_HOST")
+ set(flag "--env:host")
+ elseif("${arg}" STREQUAL "ENV_BUILD")
+ set(flag "--env:build")
+ elseif("${arg}" STREQUAL "OPTIONS")
+ set(flag "--options")
+ elseif("${arg}" STREQUAL "OPTIONS_HOST")
+ set(flag "--options:host")
+ elseif("${arg}" STREQUAL "OPTIONS_BUILD")
+ set(flag "--options:build")
+ elseif("${arg}" STREQUAL "PROFILE")
+ set(flag "--profile")
+ elseif("${arg}" STREQUAL "PROFILE_HOST")
+ set(flag "--profile:host")
+ elseif("${arg}" STREQUAL "PROFILE_BUILD")
+ set(flag "--profile:build")
+ elseif("${arg}" STREQUAL "SETTINGS")
+ set(flag "--settings")
+ elseif("${arg}" STREQUAL "SETTINGS_HOST")
+ set(flag "--settings:host")
+ elseif("${arg}" STREQUAL "SETTINGS_BUILD")
+ set(flag "--settings:build")
+ endif()
+ list(LENGTH ARGS_${arg} numargs)
+ foreach(item ${ARGS_${arg}})
+ if(${item} STREQUAL "all" AND ${arg} STREQUAL "BUILD")
+ set(${arg} "--build")
+ break()
+ endif()
+ set(${arg} ${${arg}} ${flag} ${item})
+ endforeach()
+ endif()
+ endforeach()
+ if(DEFINED UPDATE)
+ set(UPDATE --update)
+ endif()
+ if(DEFINED BASE)
+ set(BASE --base)
+ endif()
+ set(lock_create_Args lock create ${PATH} ${REFERENCE} ${UPDATE} ${BASE} ${REMOTE} ${LOCKFILE} ${LOCKFILE_OUT} ${LOCKFILE_NODE_ID} ${INSTALL_FOLDER}
+ ${GENERATOR} ${BUILD} ${ENV} ${ENV_HOST} ${ENV_BUILD} ${OPTIONS} ${OPTIONS_HOST} ${OPTIONS_BUILD}
+ ${PROFILE} ${PROFILE_HOST} ${PROFILE_BUILD} ${SETTINGS} ${SETTINGS_HOST} ${SETTINGS_BUILD})
+
+ string(REPLACE ";" " " _lock_create_Args "${lock_create_Args}")
+ message(STATUS "Conan executing: ${CONAN_CMD} ${_lock_create_Args}")
+
+ if(ARGS_OUTPUT_QUIET)
+ set(OUTPUT_OPT OUTPUT_QUIET)
+ endif()
+ if(ARGS_ERROR_QUIET)
+ set(ERROR_OPT ERROR_QUIET)
+ endif()
+
+ execute_process(COMMAND ${CONAN_CMD} ${lock_create_Args}
+ RESULT_VARIABLE return_code
+ ${OUTPUT_OPT}
+ ${ERROR_OPT}
+ WORKING_DIRECTORY ${CMAKE_CURRENT_BINARY_DIR})
+
+ if(NOT "${return_code}" STREQUAL "0")
+ if (ARGS_ERROR_QUIET)
+ message(WARNING "Conan lock create failed='${return_code}'")
+ else()
+ message(FATAL_ERROR "Conan lock create failed='${return_code}'")
+ endif()
+ endif()
+endfunction()
+
function(conan_cmake_setup_conanfile)
conan_parse_arguments(${ARGV})
if(ARGUMENTS_CONANFILE)
@@ -734,7 +885,7 @@ endmacro()
macro(conan_cmake_run)
conan_parse_arguments(${ARGV})
-
+
if(ARGUMENTS_CONFIGURATION_TYPES AND NOT CMAKE_CONFIGURATION_TYPES)
message(WARNING "CONFIGURATION_TYPES should only be specified for multi-configuration generators")
elseif(ARGUMENTS_CONFIGURATION_TYPES AND ARGUMENTS_BUILD_TYPE)
@@ -785,6 +936,30 @@ macro(conan_cmake_run)
endif()
endmacro()
+function(conan_version result)
+ set(${result} "" PARENT_SCOPE)
+
+ if(NOT CONAN_CMD)
+ find_program(CONAN_CMD conan)
+ if(NOT CONAN_CMD AND CONAN_REQUIRED)
+ message(FATAL_ERROR "Conan executable not found! Please install conan.")
+ endif()
+ endif()
+
+ execute_process(COMMAND ${CONAN_CMD} --version
+ RESULT_VARIABLE return_code
+ OUTPUT_VARIABLE CONAN_VERSION_OUTPUT
+ ERROR_VARIABLE CONAN_VERSION_OUTPUT)
+
+ if(NOT "${return_code}" STREQUAL "0")
+ message(FATAL_ERROR "Conan --version failed='${return_code}'")
+ endif()
+
+ string(REGEX MATCH ".*Conan version ([0-9]+\\.[0-9]+\\.[0-9]+)" FOO "${CONAN_VERSION_OUTPUT}")
+
+ set(${result} ${CMAKE_MATCH_1} PARENT_SCOPE)
+endfunction()
+
macro(conan_check)
# Checks conan availability in PATH
# Arguments REQUIRED, DETECT_QUIET and VERSION are optional
@@ -804,25 +979,16 @@ macro(conan_check)
if(NOT CONAN_DETECT_QUIET)
message(STATUS "Conan: Found program ${CONAN_CMD}")
endif()
- execute_process(COMMAND ${CONAN_CMD} --version
- RESULT_VARIABLE return_code
- OUTPUT_VARIABLE CONAN_VERSION_OUTPUT
- ERROR_VARIABLE CONAN_VERSION_OUTPUT)
- if(NOT "${return_code}" STREQUAL "0")
- message(FATAL_ERROR "Conan --version failed='${return_code}'")
- endif()
-
+ conan_version(CONAN_DETECTED_VERSION)
+
if(NOT CONAN_DETECT_QUIET)
- string(STRIP "${CONAN_VERSION_OUTPUT}" _CONAN_VERSION_OUTPUT)
- message(STATUS "Conan: Version found ${_CONAN_VERSION_OUTPUT}")
+ message(STATUS "Conan: Version found ${CONAN_DETECTED_VERSION}")
endif()
if(DEFINED CONAN_VERSION)
- string(REGEX MATCH ".*Conan version ([0-9]+\\.[0-9]+\\.[0-9]+)" FOO
- "${CONAN_VERSION_OUTPUT}")
- if(${CMAKE_MATCH_1} VERSION_LESS ${CONAN_VERSION})
- message(FATAL_ERROR "Conan outdated. Installed: ${CMAKE_MATCH_1}, \
+ if(${CONAN_DETECTED_VERSION} VERSION_LESS ${CONAN_VERSION})
+ message(FATAL_ERROR "Conan outdated. Installed: ${CONAN_DETECTED_VERSION}, \
required: ${CONAN_VERSION}. Consider updating via 'pip \
install conan==${CONAN_VERSION}'.")
endif()
@@ -869,9 +1035,10 @@ macro(conan_config_install)
set(multiValueArgs ARGS)
cmake_parse_arguments(CONAN "" "${oneValueArgs}" "${multiValueArgs}" ${ARGN})
- find_program(CONAN_CMD conan)
- if(NOT CONAN_CMD AND CONAN_REQUIRED)
- message(FATAL_ERROR "Conan executable not found!")
+ if(DEFINED CONAN_COMMAND)
+ set(CONAN_CMD ${CONAN_COMMAND})
+ else()
+ conan_check(REQUIRED)
endif()
if(DEFINED CONAN_VERIFY_SSL)
@@ -883,7 +1050,9 @@ macro(conan_config_install)
endif()
if(DEFINED CONAN_ARGS)
- set(CONAN_ARGS_ARGS "--args=\"${CONAN_ARGS}\"")
+ # Convert ; seperated multi arg list into space seperated string
+ string(REPLACE ";" " " l_CONAN_ARGS "${CONAN_ARGS}")
+ set(CONAN_ARGS_ARGS "--args=${l_CONAN_ARGS}")
endif()
if(DEFINED CONAN_SOURCE)
@@ -907,3 +1076,67 @@ macro(conan_config_install)
message(FATAL_ERROR "Conan config failed='${return_code}'")
endif()
endmacro()
+
+
+function(conan_cmake_profile)
+ set(profileOneValueArgs FILEPATH)
+ set(profileMultiValueArgs SETTINGS OPTIONS CONF ENV BUILDENV RUNENV TOOL_REQUIRES)
+ cmake_parse_arguments(ARGS "" "${profileOneValueArgs}" "${profileMultiValueArgs}" ${ARGN})
+
+ if(DEFINED ARGS_FILEPATH)
+ set(_FN "${ARGS_FILEPATH}")
+ else()
+ set(_FN "${CMAKE_CURRENT_BINARY_DIR}/profile")
+ endif()
+ message(STATUS "Conan: Creating profile ${_FN}")
+ file(WRITE ${_FN} "")
+
+ if(DEFINED ARGS_SETTINGS)
+ file(APPEND ${_FN} "[settings]\n")
+ foreach(SETTING ${ARGS_SETTINGS})
+ file(APPEND ${_FN} ${SETTING} "\n")
+ endforeach()
+ endif()
+
+ if(DEFINED ARGS_OPTIONS)
+ file(APPEND ${_FN} "[options]\n")
+ foreach(OPTION ${ARGS_OPTIONS})
+ file(APPEND ${_FN} ${OPTION} "\n")
+ endforeach()
+ endif()
+
+ if(DEFINED ARGS_CONF)
+ file(APPEND ${_FN} "[conf]\n")
+ foreach(CONF ${ARGS_CONF})
+ file(APPEND ${_FN} ${CONF} "\n")
+ endforeach()
+ endif()
+
+ if(DEFINED ARGS_ENV)
+ file(APPEND ${_FN} "[env]\n")
+ foreach(ENV ${ARGS_ENV})
+ file(APPEND ${_FN} ${ENV} "\n")
+ endforeach()
+ endif()
+
+ if(DEFINED ARGS_BUILDENV)
+ file(APPEND ${_FN} "[buildenv]\n")
+ foreach(BUILDENV ${ARGS_BUILDENV})
+ file(APPEND ${_FN} ${BUILDENV} "\n")
+ endforeach()
+ endif()
+
+ if(DEFINED ARGS_RUNENV)
+ file(APPEND ${_FN} "[runenv]\n")
+ foreach(RUNENV ${ARGS_RUNENV})
+ file(APPEND ${_FN} ${RUNENV} "\n")
+ endforeach()
+ endif()
+
+ if(DEFINED ARGS_TOOL_REQUIRES)
+ file(APPEND ${_FN} "[tool_requires]\n")
+ foreach(TOOL_REQUIRE ${ARGS_TOOL_REQUIRES})
+ file(APPEND ${_FN} ${TOOL_REQUIRE} "\n")
+ endforeach()
+ endif()
+endfunction()
diff --git a/cmake/dependencies.cmake b/cmake/dependencies.cmake
index fe6152980b..226089c2f5 100644
--- a/cmake/dependencies.cmake
+++ b/cmake/dependencies.cmake
@@ -9,7 +9,7 @@ if ((NOT BUILDING_RUNTIME) OR ENABLE_VULKAN_RUNTIME)
endif ()
if (NOT BUILDING_RUNTIME)
- find_package(Flatbuffers REQUIRED)
+ find_package(flatbuffers REQUIRED)
find_package(libzip REQUIRED)
if(NOT CONAN_EXPORTED)
set(FLATBUFFERS_FLATC_EXECUTABLE ${flatbuffers_LIB_DIRS}/../bin/flatc)
diff --git a/conanfile.py b/conanfile.py
index b11adc3851..1a84490650 100644
--- a/conanfile.py
+++ b/conanfile.py
@@ -60,7 +60,8 @@ def requirements(self):
self.requires('protobuf/3.17.1')
self.requires('xtensor/0.21.5')
self.requires('spdlog/1.8.2')
- self.requires('libzippp/4.0')
+ self.requires('zlib/1.2.12')
+ self.requires('libzippp/5.0-1.8.0')
self.requires('inja/3.2.0')
self.requires('shaderc/2021.1')
if self.options.tests:
@@ -82,20 +83,21 @@ def configure(self):
if not self.options.runtime:
self.options["opencv"].contrib = False
+ self.options["opencv"].with_ade = False
self.options["opencv"].with_webp = False
self.options["opencv"].with_openexr = False
self.options["opencv"].with_eigen = False
self.options["opencv"].with_quirc = False
+ self.options["opencv"].with_ffmpeg = False
+ self.options["opencv"].with_tiff = False
+ self.options["opencv"].with_jpeg = 'libjpeg-turbo'
self.options["opencv"].dnn = False
- self.options["flatbuffers"].options_from_context = False
self.options["xtensor"].xsimd = False
self.options["libzip"].with_bzip2 = False
self.options["libzip"].with_zstd = False
self.options["libzip"].crypto = False
if self.settings.os == 'Linux':
self.options["opencv"].with_gtk = False
- self.options["spirv-tools"].link_libcpp = False
- self.options["shaderc"].link_libcpp = False
if (not self.options.runtime) or self.options.vulkan_runtime:
if self.settings.os == 'Linux':
diff --git a/docs/USAGE_EN.md b/docs/USAGE_EN.md
index b161c26fa7..b8af24687a 100644
--- a/docs/USAGE_EN.md
+++ b/docs/USAGE_EN.md
@@ -2,32 +2,67 @@
# Overview
-nncase provides both python wheel package and ncc client to compile your neural models.
+nncase provides python wheel package to compile your neural models. The current documentation only works for nncase-v1. The available version are shown below.
-- nncase wheel package can be downloaded at [nncase release](https://github.com/kendryte/nncase/releases), target wheel package except for both cpu and K210 can be got from nncase sdk for your target.
-- For ncc client, you should git clone nncase repository and then build it by yourself.
+```
+1.0.0.20211029, 1.1.0.20211203, 1.3.0.20220127, 1.4.0.20220303, 1.5.0.20220331, 1.6.0.20220505, 1.7.0.20220530, 1.7.1.20220701, 1.8.0.20220929, 1.9.0.20230322
+```
+
+- nncase wheel package can be downloaded at [nncase release](https://github.com/kendryte/nncase/releases).
# nncase python APIs
-nncase provides Python APIs to compile neural network model and inference on your PC.
+nncase provides Python APIs to compile neural network model and inference on x86_64 and amd64 platforms.
## Installation
+The nncase toolchain compiler consists of nncase and plug-in wheel packages.
+
+- Both nncase and plug-in wheel packages are released at [nncase github](https://github.com/kendryte/nncase/releases)
+- Nncase wheel package supports Python 3.6/3.7/3.8/3.9/3.10, You can download it according to your operating system and Python version.
+- The plug-in wheel package does not depend on Python version, you can install it directly.
+
You can make use of [nncase docker image](https://github.com/kendryte/nncase/blob/master/docs/build.md)(Ubuntu 20.04 + Python 3.8) if you do not have Ubuntu development.
```shell
+$ cd /path/to/nncase_sdk
$ docker pull registry.cn-hangzhou.aliyuncs.com/kendryte/nncase:latest
$ docker run -it --rm -v `pwd`:/mnt -w /mnt registry.cn-hangzhou.aliyuncs.com/kendryte/nncase:latest /bin/bash -c "/bin/bash"
```
-Take Ubuntu 20.04 + Python 3.8 for example
+### cpu/K210
+
+- Download nncase wheel package and then install it.
+
+```
+root@2b11cc15c7f8:/mnt# wget -P x86_64 https://github.com/kendryte/nncase/releases/download/v1.8.0/nncase-1.8.0.20220929-cp38-cp38-manylinux_2_24_x86_64.whl
+
+root@2b11cc15c7f8:/mnt# pip3 install x86_64/*.whl
+```
+
+### K510
+
+- Download both nncase and nncase_k510 wheel packages and then install them.
```shell
-root@f74598de4a02:/mnt# pip3 install nncase_github/nncase-1.0.0.20211029-cp38-cp38-manylinux_2_24_x86_64.whl
+root@2b11cc15c7f8:/mnt# wget -P x86_64 https://github.com/kendryte/nncase/releases/download/v1.8.0/nncase-1.8.0.20220929-cp38-cp38-manylinux_2_24_x86_64.whl
+root@2b11cc15c7f8:/mnt# wget -P x86_64 https://github.com/kendryte/nncase/releases/download/v1.8.0/nncase_k510-1.8.0.20220930-py2.py3-none-manylinux_2_24_x86_64.whl
+
+root@2b11cc15c7f8:/mnt# pip3 install x86_64/*.whl
```
-> You should get and install target wheel package from your nncase sdk if you do not take cpu/K210 as your target
+### Check nncase version
+
+```python
+root@469e6a4a9e71:/mnt# python3
+Python 3.8.10 (default, Jun 2 2021, 10:49:15)
+[GCC 9.4.0] on linux
+Type "help", "copyright", "credits" or "license" for more information.
+>>> import _nncase
+>>> print(_nncase.__version__)
+1.8.0-55be52f
+```
## nncase compile model APIs
@@ -76,13 +111,13 @@ The details of all attributes are following.
| quant_type | string | N | Specify the quantization type for input data , such as 'uint8', 'int8', 'int16' |
| w_quant_type | string | N | Specify the quantization type for weight , such as 'uint8'(by default), 'int8', 'int16' |
| use_mse_quant_w | bool | N | Specify whether use mean-square error when quantizing weight |
-| split_w_to_act | bool | N | Specify whether split weight into activation |
+| split_w_to_act | bool | N | Specify whether split weight into activation |
| preprocess | bool | N | Whether enable preprocess, False by default |
| swapRB | bool | N | Whether swap red and blue channel for RGB data(from RGB to BGR or from BGR to RGB), False by default |
| mean | list | N | Normalize mean value for preprocess, [0, 0, 0] by default |
| std | list | N | Normalize std value for preprocess, [1, 1, 1] by default |
| input_range | list | N | The float range for dequantized input data, [0,1] by default |
-| output_range | list | N | The float range for quantized output data, [ ] by default |
+| output_range | list | N | The float range for quantized output data, [ ] by default |
| input_shape | list | N | Specify the shape of input data. input_shape should be consistent with input _layout. There will be letterbox operations(Such as resize/pad) if input_shape is not the same as input shape of model. |
| letterbox_value | float | N | Specify the pad value of letterbox during preprocess. |
| input_type | string | N | Specify the data type of input data, 'float32' by default. |
@@ -727,10 +762,50 @@ if __name__ == '__main__':
## Deploy nncase runtime
-### K210
+### Inference on K210 development board
+
+1. Download [SDK](https://github.com/kendryte/kendryte-standalone-sdk)
+
+ ```shell
+ $ git clone https://github.com/kendryte/kendryte-standalone-sdk.git
+ $ cd kendryte-standalone-sdk
+ $ export KENDRYTE_WORKSPACE=`pwd`
+ ```
+2. Download the cross-compile toolchain and extract it
+
+ ```shell
+ $ wget https://github.com/kendryte/kendryte-gnu-toolchain/releases/download/v8.2.0-20190409/kendryte-toolchain-ubuntu-amd64-8.2.0-20190409.tar.xz -O $KENDRYTE_WORKSPACE/kendryte-toolchain.tar.xz
+ $ cd $KENDRYTE_WORKSPACE
+ $ mkdir toolchain
+ $ tar -xf kendryte-toolchain.tar.xz -C ./toolchain
+ ```
+3. Update nncase runtime
+
+ Download `k210-runtime.zip` from [Release](https://github.com/kendryte/nncase/releases) and extract it into [kendryte-standalone-sdk](https://github.com/kendryte/kendryte-standalone-sdk) 's `lib/nncase/v1`.
+4. Compile App
+
+ ```shell
+ # 1.copy your programe into `$KENDRYTE_WORKSPACE/src`
+ # e.g. copy ($NNCASE_WORK_DIR/examples/facedetect_landmark/k210/facedetect_landmark_example) into PATH_TO_SDK/src.
+ $ cp -r $NNCASE_WORK_DIR/examples/facedetect_landmark/k210/facedetect_landmark_example $KENDRYTE_WORKSPACE/src/
+
+ # 2. compile
+ $ cd $KENDRYTE_WORKSPACE
+ $ mkdir build
+ $ cmake .. -DPROJ=facedetect_landmark_example -DTOOLCHAIN=$KENDRYTE_WORKSPACE/toolchain/kendryte-toolchain/bin && make
+ ```
+
+ `facedetect_landmark_example` and `FaceDETECt_landmark_example.bin` will be generated.
+5. Write the program to the K210 development board
-1. Download `k210-runtime.zip` from [Release](https://github.com/kendryte/nncase/releases) page.
-2. Unzip to your [kendryte-standalone-sdk](https://github.com/kendryte/kendryte-standalone-sdk) 's `lib/nncase/v1` directory.
+ ```shell
+ # 1. Check available USB ports
+ $ ls /dev/ttyUSB*
+ # /dev/ttyUSB0 /dev/ttyUSB1
+
+ # 2. Write your App by kflash
+ $ kflash -p /dev/ttyUSB0 -t facedetect_landmark_example.bin
+ ```
## nncase inference APIs
@@ -1161,143 +1236,3 @@ N/A
```python
sim.run()
```
-
-# ncc
-
-## Comannd line
-
-```shell
-DESCRIPTION
-NNCASE model compiler and inference tool.
-
-SYNOPSIS
- ncc compile -i -t
- [--input-prototxt ]