diff --git a/.ci/pnnx.yml b/.ci/pnnx.yml
index 5c44354aaaa1..d49da39a0afc 100644
--- a/.ci/pnnx.yml
+++ b/.ci/pnnx.yml
@@ -4,12 +4,14 @@ on:
branches: [master]
paths:
- '.ci/pnnx.yml'
+ - 'src/layer/*'
- 'tools/pnnx/**'
- '!tools/pnnx/README.md'
mr:
target-branches: [master]
paths:
- '.ci/pnnx.yml'
+ - 'src/layer/*'
- 'tools/pnnx/**'
- '!tools/pnnx/README.md'
concurrency:
@@ -17,10 +19,10 @@ concurrency:
variables:
protobuf_version: 21.12
- libtorch_version: 2.3.0
- libtorchvision_version: 0.18.0
- onnxruntime_version: 1.17.3
- cache_date: 20240504
+ libtorch_version: 2.4.0
+ libtorchvision_version: 0.19.0
+ onnxruntime_version: 1.18.1
+ cache_date: 20240804
jobs:
ubuntu:
@@ -57,6 +59,9 @@ jobs:
- torch-version: 2.3.0
torchvision-version: 0.18.0
+ - torch-version: 2.4.0
+ torchvision-version: 0.19.0
+
runs-on:
pool-name: docker
container:
@@ -160,7 +165,7 @@ jobs:
- name: setup-pytorch
run: |
export PYTHONUSERBASE=${{ci.workspace}}/torch-${{matrix.torch-version}}
- pip3 install --user torch==${{matrix.torch-version}}+cpu torchvision==${{matrix.torchvision-version}}+cpu -f https://download.pytorch.org/whl/torch_stable.html
+ pip3 install --user torch==${{matrix.torch-version}}+cpu torchvision==${{matrix.torchvision-version}}+cpu --index-url https://download.pytorch.org/whl/cpu
pip3 install --user onnx
pip3 install --user onnxscript
diff --git a/.github/workflows/release-python.yml b/.github/workflows/release-python.yml
index d8304c0e33c0..6b6db4f0d2e9 100644
--- a/.github/workflows/release-python.yml
+++ b/.github/workflows/release-python.yml
@@ -87,7 +87,7 @@ jobs:
# build wheels for ubuntu-20.04
- name: Build wheels for ubuntu
if: matrix.os == 'ubuntu-20.04'
- uses: pypa/cibuildwheel@v2.17.0
+ uses: pypa/cibuildwheel@v2.20.0
env:
CIBW_ARCHS_LINUX: ${{ matrix.arch }}
CIBW_BUILD: ${{ matrix.build }}
@@ -99,7 +99,7 @@ jobs:
# build wheels for windows-2019
- name: Build wheels for windows
if: matrix.os == 'windows-2019' && (matrix.arch == 'AMD64' || matrix.arch == 'x86')
- uses: pypa/cibuildwheel@v2.17.0
+ uses: pypa/cibuildwheel@v2.20.0
env:
CIBW_ARCHS_WINDOWS: ${{ matrix.arch }}
CIBW_BUILD: ${{ matrix.build }}
@@ -112,7 +112,7 @@ jobs:
- name: Build wheels for windows ARM64
if: matrix.os == 'windows-2019' && matrix.arch == 'ARM64'
- uses: pypa/cibuildwheel@v2.17.0
+ uses: pypa/cibuildwheel@v2.20.0
env:
CIBW_ARCHS_WINDOWS: ${{ matrix.arch }}
CIBW_BUILD: ${{ matrix.build }}
@@ -184,41 +184,43 @@ jobs:
- name: vulkansdk for macos
if: matrix.os == 'macos-13'
run: |
- wget https://sdk.lunarg.com/sdk/download/1.3.236.0/mac/vulkansdk-macos-1.3.236.0.dmg?Human=true -O vulkansdk-macos-1.3.236.0.dmg
- hdiutil attach vulkansdk-macos-1.3.236.0.dmg
- sudo /Volumes/vulkansdk-macos-1.3.236.0/InstallVulkan.app/Contents/MacOS/InstallVulkan --root $GITHUB_WORKSPACE/vulkansdk-macos-1.3.236.0 --accept-licenses --default-answer --confirm-command install
+ wget https://sdk.lunarg.com/sdk/download/1.3.290.0/mac/vulkansdk-macos-1.3.290.0.dmg?Human=true -O vulkansdk-macos-1.3.290.0.dmg
+ hdiutil attach vulkansdk-macos-1.3.290.0.dmg
+ sudo /Volumes/vulkansdk-macos-1.3.290.0/InstallVulkan.app/Contents/MacOS/InstallVulkan --root $GITHUB_WORKSPACE/vulkansdk-macos-1.3.290.0 --accept-licenses --default-answer --confirm-command install
- name: Build wheels for macos x86_64
if: matrix.os == 'macos-13' && matrix.arch == 'x86_64'
- uses: pypa/cibuildwheel@v2.17.0
+ uses: pypa/cibuildwheel@v2.20.0
env:
CIBW_ARCHS_MACOS: ${{ matrix.arch }}
CIBW_BUILD: ${{ matrix.build }}
CIBW_BUILD_VERBOSITY: 1
CIBW_ENVIRONMENT: CMAKE_BUILD_PARALLEL_LEVEL=3
CMAKE_TOOLCHAIN_FILE=$GITHUB_WORKSPACE/toolchains/ios.toolchain.cmake PLATFORM=MAC ARCHS="x86_64"
- DEPLOYMENT_TARGET="10.9" ENABLE_BITCODE=OFF ENABLE_ARC=OFF ENABLE_VISIBILITY=OFF
+ DEPLOYMENT_TARGET=$MAC_DEPLOYMENT_TARGET ENABLE_BITCODE=OFF ENABLE_ARC=OFF ENABLE_VISIBILITY=OFF
OpenMP_C_FLAGS="-Xclang -fopenmp" OpenMP_CXX_FLAGS="-Xclang -fopenmp"
OpenMP_C_LIB_NAMES="libomp" OpenMP_CXX_LIB_NAMES="libomp"
OpenMP_libomp_LIBRARY="libomp.a"
- Vulkan_LIBRARY=$GITHUB_WORKSPACE/vulkansdk-macos-1.3.236.0/MoltenVK/dylib/macOS/libMoltenVK.dylib
+ Vulkan_LIBRARY=$GITHUB_WORKSPACE/vulkansdk-macos-1.3.290.0/macOS/lib/libMoltenVK.dylib
+ MACOSX_DEPLOYMENT_TARGET=$MAC_DEPLOYMENT_TARGET
with:
output-dir: wheelhouse
- name: Build wheels for macos arm64
if: matrix.os == 'macos-13' && matrix.arch == 'arm64'
- uses: pypa/cibuildwheel@v2.17.0
+ uses: pypa/cibuildwheel@v2.20.0
env:
CIBW_ARCHS_MACOS: ${{ matrix.arch }}
CIBW_BUILD: ${{ matrix.build }}
CIBW_BUILD_VERBOSITY: 1
CIBW_ENVIRONMENT: CMAKE_BUILD_PARALLEL_LEVEL=3
CMAKE_TOOLCHAIN_FILE=$GITHUB_WORKSPACE/toolchains/ios.toolchain.cmake PLATFORM=MAC_ARM64 ARCHS="arm64"
- DEPLOYMENT_TARGET="11.0" ENABLE_BITCODE=OFF ENABLE_ARC=OFF ENABLE_VISIBILITY=OFF
+ DEPLOYMENT_TARGET=$MAC_DEPLOYMENT_TARGET ENABLE_BITCODE=OFF ENABLE_ARC=OFF ENABLE_VISIBILITY=OFF
OpenMP_C_FLAGS="-Xclang -fopenmp" OpenMP_CXX_FLAGS="-Xclang -fopenmp"
OpenMP_C_LIB_NAMES="libomp" OpenMP_CXX_LIB_NAMES="libomp"
OpenMP_libomp_LIBRARY="libomp.a"
- Vulkan_LIBRARY=$GITHUB_WORKSPACE/vulkansdk-macos-1.3.236.0/MoltenVK/dylib/macOS/libMoltenVK.dylib
+ Vulkan_LIBRARY=$GITHUB_WORKSPACE/vulkansdk-macos-1.3.290.0/macOS/lib/libMoltenVK.dylib
+ MACOSX_DEPLOYMENT_TARGET=$MAC_DEPLOYMENT_TARGET
with:
output-dir: wheelhouse
@@ -244,7 +246,7 @@ jobs:
fail-fast: false
matrix:
arch: [aarch64, ppc64le, s390x]
- build_cp: [cp36, cp37, cp38, cp39, cp310, cp311, cp312]
+ build_cp: [cp36, cp37, cp38, cp39, cp310, cp311, cp312, cp313]
build_sub: [manylinux, musllinux]
steps:
@@ -262,7 +264,7 @@ jobs:
platforms: all
- name: Build wheels for manylinux with qemu
- uses: pypa/cibuildwheel@v2.17.0
+ uses: pypa/cibuildwheel@v2.20.0
env:
CIBW_ARCHS_LINUX: ${{ matrix.arch }}
CIBW_BUILD: ${{ matrix.build_cp }}-${{ matrix.build_sub }}*
@@ -310,7 +312,7 @@ jobs:
platforms: all
- name: Build wheels for manylinux with qemu
- uses: pypa/cibuildwheel@v2.17.0
+ uses: pypa/cibuildwheel@v2.20.0
env:
CIBW_ARCHS_LINUX: ${{ matrix.arch }}
CIBW_BUILD: ${{ matrix.build_pp }}-*
diff --git a/.github/workflows/release.yml b/.github/workflows/release.yml
index 6309214e08f6..2e875fc51e73 100644
--- a/.github/workflows/release.yml
+++ b/.github/workflows/release.yml
@@ -53,11 +53,20 @@ jobs:
name: ${{ env.PACKAGENAME }}
path: /tmp/${{ env.PACKAGENAME }}.zip
- ubuntu-2004:
+ ubuntu:
needs: [setup]
- runs-on: ubuntu-20.04
+ strategy:
+ matrix:
+ opt:
+ - { shared-lib: OFF, os: ubuntu-20.04, id: ubuntu-2004 }
+ - { shared-lib: OFF, os: ubuntu-22.04, id: ubuntu-2204 }
+ - { shared-lib: OFF, os: ubuntu-24.04, id: ubuntu-2404 }
+ - { shared-lib: ON, os: ubuntu-20.04, id: ubuntu-2004-shared }
+ - { shared-lib: ON, os: ubuntu-22.04, id: ubuntu-2204-shared }
+ - { shared-lib: ON, os: ubuntu-24.04, id: ubuntu-2404-shared }
+ runs-on: ${{ matrix.opt.os }}
env:
- PACKAGENAME: ncnn-${{ needs.setup.outputs.VERSION }}-ubuntu-2004
+ PACKAGENAME: ncnn-${{ needs.setup.outputs.VERSION }}-${{ matrix.opt.id }}
steps:
- uses: actions/checkout@v4
with:
@@ -69,71 +78,7 @@ jobs:
run: |
mkdir build && cd build
cmake -DCMAKE_BUILD_TYPE=Release -DCMAKE_INSTALL_PREFIX=install -DNCNN_VERSION_STRING="${{ needs.setup.outputs.VERSION }}" \
- -DNCNN_VULKAN=ON -DNCNN_BUILD_EXAMPLES=OFF -DNCNN_BUILD_TOOLS=ON -DNCNN_BUILD_BENCHMARK=OFF ..
- cmake --build . -j 2
- cmake --build . --target install/strip
- - name: package
- run: |
- rm -rf ${{ env.PACKAGENAME }}
- mkdir -p ${{ env.PACKAGENAME }}
- cp -a build/install/* ${{ env.PACKAGENAME }}
- rm -f ${{ env.PACKAGENAME }}.zip
- zip -9 -y -r ${{ env.PACKAGENAME }}.zip ${{ env.PACKAGENAME }}
- - name: upload-zip
- uses: actions/upload-artifact@v4
- with:
- name: ${{ env.PACKAGENAME }}
- path: ${{ env.PACKAGENAME }}.zip
-
- ubuntu-2004-shared:
- needs: [setup]
- runs-on: ubuntu-20.04
- env:
- PACKAGENAME: ncnn-${{ needs.setup.outputs.VERSION }}-ubuntu-2004-shared
- steps:
- - uses: actions/checkout@v4
- with:
- submodules: true
- - name: apt
- run: |
- sudo apt-get install -y libprotobuf-dev protobuf-compiler
- - name: build
- run: |
- mkdir build && cd build
- cmake -DCMAKE_BUILD_TYPE=Release -DCMAKE_INSTALL_PREFIX=install -DNCNN_VERSION_STRING="${{ needs.setup.outputs.VERSION }}" \
- -DNCNN_VULKAN=ON -DNCNN_BUILD_EXAMPLES=OFF -DNCNN_BUILD_TOOLS=ON -DNCNN_BUILD_BENCHMARK=OFF -DNCNN_SHARED_LIB=ON ..
- cmake --build . -j $(nproc)
- cmake --build . --target install/strip
- - name: package
- run: |
- rm -rf ${{ env.PACKAGENAME }}
- mkdir -p ${{ env.PACKAGENAME }}
- cp -a -P build/install/* ${{ env.PACKAGENAME }}
- rm -f ${{ env.PACKAGENAME }}.zip
- zip -9 -y -r ${{ env.PACKAGENAME }}.zip ${{ env.PACKAGENAME }}
- - name: upload-zip
- uses: actions/upload-artifact@v4
- with:
- name: ${{ env.PACKAGENAME }}
- path: ${{ env.PACKAGENAME }}.zip
-
- ubuntu-2204:
- needs: [setup]
- runs-on: ubuntu-22.04
- env:
- PACKAGENAME: ncnn-${{ needs.setup.outputs.VERSION }}-ubuntu-2204
- steps:
- - uses: actions/checkout@v4
- with:
- submodules: true
- - name: apt
- run: |
- sudo apt-get install -y libprotobuf-dev protobuf-compiler
- - name: build
- run: |
- mkdir build && cd build
- cmake -DCMAKE_BUILD_TYPE=Release -DCMAKE_INSTALL_PREFIX=install -DNCNN_VERSION_STRING="${{ needs.setup.outputs.VERSION }}" \
- -DNCNN_VULKAN=ON -DNCNN_BUILD_EXAMPLES=OFF -DNCNN_BUILD_TOOLS=ON -DNCNN_BUILD_BENCHMARK=OFF ..
+ -DNCNN_VULKAN=ON -DNCNN_BUILD_EXAMPLES=OFF -DNCNN_BUILD_TOOLS=ON -DNCNN_BUILD_BENCHMARK=OFF -DNCNN_SHARED_LIB=${{ matrix.opt.shared-lib }} ..
cmake --build . -j $(nproc)
cmake --build . --target install/strip
- name: package
@@ -149,38 +94,6 @@ jobs:
name: ${{ env.PACKAGENAME }}
path: ${{ env.PACKAGENAME }}.zip
- ubuntu-2204-shared:
- needs: [setup]
- runs-on: ubuntu-22.04
- env:
- PACKAGENAME: ncnn-${{ needs.setup.outputs.VERSION }}-ubuntu-2204-shared
- steps:
- - uses: actions/checkout@v4
- with:
- submodules: true
- - name: apt
- run: |
- sudo apt-get install -y libprotobuf-dev protobuf-compiler
- - name: build
- run: |
- mkdir build && cd build
- cmake -DCMAKE_BUILD_TYPE=Release -DCMAKE_INSTALL_PREFIX=install -DNCNN_VERSION_STRING="${{ needs.setup.outputs.VERSION }}" \
- -DNCNN_VULKAN=ON -DNCNN_BUILD_EXAMPLES=OFF -DNCNN_BUILD_TOOLS=ON -DNCNN_BUILD_BENCHMARK=OFF -DNCNN_SHARED_LIB=ON ..
- cmake --build . -j $(nproc)
- cmake --build . --target install/strip
- - name: package
- run: |
- rm -rf ${{ env.PACKAGENAME }}
- mkdir -p ${{ env.PACKAGENAME }}
- cp -a -P build/install/* ${{ env.PACKAGENAME }}
- rm -f ${{ env.PACKAGENAME }}.zip
- zip -9 -y -r ${{ env.PACKAGENAME }}.zip ${{ env.PACKAGENAME }}
- - name: upload-zip
- uses: actions/upload-artifact@v4
- with:
- name: ${{ env.PACKAGENAME }}
- path: ${{ env.PACKAGENAME }}.zip
-
openmp-macos:
runs-on: macos-13
env:
@@ -255,85 +168,14 @@ jobs:
macos:
needs: [setup, openmp-macos]
+ strategy:
+ matrix:
+ opt:
+ - { vulkan: OFF, id: macos }
+ - { vulkan: ON, id: macos-vulkan }
runs-on: macos-13
env:
- PACKAGENAME: ncnn-${{ needs.setup.outputs.VERSION }}-macos
- NCNN_CMAKE_OPTIONS: |
- -DCMAKE_TOOLCHAIN_FILE=../toolchains/ios.toolchain.cmake \
- -DDEPLOYMENT_TARGET=$MAC_DEPLOYMENT_TARGET \
- -DENABLE_BITCODE=$ENABLE_BITCODE \
- -DENABLE_ARC=$ENABLE_ARC \
- -DENABLE_VISIBILITY=$ENABLE_VISIBILITY \
- -DCMAKE_INSTALL_PREFIX=install \
- -DCMAKE_BUILD_TYPE=Release \
- -DOpenMP_C_FLAGS="-Xclang -fopenmp" -DOpenMP_CXX_FLAGS="-Xclang -fopenmp" \
- -DOpenMP_C_LIB_NAMES="libomp" -DOpenMP_CXX_LIB_NAMES="libomp" \
- -DOpenMP_libomp_LIBRARY="libomp.a" \
- -DNCNN_VERSION_STRING="${{ needs.setup.outputs.VERSION }}" \
- -DNCNN_BUILD_TOOLS=OFF \
- -DNCNN_BUILD_EXAMPLES=OFF \
- -DNCNN_BUILD_BENCHMARK=OFF \
-
- steps:
- - uses: actions/checkout@v4
- - name: download-openmp-macos
- uses: actions/download-artifact@v4
- with:
- name: openmp-macos
- path: openmp-macos
- - name: install-openmp
- run: |
- sudo cp openmp-macos/include/* $DEVELOPER_DIR/Platforms/MacOSX.platform/Developer/SDKs/MacOSX.sdk/usr/include
- sudo cp openmp-macos/lib/libomp.a $DEVELOPER_DIR/Platforms/MacOSX.platform/Developer/SDKs/MacOSX.sdk/usr/lib
- - name: build-x86_64
- run: |
- mkdir build-x86_64 && cd build-x86_64
- cmake ${{ env.NCNN_CMAKE_OPTIONS }} -DPLATFORM=MAC -DARCHS="x86_64" ..
- cmake --build . -j 4
- cmake --build . --target install/strip
- - name: build-arm64
- run: |
- mkdir build-arm64 && cd build-arm64
- cmake ${{ env.NCNN_CMAKE_OPTIONS }} -DPLATFORM=MAC_ARM64 -DARCHS="arm64" ..
- cmake --build . -j 4
- cmake --build . --target install/strip
- - name: package-openmp
- run: |
- rm -rf openmp.framework
- mkdir -p openmp.framework/Versions/A/Headers
- mkdir -p openmp.framework/Versions/A/Resources
- ln -s A openmp.framework/Versions/Current
- ln -s Versions/Current/Headers openmp.framework/Headers
- ln -s Versions/Current/Resources openmp.framework/Resources
- ln -s Versions/Current/openmp openmp.framework/openmp
- cp openmp-macos/lib/libomp.a openmp.framework/Versions/A/openmp
- cp -a openmp-macos/include/* openmp.framework/Versions/A/Headers/
- sed -e 's/__NAME__/openmp/g' -e 's/__IDENTIFIER__/org.llvm.openmp/g' -e 's/__VERSION__/18.1/g' Info.plist > openmp.framework/Versions/A/Resources/Info.plist
- - name: package
- run: |
- rm -rf ncnn.framework
- mkdir -p ncnn.framework/Versions/A/Headers
- mkdir -p ncnn.framework/Versions/A/Resources
- ln -s A ncnn.framework/Versions/Current
- ln -s Versions/Current/Headers ncnn.framework/Headers
- ln -s Versions/Current/Resources ncnn.framework/Resources
- ln -s Versions/Current/ncnn ncnn.framework/ncnn
- lipo -create build-x86_64/install/lib/libncnn.a build-arm64/install/lib/libncnn.a -o ncnn.framework/Versions/A/ncnn
- cp -a build-x86_64/install/include/* ncnn.framework/Versions/A/Headers/
- sed -e 's/__NAME__/ncnn/g' -e 's/__IDENTIFIER__/com.tencent.ncnn/g' -e 's/__VERSION__/1.0/g' Info.plist > ncnn.framework/Versions/A/Resources/Info.plist
- rm -f ${{ env.PACKAGENAME }}.zip
- zip -9 -y -r ${{ env.PACKAGENAME }}.zip openmp.framework ncnn.framework
- - name: upload-zip
- uses: actions/upload-artifact@v4
- with:
- name: ${{ env.PACKAGENAME }}
- path: ${{ env.PACKAGENAME }}.zip
-
- macos-gpu:
- needs: [setup, openmp-macos]
- runs-on: macos-13
- env:
- PACKAGENAME: ncnn-${{ needs.setup.outputs.VERSION }}-macos-vulkan
+ PACKAGENAME: ncnn-${{ needs.setup.outputs.VERSION }}-${{ matrix.opt.id }}
NCNN_CMAKE_OPTIONS: |
-DCMAKE_TOOLCHAIN_FILE=../toolchains/ios.toolchain.cmake \
-DDEPLOYMENT_TARGET=$MAC_DEPLOYMENT_TARGET \
@@ -346,10 +188,10 @@ jobs:
-DOpenMP_C_LIB_NAMES="libomp" -DOpenMP_CXX_LIB_NAMES="libomp" \
-DOpenMP_libomp_LIBRARY="libomp.a" \
-DNCNN_VERSION_STRING="${{ needs.setup.outputs.VERSION }}" \
- -DNCNN_VULKAN=ON \
-DNCNN_BUILD_TOOLS=OFF \
-DNCNN_BUILD_EXAMPLES=OFF \
-DNCNN_BUILD_BENCHMARK=OFF \
+ -DNCNN_VULKAN=${{ matrix.opt.vulkan }} \
steps:
- uses: actions/checkout@v4
@@ -389,6 +231,7 @@ jobs:
cp -a openmp-macos/include/* openmp.framework/Versions/A/Headers/
sed -e 's/__NAME__/openmp/g' -e 's/__IDENTIFIER__/org.llvm.openmp/g' -e 's/__VERSION__/18.1/g' Info.plist > openmp.framework/Versions/A/Resources/Info.plist
- name: package-glslang
+ if: matrix.opt.vulkan == 'ON'
run: |
rm -rf glslang.framework
mkdir -p glslang.framework/Versions/A/Headers
@@ -397,12 +240,26 @@ jobs:
ln -s Versions/Current/Headers glslang.framework/Headers
ln -s Versions/Current/Resources glslang.framework/Resources
ln -s Versions/Current/glslang glslang.framework/glslang
- libtool -static build-x86_64/install/lib/libglslang.a build-x86_64/install/lib/libMachineIndependent.a build-x86_64/install/lib/libGenericCodeGen.a build-x86_64/install/lib/libSPIRV.a build-x86_64/install/lib/libOGLCompiler.a build-x86_64/install/lib/libOSDependent.a -o build-x86_64/install/lib/libglslang_combined.a
- libtool -static build-arm64/install/lib/libglslang.a build-arm64/install/lib/libMachineIndependent.a build-arm64/install/lib/libGenericCodeGen.a build-arm64/install/lib/libSPIRV.a build-arm64/install/lib/libOGLCompiler.a build-arm64/install/lib/libOSDependent.a -o build-arm64/install/lib/libglslang_combined.a
+ libtool -static \
+ build-x86_64/install/lib/libglslang.a \
+ build-x86_64/install/lib/libMachineIndependent.a \
+ build-x86_64/install/lib/libGenericCodeGen.a \
+ build-x86_64/install/lib/libSPIRV.a \
+ build-x86_64/install/lib/libOGLCompiler.a \
+ build-x86_64/install/lib/libOSDependent.a \
+ -o build-x86_64/install/lib/libglslang_combined.a
+ libtool -static \
+ build-arm64/install/lib/libglslang.a \
+ build-arm64/install/lib/libMachineIndependent.a \
+ build-arm64/install/lib/libGenericCodeGen.a \
+ build-arm64/install/lib/libSPIRV.a \
+ build-arm64/install/lib/libOGLCompiler.a \
+ build-arm64/install/lib/libOSDependent.a \
+ -o build-arm64/install/lib/libglslang_combined.a
lipo -create build-x86_64/install/lib/libglslang_combined.a build-arm64/install/lib/libglslang_combined.a -o glslang.framework/Versions/A/glslang
cp -a build-x86_64/install/include/glslang glslang.framework/Versions/A/Headers/
sed -e 's/__NAME__/glslang/g' -e 's/__IDENTIFIER__/org.khronos.glslang/g' -e 's/__VERSION__/1.0/g' Info.plist > glslang.framework/Versions/A/Resources/Info.plist
- - name: package
+ - name: package-ncnn
run: |
rm -rf ncnn.framework
mkdir -p ncnn.framework/Versions/A/Headers
@@ -412,8 +269,16 @@ jobs:
ln -s Versions/Current/Resources ncnn.framework/Resources
ln -s Versions/Current/ncnn ncnn.framework/ncnn
lipo -create build-x86_64/install/lib/libncnn.a build-arm64/install/lib/libncnn.a -o ncnn.framework/Versions/A/ncnn
- cp -a build-x86_64/install/include/ncnn ncnn.framework/Versions/A/Headers/
+ cp -a build-x86_64/install/include/* ncnn.framework/Versions/A/Headers/
sed -e 's/__NAME__/ncnn/g' -e 's/__IDENTIFIER__/com.tencent.ncnn/g' -e 's/__VERSION__/1.0/g' Info.plist > ncnn.framework/Versions/A/Resources/Info.plist
+ - name: package
+ if: matrix.opt.vulkan == 'OFF'
+ run: |
+ rm -f ${{ env.PACKAGENAME }}.zip
+ zip -9 -y -r ${{ env.PACKAGENAME }}.zip openmp.framework ncnn.framework
+ - name: package
+ if: matrix.opt.vulkan == 'ON'
+ run: |
rm -f ${{ env.PACKAGENAME }}.zip
zip -9 -y -r ${{ env.PACKAGENAME }}.zip openmp.framework glslang.framework ncnn.framework
- name: upload-zip
@@ -485,77 +350,14 @@ jobs:
ios:
needs: [setup, openmp-ios]
+ strategy:
+ matrix:
+ opt:
+ - { vulkan: OFF, id: ios }
+ - { vulkan: ON, id: ios-vulkan }
runs-on: macos-13
env:
- PACKAGENAME: ncnn-${{ needs.setup.outputs.VERSION }}-ios
- NCNN_CMAKE_OPTIONS: |
- -DCMAKE_TOOLCHAIN_FILE=../toolchains/ios.toolchain.cmake \
- -DDEPLOYMENT_TARGET=$IOS_DEPLOYMENT_TARGET \
- -DENABLE_BITCODE=$ENABLE_BITCODE \
- -DENABLE_ARC=$ENABLE_ARC \
- -DENABLE_VISIBILITY=$ENABLE_VISIBILITY \
- -DCMAKE_INSTALL_PREFIX=install \
- -DCMAKE_BUILD_TYPE=Release \
- -DOpenMP_C_FLAGS="-Xclang -fopenmp" -DOpenMP_CXX_FLAGS="-Xclang -fopenmp" \
- -DOpenMP_C_LIB_NAMES="libomp" -DOpenMP_CXX_LIB_NAMES="libomp" \
- -DOpenMP_libomp_LIBRARY="libomp.a" \
- -DNCNN_VERSION_STRING="${{ needs.setup.outputs.VERSION }}" \
- -DNCNN_BUILD_BENCHMARK=OFF \
-
- steps:
- - uses: actions/checkout@v4
- - name: download-openmp-ios
- uses: actions/download-artifact@v4
- with:
- name: openmp-ios
- path: openmp-ios
- - name: install-openmp
- run: |
- sudo cp openmp-ios/include/* $DEVELOPER_DIR/Platforms/iPhoneOS.platform/Developer/SDKs/iPhoneOS.sdk/usr/include
- sudo cp openmp-ios/lib/libomp.a $DEVELOPER_DIR/Platforms/iPhoneOS.platform/Developer/SDKs/iPhoneOS.sdk/usr/lib
- - name: build-arm64
- run: |
- mkdir build-arm64 && cd build-arm64
- cmake ${{ env.NCNN_CMAKE_OPTIONS }} -DPLATFORM=OS64 -DARCHS="arm64" ..
- cmake --build . -j 4
- cmake --build . --target install/strip
- - name: package-openmp
- run: |
- rm -rf openmp.framework
- mkdir -p openmp.framework/Versions/A/Headers
- mkdir -p openmp.framework/Versions/A/Resources
- ln -s A openmp.framework/Versions/Current
- ln -s Versions/Current/Headers openmp.framework/Headers
- ln -s Versions/Current/Resources openmp.framework/Resources
- ln -s Versions/Current/openmp openmp.framework/openmp
- cp openmp-ios/lib/libomp.a openmp.framework/Versions/A/openmp
- cp -a openmp-ios/include/* openmp.framework/Versions/A/Headers/
- sed -e 's/__NAME__/openmp/g' -e 's/__IDENTIFIER__/org.llvm.openmp/g' -e 's/__VERSION__/18.1/g' Info.plist > openmp.framework/Versions/A/Resources/Info.plist
- - name: package
- run: |
- rm -rf ncnn.framework
- mkdir -p ncnn.framework/Versions/A/Headers
- mkdir -p ncnn.framework/Versions/A/Resources
- ln -s A ncnn.framework/Versions/Current
- ln -s Versions/Current/Headers ncnn.framework/Headers
- ln -s Versions/Current/Resources ncnn.framework/Resources
- ln -s Versions/Current/ncnn ncnn.framework/ncnn
- cp build-arm64/install/lib/libncnn.a ncnn.framework/Versions/A/ncnn
- cp -a build-arm64/install/include/* ncnn.framework/Versions/A/Headers/
- sed -e 's/__NAME__/ncnn/g' -e 's/__IDENTIFIER__/com.tencent.ncnn/g' -e 's/__VERSION__/1.0/g' Info.plist > ncnn.framework/Versions/A/Resources/Info.plist
- rm -f ${{ env.PACKAGENAME }}.zip
- zip -9 -y -r ${{ env.PACKAGENAME }}.zip openmp.framework ncnn.framework
- - name: upload-zip
- uses: actions/upload-artifact@v4
- with:
- name: ${{ env.PACKAGENAME }}
- path: ${{ env.PACKAGENAME }}.zip
-
- ios-gpu:
- needs: [setup, openmp-ios]
- runs-on: macos-13
- env:
- PACKAGENAME: ncnn-${{ needs.setup.outputs.VERSION }}-ios-vulkan
+ PACKAGENAME: ncnn-${{ needs.setup.outputs.VERSION }}-${{ matrix.opt.id }}
NCNN_CMAKE_OPTIONS: |
-DCMAKE_TOOLCHAIN_FILE=../toolchains/ios.toolchain.cmake \
-DDEPLOYMENT_TARGET=$IOS_DEPLOYMENT_TARGET \
@@ -568,8 +370,8 @@ jobs:
-DOpenMP_C_LIB_NAMES="libomp" -DOpenMP_CXX_LIB_NAMES="libomp" \
-DOpenMP_libomp_LIBRARY="libomp.a" \
-DNCNN_VERSION_STRING="${{ needs.setup.outputs.VERSION }}" \
- -DNCNN_VULKAN=ON \
-DNCNN_BUILD_BENCHMARK=OFF \
+ -DNCNN_VULKAN=${{ matrix.opt.vulkan }} \
steps:
- uses: actions/checkout@v4
@@ -603,6 +405,7 @@ jobs:
cp -a openmp-ios/include/* openmp.framework/Versions/A/Headers/
sed -e 's/__NAME__/openmp/g' -e 's/__IDENTIFIER__/org.llvm.openmp/g' -e 's/__VERSION__/18.1/g' Info.plist > openmp.framework/Versions/A/Resources/Info.plist
- name: package-glslang
+ if: matrix.opt.vulkan == 'ON'
run: |
rm -rf glslang.framework
mkdir -p glslang.framework/Versions/A/Headers
@@ -622,7 +425,7 @@ jobs:
cp build-arm64/install/lib/libglslang_combined.a glslang.framework/Versions/A/glslang
cp -a build-arm64/install/include/glslang glslang.framework/Versions/A/Headers/
sed -e 's/__NAME__/glslang/g' -e 's/__IDENTIFIER__/org.khronos.glslang/g' -e 's/__VERSION__/1.0/g' Info.plist > glslang.framework/Versions/A/Resources/Info.plist
- - name: package
+ - name: package-ncnn
run: |
rm -rf ncnn.framework
mkdir -p ncnn.framework/Versions/A/Headers
@@ -632,8 +435,16 @@ jobs:
ln -s Versions/Current/Resources ncnn.framework/Resources
ln -s Versions/Current/ncnn ncnn.framework/ncnn
cp build-arm64/install/lib/libncnn.a ncnn.framework/Versions/A/ncnn
- cp -a build-arm64/install/include/ncnn ncnn.framework/Versions/A/Headers/
+ cp -a build-arm64/install/include/* ncnn.framework/Versions/A/Headers/
sed -e 's/__NAME__/ncnn/g' -e 's/__IDENTIFIER__/com.tencent.ncnn/g' -e 's/__VERSION__/1.0/g' Info.plist > ncnn.framework/Versions/A/Resources/Info.plist
+ - name: package
+ if: matrix.opt.vulkan == 'OFF'
+ run: |
+ rm -f ${{ env.PACKAGENAME }}.zip
+ zip -9 -y -r ${{ env.PACKAGENAME }}.zip openmp.framework ncnn.framework
+ - name: package
+ if: matrix.opt.vulkan == 'ON'
+ run: |
rm -f ${{ env.PACKAGENAME }}.zip
zip -9 -y -r ${{ env.PACKAGENAME }}.zip openmp.framework glslang.framework ncnn.framework
- name: upload-zip
@@ -716,9 +527,14 @@ jobs:
ios-simulator:
needs: [setup, openmp-ios-simulator]
+ strategy:
+ matrix:
+ opt:
+ - { vulkan: OFF, id: ios-simulator }
+ - { vulkan: ON, id: ios-simulator-vulkan }
runs-on: macos-13
env:
- PACKAGENAME: ncnn-${{ needs.setup.outputs.VERSION }}-ios-simulator
+ PACKAGENAME: ncnn-${{ needs.setup.outputs.VERSION }}-${{ matrix.opt.id }}
NCNN_CMAKE_OPTIONS: |
-DCMAKE_TOOLCHAIN_FILE=../toolchains/ios.toolchain.cmake \
-DDEPLOYMENT_TARGET=$IOS_DEPLOYMENT_TARGET \
@@ -732,89 +548,12 @@ jobs:
-DOpenMP_libomp_LIBRARY="libomp.a" \
-DNCNN_VERSION_STRING="${{ needs.setup.outputs.VERSION }}" \
-DNCNN_BUILD_BENCHMARK=OFF \
+ -DNCNN_VULKAN=${{ matrix.opt.vulkan }} \
steps:
- uses: actions/checkout@v4
- - name: download-openmp-ios-simulator
- uses: actions/download-artifact@v4
- with:
- name: openmp-ios-simulator
- path: openmp-ios-simulator
- - name: install-openmp
- run: |
- sudo cp openmp-ios-simulator/include/* $DEVELOPER_DIR/Platforms/iPhoneSimulator.platform/Developer/SDKs/iPhoneSimulator.sdk/usr/include
- sudo cp openmp-ios-simulator/lib/libomp.a $DEVELOPER_DIR/Platforms/iPhoneSimulator.platform/Developer/SDKs/iPhoneSimulator.sdk/usr/lib
- - name: build-x86_64
- run: |
- mkdir build-x86_64 && cd build-x86_64
- cmake ${{ env.NCNN_CMAKE_OPTIONS }} -DPLATFORM=SIMULATOR64 -DARCHS="x86_64" ..
- cmake --build . -j 4
- cmake --build . --target install/strip
- - name: build-arm64
- run: |
- mkdir build-arm64 && cd build-arm64
- cmake ${{ env.NCNN_CMAKE_OPTIONS }} -DPLATFORM=SIMULATORARM64 -DARCHS="arm64" ..
- cmake --build . -j 4
- cmake --build . --target install/strip
- - name: package-openmp
- run: |
- rm -rf openmp.framework
- mkdir -p openmp.framework/Versions/A/Headers
- mkdir -p openmp.framework/Versions/A/Resources
- ln -s A openmp.framework/Versions/Current
- ln -s Versions/Current/Headers openmp.framework/Headers
- ln -s Versions/Current/Resources openmp.framework/Resources
- ln -s Versions/Current/openmp openmp.framework/openmp
- cp openmp-ios-simulator/lib/libomp.a openmp.framework/Versions/A/openmp
- cp -a openmp-ios-simulator/include/* openmp.framework/Versions/A/Headers/
- sed -e 's/__NAME__/openmp/g' -e 's/__IDENTIFIER__/org.llvm.openmp/g' -e 's/__VERSION__/18.1/g' Info.plist > openmp.framework/Versions/A/Resources/Info.plist
- - name: package
- run: |
- rm -rf ncnn.framework
- mkdir -p ncnn.framework/Versions/A/Headers
- mkdir -p ncnn.framework/Versions/A/Resources
- ln -s A ncnn.framework/Versions/Current
- ln -s Versions/Current/Headers ncnn.framework/Headers
- ln -s Versions/Current/Resources ncnn.framework/Resources
- ln -s Versions/Current/ncnn ncnn.framework/ncnn
- lipo -create \
- build-x86_64/install/lib/libncnn.a \
- build-arm64/install/lib/libncnn.a \
- -o ncnn.framework/Versions/A/ncnn
- cp -a build-x86_64/install/include/* ncnn.framework/Versions/A/Headers/
- sed -e 's/__NAME__/ncnn/g' -e 's/__IDENTIFIER__/com.tencent.ncnn/g' -e 's/__VERSION__/1.0/g' Info.plist > ncnn.framework/Versions/A/Resources/Info.plist
- rm -f ${{ env.PACKAGENAME }}.zip
- zip -9 -y -r ${{ env.PACKAGENAME }}.zip openmp.framework ncnn.framework
- - name: upload-zip
- uses: actions/upload-artifact@v4
- with:
- name: ${{ env.PACKAGENAME }}
- path: ${{ env.PACKAGENAME }}.zip
-
- ios-simulator-gpu:
- needs: [setup, openmp-ios-simulator]
- runs-on: macos-13
- env:
- PACKAGENAME: ncnn-${{ needs.setup.outputs.VERSION }}-ios-simulator-vulkan
- NCNN_CMAKE_OPTIONS: |
- -DCMAKE_TOOLCHAIN_FILE=../toolchains/ios.toolchain.cmake \
- -DDEPLOYMENT_TARGET=$IOS_DEPLOYMENT_TARGET \
- -DENABLE_BITCODE=$ENABLE_BITCODE \
- -DENABLE_ARC=$ENABLE_ARC \
- -DENABLE_VISIBILITY=$ENABLE_VISIBILITY \
- -DCMAKE_INSTALL_PREFIX=install \
- -DCMAKE_BUILD_TYPE=Release \
- -DOpenMP_C_FLAGS="-Xclang -fopenmp" -DOpenMP_CXX_FLAGS="-Xclang -fopenmp" \
- -DOpenMP_C_LIB_NAMES="libomp" -DOpenMP_CXX_LIB_NAMES="libomp" \
- -DOpenMP_libomp_LIBRARY="libomp.a" \
- -DNCNN_VERSION_STRING="${{ needs.setup.outputs.VERSION }}" \
- -DNCNN_VULKAN=ON \
- -DNCNN_BUILD_BENCHMARK=OFF \
-
- steps:
- - uses: actions/checkout@v4
- with:
- submodules: true
+ with:
+ submodules: true
- name: download-openmp-ios-simulator
uses: actions/download-artifact@v4
with:
@@ -849,6 +588,7 @@ jobs:
cp -a openmp-ios-simulator/include/* openmp.framework/Versions/A/Headers/
sed -e 's/__NAME__/openmp/g' -e 's/__IDENTIFIER__/org.llvm.openmp/g' -e 's/__VERSION__/18.1/g' Info.plist > openmp.framework/Versions/A/Resources/Info.plist
- name: package-glslang
+ if: matrix.opt.vulkan == 'ON'
run: |
rm -rf glslang.framework
mkdir -p glslang.framework/Versions/A/Headers
@@ -879,7 +619,7 @@ jobs:
-o glslang.framework/Versions/A/glslang
cp -a build-x86_64/install/include/glslang glslang.framework/Versions/A/Headers/
sed -e 's/__NAME__/glslang/g' -e 's/__IDENTIFIER__/org.khronos.glslang/g' -e 's/__VERSION__/1.0/g' Info.plist > glslang.framework/Versions/A/Resources/Info.plist
- - name: package
+ - name: package-ncnn
run: |
rm -rf ncnn.framework
mkdir -p ncnn.framework/Versions/A/Headers
@@ -892,8 +632,16 @@ jobs:
build-x86_64/install/lib/libncnn.a \
build-arm64/install/lib/libncnn.a \
-o ncnn.framework/Versions/A/ncnn
- cp -a build-x86_64/install/include/ncnn ncnn.framework/Versions/A/Headers/
+ cp -a build-x86_64/install/include/* ncnn.framework/Versions/A/Headers/
sed -e 's/__NAME__/ncnn/g' -e 's/__IDENTIFIER__/com.tencent.ncnn/g' -e 's/__VERSION__/1.0/g' Info.plist > ncnn.framework/Versions/A/Resources/Info.plist
+ - name: package
+ if: matrix.opt.vulkan == 'OFF'
+ run: |
+ rm -f ${{ env.PACKAGENAME }}.zip
+ zip -9 -y -r ${{ env.PACKAGENAME }}.zip openmp.framework ncnn.framework
+ - name: package
+ if: matrix.opt.vulkan == 'ON'
+ run: |
rm -f ${{ env.PACKAGENAME }}.zip
zip -9 -y -r ${{ env.PACKAGENAME }}.zip openmp.framework glslang.framework ncnn.framework
- name: upload-zip
@@ -976,86 +724,14 @@ jobs:
mac-catalyst:
needs: [setup, openmp-mac-catalyst]
+ strategy:
+ matrix:
+ opt:
+ - { vulkan: OFF, id: mac-catalyst }
+ - { vulkan: ON, id: mac-catalyst-vulkan }
runs-on: macos-13
env:
- PACKAGENAME: ncnn-${{ needs.setup.outputs.VERSION }}-mac-catalyst
- NCNN_CMAKE_OPTIONS: |
- -DCMAKE_TOOLCHAIN_FILE=../toolchains/ios.toolchain.cmake \
- -DDEPLOYMENT_TARGET=$MAC_CATALYST_DEPLOYMENT_TARGET \
- -DENABLE_BITCODE=$ENABLE_BITCODE \
- -DENABLE_ARC=$ENABLE_ARC \
- -DENABLE_VISIBILITY=$ENABLE_VISIBILITY \
- -DCMAKE_INSTALL_PREFIX=install \
- -DCMAKE_BUILD_TYPE=Release \
- -DOpenMP_C_FLAGS="-Xclang -fopenmp" -DOpenMP_CXX_FLAGS="-Xclang -fopenmp" \
- -DOpenMP_C_LIB_NAMES="libomp" -DOpenMP_CXX_LIB_NAMES="libomp" \
- -DOpenMP_libomp_LIBRARY="libomp.a" \
- -DNCNN_VERSION_STRING="${{ needs.setup.outputs.VERSION }}" \
- -DNCNN_BUILD_BENCHMARK=OFF \
-
- steps:
- - uses: actions/checkout@v4
- - name: download-openmp-mac-catalyst
- uses: actions/download-artifact@v4
- with:
- name: openmp-mac-catalyst
- path: openmp-mac-catalyst
- - name: install-openmp
- run: |
- sudo cp openmp-mac-catalyst/include/* $DEVELOPER_DIR/Platforms/MacOSX.platform/Developer/SDKs/MacOSX.sdk/usr/include
- sudo cp openmp-mac-catalyst/lib/libomp.a $DEVELOPER_DIR/Platforms/MacOSX.platform/Developer/SDKs/MacOSX.sdk/usr/lib
- - name: build-x86_64
- run: |
- mkdir build-x86_64 && cd build-x86_64
- cmake ${{ env.NCNN_CMAKE_OPTIONS }} -DPLATFORM=MAC_CATALYST -DARCHS="x86_64" ..
- cmake --build . -j 4
- cmake --build . --target install/strip
- - name: build-arm64
- run: |
- mkdir build-arm64 && cd build-arm64
- cmake ${{ env.NCNN_CMAKE_OPTIONS }} -DPLATFORM=MAC_CATALYST -DARCHS="arm64" ..
- cmake --build . -j 4
- cmake --build . --target install/strip
- - name: package-openmp
- run: |
- rm -rf openmp.framework
- mkdir -p openmp.framework/Versions/A/Headers
- mkdir -p openmp.framework/Versions/A/Resources
- ln -s A openmp.framework/Versions/Current
- ln -s Versions/Current/Headers openmp.framework/Headers
- ln -s Versions/Current/Resources openmp.framework/Resources
- ln -s Versions/Current/openmp openmp.framework/openmp
- cp openmp-mac-catalyst/lib/libomp.a openmp.framework/Versions/A/openmp
- cp -a openmp-mac-catalyst/include/* openmp.framework/Versions/A/Headers/
- sed -e 's/__NAME__/openmp/g' -e 's/__IDENTIFIER__/org.llvm.openmp/g' -e 's/__VERSION__/18.1/g' Info.plist > openmp.framework/Versions/A/Resources/Info.plist
- - name: package
- run: |
- rm -rf ncnn.framework
- mkdir -p ncnn.framework/Versions/A/Headers
- mkdir -p ncnn.framework/Versions/A/Resources
- ln -s A ncnn.framework/Versions/Current
- ln -s Versions/Current/Headers ncnn.framework/Headers
- ln -s Versions/Current/Resources ncnn.framework/Resources
- ln -s Versions/Current/ncnn ncnn.framework/ncnn
- lipo -create \
- build-x86_64/install/lib/libncnn.a \
- build-arm64/install/lib/libncnn.a \
- -o ncnn.framework/Versions/A/ncnn
- cp -a build-x86_64/install/include/* ncnn.framework/Versions/A/Headers/
- sed -e 's/__NAME__/ncnn/g' -e 's/__IDENTIFIER__/com.tencent.ncnn/g' -e 's/__VERSION__/1.0/g' Info.plist > ncnn.framework/Versions/A/Resources/Info.plist
- rm -f ${{ env.PACKAGENAME }}.zip
- zip -9 -y -r ${{ env.PACKAGENAME }}.zip openmp.framework ncnn.framework
- - name: upload-zip
- uses: actions/upload-artifact@v4
- with:
- name: ${{ env.PACKAGENAME }}
- path: ${{ env.PACKAGENAME }}.zip
-
- mac-catalyst-gpu:
- needs: [setup, openmp-mac-catalyst]
- runs-on: macos-13
- env:
- PACKAGENAME: ncnn-${{ needs.setup.outputs.VERSION }}-mac-catalyst-vulkan
+ PACKAGENAME: ncnn-${{ needs.setup.outputs.VERSION }}-${{ matrix.opt.id }}
NCNN_CMAKE_OPTIONS: |
-DCMAKE_TOOLCHAIN_FILE=../toolchains/ios.toolchain.cmake \
-DDEPLOYMENT_TARGET=$MAC_CATALYST_DEPLOYMENT_TARGET \
@@ -1068,8 +744,8 @@ jobs:
-DOpenMP_C_LIB_NAMES="libomp" -DOpenMP_CXX_LIB_NAMES="libomp" \
-DOpenMP_libomp_LIBRARY="libomp.a" \
-DNCNN_VERSION_STRING="${{ needs.setup.outputs.VERSION }}" \
- -DNCNN_VULKAN=ON \
-DNCNN_BUILD_BENCHMARK=OFF \
+ -DNCNN_VULKAN=${{ matrix.opt.vulkan }} \
steps:
- uses: actions/checkout@v4
@@ -1109,6 +785,7 @@ jobs:
cp -a openmp-mac-catalyst/include/* openmp.framework/Versions/A/Headers/
sed -e 's/__NAME__/openmp/g' -e 's/__IDENTIFIER__/org.llvm.openmp/g' -e 's/__VERSION__/18.1/g' Info.plist > openmp.framework/Versions/A/Resources/Info.plist
- name: package-glslang
+ if: matrix.opt.vulkan == 'ON'
run: |
rm -rf glslang.framework
mkdir -p glslang.framework/Versions/A/Headers
@@ -1139,7 +816,7 @@ jobs:
-o glslang.framework/Versions/A/glslang
cp -a build-x86_64/install/include/glslang glslang.framework/Versions/A/Headers/
sed -e 's/__NAME__/glslang/g' -e 's/__IDENTIFIER__/org.khronos.glslang/g' -e 's/__VERSION__/1.0/g' Info.plist > glslang.framework/Versions/A/Resources/Info.plist
- - name: package
+ - name: package-ncnn
run: |
rm -rf ncnn.framework
mkdir -p ncnn.framework/Versions/A/Headers
@@ -1152,8 +829,16 @@ jobs:
build-x86_64/install/lib/libncnn.a \
build-arm64/install/lib/libncnn.a \
-o ncnn.framework/Versions/A/ncnn
- cp -a build-x86_64/install/include/ncnn ncnn.framework/Versions/A/Headers/
+ cp -a build-x86_64/install/include/* ncnn.framework/Versions/A/Headers/
sed -e 's/__NAME__/ncnn/g' -e 's/__IDENTIFIER__/com.tencent.ncnn/g' -e 's/__VERSION__/1.0/g' Info.plist > ncnn.framework/Versions/A/Resources/Info.plist
+ - name: package
+ if: matrix.opt.vulkan == 'OFF'
+ run: |
+ rm -f ${{ env.PACKAGENAME }}.zip
+ zip -9 -y -r ${{ env.PACKAGENAME }}.zip openmp.framework ncnn.framework
+ - name: package
+ if: matrix.opt.vulkan == 'ON'
+ run: |
rm -f ${{ env.PACKAGENAME }}.zip
zip -9 -y -r ${{ env.PACKAGENAME }}.zip openmp.framework glslang.framework ncnn.framework
- name: upload-zip
@@ -1534,86 +1219,14 @@ jobs:
tvos:
needs: [setup, openmp-tvos]
+ strategy:
+ matrix:
+ opt:
+ - { vulkan: OFF, id: tvos }
+ - { vulkan: ON, id: tvos-vulkan }
runs-on: macos-13
env:
- PACKAGENAME: ncnn-${{ needs.setup.outputs.VERSION }}-tvos
- NCNN_CMAKE_OPTIONS: |
- -DCMAKE_TOOLCHAIN_FILE=../toolchains/ios.toolchain.cmake \
- -DDEPLOYMENT_TARGET=$TVOS_DEPLOYMENT_TARGET \
- -DENABLE_BITCODE=$ENABLE_BITCODE \
- -DENABLE_ARC=$ENABLE_ARC \
- -DENABLE_VISIBILITY=$ENABLE_VISIBILITY \
- -DCMAKE_INSTALL_PREFIX=install \
- -DCMAKE_BUILD_TYPE=Release \
- -DOpenMP_C_FLAGS="-Xclang -fopenmp" -DOpenMP_CXX_FLAGS="-Xclang -fopenmp" \
- -DOpenMP_C_LIB_NAMES="libomp" -DOpenMP_CXX_LIB_NAMES="libomp" \
- -DOpenMP_libomp_LIBRARY="libomp.a" \
- -DNCNN_VERSION_STRING="${{ needs.setup.outputs.VERSION }}" \
- -DNCNN_BUILD_BENCHMARK=OFF \
-
- steps:
- - uses: actions/checkout@v4
- - name: download-openmp-tvos
- uses: actions/download-artifact@v4
- with:
- name: openmp-tvos
- path: openmp-tvos
- - name: install-openmp
- run: |
- sudo cp openmp-tvos/include/* $DEVELOPER_DIR/Platforms/AppleTVOS.platform/Developer/SDKs/AppleTVOS.sdk/usr/include
- sudo cp openmp-tvos/lib/libomp.a $DEVELOPER_DIR/Platforms/AppleTVOS.platform/Developer/SDKs/AppleTVOS.sdk/usr/lib
- - name: build-arm64
- run: |
- mkdir build-arm64 && cd build-arm64
- cmake ${{ env.NCNN_CMAKE_OPTIONS }} -DPLATFORM=TVOS -DARCHS="arm64" ..
- cmake --build . -j 4
- cmake --build . --target install/strip
- - name: build-arm64e
- run: |
- mkdir build-arm64e && cd build-arm64e
- cmake ${{ env.NCNN_CMAKE_OPTIONS }} -DPLATFORM=TVOS -DARCHS="arm64e" ..
- cmake --build . -j 4
- cmake --build . --target install/strip
- - name: package-openmp
- run: |
- rm -rf openmp.framework
- mkdir -p openmp.framework/Versions/A/Headers
- mkdir -p openmp.framework/Versions/A/Resources
- ln -s A openmp.framework/Versions/Current
- ln -s Versions/Current/Headers openmp.framework/Headers
- ln -s Versions/Current/Resources openmp.framework/Resources
- ln -s Versions/Current/openmp openmp.framework/openmp
- cp openmp-tvos/lib/libomp.a openmp.framework/Versions/A/openmp
- cp -a openmp-tvos/include/* openmp.framework/Versions/A/Headers/
- sed -e 's/__NAME__/openmp/g' -e 's/__IDENTIFIER__/org.llvm.openmp/g' -e 's/__VERSION__/18.1/g' Info.plist > openmp.framework/Versions/A/Resources/Info.plist
- - name: package
- run: |
- rm -rf ncnn.framework
- mkdir -p ncnn.framework/Versions/A/Headers
- mkdir -p ncnn.framework/Versions/A/Resources
- ln -s A ncnn.framework/Versions/Current
- ln -s Versions/Current/Headers ncnn.framework/Headers
- ln -s Versions/Current/Resources ncnn.framework/Resources
- ln -s Versions/Current/ncnn ncnn.framework/ncnn
- lipo -create \
- build-arm64/install/lib/libncnn.a \
- build-arm64e/install/lib/libncnn.a \
- -o ncnn.framework/Versions/A/ncnn
- cp -a build-arm64/install/include/* ncnn.framework/Versions/A/Headers/
- sed -e 's/__NAME__/ncnn/g' -e 's/__IDENTIFIER__/com.tencent.ncnn/g' -e 's/__VERSION__/1.0/g' Info.plist > ncnn.framework/Versions/A/Resources/Info.plist
- rm -f ${{ env.PACKAGENAME }}.zip
- zip -9 -y -r ${{ env.PACKAGENAME }}.zip openmp.framework ncnn.framework
- - name: upload-zip
- uses: actions/upload-artifact@v4
- with:
- name: ${{ env.PACKAGENAME }}
- path: ${{ env.PACKAGENAME }}.zip
-
- tvos-gpu:
- needs: [setup, openmp-tvos]
- runs-on: macos-13
- env:
- PACKAGENAME: ncnn-${{ needs.setup.outputs.VERSION }}-tvos-vulkan
+ PACKAGENAME: ncnn-${{ needs.setup.outputs.VERSION }}-${{ matrix.opt.id }}
NCNN_CMAKE_OPTIONS: |
-DCMAKE_TOOLCHAIN_FILE=../toolchains/ios.toolchain.cmake \
-DDEPLOYMENT_TARGET=$TVOS_DEPLOYMENT_TARGET \
@@ -1626,8 +1239,8 @@ jobs:
-DOpenMP_C_LIB_NAMES="libomp" -DOpenMP_CXX_LIB_NAMES="libomp" \
-DOpenMP_libomp_LIBRARY="libomp.a" \
-DNCNN_VERSION_STRING="${{ needs.setup.outputs.VERSION }}" \
- -DNCNN_VULKAN=ON \
-DNCNN_BUILD_BENCHMARK=OFF \
+ -DNCNN_VULKAN=${{ matrix.opt.vulkan }} \
steps:
- uses: actions/checkout@v4
@@ -1667,6 +1280,7 @@ jobs:
cp -a openmp-tvos/include/* openmp.framework/Versions/A/Headers/
sed -e 's/__NAME__/openmp/g' -e 's/__IDENTIFIER__/org.llvm.openmp/g' -e 's/__VERSION__/18.1/g' Info.plist > openmp.framework/Versions/A/Resources/Info.plist
- name: package-glslang
+ if: matrix.opt.vulkan == 'ON'
run: |
rm -rf glslang.framework
mkdir -p glslang.framework/Versions/A/Headers
@@ -1697,7 +1311,7 @@ jobs:
-o glslang.framework/Versions/A/glslang
cp -a build-arm64/install/include/glslang glslang.framework/Versions/A/Headers/
sed -e 's/__NAME__/glslang/g' -e 's/__IDENTIFIER__/org.khronos.glslang/g' -e 's/__VERSION__/1.0/g' Info.plist > glslang.framework/Versions/A/Resources/Info.plist
- - name: package
+ - name: package-ncnn
run: |
rm -rf ncnn.framework
mkdir -p ncnn.framework/Versions/A/Headers
@@ -1712,6 +1326,14 @@ jobs:
-o ncnn.framework/Versions/A/ncnn
cp -a build-arm64/install/include/* ncnn.framework/Versions/A/Headers/
sed -e 's/__NAME__/ncnn/g' -e 's/__IDENTIFIER__/com.tencent.ncnn/g' -e 's/__VERSION__/1.0/g' Info.plist > ncnn.framework/Versions/A/Resources/Info.plist
+ - name: package
+ if: matrix.opt.vulkan == 'OFF'
+ run: |
+ rm -f ${{ env.PACKAGENAME }}.zip
+ zip -9 -y -r ${{ env.PACKAGENAME }}.zip openmp.framework ncnn.framework
+ - name: package
+ if: matrix.opt.vulkan == 'ON'
+ run: |
rm -f ${{ env.PACKAGENAME }}.zip
zip -9 -y -r ${{ env.PACKAGENAME }}.zip openmp.framework glslang.framework ncnn.framework
- name: upload-zip
@@ -1794,9 +1416,14 @@ jobs:
tvos-simulator:
needs: [setup, openmp-tvos-simulator]
+ strategy:
+ matrix:
+ opt:
+ - { vulkan: OFF, id: tvos-simulator }
+ - { vulkan: ON, id: tvos-simulator-vulkan }
runs-on: macos-13
env:
- PACKAGENAME: ncnn-${{ needs.setup.outputs.VERSION }}-tvos-simulator
+ PACKAGENAME: ncnn-${{ needs.setup.outputs.VERSION }}-${{ matrix.opt.id }}
NCNN_CMAKE_OPTIONS: |
-DCMAKE_TOOLCHAIN_FILE=../toolchains/ios.toolchain.cmake \
-DDEPLOYMENT_TARGET=$TVOS_DEPLOYMENT_TARGET \
@@ -1810,9 +1437,12 @@ jobs:
-DOpenMP_libomp_LIBRARY="libomp.a" \
-DNCNN_VERSION_STRING="${{ needs.setup.outputs.VERSION }}" \
-DNCNN_BUILD_BENCHMARK=OFF \
+ -DNCNN_VULKAN=${{ matrix.opt.vulkan }} \
steps:
- uses: actions/checkout@v4
+ with:
+ submodules: true
- name: download-openmp-tvos-simulator
uses: actions/download-artifact@v4
with:
@@ -1846,87 +1476,8 @@ jobs:
cp openmp-tvos-simulator/lib/libomp.a openmp.framework/Versions/A/openmp
cp -a openmp-tvos-simulator/include/* openmp.framework/Versions/A/Headers/
sed -e 's/__NAME__/openmp/g' -e 's/__IDENTIFIER__/org.llvm.openmp/g' -e 's/__VERSION__/18.1/g' Info.plist > openmp.framework/Versions/A/Resources/Info.plist
- - name: package
- run: |
- rm -rf ncnn.framework
- mkdir -p ncnn.framework/Versions/A/Headers
- mkdir -p ncnn.framework/Versions/A/Resources
- ln -s A ncnn.framework/Versions/Current
- ln -s Versions/Current/Headers ncnn.framework/Headers
- ln -s Versions/Current/Resources ncnn.framework/Resources
- ln -s Versions/Current/ncnn ncnn.framework/ncnn
- lipo -create \
- build-x86_64/install/lib/libncnn.a \
- build-arm64/install/lib/libncnn.a \
- -o ncnn.framework/Versions/A/ncnn
- cp -a build-x86_64/install/include/* ncnn.framework/Versions/A/Headers/
- sed -e 's/__NAME__/ncnn/g' -e 's/__IDENTIFIER__/com.tencent.ncnn/g' -e 's/__VERSION__/1.0/g' Info.plist > ncnn.framework/Versions/A/Resources/Info.plist
- rm -f ${{ env.PACKAGENAME }}.zip
- zip -9 -y -r ${{ env.PACKAGENAME }}.zip openmp.framework ncnn.framework
- - name: upload-zip
- uses: actions/upload-artifact@v4
- with:
- name: ${{ env.PACKAGENAME }}
- path: ${{ env.PACKAGENAME }}.zip
-
- tvos-simulator-gpu:
- needs: [setup, openmp-tvos-simulator]
- runs-on: macos-13
- env:
- PACKAGENAME: ncnn-${{ needs.setup.outputs.VERSION }}-tvos-simulator-vulkan
- NCNN_CMAKE_OPTIONS: |
- -DCMAKE_TOOLCHAIN_FILE=../toolchains/ios.toolchain.cmake \
- -DDEPLOYMENT_TARGET=$TVOS_DEPLOYMENT_TARGET \
- -DENABLE_BITCODE=$ENABLE_BITCODE \
- -DENABLE_ARC=$ENABLE_ARC \
- -DENABLE_VISIBILITY=$ENABLE_VISIBILITY \
- -DCMAKE_INSTALL_PREFIX=install \
- -DCMAKE_BUILD_TYPE=Release \
- -DOpenMP_C_FLAGS="-Xclang -fopenmp" -DOpenMP_CXX_FLAGS="-Xclang -fopenmp" \
- -DOpenMP_C_LIB_NAMES="libomp" -DOpenMP_CXX_LIB_NAMES="libomp" \
- -DOpenMP_libomp_LIBRARY="libomp.a" \
- -DNCNN_VERSION_STRING="${{ needs.setup.outputs.VERSION }}" \
- -DNCNN_VULKAN=ON \
- -DNCNN_BUILD_BENCHMARK=OFF \
-
- steps:
- - uses: actions/checkout@v4
- with:
- submodules: true
- - name: download-openmp-tvos-simulator
- uses: actions/download-artifact@v4
- with:
- name: openmp-tvos-simulator
- path: openmp-tvos-simulator
- - name: install-openmp
- run: |
- sudo cp openmp-tvos-simulator/include/* $DEVELOPER_DIR/Platforms/AppleTVSimulator.platform/Developer/SDKs/AppleTVSimulator.sdk/usr/include
- sudo cp openmp-tvos-simulator/lib/libomp.a $DEVELOPER_DIR/Platforms/AppleTVSimulator.platform/Developer/SDKs/AppleTVSimulator.sdk/usr/lib
- - name: build-x86_64
- run: |
- mkdir build-x86_64 && cd build-x86_64
- cmake ${{ env.NCNN_CMAKE_OPTIONS }} -DPLATFORM=SIMULATOR_TVOS -DARCHS="x86_64" ..
- cmake --build . -j 4
- cmake --build . --target install/strip
- - name: build-arm64
- run: |
- mkdir build-arm64 && cd build-arm64
- cmake ${{ env.NCNN_CMAKE_OPTIONS }} -DPLATFORM=SIMULATOR_TVOS -DARCHS="arm64" ..
- cmake --build . -j 4
- cmake --build . --target install/strip
- - name: package-openmp
- run: |
- rm -rf openmp.framework
- mkdir -p openmp.framework/Versions/A/Headers
- mkdir -p openmp.framework/Versions/A/Resources
- ln -s A openmp.framework/Versions/Current
- ln -s Versions/Current/Headers openmp.framework/Headers
- ln -s Versions/Current/Resources openmp.framework/Resources
- ln -s Versions/Current/openmp openmp.framework/openmp
- cp openmp-tvos-simulator/lib/libomp.a openmp.framework/Versions/A/openmp
- cp -a openmp-tvos-simulator/include/* openmp.framework/Versions/A/Headers/
- sed -e 's/__NAME__/openmp/g' -e 's/__IDENTIFIER__/org.llvm.openmp/g' -e 's/__VERSION__/18.1/g' Info.plist > openmp.framework/Versions/A/Resources/Info.plist
- - name: package-glslang
+ - name: package-glslang
+ if: matrix.opt.vulkan == 'ON'
run: |
rm -rf glslang.framework
mkdir -p glslang.framework/Versions/A/Headers
@@ -1957,7 +1508,7 @@ jobs:
-o glslang.framework/Versions/A/glslang
cp -a build-x86_64/install/include/glslang glslang.framework/Versions/A/Headers/
sed -e 's/__NAME__/glslang/g' -e 's/__IDENTIFIER__/org.khronos.glslang/g' -e 's/__VERSION__/1.0/g' Info.plist > glslang.framework/Versions/A/Resources/Info.plist
- - name: package
+ - name: package-ncnn
run: |
rm -rf ncnn.framework
mkdir -p ncnn.framework/Versions/A/Headers
@@ -1972,6 +1523,14 @@ jobs:
-o ncnn.framework/Versions/A/ncnn
cp -a build-x86_64/install/include/* ncnn.framework/Versions/A/Headers/
sed -e 's/__NAME__/ncnn/g' -e 's/__IDENTIFIER__/com.tencent.ncnn/g' -e 's/__VERSION__/1.0/g' Info.plist > ncnn.framework/Versions/A/Resources/Info.plist
+ - name: package
+ if: matrix.opt.vulkan == 'OFF'
+ run: |
+ rm -f ${{ env.PACKAGENAME }}.zip
+ zip -9 -y -r ${{ env.PACKAGENAME }}.zip openmp.framework ncnn.framework
+ - name: package
+ if: matrix.opt.vulkan == 'ON'
+ run: |
rm -f ${{ env.PACKAGENAME }}.zip
zip -9 -y -r ${{ env.PACKAGENAME }}.zip openmp.framework glslang.framework ncnn.framework
- name: upload-zip
@@ -2043,9 +1602,14 @@ jobs:
visionos:
needs: [setup, openmp-visionos]
+ strategy:
+ matrix:
+ opt:
+ - { vulkan: OFF, id: visionos }
+ - { vulkan: ON, id: visionos-vulkan }
runs-on: macos-13
env:
- PACKAGENAME: ncnn-${{ needs.setup.outputs.VERSION }}-visionos
+ PACKAGENAME: ncnn-${{ needs.setup.outputs.VERSION }}-${{ matrix.opt.id }}
NCNN_CMAKE_OPTIONS: |
-DCMAKE_TOOLCHAIN_FILE=../toolchains/ios.toolchain.cmake \
-DDEPLOYMENT_TARGET=$VISIONOS_DEPLOYMENT_TARGET \
@@ -2059,9 +1623,12 @@ jobs:
-DOpenMP_libomp_LIBRARY="libomp.a" \
-DNCNN_VERSION_STRING="${{ needs.setup.outputs.VERSION }}" \
-DNCNN_BUILD_BENCHMARK=OFF \
+ -DNCNN_VULKAN=${{ matrix.opt.vulkan }} \
steps:
- uses: actions/checkout@v4
+ with:
+ submodules: true
- name: download-openmp-visionos
uses: actions/download-artifact@v4
with:
@@ -2089,7 +1656,28 @@ jobs:
cp openmp-visionos/lib/libomp.a openmp.framework/Versions/A/openmp
cp -a openmp-visionos/include/* openmp.framework/Versions/A/Headers/
sed -e 's/__NAME__/openmp/g' -e 's/__IDENTIFIER__/org.llvm.openmp/g' -e 's/__VERSION__/18.1/g' Info.plist > openmp.framework/Versions/A/Resources/Info.plist
- - name: package
+ - name: package-glslang
+ if: matrix.opt.vulkan == 'ON'
+ run: |
+ rm -rf glslang.framework
+ mkdir -p glslang.framework/Versions/A/Headers
+ mkdir -p glslang.framework/Versions/A/Resources
+ ln -s A glslang.framework/Versions/Current
+ ln -s Versions/Current/Headers glslang.framework/Headers
+ ln -s Versions/Current/Resources glslang.framework/Resources
+ ln -s Versions/Current/glslang glslang.framework/glslang
+ libtool -static \
+ build-arm64/install/lib/libglslang.a \
+ build-arm64/install/lib/libMachineIndependent.a \
+ build-arm64/install/lib/libGenericCodeGen.a \
+ build-arm64/install/lib/libSPIRV.a \
+ build-arm64/install/lib/libOGLCompiler.a \
+ build-arm64/install/lib/libOSDependent.a \
+ -o build-arm64/install/lib/libglslang_combined.a
+ cp build-arm64/install/lib/libglslang_combined.a glslang.framework/Versions/A/glslang
+ cp -a build-arm64/install/include/glslang glslang.framework/Versions/A/Headers/
+ sed -e 's/__NAME__/glslang/g' -e 's/__IDENTIFIER__/org.khronos.glslang/g' -e 's/__VERSION__/1.0/g' Info.plist > glslang.framework/Versions/A/Resources/Info.plist
+ - name: package-ncnn
run: |
rm -rf ncnn.framework
mkdir -p ncnn.framework/Versions/A/Headers
@@ -2101,8 +1689,16 @@ jobs:
cp build-arm64/install/lib/libncnn.a ncnn.framework/Versions/A/ncnn
cp -a build-arm64/install/include/* ncnn.framework/Versions/A/Headers/
sed -e 's/__NAME__/ncnn/g' -e 's/__IDENTIFIER__/com.tencent.ncnn/g' -e 's/__VERSION__/1.0/g' Info.plist > ncnn.framework/Versions/A/Resources/Info.plist
+ - name: package
+ if: matrix.opt.vulkan == 'OFF'
+ run: |
rm -f ${{ env.PACKAGENAME }}.zip
zip -9 -y -r ${{ env.PACKAGENAME }}.zip openmp.framework ncnn.framework
+ - name: package
+ if: matrix.opt.vulkan == 'ON'
+ run: |
+ rm -f ${{ env.PACKAGENAME }}.zip
+ zip -9 -y -r ${{ env.PACKAGENAME }}.zip openmp.framework glslang.framework ncnn.framework
- name: upload-zip
uses: actions/upload-artifact@v4
with:
@@ -2183,9 +1779,14 @@ jobs:
visionos-simulator:
needs: [setup, openmp-visionos-simulator]
+ strategy:
+ matrix:
+ opt:
+ - { vulkan: OFF, id: visionos-simulator }
+ - { vulkan: ON, id: visionos-simulator-vulkan }
runs-on: macos-13
env:
- PACKAGENAME: ncnn-${{ needs.setup.outputs.VERSION }}-visionos-simulator
+ PACKAGENAME: ncnn-${{ needs.setup.outputs.VERSION }}-${{ matrix.opt.id }}
NCNN_CMAKE_OPTIONS: |
-DCMAKE_TOOLCHAIN_FILE=../toolchains/ios.toolchain.cmake \
-DDEPLOYMENT_TARGET=$VISIONOS_DEPLOYMENT_TARGET \
@@ -2199,9 +1800,12 @@ jobs:
-DOpenMP_libomp_LIBRARY="libomp.a" \
-DNCNN_VERSION_STRING="${{ needs.setup.outputs.VERSION }}" \
-DNCNN_BUILD_BENCHMARK=OFF \
+ -DNCNN_VULKAN=${{ matrix.opt.vulkan }} \
steps:
- uses: actions/checkout@v4
+ with:
+ submodules: true
- name: download-openmp-visionos-simulator
uses: actions/download-artifact@v4
with:
@@ -2235,7 +1839,39 @@ jobs:
cp openmp-visionos-simulator/lib/libomp.a openmp.framework/Versions/A/openmp
cp -a openmp-visionos-simulator/include/* openmp.framework/Versions/A/Headers/
sed -e 's/__NAME__/openmp/g' -e 's/__IDENTIFIER__/org.llvm.openmp/g' -e 's/__VERSION__/18.1/g' Info.plist > openmp.framework/Versions/A/Resources/Info.plist
- - name: package
+ - name: package-glslang
+ if: matrix.opt.vulkan == 'ON'
+ run: |
+ rm -rf glslang.framework
+ mkdir -p glslang.framework/Versions/A/Headers
+ mkdir -p glslang.framework/Versions/A/Resources
+ ln -s A glslang.framework/Versions/Current
+ ln -s Versions/Current/Headers glslang.framework/Headers
+ ln -s Versions/Current/Resources glslang.framework/Resources
+ ln -s Versions/Current/glslang glslang.framework/glslang
+ libtool -static \
+ build-x86_64/install/lib/libglslang.a \
+ build-x86_64/install/lib/libMachineIndependent.a \
+ build-x86_64/install/lib/libGenericCodeGen.a \
+ build-x86_64/install/lib/libSPIRV.a \
+ build-x86_64/install/lib/libOGLCompiler.a \
+ build-x86_64/install/lib/libOSDependent.a \
+ -o build-x86_64/install/lib/libglslang_combined.a
+ libtool -static \
+ build-arm64/install/lib/libglslang.a \
+ build-arm64/install/lib/libMachineIndependent.a \
+ build-arm64/install/lib/libGenericCodeGen.a \
+ build-arm64/install/lib/libSPIRV.a \
+ build-arm64/install/lib/libOGLCompiler.a \
+ build-arm64/install/lib/libOSDependent.a \
+ -o build-arm64/install/lib/libglslang_combined.a
+ lipo -create \
+ build-x86_64/install/lib/libglslang_combined.a \
+ build-arm64/install/lib/libglslang_combined.a \
+ -o glslang.framework/Versions/A/glslang
+ cp -a build-x86_64/install/include/glslang glslang.framework/Versions/A/Headers/
+ sed -e 's/__NAME__/glslang/g' -e 's/__IDENTIFIER__/org.khronos.glslang/g' -e 's/__VERSION__/1.0/g' Info.plist > glslang.framework/Versions/A/Resources/Info.plist
+ - name: package-ncnn
run: |
rm -rf ncnn.framework
mkdir -p ncnn.framework/Versions/A/Headers
@@ -2250,8 +1886,16 @@ jobs:
-o ncnn.framework/Versions/A/ncnn
cp -a build-x86_64/install/include/* ncnn.framework/Versions/A/Headers/
sed -e 's/__NAME__/ncnn/g' -e 's/__IDENTIFIER__/com.tencent.ncnn/g' -e 's/__VERSION__/1.0/g' Info.plist > ncnn.framework/Versions/A/Resources/Info.plist
+ - name: package
+ if: matrix.opt.vulkan == 'OFF'
+ run: |
rm -f ${{ env.PACKAGENAME }}.zip
zip -9 -y -r ${{ env.PACKAGENAME }}.zip openmp.framework ncnn.framework
+ - name: package
+ if: matrix.opt.vulkan == 'ON'
+ run: |
+ rm -f ${{ env.PACKAGENAME }}.zip
+ zip -9 -y -r ${{ env.PACKAGENAME }}.zip openmp.framework glslang.framework ncnn.framework
- name: upload-zip
uses: actions/upload-artifact@v4
with:
@@ -2260,51 +1904,63 @@ jobs:
android:
needs: [setup]
+ strategy:
+ matrix:
+ opt:
+ - { vulkan: OFF, shared-lib: OFF, id: android }
+ - { vulkan: OFF, shared-lib: ON, id: android-shared }
+ - { vulkan: ON, shared-lib: OFF, id: android-vulkan }
+ - { vulkan: ON, shared-lib: ON, id: android-vulkan-shared }
runs-on: ubuntu-latest
env:
- PACKAGENAME: ncnn-${{ needs.setup.outputs.VERSION }}-android
+ PACKAGENAME: ncnn-${{ needs.setup.outputs.VERSION }}-${{ matrix.opt.id }}
+ NCNN_CMAKE_OPTIONS: |
+ -DCMAKE_TOOLCHAIN_FILE=$ANDROID_NDK_LATEST_HOME/build/cmake/android.toolchain.cmake \
+ -DANDROID_USE_LEGACY_TOOLCHAIN_FILE=False \
+ -DCMAKE_BUILD_TYPE=Release \
+ -DCMAKE_INSTALL_PREFIX=install \
+ -DNCNN_VERSION_STRING="${{ needs.setup.outputs.VERSION }}" \
+ -DNCNN_BUILD_BENCHMARK=OFF \
+ -DNCNN_VULKAN=${{ matrix.opt.vulkan }} \
+ -DNCNN_SHARED_LIB=${{ matrix.opt.shared-lib }} \
+ -DNCNN_AVX512BF16=OFF \
+
steps:
- uses: actions/checkout@v4
+ with:
+ submodules: true
- name: ndk-fix-debug
run: sed -i -e '/^ -g$/d' $ANDROID_NDK_LATEST_HOME/build/cmake/android-legacy.toolchain.cmake
- - name: build-armv7
+ - name: build-armeabi-v7a
run: |
- mkdir build-armv7 && cd build-armv7
- cmake -DCMAKE_TOOLCHAIN_FILE=$ANDROID_NDK_LATEST_HOME/build/cmake/android.toolchain.cmake -DANDROID_USE_LEGACY_TOOLCHAIN_FILE=False -DCMAKE_BUILD_TYPE=Release -DCMAKE_INSTALL_PREFIX=install -DNCNN_VERSION_STRING="${{ needs.setup.outputs.VERSION }}" \
- -DANDROID_ABI="armeabi-v7a" -DANDROID_ARM_NEON=ON -DANDROID_PLATFORM=android-14 \
- -DNCNN_BUILD_BENCHMARK=OFF ..
+ mkdir build-armeabi-v7a && cd build-armeabi-v7a
+ cmake ${{ env.NCNN_CMAKE_OPTIONS }} -DANDROID_ABI="armeabi-v7a" -DANDROID_ARM_NEON=ON -DANDROID_PLATFORM=android-14 ..
cmake --build . -j $(nproc)
cmake --build . --target install/strip
- - name: build-aarch64
+ - name: build-arm64-v8a
run: |
- mkdir build-aarch64 && cd build-aarch64
- cmake -DCMAKE_TOOLCHAIN_FILE=$ANDROID_NDK_LATEST_HOME/build/cmake/android.toolchain.cmake -DANDROID_USE_LEGACY_TOOLCHAIN_FILE=False -DCMAKE_BUILD_TYPE=Release -DCMAKE_INSTALL_PREFIX=install -DNCNN_VERSION_STRING="${{ needs.setup.outputs.VERSION }}" \
- -DANDROID_ABI="arm64-v8a" -DANDROID_PLATFORM=android-21 \
- -DNCNN_BUILD_BENCHMARK=OFF ..
+ mkdir build-arm64-v8a && cd build-arm64-v8a
+ cmake ${{ env.NCNN_CMAKE_OPTIONS }}-DANDROID_ABI="arm64-v8a" -DANDROID_PLATFORM=android-21 ..
cmake --build . -j $(nproc)
cmake --build . --target install/strip
- name: build-x86
run: |
mkdir build-x86 && cd build-x86
- cmake -DCMAKE_TOOLCHAIN_FILE=$ANDROID_NDK_LATEST_HOME/build/cmake/android.toolchain.cmake -DANDROID_USE_LEGACY_TOOLCHAIN_FILE=False -DCMAKE_BUILD_TYPE=Release -DCMAKE_INSTALL_PREFIX=install -DNCNN_VERSION_STRING="${{ needs.setup.outputs.VERSION }}" \
- -DANDROID_ABI="x86" -DANDROID_PLATFORM=android-14 \
- -DNCNN_BUILD_BENCHMARK=OFF ..
+ cmake ${{ env.NCNN_CMAKE_OPTIONS }}-DANDROID_ABI="x86" -DANDROID_PLATFORM=android-14 ..
cmake --build . -j $(nproc)
cmake --build . --target install/strip
- name: build-x86_64
run: |
mkdir build-x86_64 && cd build-x86_64
- cmake -DCMAKE_TOOLCHAIN_FILE=$ANDROID_NDK_LATEST_HOME/build/cmake/android.toolchain.cmake -DANDROID_USE_LEGACY_TOOLCHAIN_FILE=False -DCMAKE_BUILD_TYPE=Release -DCMAKE_INSTALL_PREFIX=install -DNCNN_VERSION_STRING="${{ needs.setup.outputs.VERSION }}" \
- -DANDROID_ABI="x86_64" -DANDROID_PLATFORM=android-21 \
- -DNCNN_BUILD_BENCHMARK=OFF ..
+ cmake ${{ env.NCNN_CMAKE_OPTIONS }}-DANDROID_ABI="x86_64" -DANDROID_PLATFORM=android-21 ..
cmake --build . -j $(nproc)
cmake --build . --target install/strip
- name: package
run: |
rm -rf ${{ env.PACKAGENAME }}
mkdir -p ${{ env.PACKAGENAME }}
- cp -a build-armv7/install ${{ env.PACKAGENAME }}/armeabi-v7a
- cp -a build-aarch64/install ${{ env.PACKAGENAME }}/arm64-v8a
+ cp -a build-armeabi-v7a/install ${{ env.PACKAGENAME }}/armeabi-v7a
+ cp -a build-arm64-v8a/install ${{ env.PACKAGENAME }}/arm64-v8a
cp -a build-x86/install ${{ env.PACKAGENAME }}/x86
cp -a build-x86_64/install ${{ env.PACKAGENAME }}/x86_64
rm -f ${{ env.PACKAGENAME }}.zip
@@ -2315,55 +1971,63 @@ jobs:
name: ${{ env.PACKAGENAME }}
path: ${{ env.PACKAGENAME }}.zip
- android-shared:
+ webassembly:
needs: [setup]
runs-on: ubuntu-latest
env:
- PACKAGENAME: ncnn-${{ needs.setup.outputs.VERSION }}-android-shared
+ PACKAGENAME: ncnn-${{ needs.setup.outputs.VERSION }}-webassembly
steps:
- uses: actions/checkout@v4
- - name: ndk-fix-debug
- run: sed -i -e '/^ -g$/d' $ANDROID_NDK_LATEST_HOME/build/cmake/android-legacy.toolchain.cmake
- - name: build-armv7
+ - name: emsdk
+ run: |
+ git clone https://github.com/emscripten-core/emsdk.git
+ cd emsdk
+ ./emsdk install $EMSCRIPTEN_VERSION
+ ./emsdk activate $EMSCRIPTEN_VERSION
+ - name: build
run: |
- mkdir build-armv7 && cd build-armv7
- cmake -DCMAKE_TOOLCHAIN_FILE=$ANDROID_NDK_LATEST_HOME/build/cmake/android.toolchain.cmake -DANDROID_USE_LEGACY_TOOLCHAIN_FILE=False -DCMAKE_BUILD_TYPE=Release -DCMAKE_INSTALL_PREFIX=install -DNCNN_VERSION_STRING="${{ needs.setup.outputs.VERSION }}" \
- -DANDROID_ABI="armeabi-v7a" -DANDROID_ARM_NEON=ON -DANDROID_PLATFORM=android-14 \
- -DNCNN_BUILD_BENCHMARK=OFF -DNCNN_SHARED_LIB=ON ..
+ source emsdk/emsdk_env.sh
+ mkdir build && cd build
+ cmake -DCMAKE_TOOLCHAIN_FILE=$EMSDK/upstream/emscripten/cmake/Modules/Platform/Emscripten.cmake -DCMAKE_BUILD_TYPE=Release -DCMAKE_INSTALL_PREFIX=install -DNCNN_VERSION_STRING="${{ needs.setup.outputs.VERSION }}" \
+ -DNCNN_THREADS=OFF -DNCNN_OPENMP=OFF -DNCNN_SIMPLEOMP=OFF -DNCNN_SIMPLEOCV=ON -DNCNN_RUNTIME_CPU=OFF -DNCNN_SSE2=OFF -DNCNN_AVX2=OFF -DNCNN_AVX=OFF \
+ -DNCNN_BUILD_TOOLS=OFF -DNCNN_BUILD_EXAMPLES=OFF -DNCNN_BUILD_BENCHMARK=OFF ..
cmake --build . -j $(nproc)
cmake --build . --target install/strip
- - name: build-aarch64
+ - name: build-simd
run: |
- mkdir build-aarch64 && cd build-aarch64
- cmake -DCMAKE_TOOLCHAIN_FILE=$ANDROID_NDK_LATEST_HOME/build/cmake/android.toolchain.cmake -DANDROID_USE_LEGACY_TOOLCHAIN_FILE=False -DCMAKE_BUILD_TYPE=Release -DCMAKE_INSTALL_PREFIX=install -DNCNN_VERSION_STRING="${{ needs.setup.outputs.VERSION }}" \
- -DANDROID_ABI="arm64-v8a" -DANDROID_PLATFORM=android-21 \
- -DNCNN_BUILD_BENCHMARK=OFF -DNCNN_SHARED_LIB=ON ..
+ source emsdk/emsdk_env.sh
+ mkdir build-simd && cd build-simd
+ cmake -DCMAKE_TOOLCHAIN_FILE=$EMSDK/upstream/emscripten/cmake/Modules/Platform/Emscripten.cmake -DCMAKE_BUILD_TYPE=Release -DCMAKE_INSTALL_PREFIX=install -DNCNN_VERSION_STRING="${{ needs.setup.outputs.VERSION }}" \
+ -DNCNN_THREADS=OFF -DNCNN_OPENMP=OFF -DNCNN_SIMPLEOMP=OFF -DNCNN_SIMPLEOCV=ON -DNCNN_RUNTIME_CPU=OFF -DNCNN_SSE2=ON -DNCNN_AVX2=OFF -DNCNN_AVX=OFF \
+ -DNCNN_BUILD_TOOLS=OFF -DNCNN_BUILD_EXAMPLES=OFF -DNCNN_BUILD_BENCHMARK=OFF ..
cmake --build . -j $(nproc)
cmake --build . --target install/strip
- - name: build-x86
+ - name: build-threads
run: |
- mkdir build-x86 && cd build-x86
- cmake -DCMAKE_TOOLCHAIN_FILE=$ANDROID_NDK_LATEST_HOME/build/cmake/android.toolchain.cmake -DANDROID_USE_LEGACY_TOOLCHAIN_FILE=False -DCMAKE_BUILD_TYPE=Release -DCMAKE_INSTALL_PREFIX=install -DNCNN_VERSION_STRING="${{ needs.setup.outputs.VERSION }}" \
- -DANDROID_ABI="x86" -DANDROID_PLATFORM=android-14 \
- -DNCNN_BUILD_BENCHMARK=OFF -DNCNN_SHARED_LIB=ON ..
+ source emsdk/emsdk_env.sh
+ mkdir build-threads && cd build-threads
+ cmake -DCMAKE_TOOLCHAIN_FILE=$EMSDK/upstream/emscripten/cmake/Modules/Platform/Emscripten.cmake -DCMAKE_BUILD_TYPE=Release -DCMAKE_INSTALL_PREFIX=install -DNCNN_VERSION_STRING="${{ needs.setup.outputs.VERSION }}" \
+ -DNCNN_THREADS=ON -DNCNN_OPENMP=ON -DNCNN_SIMPLEOMP=ON -DNCNN_SIMPLEOCV=ON -DNCNN_RUNTIME_CPU=OFF -DNCNN_SSE2=OFF -DNCNN_AVX2=OFF -DNCNN_AVX=OFF \
+ -DNCNN_BUILD_TOOLS=OFF -DNCNN_BUILD_EXAMPLES=OFF -DNCNN_BUILD_BENCHMARK=OFF ..
cmake --build . -j $(nproc)
cmake --build . --target install/strip
- - name: build-x86_64
+ - name: build-simd-threads
run: |
- mkdir build-x86_64 && cd build-x86_64
- cmake -DCMAKE_TOOLCHAIN_FILE=$ANDROID_NDK_LATEST_HOME/build/cmake/android.toolchain.cmake -DANDROID_USE_LEGACY_TOOLCHAIN_FILE=False -DCMAKE_BUILD_TYPE=Release -DCMAKE_INSTALL_PREFIX=install -DNCNN_VERSION_STRING="${{ needs.setup.outputs.VERSION }}" \
- -DANDROID_ABI="x86_64" -DANDROID_PLATFORM=android-21 \
- -DNCNN_BUILD_BENCHMARK=OFF -DNCNN_SHARED_LIB=ON ..
+ source emsdk/emsdk_env.sh
+ mkdir build-simd-threads && cd build-simd-threads
+ cmake -DCMAKE_TOOLCHAIN_FILE=$EMSDK/upstream/emscripten/cmake/Modules/Platform/Emscripten.cmake -DCMAKE_BUILD_TYPE=Release -DCMAKE_INSTALL_PREFIX=install -DNCNN_VERSION_STRING="${{ needs.setup.outputs.VERSION }}" \
+ -DNCNN_THREADS=ON -DNCNN_OPENMP=ON -DNCNN_SIMPLEOMP=ON -DNCNN_SIMPLEOCV=ON -DNCNN_RUNTIME_CPU=OFF -DNCNN_SSE2=ON -DNCNN_AVX2=OFF -DNCNN_AVX=OFF \
+ -DNCNN_BUILD_TOOLS=OFF -DNCNN_BUILD_EXAMPLES=OFF -DNCNN_BUILD_BENCHMARK=OFF ..
cmake --build . -j $(nproc)
cmake --build . --target install/strip
- name: package
run: |
rm -rf ${{ env.PACKAGENAME }}
mkdir -p ${{ env.PACKAGENAME }}
- cp -a build-armv7/install ${{ env.PACKAGENAME }}/armeabi-v7a
- cp -a build-aarch64/install ${{ env.PACKAGENAME }}/arm64-v8a
- cp -a build-x86/install ${{ env.PACKAGENAME }}/x86
- cp -a build-x86_64/install ${{ env.PACKAGENAME }}/x86_64
+ cp -a build/install ${{ env.PACKAGENAME }}/basic
+ cp -a build-simd/install ${{ env.PACKAGENAME }}/simd
+ cp -a build-threads/install ${{ env.PACKAGENAME }}/threads
+ cp -a build-simd-threads/install ${{ env.PACKAGENAME }}/simd-threads
rm -f ${{ env.PACKAGENAME }}.zip
zip -9 -y -r ${{ env.PACKAGENAME }}.zip ${{ env.PACKAGENAME }}
- name: upload-zip
@@ -2372,692 +2036,96 @@ jobs:
name: ${{ env.PACKAGENAME }}
path: ${{ env.PACKAGENAME }}.zip
- android-gpu:
+ windows:
needs: [setup]
- runs-on: ubuntu-latest
+ strategy:
+ matrix:
+ opt:
+ - { shared-lib: OFF, os: windows-2019, toolset-version: v140, id: vs2015 }
+ - { shared-lib: OFF, os: windows-2019, toolset-version: v141, id: vs2017 }
+ - { shared-lib: OFF, os: windows-2019, toolset-version: v142, id: vs2019 }
+ - { shared-lib: OFF, os: windows-2022, toolset-version: v143, id: vs2022 }
+ - { shared-lib: ON, os: windows-2019, toolset-version: v140, id: vs2015-shared }
+ - { shared-lib: ON, os: windows-2019, toolset-version: v141, id: vs2017-shared }
+ - { shared-lib: ON, os: windows-2019, toolset-version: v142, id: vs2019-shared }
+ - { shared-lib: ON, os: windows-2022, toolset-version: v143, id: vs2022-shared }
+ runs-on: ${{ matrix.opt.os }}
env:
- PACKAGENAME: ncnn-${{ needs.setup.outputs.VERSION }}-android-vulkan
+ PACKAGENAME: ncnn-${{ needs.setup.outputs.VERSION }}-windows-${{ matrix.opt.id }}
+ UseMultiToolTask: true
+ NCNN_CMAKE_OPTIONS: |
+ -T ${{ matrix.opt.toolset-version }},host=x64 `
+ -DCMAKE_BUILD_TYPE=Release `
+ -DCMAKE_INSTALL_PREFIX=install `
+ -DNCNN_VERSION_STRING="${{ needs.setup.outputs.VERSION }}" `
+ -DNCNN_BUILD_EXAMPLES=OFF `
+ -DNCNN_BUILD_TOOLS=ON `
+ -DNCNN_BUILD_BENCHMARK=OFF `
+ -DNCNN_VULKAN=ON `
+ -DNCNN_SHARED_LIB=${{ matrix.opt.shared-lib }} `
+
steps:
- uses: actions/checkout@v4
with:
submodules: true
- - name: ndk-fix-debug
- run: sed -i -e '/^ -g$/d' $ANDROID_NDK_LATEST_HOME/build/cmake/android-legacy.toolchain.cmake
- - name: build-armv7
- run: |
- mkdir build-armv7 && cd build-armv7
- cmake -DCMAKE_TOOLCHAIN_FILE=$ANDROID_NDK_LATEST_HOME/build/cmake/android.toolchain.cmake -DANDROID_USE_LEGACY_TOOLCHAIN_FILE=False -DCMAKE_BUILD_TYPE=Release -DCMAKE_INSTALL_PREFIX=install -DNCNN_VERSION_STRING="${{ needs.setup.outputs.VERSION }}" \
- -DANDROID_ABI="armeabi-v7a" -DANDROID_ARM_NEON=ON -DANDROID_PLATFORM=android-14 \
- -DNCNN_VULKAN=ON -DNCNN_BUILD_BENCHMARK=OFF ..
- cmake --build . -j $(nproc)
- cmake --build . --target install/strip
- - name: build-aarch64
+ - name: cache-protobuf
+ id: cache-protobuf
+ uses: actions/cache@v4
+ with:
+ path: "protobuf-install"
+ key: protobuf-${{ matrix.opt.toolset-version }}-x86-x64-install
+ - name: protobuf
+ if: steps.cache-protobuf.outputs.cache-hit != 'true'
run: |
- mkdir build-aarch64 && cd build-aarch64
- cmake -DCMAKE_TOOLCHAIN_FILE=$ANDROID_NDK_LATEST_HOME/build/cmake/android.toolchain.cmake -DANDROID_USE_LEGACY_TOOLCHAIN_FILE=False -DCMAKE_BUILD_TYPE=Release -DCMAKE_INSTALL_PREFIX=install -DNCNN_VERSION_STRING="${{ needs.setup.outputs.VERSION }}" \
- -DANDROID_ABI="arm64-v8a" -DANDROID_PLATFORM=android-21 \
- -DNCNN_VULKAN=ON -DNCNN_BUILD_BENCHMARK=OFF ..
- cmake --build . -j $(nproc)
- cmake --build . --target install/strip
+ Invoke-WebRequest -Uri https://github.com/protocolbuffers/protobuf/archive/v3.11.2.zip -OutFile protobuf-3.11.2.zip
+ 7z x ./protobuf-3.11.2.zip
+ cd protobuf-3.11.2
+ mkdir build-x86; cd build-x86;
+ cmake -T ${{ matrix.opt.toolset-version }},host=x64 -A Win32 -DCMAKE_INSTALL_PREFIX="$env:GITHUB_WORKSPACE\protobuf-install\x86" -Dprotobuf_BUILD_TESTS=OFF -Dprotobuf_MSVC_STATIC_RUNTIME=OFF ../cmake
+ cmake --build . --config Release -j 4
+ cmake --build . --config Release --target install
+ cd ..
+ mkdir build-x64; cd build-x64;
+ cmake -T ${{ matrix.opt.toolset-version }},host=x64 -A x64 -DCMAKE_INSTALL_PREFIX="$env:GITHUB_WORKSPACE\protobuf-install\x64" -Dprotobuf_BUILD_TESTS=OFF -Dprotobuf_MSVC_STATIC_RUNTIME=OFF ../cmake
+ cmake --build . --config Release -j 4
+ cmake --build . --config Release --target install
- name: build-x86
run: |
- mkdir build-x86 && cd build-x86
- cmake -DCMAKE_TOOLCHAIN_FILE=$ANDROID_NDK_LATEST_HOME/build/cmake/android.toolchain.cmake -DANDROID_USE_LEGACY_TOOLCHAIN_FILE=False -DCMAKE_BUILD_TYPE=Release -DCMAKE_INSTALL_PREFIX=install -DNCNN_VERSION_STRING="${{ needs.setup.outputs.VERSION }}" \
- -DANDROID_ABI="x86" -DANDROID_PLATFORM=android-14 \
- -DNCNN_VULKAN=ON -DNCNN_BUILD_BENCHMARK=OFF ..
- cmake --build . -j $(nproc)
- cmake --build . --target install/strip
- - name: build-x86_64
+ mkdir build-x86; cd build-x86
+ cmake ${{ env.NCNN_CMAKE_OPTIONS }} -A Win32 -Dprotobuf_DIR="$env:GITHUB_WORKSPACE\protobuf-install\x86\cmake" ..
+ cmake --build . --config Release -j 4
+ cmake --build . --config Release --target install
+ - name: build-x64
run: |
- mkdir build-x86_64 && cd build-x86_64
- cmake -DCMAKE_TOOLCHAIN_FILE=$ANDROID_NDK_LATEST_HOME/build/cmake/android.toolchain.cmake -DANDROID_USE_LEGACY_TOOLCHAIN_FILE=False -DCMAKE_BUILD_TYPE=Release -DCMAKE_INSTALL_PREFIX=install -DNCNN_VERSION_STRING="${{ needs.setup.outputs.VERSION }}" \
- -DANDROID_ABI="x86_64" -DANDROID_PLATFORM=android-21 \
- -DNCNN_VULKAN=ON -DNCNN_BUILD_BENCHMARK=OFF ..
- cmake --build . -j $(nproc)
- cmake --build . --target install/strip
- - name: package
- run: |
- rm -rf ${{ env.PACKAGENAME }}
- mkdir -p ${{ env.PACKAGENAME }}
- cp -a build-armv7/install ${{ env.PACKAGENAME }}/armeabi-v7a
- cp -a build-aarch64/install ${{ env.PACKAGENAME }}/arm64-v8a
- cp -a build-x86/install ${{ env.PACKAGENAME }}/x86
- cp -a build-x86_64/install ${{ env.PACKAGENAME }}/x86_64
- rm -f ${{ env.PACKAGENAME }}.zip
- zip -9 -y -r ${{ env.PACKAGENAME }}.zip ${{ env.PACKAGENAME }}
- - name: upload-zip
- uses: actions/upload-artifact@v4
- with:
- name: ${{ env.PACKAGENAME }}
- path: ${{ env.PACKAGENAME }}.zip
-
- android-gpu-shared:
- needs: [setup]
- runs-on: ubuntu-latest
- env:
- PACKAGENAME: ncnn-${{ needs.setup.outputs.VERSION }}-android-vulkan-shared
- steps:
- - uses: actions/checkout@v4
- with:
- submodules: true
- - name: ndk-fix-debug
- run: sed -i -e '/^ -g$/d' $ANDROID_NDK_LATEST_HOME/build/cmake/android-legacy.toolchain.cmake
- - name: build-armv7
- run: |
- mkdir build-armv7 && cd build-armv7
- cmake -DCMAKE_TOOLCHAIN_FILE=$ANDROID_NDK_LATEST_HOME/build/cmake/android.toolchain.cmake -DANDROID_USE_LEGACY_TOOLCHAIN_FILE=False -DCMAKE_BUILD_TYPE=Release -DCMAKE_INSTALL_PREFIX=install -DNCNN_VERSION_STRING="${{ needs.setup.outputs.VERSION }}" \
- -DANDROID_ABI="armeabi-v7a" -DANDROID_ARM_NEON=ON -DANDROID_PLATFORM=android-14 \
- -DNCNN_VULKAN=ON -DNCNN_BUILD_BENCHMARK=OFF -DNCNN_SHARED_LIB=ON ..
- cmake --build . -j $(nproc)
- cmake --build . --target install/strip
- - name: build-aarch64
- run: |
- mkdir build-aarch64 && cd build-aarch64
- cmake -DCMAKE_TOOLCHAIN_FILE=$ANDROID_NDK_LATEST_HOME/build/cmake/android.toolchain.cmake -DANDROID_USE_LEGACY_TOOLCHAIN_FILE=False -DCMAKE_BUILD_TYPE=Release -DCMAKE_INSTALL_PREFIX=install -DNCNN_VERSION_STRING="${{ needs.setup.outputs.VERSION }}" \
- -DANDROID_ABI="arm64-v8a" -DANDROID_PLATFORM=android-21 \
- -DNCNN_VULKAN=ON -DNCNN_BUILD_BENCHMARK=OFF -DNCNN_SHARED_LIB=ON ..
- cmake --build . -j $(nproc)
- cmake --build . --target install/strip
- - name: build-x86
- run: |
- mkdir build-x86 && cd build-x86
- cmake -DCMAKE_TOOLCHAIN_FILE=$ANDROID_NDK_LATEST_HOME/build/cmake/android.toolchain.cmake -DANDROID_USE_LEGACY_TOOLCHAIN_FILE=False -DCMAKE_BUILD_TYPE=Release -DCMAKE_INSTALL_PREFIX=install -DNCNN_VERSION_STRING="${{ needs.setup.outputs.VERSION }}" \
- -DANDROID_ABI="x86" -DANDROID_PLATFORM=android-14 \
- -DNCNN_VULKAN=ON -DNCNN_BUILD_BENCHMARK=OFF -DNCNN_SHARED_LIB=ON ..
- cmake --build . -j $(nproc)
- cmake --build . --target install/strip
- - name: build-x86_64
- run: |
- mkdir build-x86_64 && cd build-x86_64
- cmake -DCMAKE_TOOLCHAIN_FILE=$ANDROID_NDK_LATEST_HOME/build/cmake/android.toolchain.cmake -DANDROID_USE_LEGACY_TOOLCHAIN_FILE=False -DCMAKE_BUILD_TYPE=Release -DCMAKE_INSTALL_PREFIX=install -DNCNN_VERSION_STRING="${{ needs.setup.outputs.VERSION }}" \
- -DANDROID_ABI="x86_64" -DANDROID_PLATFORM=android-21 \
- -DNCNN_VULKAN=ON -DNCNN_BUILD_BENCHMARK=OFF -DNCNN_SHARED_LIB=ON ..
- cmake --build . -j $(nproc)
- cmake --build . --target install/strip
- - name: package
- run: |
- rm -rf ${{ env.PACKAGENAME }}
- mkdir -p ${{ env.PACKAGENAME }}
- cp -a build-armv7/install ${{ env.PACKAGENAME }}/armeabi-v7a
- cp -a build-aarch64/install ${{ env.PACKAGENAME }}/arm64-v8a
- cp -a build-x86/install ${{ env.PACKAGENAME }}/x86
- cp -a build-x86_64/install ${{ env.PACKAGENAME }}/x86_64
- rm -f ${{ env.PACKAGENAME }}.zip
- zip -9 -y -r ${{ env.PACKAGENAME }}.zip ${{ env.PACKAGENAME }}
- - name: upload-zip
- uses: actions/upload-artifact@v4
- with:
- name: ${{ env.PACKAGENAME }}
- path: ${{ env.PACKAGENAME }}.zip
-
- webassembly:
- needs: [setup]
- runs-on: ubuntu-latest
- env:
- PACKAGENAME: ncnn-${{ needs.setup.outputs.VERSION }}-webassembly
- steps:
- - uses: actions/checkout@v4
- - name: emsdk
- run: |
- git clone https://github.com/emscripten-core/emsdk.git
- cd emsdk
- ./emsdk install $EMSCRIPTEN_VERSION
- ./emsdk activate $EMSCRIPTEN_VERSION
- - name: build
- run: |
- source emsdk/emsdk_env.sh
- mkdir build && cd build
- cmake -DCMAKE_TOOLCHAIN_FILE=$EMSDK/upstream/emscripten/cmake/Modules/Platform/Emscripten.cmake -DCMAKE_BUILD_TYPE=Release -DCMAKE_INSTALL_PREFIX=install -DNCNN_VERSION_STRING="${{ needs.setup.outputs.VERSION }}" \
- -DNCNN_THREADS=OFF -DNCNN_OPENMP=OFF -DNCNN_SIMPLEOMP=OFF -DNCNN_SIMPLEOCV=ON -DNCNN_RUNTIME_CPU=OFF -DNCNN_SSE2=OFF -DNCNN_AVX2=OFF -DNCNN_AVX=OFF \
- -DNCNN_BUILD_TOOLS=OFF -DNCNN_BUILD_EXAMPLES=OFF -DNCNN_BUILD_BENCHMARK=OFF ..
- cmake --build . -j $(nproc)
- cmake --build . --target install/strip
- - name: build-simd
- run: |
- source emsdk/emsdk_env.sh
- mkdir build-simd && cd build-simd
- cmake -DCMAKE_TOOLCHAIN_FILE=$EMSDK/upstream/emscripten/cmake/Modules/Platform/Emscripten.cmake -DCMAKE_BUILD_TYPE=Release -DCMAKE_INSTALL_PREFIX=install -DNCNN_VERSION_STRING="${{ needs.setup.outputs.VERSION }}" \
- -DNCNN_THREADS=OFF -DNCNN_OPENMP=OFF -DNCNN_SIMPLEOMP=OFF -DNCNN_SIMPLEOCV=ON -DNCNN_RUNTIME_CPU=OFF -DNCNN_SSE2=ON -DNCNN_AVX2=OFF -DNCNN_AVX=OFF \
- -DNCNN_BUILD_TOOLS=OFF -DNCNN_BUILD_EXAMPLES=OFF -DNCNN_BUILD_BENCHMARK=OFF ..
- cmake --build . -j $(nproc)
- cmake --build . --target install/strip
- - name: build-threads
- run: |
- source emsdk/emsdk_env.sh
- mkdir build-threads && cd build-threads
- cmake -DCMAKE_TOOLCHAIN_FILE=$EMSDK/upstream/emscripten/cmake/Modules/Platform/Emscripten.cmake -DCMAKE_BUILD_TYPE=Release -DCMAKE_INSTALL_PREFIX=install -DNCNN_VERSION_STRING="${{ needs.setup.outputs.VERSION }}" \
- -DNCNN_THREADS=ON -DNCNN_OPENMP=ON -DNCNN_SIMPLEOMP=ON -DNCNN_SIMPLEOCV=ON -DNCNN_RUNTIME_CPU=OFF -DNCNN_SSE2=OFF -DNCNN_AVX2=OFF -DNCNN_AVX=OFF \
- -DNCNN_BUILD_TOOLS=OFF -DNCNN_BUILD_EXAMPLES=OFF -DNCNN_BUILD_BENCHMARK=OFF ..
- cmake --build . -j $(nproc)
- cmake --build . --target install/strip
- - name: build-simd-threads
- run: |
- source emsdk/emsdk_env.sh
- mkdir build-simd-threads && cd build-simd-threads
- cmake -DCMAKE_TOOLCHAIN_FILE=$EMSDK/upstream/emscripten/cmake/Modules/Platform/Emscripten.cmake -DCMAKE_BUILD_TYPE=Release -DCMAKE_INSTALL_PREFIX=install -DNCNN_VERSION_STRING="${{ needs.setup.outputs.VERSION }}" \
- -DNCNN_THREADS=ON -DNCNN_OPENMP=ON -DNCNN_SIMPLEOMP=ON -DNCNN_SIMPLEOCV=ON -DNCNN_RUNTIME_CPU=OFF -DNCNN_SSE2=ON -DNCNN_AVX2=OFF -DNCNN_AVX=OFF \
- -DNCNN_BUILD_TOOLS=OFF -DNCNN_BUILD_EXAMPLES=OFF -DNCNN_BUILD_BENCHMARK=OFF ..
- cmake --build . -j $(nproc)
- cmake --build . --target install/strip
- - name: package
- run: |
- rm -rf ${{ env.PACKAGENAME }}
- mkdir -p ${{ env.PACKAGENAME }}
- cp -a build/install ${{ env.PACKAGENAME }}/basic
- cp -a build-simd/install ${{ env.PACKAGENAME }}/simd
- cp -a build-threads/install ${{ env.PACKAGENAME }}/threads
- cp -a build-simd-threads/install ${{ env.PACKAGENAME }}/simd-threads
- rm -f ${{ env.PACKAGENAME }}.zip
- zip -9 -y -r ${{ env.PACKAGENAME }}.zip ${{ env.PACKAGENAME }}
- - name: upload-zip
- uses: actions/upload-artifact@v4
- with:
- name: ${{ env.PACKAGENAME }}
- path: ${{ env.PACKAGENAME }}.zip
-
- windows-vs2015:
- needs: [setup]
- runs-on: windows-2019
- env:
- PACKAGENAME: ncnn-${{ needs.setup.outputs.VERSION }}-windows-vs2015
- UseMultiToolTask: true
- steps:
- - uses: actions/checkout@v4
- with:
- submodules: true
- - name: cache-protobuf
- id: cache-protobuf
- uses: actions/cache@v4
- with:
- path: "protobuf-install"
- key: protobuf-vs2015-x86-x64-install
- - name: protobuf
- if: steps.cache-protobuf.outputs.cache-hit != 'true'
- run: |
- Invoke-WebRequest -Uri https://github.com/protocolbuffers/protobuf/archive/v3.11.2.zip -OutFile protobuf-3.11.2.zip
- 7z x ./protobuf-3.11.2.zip
- cd protobuf-3.11.2
- mkdir build-x86; cd build-x86;
- cmake -T v140,host=x64 -A Win32 -DCMAKE_INSTALL_PREFIX="$env:GITHUB_WORKSPACE\protobuf-install\x86" -Dprotobuf_BUILD_TESTS=OFF -Dprotobuf_MSVC_STATIC_RUNTIME=OFF ../cmake
- cmake --build . --config Release -j 4
- cmake --build . --config Release --target install
- cd ..
- mkdir build-x64; cd build-x64;
- cmake -T v140,host=x64 -A x64 -DCMAKE_INSTALL_PREFIX="$env:GITHUB_WORKSPACE\protobuf-install\x64" -Dprotobuf_BUILD_TESTS=OFF -Dprotobuf_MSVC_STATIC_RUNTIME=OFF ../cmake
- cmake --build . --config Release -j 4
- cmake --build . --config Release --target install
- - name: build-x86
- run: |
- mkdir build-x86; cd build-x86
- cmake -T v140,host=x64 -A Win32 -DCMAKE_INSTALL_PREFIX=install -DNCNN_VERSION_STRING="${{ needs.setup.outputs.VERSION }}" -Dprotobuf_DIR="$env:GITHUB_WORKSPACE\protobuf-install\x86\cmake" -DNCNN_VULKAN=ON -DNCNN_BUILD_EXAMPLES=OFF -DNCNN_BUILD_TOOLS=ON -DNCNN_BUILD_BENCHMARK=OFF ..
- cmake --build . --config Release -j 4
- cmake --build . --config Release --target install
- - name: build-x64
- run: |
- mkdir build-x64; cd build-x64
- cmake -T v140,host=x64 -A x64 -DCMAKE_INSTALL_PREFIX=install -DNCNN_VERSION_STRING="${{ needs.setup.outputs.VERSION }}" -Dprotobuf_DIR="$env:GITHUB_WORKSPACE\protobuf-install\x64\cmake" -DNCNN_VULKAN=ON -DNCNN_BUILD_EXAMPLES=OFF -DNCNN_BUILD_TOOLS=ON -DNCNN_BUILD_BENCHMARK=OFF ..
- cmake --build . --config Release -j 4
- cmake --build . --config Release --target install
- - name: package
- run: |
- mkdir ${{ env.PACKAGENAME }}
- mkdir ${{ env.PACKAGENAME }}/x86
- mkdir ${{ env.PACKAGENAME }}/x64
- Copy-Item -Verbose -Recurse -Path "build-x86\install\*" -Destination "${{ env.PACKAGENAME }}\x86"
- Copy-Item -Verbose -Recurse -Path "build-x64\install\*" -Destination "${{ env.PACKAGENAME }}\x64"
- 7z a -r ${{ env.PACKAGENAME }}.zip ${{ env.PACKAGENAME }}
- - name: upload-zip
- uses: actions/upload-artifact@v4
- with:
- name: ${{ env.PACKAGENAME }}
- path: ${{ env.PACKAGENAME }}.zip
-
- windows-vs2015-shared:
- needs: [setup]
- runs-on: windows-2019
- env:
- PACKAGENAME: ncnn-${{ needs.setup.outputs.VERSION }}-windows-vs2015-shared
- UseMultiToolTask: true
- steps:
- - uses: actions/checkout@v4
- with:
- submodules: true
- - name: cache-protobuf
- id: cache-protobuf
- uses: actions/cache@v4
- with:
- path: "protobuf-install"
- key: protobuf-vs2015-x86-x64-install
- - name: protobuf
- if: steps.cache-protobuf.outputs.cache-hit != 'true'
- run: |
- Invoke-WebRequest -Uri https://github.com/protocolbuffers/protobuf/archive/v3.11.2.zip -OutFile protobuf-3.11.2.zip
- 7z x ./protobuf-3.11.2.zip
- cd protobuf-3.11.2
- mkdir build-x86; cd build-x86;
- cmake -T v140,host=x64 -A Win32 -DCMAKE_INSTALL_PREFIX="$env:GITHUB_WORKSPACE\protobuf-install\x86" -Dprotobuf_BUILD_TESTS=OFF -Dprotobuf_MSVC_STATIC_RUNTIME=OFF ../cmake
- cmake --build . --config Release -j 4
- cmake --build . --config Release --target install
- cd ..
- mkdir build-x64; cd build-x64;
- cmake -T v140,host=x64 -A x64 -DCMAKE_INSTALL_PREFIX="$env:GITHUB_WORKSPACE\protobuf-install\x64" -Dprotobuf_BUILD_TESTS=OFF -Dprotobuf_MSVC_STATIC_RUNTIME=OFF ../cmake
- cmake --build . --config Release -j 4
- cmake --build . --config Release --target install
- - name: build-x86
- run: |
- mkdir build-x86; cd build-x86
- cmake -T v140,host=x64 -A Win32 -DCMAKE_INSTALL_PREFIX=install -DNCNN_VERSION_STRING="${{ needs.setup.outputs.VERSION }}" -Dprotobuf_DIR="$env:GITHUB_WORKSPACE\protobuf-install\x86\cmake" -DNCNN_VULKAN=ON -DNCNN_BUILD_EXAMPLES=OFF -DNCNN_BUILD_TOOLS=ON -DNCNN_BUILD_BENCHMARK=OFF -DNCNN_SHARED_LIB=ON ..
- cmake --build . --config Release -j 4
- cmake --build . --config Release --target install
- - name: build-x64
- run: |
- mkdir build-x64; cd build-x64
- cmake -T v140,host=x64 -A x64 -DCMAKE_INSTALL_PREFIX=install -DNCNN_VERSION_STRING="${{ needs.setup.outputs.VERSION }}" -Dprotobuf_DIR="$env:GITHUB_WORKSPACE\protobuf-install\x64\cmake" -DNCNN_VULKAN=ON -DNCNN_BUILD_EXAMPLES=OFF -DNCNN_BUILD_TOOLS=ON -DNCNN_BUILD_BENCHMARK=OFF -DNCNN_SHARED_LIB=ON ..
- cmake --build . --config Release -j 4
- cmake --build . --config Release --target install
- - name: package
- run: |
- mkdir ${{ env.PACKAGENAME }}
- mkdir ${{ env.PACKAGENAME }}/x86
- mkdir ${{ env.PACKAGENAME }}/x64
- Copy-Item -Verbose -Recurse -Path "build-x86\install\*" -Destination "${{ env.PACKAGENAME }}\x86"
- Copy-Item -Verbose -Recurse -Path "build-x64\install\*" -Destination "${{ env.PACKAGENAME }}\x64"
- 7z a -r ${{ env.PACKAGENAME }}.zip ${{ env.PACKAGENAME }}
- - name: upload-zip
- uses: actions/upload-artifact@v4
- with:
- name: ${{ env.PACKAGENAME }}
- path: ${{ env.PACKAGENAME }}.zip
-
- windows-vs2017:
- needs: [setup]
- runs-on: windows-2019
- env:
- PACKAGENAME: ncnn-${{ needs.setup.outputs.VERSION }}-windows-vs2017
- UseMultiToolTask: true
- steps:
- - uses: actions/checkout@v4
- with:
- submodules: true
- - name: cache-protobuf
- id: cache-protobuf
- uses: actions/cache@v4
- with:
- path: "protobuf-install"
- key: protobuf-vs2017-x86-x64-install
- - name: protobuf
- if: steps.cache-protobuf.outputs.cache-hit != 'true'
- run: |
- Invoke-WebRequest -Uri https://github.com/protocolbuffers/protobuf/archive/v3.11.2.zip -OutFile protobuf-3.11.2.zip
- 7z x ./protobuf-3.11.2.zip
- cd protobuf-3.11.2
- mkdir build-x86; cd build-x86;
- cmake -T v141,host=x64 -A Win32 -DCMAKE_INSTALL_PREFIX="$env:GITHUB_WORKSPACE\protobuf-install\x86" -Dprotobuf_BUILD_TESTS=OFF -Dprotobuf_MSVC_STATIC_RUNTIME=OFF ../cmake
- cmake --build . --config Release -j 4
- cmake --build . --config Release --target install
- cd ..
- mkdir build-x64; cd build-x64;
- cmake -T v141,host=x64 -A x64 -DCMAKE_INSTALL_PREFIX="$env:GITHUB_WORKSPACE\protobuf-install\x64" -Dprotobuf_BUILD_TESTS=OFF -Dprotobuf_MSVC_STATIC_RUNTIME=OFF ../cmake
- cmake --build . --config Release -j 4
- cmake --build . --config Release --target install
- - name: build-x86
- run: |
- mkdir build-x86; cd build-x86
- cmake -T v141,host=x64 -A Win32 -DCMAKE_INSTALL_PREFIX=install -DNCNN_VERSION_STRING="${{ needs.setup.outputs.VERSION }}" -Dprotobuf_DIR="$env:GITHUB_WORKSPACE\protobuf-install\x86\cmake" -DNCNN_VULKAN=ON -DNCNN_BUILD_EXAMPLES=OFF -DNCNN_BUILD_TOOLS=ON -DNCNN_BUILD_BENCHMARK=OFF ..
- cmake --build . --config Release -j 4
- cmake --build . --config Release --target install
- - name: build-x64
- run: |
- mkdir build-x64; cd build-x64
- cmake -T v141,host=x64 -A x64 -DCMAKE_INSTALL_PREFIX=install -DNCNN_VERSION_STRING="${{ needs.setup.outputs.VERSION }}" -Dprotobuf_DIR="$env:GITHUB_WORKSPACE\protobuf-install\x64\cmake" -DNCNN_VULKAN=ON -DNCNN_BUILD_EXAMPLES=OFF -DNCNN_BUILD_TOOLS=ON -DNCNN_BUILD_BENCHMARK=OFF ..
- cmake --build . --config Release -j 4
- cmake --build . --config Release --target install
- - name: package
- run: |
- mkdir ${{ env.PACKAGENAME }}
- mkdir ${{ env.PACKAGENAME }}/x86
- mkdir ${{ env.PACKAGENAME }}/x64
- Copy-Item -Verbose -Recurse -Path "build-x86\install\*" -Destination "${{ env.PACKAGENAME }}\x86"
- Copy-Item -Verbose -Recurse -Path "build-x64\install\*" -Destination "${{ env.PACKAGENAME }}\x64"
- 7z a -r ${{ env.PACKAGENAME }}.zip ${{ env.PACKAGENAME }}
- - name: upload-zip
- uses: actions/upload-artifact@v4
- with:
- name: ${{ env.PACKAGENAME }}
- path: ${{ env.PACKAGENAME }}.zip
-
- windows-vs2017-shared:
- needs: [setup]
- runs-on: windows-2019
- env:
- PACKAGENAME: ncnn-${{ needs.setup.outputs.VERSION }}-windows-vs2017-shared
- UseMultiToolTask: true
- steps:
- - uses: actions/checkout@v4
- with:
- submodules: true
- - name: cache-protobuf
- id: cache-protobuf
- uses: actions/cache@v4
- with:
- path: "protobuf-install"
- key: protobuf-vs2017-x86-x64-install
- - name: protobuf
- if: steps.cache-protobuf.outputs.cache-hit != 'true'
- run: |
- Invoke-WebRequest -Uri https://github.com/protocolbuffers/protobuf/archive/v3.11.2.zip -OutFile protobuf-3.11.2.zip
- 7z x ./protobuf-3.11.2.zip
- cd protobuf-3.11.2
- mkdir build-x86; cd build-x86;
- cmake -T v141,host=x64 -A Win32 -DCMAKE_INSTALL_PREFIX="$env:GITHUB_WORKSPACE\protobuf-install\x86" -Dprotobuf_BUILD_TESTS=OFF -Dprotobuf_MSVC_STATIC_RUNTIME=OFF ../cmake
- cmake --build . --config Release -j 4
- cmake --build . --config Release --target install
- cd ..
- mkdir build-x64; cd build-x64;
- cmake -T v141,host=x64 -A x64 -DCMAKE_INSTALL_PREFIX="$env:GITHUB_WORKSPACE\protobuf-install\x64" -Dprotobuf_BUILD_TESTS=OFF -Dprotobuf_MSVC_STATIC_RUNTIME=OFF ../cmake
- cmake --build . --config Release -j 4
- cmake --build . --config Release --target install
- - name: build-x86
- run: |
- mkdir build-x86; cd build-x86
- cmake -T v141,host=x64 -A Win32 -DCMAKE_INSTALL_PREFIX=install -DNCNN_VERSION_STRING="${{ needs.setup.outputs.VERSION }}" -Dprotobuf_DIR="$env:GITHUB_WORKSPACE\protobuf-install\x86\cmake" -DNCNN_VULKAN=ON -DNCNN_BUILD_EXAMPLES=OFF -DNCNN_BUILD_TOOLS=ON -DNCNN_BUILD_BENCHMARK=OFF -DNCNN_SHARED_LIB=ON ..
- cmake --build . --config Release -j 4
- cmake --build . --config Release --target install
- - name: build-x64
- run: |
- mkdir build-x64; cd build-x64
- cmake -T v141,host=x64 -A x64 -DCMAKE_INSTALL_PREFIX=install -DNCNN_VERSION_STRING="${{ needs.setup.outputs.VERSION }}" -Dprotobuf_DIR="$env:GITHUB_WORKSPACE\protobuf-install\x64\cmake" -DNCNN_VULKAN=ON -DNCNN_BUILD_EXAMPLES=OFF -DNCNN_BUILD_TOOLS=ON -DNCNN_BUILD_BENCHMARK=OFF -DNCNN_SHARED_LIB=ON ..
- cmake --build . --config Release -j 4
- cmake --build . --config Release --target install
- - name: package
- run: |
- mkdir ${{ env.PACKAGENAME }}
- mkdir ${{ env.PACKAGENAME }}/x86
- mkdir ${{ env.PACKAGENAME }}/x64
- Copy-Item -Verbose -Recurse -Path "build-x86\install\*" -Destination "${{ env.PACKAGENAME }}\x86"
- Copy-Item -Verbose -Recurse -Path "build-x64\install\*" -Destination "${{ env.PACKAGENAME }}\x64"
- 7z a -r ${{ env.PACKAGENAME }}.zip ${{ env.PACKAGENAME }}
- - name: upload-zip
- uses: actions/upload-artifact@v4
- with:
- name: ${{ env.PACKAGENAME }}
- path: ${{ env.PACKAGENAME }}.zip
-
- windows-vs2019:
- needs: [setup]
- runs-on: windows-latest
- env:
- PACKAGENAME: ncnn-${{ needs.setup.outputs.VERSION }}-windows-vs2019
- UseMultiToolTask: true
- steps:
- - uses: actions/checkout@v4
- with:
- submodules: true
- - name: cache-protobuf
- id: cache-protobuf
- uses: actions/cache@v4
- with:
- path: "protobuf-install"
- key: protobuf-vs2019-x86-x64-install
- - name: protobuf
- if: steps.cache-protobuf.outputs.cache-hit != 'true'
- run: |
- Invoke-WebRequest -Uri https://github.com/protocolbuffers/protobuf/archive/v3.11.2.zip -OutFile protobuf-3.11.2.zip
- 7z x ./protobuf-3.11.2.zip
- cd protobuf-3.11.2
- mkdir build-x86; cd build-x86;
- cmake -T v142,host=x64 -A Win32 -DCMAKE_INSTALL_PREFIX="$env:GITHUB_WORKSPACE\protobuf-install\x86" -Dprotobuf_BUILD_TESTS=OFF -Dprotobuf_MSVC_STATIC_RUNTIME=OFF ../cmake
- cmake --build . --config Release -j 4
- cmake --build . --config Release --target install
- cd ..
- mkdir build-x64; cd build-x64;
- cmake -DCMAKE_INSTALL_PREFIX="$env:GITHUB_WORKSPACE\protobuf-install\x64" -Dprotobuf_BUILD_TESTS=OFF -Dprotobuf_MSVC_STATIC_RUNTIME=OFF ../cmake
- cmake --build . --config Release -j 4
- cmake --build . --config Release --target install
- - name: build-x86
- run: |
- mkdir build-x86; cd build-x86
- cmake -T v142,host=x64 -A Win32 -DCMAKE_INSTALL_PREFIX=install -DNCNN_VERSION_STRING="${{ needs.setup.outputs.VERSION }}" -Dprotobuf_DIR="$env:GITHUB_WORKSPACE\protobuf-install\x86\cmake" -DNCNN_VULKAN=ON -DNCNN_BUILD_EXAMPLES=OFF -DNCNN_BUILD_TOOLS=ON -DNCNN_BUILD_BENCHMARK=OFF ..
- cmake --build . --config Release -j 4
- cmake --build . --config Release --target install
- - name: build-x64
- run: |
- mkdir build-x64; cd build-x64
- cmake -DCMAKE_INSTALL_PREFIX=install -DNCNN_VERSION_STRING="${{ needs.setup.outputs.VERSION }}" -Dprotobuf_DIR="$env:GITHUB_WORKSPACE\protobuf-install\x64\cmake" -DNCNN_VULKAN=ON -DNCNN_BUILD_EXAMPLES=OFF -DNCNN_BUILD_TOOLS=ON -DNCNN_BUILD_BENCHMARK=OFF ..
- cmake --build . --config Release -j 4
- cmake --build . --config Release --target install
- - name: build-arm
- run: |
- mkdir build-arm; cd build-arm
- cmake -T v142,host=x64 -A arm -DCMAKE_INSTALL_PREFIX=install -DNCNN_VERSION_STRING="${{ needs.setup.outputs.VERSION }}" -DNCNN_VULKAN=ON -DNCNN_BUILD_EXAMPLES=OFF -DNCNN_BUILD_TOOLS=ON -DNCNN_BUILD_BENCHMARK=OFF ..
- cmake --build . --config Release -j 4
- cmake --build . --config Release --target install
- - name: build-arm64
- run: |
- mkdir build-arm64; cd build-arm64
- cmake -T v142,host=x64 -A arm64 -DCMAKE_INSTALL_PREFIX=install -DNCNN_VERSION_STRING="${{ needs.setup.outputs.VERSION }}" -DNCNN_VULKAN=ON -DNCNN_BUILD_EXAMPLES=OFF -DNCNN_BUILD_TOOLS=ON -DNCNN_BUILD_BENCHMARK=OFF ..
- cmake --build . --config Release -j 4
- cmake --build . --config Release --target install
- - name: package
- run: |
- mkdir ${{ env.PACKAGENAME }}
- mkdir ${{ env.PACKAGENAME }}/x86
- mkdir ${{ env.PACKAGENAME }}/x64
- mkdir ${{ env.PACKAGENAME }}/arm
- mkdir ${{ env.PACKAGENAME }}/arm64
- Copy-Item -Verbose -Recurse -Path "build-x86\install\*" -Destination "${{ env.PACKAGENAME }}\x86"
- Copy-Item -Verbose -Recurse -Path "build-x64\install\*" -Destination "${{ env.PACKAGENAME }}\x64"
- Copy-Item -Verbose -Recurse -Path "build-arm\install\*" -Destination "${{ env.PACKAGENAME }}\arm"
- Copy-Item -Verbose -Recurse -Path "build-arm64\install\*" -Destination "${{ env.PACKAGENAME }}\arm64"
- 7z a -r ${{ env.PACKAGENAME }}.zip ${{ env.PACKAGENAME }}
- - name: upload-zip
- uses: actions/upload-artifact@v4
- with:
- name: ${{ env.PACKAGENAME }}
- path: ${{ env.PACKAGENAME }}.zip
-
- windows-vs2019-shared:
- needs: [setup]
- runs-on: windows-latest
- env:
- PACKAGENAME: ncnn-${{ needs.setup.outputs.VERSION }}-windows-vs2019-shared
- UseMultiToolTask: true
- steps:
- - uses: actions/checkout@v4
- with:
- submodules: true
- - name: cache-protobuf
- id: cache-protobuf
- uses: actions/cache@v4
- with:
- path: "protobuf-install"
- key: protobuf-vs2019-x86-x64-install
- - name: protobuf
- if: steps.cache-protobuf.outputs.cache-hit != 'true'
- run: |
- Invoke-WebRequest -Uri https://github.com/protocolbuffers/protobuf/archive/v3.11.2.zip -OutFile protobuf-3.11.2.zip
- 7z x ./protobuf-3.11.2.zip
- cd protobuf-3.11.2
- mkdir build-x86; cd build-x86;
- cmake -T v142,host=x64 -A Win32 -DCMAKE_INSTALL_PREFIX="$env:GITHUB_WORKSPACE\protobuf-install\x86" -Dprotobuf_BUILD_TESTS=OFF -Dprotobuf_MSVC_STATIC_RUNTIME=OFF ../cmake
- cmake --build . --config Release -j 4
- cmake --build . --config Release --target install
- cd ..
- mkdir build-x64; cd build-x64;
- cmake -DCMAKE_INSTALL_PREFIX="$env:GITHUB_WORKSPACE\protobuf-install\x64" -Dprotobuf_BUILD_TESTS=OFF -Dprotobuf_MSVC_STATIC_RUNTIME=OFF ../cmake
- cmake --build . --config Release -j 4
- cmake --build . --config Release --target install
- - name: build-x86
- run: |
- mkdir build-x86; cd build-x86
- cmake -T v142,host=x64 -A Win32 -DCMAKE_INSTALL_PREFIX=install -DNCNN_VERSION_STRING="${{ needs.setup.outputs.VERSION }}" -Dprotobuf_DIR="$env:GITHUB_WORKSPACE\protobuf-install\x86\cmake" -DNCNN_VULKAN=ON -DNCNN_BUILD_EXAMPLES=OFF -DNCNN_BUILD_TOOLS=ON -DNCNN_BUILD_BENCHMARK=OFF -DNCNN_SHARED_LIB=ON ..
- cmake --build . --config Release -j 4
- cmake --build . --config Release --target install
- - name: build-x64
- run: |
- mkdir build-x64; cd build-x64
- cmake -DCMAKE_INSTALL_PREFIX=install -DNCNN_VERSION_STRING="${{ needs.setup.outputs.VERSION }}" -Dprotobuf_DIR="$env:GITHUB_WORKSPACE\protobuf-install\x64\cmake" -DNCNN_VULKAN=ON -DNCNN_BUILD_EXAMPLES=OFF -DNCNN_BUILD_TOOLS=ON -DNCNN_BUILD_BENCHMARK=OFF -DNCNN_SHARED_LIB=ON ..
- cmake --build . --config Release -j 4
- cmake --build . --config Release --target install
- - name: build-arm
- run: |
- mkdir build-arm; cd build-arm
- cmake -T v142,host=x64 -A arm -DCMAKE_INSTALL_PREFIX=install -DNCNN_VERSION_STRING="${{ needs.setup.outputs.VERSION }}" -DNCNN_VULKAN=ON -DNCNN_BUILD_EXAMPLES=OFF -DNCNN_BUILD_TOOLS=ON -DNCNN_BUILD_BENCHMARK=OFF -DNCNN_SHARED_LIB=ON ..
- cmake --build . --config Release -j 4
- cmake --build . --config Release --target install
- - name: build-arm64
- run: |
- mkdir build-arm64; cd build-arm64
- cmake -T v142,host=x64 -A arm64 -DCMAKE_INSTALL_PREFIX=install -DNCNN_VERSION_STRING="${{ needs.setup.outputs.VERSION }}" -DNCNN_VULKAN=ON -DNCNN_BUILD_EXAMPLES=OFF -DNCNN_BUILD_TOOLS=ON -DNCNN_BUILD_BENCHMARK=OFF -DNCNN_SHARED_LIB=ON ..
- cmake --build . --config Release -j 4
- cmake --build . --config Release --target install
- - name: package
- run: |
- mkdir ${{ env.PACKAGENAME }}
- mkdir ${{ env.PACKAGENAME }}/x86
- mkdir ${{ env.PACKAGENAME }}/x64
- mkdir ${{ env.PACKAGENAME }}/arm
- mkdir ${{ env.PACKAGENAME }}/arm64
- Copy-Item -Verbose -Recurse -Path "build-x86\install\*" -Destination "${{ env.PACKAGENAME }}\x86"
- Copy-Item -Verbose -Recurse -Path "build-x64\install\*" -Destination "${{ env.PACKAGENAME }}\x64"
- Copy-Item -Verbose -Recurse -Path "build-arm\install\*" -Destination "${{ env.PACKAGENAME }}\arm"
- Copy-Item -Verbose -Recurse -Path "build-arm64\install\*" -Destination "${{ env.PACKAGENAME }}\arm64"
- 7z a -r ${{ env.PACKAGENAME }}.zip ${{ env.PACKAGENAME }}
- - name: upload-zip
- uses: actions/upload-artifact@v4
- with:
- name: ${{ env.PACKAGENAME }}
- path: ${{ env.PACKAGENAME }}.zip
-
- windows-vs2022:
- needs: [setup]
- runs-on: windows-latest
- env:
- PACKAGENAME: ncnn-${{ needs.setup.outputs.VERSION }}-windows-vs2022
- UseMultiToolTask: true
- steps:
- - uses: actions/checkout@v4
- with:
- submodules: true
- - name: cache-protobuf
- id: cache-protobuf
- uses: actions/cache@v4
- with:
- path: "protobuf-install"
- key: protobuf-vs2022-x86-x64-install
- - name: protobuf
- if: steps.cache-protobuf.outputs.cache-hit != 'true'
- run: |
- Invoke-WebRequest -Uri https://github.com/protocolbuffers/protobuf/archive/v3.11.2.zip -OutFile protobuf-3.11.2.zip
- 7z x ./protobuf-3.11.2.zip
- cd protobuf-3.11.2
- mkdir build-x86; cd build-x86;
- cmake -T v143,host=x64 -A Win32 -DCMAKE_INSTALL_PREFIX="$env:GITHUB_WORKSPACE\protobuf-install\x86" -Dprotobuf_BUILD_TESTS=OFF -Dprotobuf_MSVC_STATIC_RUNTIME=OFF ../cmake
- cmake --build . --config Release -j 4
- cmake --build . --config Release --target install
- cd ..
- mkdir build-x64; cd build-x64;
- cmake -DCMAKE_INSTALL_PREFIX="$env:GITHUB_WORKSPACE\protobuf-install\x64" -Dprotobuf_BUILD_TESTS=OFF -Dprotobuf_MSVC_STATIC_RUNTIME=OFF ../cmake
- cmake --build . --config Release -j 4
- cmake --build . --config Release --target install
- - name: build-x86
- run: |
- mkdir build-x86; cd build-x86
- cmake -T v143,host=x64 -A Win32 -DCMAKE_INSTALL_PREFIX=install -DNCNN_VERSION_STRING="${{ needs.setup.outputs.VERSION }}" -Dprotobuf_DIR="$env:GITHUB_WORKSPACE\protobuf-install\x86\cmake" -DNCNN_VULKAN=ON -DNCNN_BUILD_EXAMPLES=OFF -DNCNN_BUILD_TOOLS=ON -DNCNN_BUILD_BENCHMARK=OFF ..
- cmake --build . --config Release -j 4
- cmake --build . --config Release --target install
- - name: build-x64
- run: |
- mkdir build-x64; cd build-x64
- cmake -DCMAKE_INSTALL_PREFIX=install -DNCNN_VERSION_STRING="${{ needs.setup.outputs.VERSION }}" -Dprotobuf_DIR="$env:GITHUB_WORKSPACE\protobuf-install\x64\cmake" -DNCNN_VULKAN=ON -DNCNN_BUILD_EXAMPLES=OFF -DNCNN_BUILD_TOOLS=ON -DNCNN_BUILD_BENCHMARK=OFF ..
- cmake --build . --config Release -j 4
- cmake --build . --config Release --target install
- - name: build-arm
- run: |
- mkdir build-arm; cd build-arm
- cmake -T v143,host=x64 -A arm -DCMAKE_INSTALL_PREFIX=install -DNCNN_VERSION_STRING="${{ needs.setup.outputs.VERSION }}" -DNCNN_VULKAN=ON -DNCNN_BUILD_EXAMPLES=OFF -DNCNN_BUILD_TOOLS=ON -DNCNN_BUILD_BENCHMARK=OFF ..
- cmake --build . --config Release -j 4
- cmake --build . --config Release --target install
- - name: build-arm64
- run: |
- mkdir build-arm64; cd build-arm64
- cmake -T v143,host=x64 -A arm64 -DCMAKE_INSTALL_PREFIX=install -DNCNN_VERSION_STRING="${{ needs.setup.outputs.VERSION }}" -DNCNN_VULKAN=ON -DNCNN_BUILD_EXAMPLES=OFF -DNCNN_BUILD_TOOLS=ON -DNCNN_BUILD_BENCHMARK=OFF ..
- cmake --build . --config Release -j 4
- cmake --build . --config Release --target install
+ mkdir build-x64; cd build-x64
+ cmake ${{ env.NCNN_CMAKE_OPTIONS }} -A x64 -Dprotobuf_DIR="$env:GITHUB_WORKSPACE\protobuf-install\x64\cmake" ..
+ cmake --build . --config Release -j 4
+ cmake --build . --config Release --target install
+ - name: build-arm
+ if: matrix.opt.toolset-version == 'v142' || matrix.opt.toolset-version == 'v143'
+ run: |
+ mkdir build-arm; cd build-arm
+ cmake ${{ env.NCNN_CMAKE_OPTIONS }} -A arm ..
+ cmake --build . --config Release -j 4
+ cmake --build . --config Release --target install
+ - name: build-arm64
+ if: matrix.opt.toolset-version == 'v142' || matrix.opt.toolset-version == 'v143'
+ run: |
+ mkdir build-arm64; cd build-arm64
+ cmake ${{ env.NCNN_CMAKE_OPTIONS }} -A arm64 ..
+ cmake --build . --config Release -j 4
+ cmake --build . --config Release --target install
- name: package
+ if: matrix.opt.toolset-version == 'v140' || matrix.opt.toolset-version == 'v141'
run: |
mkdir ${{ env.PACKAGENAME }}
mkdir ${{ env.PACKAGENAME }}/x86
mkdir ${{ env.PACKAGENAME }}/x64
- mkdir ${{ env.PACKAGENAME }}/arm
- mkdir ${{ env.PACKAGENAME }}/arm64
Copy-Item -Verbose -Recurse -Path "build-x86\install\*" -Destination "${{ env.PACKAGENAME }}\x86"
Copy-Item -Verbose -Recurse -Path "build-x64\install\*" -Destination "${{ env.PACKAGENAME }}\x64"
- Copy-Item -Verbose -Recurse -Path "build-arm\install\*" -Destination "${{ env.PACKAGENAME }}\arm"
- Copy-Item -Verbose -Recurse -Path "build-arm64\install\*" -Destination "${{ env.PACKAGENAME }}\arm64"
7z a -r ${{ env.PACKAGENAME }}.zip ${{ env.PACKAGENAME }}
- - name: upload-zip
- uses: actions/upload-artifact@v4
- with:
- name: ${{ env.PACKAGENAME }}
- path: ${{ env.PACKAGENAME }}.zip
-
- windows-vs2022-shared:
- needs: [setup]
- runs-on: windows-latest
- env:
- PACKAGENAME: ncnn-${{ needs.setup.outputs.VERSION }}-windows-vs2022-shared
- UseMultiToolTask: true
- steps:
- - uses: actions/checkout@v4
- with:
- submodules: true
- - name: cache-protobuf
- id: cache-protobuf
- uses: actions/cache@v4
- with:
- path: "protobuf-install"
- key: protobuf-vs2022-x86-x64-install
- - name: protobuf
- if: steps.cache-protobuf.outputs.cache-hit != 'true'
- run: |
- Invoke-WebRequest -Uri https://github.com/protocolbuffers/protobuf/archive/v3.11.2.zip -OutFile protobuf-3.11.2.zip
- 7z x ./protobuf-3.11.2.zip
- cd protobuf-3.11.2
- mkdir build-x86; cd build-x86;
- cmake -T v143,host=x64 -A Win32 -DCMAKE_INSTALL_PREFIX="$env:GITHUB_WORKSPACE\protobuf-install\x86" -Dprotobuf_BUILD_TESTS=OFF -Dprotobuf_MSVC_STATIC_RUNTIME=OFF ../cmake
- cmake --build . --config Release -j 4
- cmake --build . --config Release --target install
- cd ..
- mkdir build-x64; cd build-x64;
- cmake -DCMAKE_INSTALL_PREFIX="$env:GITHUB_WORKSPACE\protobuf-install\x64" -Dprotobuf_BUILD_TESTS=OFF -Dprotobuf_MSVC_STATIC_RUNTIME=OFF ../cmake
- cmake --build . --config Release -j 4
- cmake --build . --config Release --target install
- - name: build-x86
- run: |
- mkdir build-x86; cd build-x86
- cmake -T v143,host=x64 -A Win32 -DCMAKE_INSTALL_PREFIX=install -DNCNN_VERSION_STRING="${{ needs.setup.outputs.VERSION }}" -Dprotobuf_DIR="$env:GITHUB_WORKSPACE\protobuf-install\x86\cmake" -DNCNN_VULKAN=ON -DNCNN_BUILD_EXAMPLES=OFF -DNCNN_BUILD_TOOLS=ON -DNCNN_BUILD_BENCHMARK=OFF -DNCNN_SHARED_LIB=ON ..
- cmake --build . --config Release -j 4
- cmake --build . --config Release --target install
- - name: build-x64
- run: |
- mkdir build-x64; cd build-x64
- cmake -DCMAKE_INSTALL_PREFIX=install -DNCNN_VERSION_STRING="${{ needs.setup.outputs.VERSION }}" -Dprotobuf_DIR="$env:GITHUB_WORKSPACE\protobuf-install\x64\cmake" -DNCNN_VULKAN=ON -DNCNN_BUILD_EXAMPLES=OFF -DNCNN_BUILD_TOOLS=ON -DNCNN_BUILD_BENCHMARK=OFF -DNCNN_SHARED_LIB=ON ..
- cmake --build . --config Release -j 4
- cmake --build . --config Release --target install
- - name: build-arm
- run: |
- mkdir build-arm; cd build-arm
- cmake -T v143,host=x64 -A arm -DCMAKE_INSTALL_PREFIX=install -DNCNN_VERSION_STRING="${{ needs.setup.outputs.VERSION }}" -DNCNN_VULKAN=ON -DNCNN_BUILD_EXAMPLES=OFF -DNCNN_BUILD_TOOLS=ON -DNCNN_BUILD_BENCHMARK=OFF -DNCNN_SHARED_LIB=ON ..
- cmake --build . --config Release -j 4
- cmake --build . --config Release --target install
- - name: build-arm64
- run: |
- mkdir build-arm64; cd build-arm64
- cmake -T v143,host=x64 -A arm64 -DCMAKE_INSTALL_PREFIX=install -DNCNN_VERSION_STRING="${{ needs.setup.outputs.VERSION }}" -DNCNN_VULKAN=ON -DNCNN_BUILD_EXAMPLES=OFF -DNCNN_BUILD_TOOLS=ON -DNCNN_BUILD_BENCHMARK=OFF -DNCNN_SHARED_LIB=ON ..
- cmake --build . --config Release -j 4
- cmake --build . --config Release --target install
- name: package
+ if: matrix.opt.toolset-version == 'v142' || matrix.opt.toolset-version == 'v143'
run: |
mkdir ${{ env.PACKAGENAME }}
mkdir ${{ env.PACKAGENAME }}/x86
@@ -3087,30 +2155,49 @@ jobs:
with:
path: artifacts
- - name: create-xcframwork
+ - name: unzip
run: |
- mkdir -p ncnn-macos
mkdir -p ncnn-ios
+ mkdir -p ncnn-ios-vulkan
mkdir -p ncnn-ios-simulator
+ mkdir -p ncnn-ios-simulator-vulkan
mkdir -p ncnn-mac-catalyst
- mkdir -p ncnn-watchos
- mkdir -p ncnn-watchos-simulator
+ mkdir -p ncnn-mac-catalyst-vulkan
+ mkdir -p ncnn-macos
+ mkdir -p ncnn-macos-vulkan
mkdir -p ncnn-tvos
+ mkdir -p ncnn-tvos-vulkan
mkdir -p ncnn-tvos-simulator
+ mkdir -p ncnn-tvos-simulator-vulkan
mkdir -p ncnn-visionos
+ mkdir -p ncnn-visionos-vulkan
mkdir -p ncnn-visionos-simulator
+ mkdir -p ncnn-visionos-simulator-vulkan
+ mkdir -p ncnn-watchos
+ mkdir -p ncnn-watchos-simulator
- unzip -q artifacts/ncnn-${{ needs.setup.outputs.VERSION }}-macos/ncnn-${{ needs.setup.outputs.VERSION }}-macos.zip -d ncnn-macos
unzip -q artifacts/ncnn-${{ needs.setup.outputs.VERSION }}-ios/ncnn-${{ needs.setup.outputs.VERSION }}-ios.zip -d ncnn-ios
+ unzip -q artifacts/ncnn-${{ needs.setup.outputs.VERSION }}-ios-vulkan/ncnn-${{ needs.setup.outputs.VERSION }}-ios-vulkan.zip -d ncnn-ios-vulkan
unzip -q artifacts/ncnn-${{ needs.setup.outputs.VERSION }}-ios-simulator/ncnn-${{ needs.setup.outputs.VERSION }}-ios-simulator.zip -d ncnn-ios-simulator
+ unzip -q artifacts/ncnn-${{ needs.setup.outputs.VERSION }}-ios-simulator-vulkan/ncnn-${{ needs.setup.outputs.VERSION }}-ios-simulator-vulkan.zip -d ncnn-ios-simulator-vulkan
unzip -q artifacts/ncnn-${{ needs.setup.outputs.VERSION }}-mac-catalyst/ncnn-${{ needs.setup.outputs.VERSION }}-mac-catalyst.zip -d ncnn-mac-catalyst
- unzip -q artifacts/ncnn-${{ needs.setup.outputs.VERSION }}-watchos/ncnn-${{ needs.setup.outputs.VERSION }}-watchos.zip -d ncnn-watchos
- unzip -q artifacts/ncnn-${{ needs.setup.outputs.VERSION }}-watchos-simulator/ncnn-${{ needs.setup.outputs.VERSION }}-watchos-simulator.zip -d ncnn-watchos-simulator
+ unzip -q artifacts/ncnn-${{ needs.setup.outputs.VERSION }}-mac-catalyst-vulkan/ncnn-${{ needs.setup.outputs.VERSION }}-mac-catalyst-vulkan.zip -d ncnn-mac-catalyst-vulkan
+ unzip -q artifacts/ncnn-${{ needs.setup.outputs.VERSION }}-macos/ncnn-${{ needs.setup.outputs.VERSION }}-macos.zip -d ncnn-macos
+ unzip -q artifacts/ncnn-${{ needs.setup.outputs.VERSION }}-macos-vulkan/ncnn-${{ needs.setup.outputs.VERSION }}-macos-vulkan.zip -d ncnn-macos-vulkan
unzip -q artifacts/ncnn-${{ needs.setup.outputs.VERSION }}-tvos/ncnn-${{ needs.setup.outputs.VERSION }}-tvos.zip -d ncnn-tvos
+ unzip -q artifacts/ncnn-${{ needs.setup.outputs.VERSION }}-tvos-vulkan/ncnn-${{ needs.setup.outputs.VERSION }}-tvos-vulkan.zip -d ncnn-tvos-vulkan
unzip -q artifacts/ncnn-${{ needs.setup.outputs.VERSION }}-tvos-simulator/ncnn-${{ needs.setup.outputs.VERSION }}-tvos-simulator.zip -d ncnn-tvos-simulator
+ unzip -q artifacts/ncnn-${{ needs.setup.outputs.VERSION }}-tvos-simulator-vulkan/ncnn-${{ needs.setup.outputs.VERSION }}-tvos-simulator-vulkan.zip -d ncnn-tvos-simulator-vulkan
unzip -q artifacts/ncnn-${{ needs.setup.outputs.VERSION }}-visionos/ncnn-${{ needs.setup.outputs.VERSION }}-visionos.zip -d ncnn-visionos
+ unzip -q artifacts/ncnn-${{ needs.setup.outputs.VERSION }}-visionos-vulkan/ncnn-${{ needs.setup.outputs.VERSION }}-visionos-vulkan.zip -d ncnn-visionos-vulkan
unzip -q artifacts/ncnn-${{ needs.setup.outputs.VERSION }}-visionos-simulator/ncnn-${{ needs.setup.outputs.VERSION }}-visionos-simulator.zip -d ncnn-visionos-simulator
+ unzip -q artifacts/ncnn-${{ needs.setup.outputs.VERSION }}-visionos-simulator-vulkan/ncnn-${{ needs.setup.outputs.VERSION }}-visionos-simulator-vulkan.zip -d ncnn-visionos-simulator-vulkan
+ unzip -q artifacts/ncnn-${{ needs.setup.outputs.VERSION }}-watchos/ncnn-${{ needs.setup.outputs.VERSION }}-watchos.zip -d ncnn-watchos
+ unzip -q artifacts/ncnn-${{ needs.setup.outputs.VERSION }}-watchos-simulator/ncnn-${{ needs.setup.outputs.VERSION }}-watchos-simulator.zip -d ncnn-watchos-simulator
+ - name: create-xcframwork
+ run: |
+ rm -rf openmp.xcframework
xcodebuild -create-xcframework \
-framework ncnn-macos/openmp.framework \
-framework ncnn-ios/openmp.framework \
@@ -3124,6 +2211,7 @@ jobs:
-framework ncnn-visionos-simulator/openmp.framework \
-output openmp.xcframework
+ rm -rf ncnn.xcframework
xcodebuild -create-xcframework \
-framework ncnn-macos/ncnn.framework \
-framework ncnn-ios/ncnn.framework \
@@ -3139,48 +2227,9 @@ jobs:
rm -f ${{ env.PACKAGENAME }}.zip
zip -9 -y -r ${{ env.PACKAGENAME }}.zip openmp.xcframework ncnn.xcframework
- - name: upload-zip
- uses: actions/upload-artifact@v4
- with:
- name: ${{ env.PACKAGENAME }}
- path: ${{ env.PACKAGENAME }}.zip
-
- apple-gpu:
- needs: [setup, macos-gpu, ios-gpu, ios-simulator-gpu, mac-catalyst-gpu, watchos, watchos-simulator, tvos-gpu, tvos-simulator-gpu, visionos, visionos-simulator]
- runs-on: macos-13
- env:
- PACKAGENAME: ncnn-${{ needs.setup.outputs.VERSION }}-apple-vulkan
- steps:
- - run: sudo xcode-select --switch /Applications/Xcode_15.2.app
- - name: download
- uses: actions/download-artifact@v4
- with:
- path: artifacts
-
- - name: create-xcframwork
+ - name: create-xcframwork-vulkan
run: |
- mkdir -p ncnn-macos-vulkan
- mkdir -p ncnn-ios-vulkan
- mkdir -p ncnn-ios-simulator-vulkan
- mkdir -p ncnn-mac-catalyst-vulkan
- mkdir -p ncnn-watchos
- mkdir -p ncnn-watchos-simulator
- mkdir -p ncnn-tvos-vulkan
- mkdir -p ncnn-tvos-simulator-vulkan
- mkdir -p ncnn-visionos
- mkdir -p ncnn-visionos-simulator
-
- unzip -q artifacts/ncnn-${{ needs.setup.outputs.VERSION }}-macos-vulkan/ncnn-${{ needs.setup.outputs.VERSION }}-macos-vulkan.zip -d ncnn-macos-vulkan
- unzip -q artifacts/ncnn-${{ needs.setup.outputs.VERSION }}-ios-vulkan/ncnn-${{ needs.setup.outputs.VERSION }}-ios-vulkan.zip -d ncnn-ios-vulkan
- unzip -q artifacts/ncnn-${{ needs.setup.outputs.VERSION }}-ios-simulator-vulkan/ncnn-${{ needs.setup.outputs.VERSION }}-ios-simulator-vulkan.zip -d ncnn-ios-simulator-vulkan
- unzip -q artifacts/ncnn-${{ needs.setup.outputs.VERSION }}-mac-catalyst-vulkan/ncnn-${{ needs.setup.outputs.VERSION }}-mac-catalyst-vulkan.zip -d ncnn-mac-catalyst-vulkan
- unzip -q artifacts/ncnn-${{ needs.setup.outputs.VERSION }}-watchos/ncnn-${{ needs.setup.outputs.VERSION }}-watchos.zip -d ncnn-watchos
- unzip -q artifacts/ncnn-${{ needs.setup.outputs.VERSION }}-watchos-simulator/ncnn-${{ needs.setup.outputs.VERSION }}-watchos-simulator.zip -d ncnn-watchos-simulator
- unzip -q artifacts/ncnn-${{ needs.setup.outputs.VERSION }}-tvos-vulkan/ncnn-${{ needs.setup.outputs.VERSION }}-tvos-vulkan.zip -d ncnn-tvos-vulkan
- unzip -q artifacts/ncnn-${{ needs.setup.outputs.VERSION }}-tvos-simulator-vulkan/ncnn-${{ needs.setup.outputs.VERSION }}-tvos-simulator-vulkan.zip -d ncnn-tvos-simulator-vulkan
- unzip -q artifacts/ncnn-${{ needs.setup.outputs.VERSION }}-visionos/ncnn-${{ needs.setup.outputs.VERSION }}-visionos.zip -d ncnn-visionos
- unzip -q artifacts/ncnn-${{ needs.setup.outputs.VERSION }}-visionos-simulator/ncnn-${{ needs.setup.outputs.VERSION }}-visionos-simulator.zip -d ncnn-visionos-simulator
-
+ rm -rf openmp.xcframework
xcodebuild -create-xcframework \
-framework ncnn-macos-vulkan/openmp.framework \
-framework ncnn-ios-vulkan/openmp.framework \
@@ -3194,6 +2243,7 @@ jobs:
-framework ncnn-visionos-simulator/openmp.framework \
-output openmp.xcframework
+ rm -rf glslang.xcframework
xcodebuild -create-xcframework \
-framework ncnn-macos-vulkan/glslang.framework \
-framework ncnn-ios-vulkan/glslang.framework \
@@ -3201,8 +2251,11 @@ jobs:
-framework ncnn-mac-catalyst-vulkan/glslang.framework \
-framework ncnn-tvos-vulkan/glslang.framework \
-framework ncnn-tvos-simulator-vulkan/glslang.framework \
+ -framework ncnn-visionos-vulkan/glslang.framework \
+ -framework ncnn-visionos-simulator-vulkan/glslang.framework \
-output glslang.xcframework
+ rm -rf ncnn.xcframework
xcodebuild -create-xcframework \
-framework ncnn-macos-vulkan/ncnn.framework \
-framework ncnn-ios-vulkan/ncnn.framework \
@@ -3212,22 +2265,27 @@ jobs:
-framework ncnn-watchos-simulator/ncnn.framework \
-framework ncnn-tvos-vulkan/ncnn.framework \
-framework ncnn-tvos-simulator-vulkan/ncnn.framework \
- -framework ncnn-visionos/ncnn.framework \
- -framework ncnn-visionos-simulator/ncnn.framework \
+ -framework ncnn-visionos-vulkan/ncnn.framework \
+ -framework ncnn-visionos-simulator-vulkan/ncnn.framework \
-output ncnn.xcframework
- rm -f ${{ env.PACKAGENAME }}.zip
- zip -9 -y -r ${{ env.PACKAGENAME }}.zip openmp.xcframework glslang.xcframework ncnn.xcframework
+ rm -f ${{ env.PACKAGENAME }}-vulkan.zip
+ zip -9 -y -r ${{ env.PACKAGENAME }}-vulkan.zip openmp.xcframework glslang.xcframework ncnn.xcframework
- name: upload-zip
uses: actions/upload-artifact@v4
with:
name: ${{ env.PACKAGENAME }}
path: ${{ env.PACKAGENAME }}.zip
+ - name: upload-zip-vulkan
+ uses: actions/upload-artifact@v4
+ with:
+ name: ${{ env.PACKAGENAME }}-vulkan
+ path: ${{ env.PACKAGENAME }}-vulkan.zip
release:
permissions:
contents: write # for softprops/action-gh-release to create a release
- needs: [setup, full-source, ubuntu-2004, ubuntu-2004-shared, ubuntu-2204, ubuntu-2204-shared, macos, macos-gpu, ios, ios-gpu, ios-simulator, ios-simulator-gpu, mac-catalyst, mac-catalyst-gpu, watchos, watchos-simulator, tvos, tvos-simulator, android, android-shared, android-gpu, android-gpu-shared, webassembly, windows-vs2015, windows-vs2015-shared, windows-vs2017, windows-vs2017-shared, windows-vs2019, windows-vs2019-shared, windows-vs2022, windows-vs2022-shared, apple, apple-gpu]
+ needs: [setup, full-source, ubuntu, macos, ios, ios-simulator, mac-catalyst, watchos, watchos-simulator, tvos, tvos-simulator, android, webassembly, windows, apple]
runs-on: ubuntu-latest
steps:
- name: download
diff --git a/CMakeLists.txt b/CMakeLists.txt
index 309e3b8fbd0a..0f32a80c86ee 100644
--- a/CMakeLists.txt
+++ b/CMakeLists.txt
@@ -37,6 +37,11 @@ if(POLICY CMP0025)
cmake_policy(SET CMP0025 NEW)
endif()
+if(POLICY CMP0057)
+ # reference from https://cmake.org/cmake/help/latest/policy/CMP0057.html
+ cmake_policy(SET CMP0057 NEW)
+endif()
+
project(ncnn)
if(MSVC AND NOT CMAKE_VERSION VERSION_LESS "3.15")
diff --git a/README.md b/README.md
index a9bb1c116fa4..146b04b1a4ed 100644
--- a/README.md
+++ b/README.md
@@ -77,7 +77,7 @@ https://github.com/Tencent/ncnn/releases/latest
Source |
- [](https://github.com/Tencent/ncnn/releases/latest/download/ncnn-20240410-full-source.zip)
+ [](https://github.com/Tencent/ncnn/releases/latest/download/ncnn-20240820-full-source.zip)
|
@@ -97,8 +97,8 @@ https://github.com/Tencent/ncnn/releases/latest
Android |
- [](https://github.com/Tencent/ncnn/releases/latest/download/ncnn-20240410-android-vulkan.zip)
- [](https://github.com/Tencent/ncnn/releases/latest/download/ncnn-20240410-android.zip)
+ [](https://github.com/Tencent/ncnn/releases/latest/download/ncnn-20240820-android-vulkan.zip)
+ [](https://github.com/Tencent/ncnn/releases/latest/download/ncnn-20240820-android.zip)
|
@@ -111,8 +111,8 @@ https://github.com/Tencent/ncnn/releases/latest
| Android shared |
- [](https://github.com/Tencent/ncnn/releases/latest/download/ncnn-20240410-android-vulkan-shared.zip)
- [](https://github.com/Tencent/ncnn/releases/latest/download/ncnn-20240410-android-shared.zip)
+ [](https://github.com/Tencent/ncnn/releases/latest/download/ncnn-20240820-android-vulkan-shared.zip)
+ [](https://github.com/Tencent/ncnn/releases/latest/download/ncnn-20240820-android-shared.zip)
|
@@ -159,8 +159,8 @@ https://github.com/Tencent/ncnn/releases/latest
iOS |
- [](https://github.com/Tencent/ncnn/releases/latest/download/ncnn-20240410-ios-vulkan.zip)
- [](https://github.com/Tencent/ncnn/releases/latest/download/ncnn-20240410-ios.zip)
+ [](https://github.com/Tencent/ncnn/releases/latest/download/ncnn-20240820-ios-vulkan.zip)
+ [](https://github.com/Tencent/ncnn/releases/latest/download/ncnn-20240820-ios.zip)
|
@@ -173,8 +173,8 @@ https://github.com/Tencent/ncnn/releases/latest
| iOS-Simulator |
- [](https://github.com/Tencent/ncnn/releases/latest/download/ncnn-20240410-ios-simulator-vulkan.zip)
- [](https://github.com/Tencent/ncnn/releases/latest/download/ncnn-20240410-ios-simulator.zip)
+ [](https://github.com/Tencent/ncnn/releases/latest/download/ncnn-20240820-ios-simulator-vulkan.zip)
+ [](https://github.com/Tencent/ncnn/releases/latest/download/ncnn-20240820-ios-simulator.zip)
|
@@ -193,8 +193,8 @@ https://github.com/Tencent/ncnn/releases/latest
macOS |
- [](https://github.com/Tencent/ncnn/releases/latest/download/ncnn-20240410-macos-vulkan.zip)
- [](https://github.com/Tencent/ncnn/releases/latest/download/ncnn-20240410-macos.zip)
+ [](https://github.com/Tencent/ncnn/releases/latest/download/ncnn-20240820-macos-vulkan.zip)
+ [](https://github.com/Tencent/ncnn/releases/latest/download/ncnn-20240820-macos.zip)
|
@@ -207,8 +207,8 @@ https://github.com/Tencent/ncnn/releases/latest
| Mac-Catalyst |
- [](https://github.com/Tencent/ncnn/releases/latest/download/ncnn-20240410-mac-catalyst-vulkan.zip)
- [](https://github.com/Tencent/ncnn/releases/latest/download/ncnn-20240410-mac-catalyst.zip)
+ [](https://github.com/Tencent/ncnn/releases/latest/download/ncnn-20240820-mac-catalyst-vulkan.zip)
+ [](https://github.com/Tencent/ncnn/releases/latest/download/ncnn-20240820-mac-catalyst.zip)
|
@@ -221,7 +221,7 @@ https://github.com/Tencent/ncnn/releases/latest
| watchOS |
- [](https://github.com/Tencent/ncnn/releases/latest/download/ncnn-20240410-watchos.zip)
+ [](https://github.com/Tencent/ncnn/releases/latest/download/ncnn-20240820-watchos.zip)
|
@@ -234,7 +234,7 @@ https://github.com/Tencent/ncnn/releases/latest
| watchOS-Simulator |
- [](https://github.com/Tencent/ncnn/releases/latest/download/ncnn-20240410-watchos-simulator.zip)
+ [](https://github.com/Tencent/ncnn/releases/latest/download/ncnn-20240820-watchos-simulator.zip)
|
@@ -242,8 +242,8 @@ https://github.com/Tencent/ncnn/releases/latest
tvOS |
- [](https://github.com/Tencent/ncnn/releases/latest/download/ncnn-20240410-tvos-vulkan.zip)
- [](https://github.com/Tencent/ncnn/releases/latest/download/ncnn-20240410-tvos.zip)
+ [](https://github.com/Tencent/ncnn/releases/latest/download/ncnn-20240820-tvos-vulkan.zip)
+ [](https://github.com/Tencent/ncnn/releases/latest/download/ncnn-20240820-tvos.zip)
|
@@ -256,8 +256,8 @@ https://github.com/Tencent/ncnn/releases/latest
| tvOS-Simulator |
- [](https://github.com/Tencent/ncnn/releases/latest/download/ncnn-20240410-tvos-simulator-vulkan.zip)
- [](https://github.com/Tencent/ncnn/releases/latest/download/ncnn-20240410-tvos-simulator.zip)
+ [](https://github.com/Tencent/ncnn/releases/latest/download/ncnn-20240820-tvos-simulator-vulkan.zip)
+ [](https://github.com/Tencent/ncnn/releases/latest/download/ncnn-20240820-tvos-simulator.zip)
|
@@ -265,7 +265,8 @@ https://github.com/Tencent/ncnn/releases/latest
visionOS |
- [](https://github.com/Tencent/ncnn/releases/latest/download/ncnn-20240410-visionos.zip)
+ [](https://github.com/Tencent/ncnn/releases/latest/download/ncnn-20240820-visionos-vulkan.zip)
+ [](https://github.com/Tencent/ncnn/releases/latest/download/ncnn-20240820-visionos.zip)
|
@@ -278,7 +279,8 @@ https://github.com/Tencent/ncnn/releases/latest
| visionOS-Simulator |
- [](https://github.com/Tencent/ncnn/releases/latest/download/ncnn-20240410-visionos-simulator.zip)
+ [](https://github.com/Tencent/ncnn/releases/latest/download/ncnn-20240820-visionos-simulator-vulkan.zip)
+ [](https://github.com/Tencent/ncnn/releases/latest/download/ncnn-20240820-visionos-simulator.zip)
|
@@ -286,8 +288,8 @@ https://github.com/Tencent/ncnn/releases/latest
Apple xcframework |
- [](https://github.com/Tencent/ncnn/releases/latest/download/ncnn-20240410-apple-vulkan.zip)
- [](https://github.com/Tencent/ncnn/releases/latest/download/ncnn-20240410-apple.zip)
+ [](https://github.com/Tencent/ncnn/releases/latest/download/ncnn-20240820-apple-vulkan.zip)
+ [](https://github.com/Tencent/ncnn/releases/latest/download/ncnn-20240820-apple.zip)
|
@@ -296,10 +298,10 @@ https://github.com/Tencent/ncnn/releases/latest
|
-
+ |
|
-
+ |
- [Build for Linux / NVIDIA Jetson / Raspberry Pi3, Pi4 / POWER](https://github.com/Tencent/ncnn/wiki/how-to-build#build-for-linux)
@@ -309,11 +311,11 @@ https://github.com/Tencent/ncnn/releases/latest
| Ubuntu 20.04 |
- [](https://github.com/Tencent/ncnn/releases/latest/download/ncnn-20240410-ubuntu-2004.zip)
- [](https://github.com/Tencent/ncnn/releases/latest/download/ncnn-20240410-ubuntu-2004-shared.zip)
+ [](https://github.com/Tencent/ncnn/releases/latest/download/ncnn-20240820-ubuntu-2004.zip)
+ [](https://github.com/Tencent/ncnn/releases/latest/download/ncnn-20240820-ubuntu-2004-shared.zip)
|
-
+ |
[](https://github.com/Tencent/ncnn/actions?query=workflow%3Alinux-x64-gpu-gcc)
@@ -323,8 +325,17 @@ https://github.com/Tencent/ncnn/releases/latest
| Ubuntu 22.04 |
- [](https://github.com/Tencent/ncnn/releases/latest/download/ncnn-20240410-ubuntu-2204.zip)
- [](https://github.com/Tencent/ncnn/releases/latest/download/ncnn-20240410-ubuntu-2204-shared.zip)
+ [](https://github.com/Tencent/ncnn/releases/latest/download/ncnn-20240820-ubuntu-2204.zip)
+ [](https://github.com/Tencent/ncnn/releases/latest/download/ncnn-20240820-ubuntu-2204-shared.zip)
+
+ |
+
+
+Ubuntu 24.04 |
+
+
+ [](https://github.com/Tencent/ncnn/releases/latest/download/ncnn-20240820-ubuntu-2404.zip)
+ [](https://github.com/Tencent/ncnn/releases/latest/download/ncnn-20240820-ubuntu-2404-shared.zip)
|
@@ -344,8 +355,8 @@ https://github.com/Tencent/ncnn/releases/latest
VS2015 |
- [](https://github.com/Tencent/ncnn/releases/latest/download/ncnn-20240410-windows-vs2015.zip)
- [](https://github.com/Tencent/ncnn/releases/latest/download/ncnn-20240410-windows-vs2015-shared.zip)
+ [](https://github.com/Tencent/ncnn/releases/latest/download/ncnn-20240820-windows-vs2015.zip)
+ [](https://github.com/Tencent/ncnn/releases/latest/download/ncnn-20240820-windows-vs2015-shared.zip)
|
@@ -358,8 +369,8 @@ https://github.com/Tencent/ncnn/releases/latest
| VS2017 |
- [](https://github.com/Tencent/ncnn/releases/latest/download/ncnn-20240410-windows-vs2017.zip)
- [](https://github.com/Tencent/ncnn/releases/latest/download/ncnn-20240410-windows-vs2017-shared.zip)
+ [](https://github.com/Tencent/ncnn/releases/latest/download/ncnn-20240820-windows-vs2017.zip)
+ [](https://github.com/Tencent/ncnn/releases/latest/download/ncnn-20240820-windows-vs2017-shared.zip)
|
@@ -367,8 +378,8 @@ https://github.com/Tencent/ncnn/releases/latest
VS2019 |
- [](https://github.com/Tencent/ncnn/releases/latest/download/ncnn-20240410-windows-vs2019.zip)
- [](https://github.com/Tencent/ncnn/releases/latest/download/ncnn-20240410-windows-vs2019-shared.zip)
+ [](https://github.com/Tencent/ncnn/releases/latest/download/ncnn-20240820-windows-vs2019.zip)
+ [](https://github.com/Tencent/ncnn/releases/latest/download/ncnn-20240820-windows-vs2019-shared.zip)
|
@@ -376,8 +387,8 @@ https://github.com/Tencent/ncnn/releases/latest
VS2022 |
- [](https://github.com/Tencent/ncnn/releases/latest/download/ncnn-20240410-windows-vs2022.zip)
- [](https://github.com/Tencent/ncnn/releases/latest/download/ncnn-20240410-windows-vs2022-shared.zip)
+ [](https://github.com/Tencent/ncnn/releases/latest/download/ncnn-20240820-windows-vs2022.zip)
+ [](https://github.com/Tencent/ncnn/releases/latest/download/ncnn-20240820-windows-vs2022-shared.zip)
|
@@ -396,7 +407,7 @@ https://github.com/Tencent/ncnn/releases/latest
WebAssembly |
- [](https://github.com/Tencent/ncnn/releases/latest/download/ncnn-20240410-webassembly.zip)
+ [](https://github.com/Tencent/ncnn/releases/latest/download/ncnn-20240820-webassembly.zip)
|
@@ -560,7 +571,7 @@ https://github.com/Tencent/ncnn/releases/latest
**[use netron for ncnn model visualization](https://netron.app)**
-**[out-of-the-box web model conversion](https://convertmodel.com/#outputFormat=ncnn)**
+**[use ncnn with pytorch or onnx](https://github.com/Tencent/ncnn/wiki/use-ncnn-with-pytorch-or-onnx)**
[ncnn low-level operation api](https://github.com/Tencent/ncnn/wiki/low-level-operation-api)
diff --git a/benchmark/README.md b/benchmark/README.md
index 1927acf81cd4..df9e55de4a8e 100644
--- a/benchmark/README.md
+++ b/benchmark/README.md
@@ -5911,6 +5911,298 @@ cooling_down = 0
FastestDet min = 5.13 max = 5.47 avg = 5.30
```
+### HUAWEI Kunpeng 920 7260 (x64 cores)
+test on Ubuntu 20.04 (gcc 9.4.0)
+```
+root@8d46e508165f:/home/lkl/ARM_CHAR/ncnn/benchmark# ../build/benchmark/benchncnn 300 1 0 -1 0
+loop_count = 300
+num_threads = 1
+powersave = 0
+gpu_device = -1
+cooling_down = 0
+ squeezenet min = 11.64 max = 12.11 avg = 11.71
+ squeezenet_int8 min = 12.22 max = 13.22 avg = 12.37
+ mobilenet min = 20.00 max = 20.79 avg = 20.08
+ mobilenet_int8 min = 17.44 max = 19.09 avg = 17.64
+ mobilenet_v2 min = 13.29 max = 14.25 avg = 13.39
+ mobilenet_v3 min = 11.06 max = 11.84 avg = 11.11
+ shufflenet min = 7.56 max = 7.74 avg = 7.59
+ shufflenet_v2 min = 7.84 max = 8.37 avg = 7.88
+ mnasnet min = 13.07 max = 13.78 avg = 13.14
+ proxylessnasnet min = 15.71 max = 16.31 avg = 15.77
+ efficientnet_b0 min = 34.79 max = 35.98 avg = 34.92
+ efficientnetv2_b0 min = 35.28 max = 36.36 avg = 35.41
+ regnety_400m min = 17.06 max = 17.74 avg = 17.16
+ blazeface min = 2.99 max = 3.04 avg = 3.01
+ googlenet min = 50.76 max = 51.74 avg = 51.00
+ googlenet_int8 min = 50.31 max = 52.27 avg = 50.65
+ resnet18 min = 34.97 max = 37.17 avg = 35.82
+ resnet18_int8 min = 40.47 max = 42.03 avg = 40.78
+ alexnet min = 39.19 max = 39.80 avg = 39.32
+ vgg16 min = 176.62 max = 181.29 avg = 177.07
+ vgg16_int8 min = 352.35 max = 358.38 avg = 355.15
+ resnet50 min = 96.76 max = 98.63 avg = 97.09
+ resnet50_int8 min = 90.00 max = 92.74 avg = 90.81
+ squeezenet_ssd min = 33.23 max = 33.99 avg = 33.39
+ squeezenet_ssd_int8 min = 38.50 max = 41.53 avg = 39.28
+ mobilenet_ssd min = 42.49 max = 44.78 avg = 42.72
+ mobilenet_ssd_int8 min = 37.06 max = 39.97 avg = 37.57
+ mobilenet_yolo min = 96.34 max = 98.91 avg = 96.73
+ mobilenetv2_yolov3 min = 50.88 max = 52.97 avg = 51.15
+ yolov4-tiny min = 65.56 max = 67.13 avg = 65.80
+ nanodet_m min = 19.94 max = 20.82 avg = 20.04
+ yolo-fastest-1.1 min = 7.66 max = 7.81 avg = 7.71
+ yolo-fastestv2 min = 6.82 max = 7.23 avg = 6.87
+ vision_transformer min = 1535.03 max = 1552.84 avg = 1543.73
+ FastestDet min = 7.17 max = 7.50 avg = 7.21
+root@8d46e508165f:/home/lkl/ARM_CHAR/ncnn/benchmark# ../build/benchmark/benchncnn 300 2 0 -1 0
+loop_count = 300
+num_threads = 2
+powersave = 0
+gpu_device = -1
+cooling_down = 0
+ squeezenet min = 6.35 max = 9.15 avg = 7.33
+ squeezenet_int8 min = 8.06 max = 8.60 avg = 8.14
+ mobilenet min = 10.30 max = 11.86 avg = 11.48
+ mobilenet_int8 min = 8.93 max = 11.87 avg = 10.47
+ mobilenet_v2 min = 9.05 max = 11.50 avg = 9.19
+ mobilenet_v3 min = 6.32 max = 6.42 avg = 6.36
+ shufflenet min = 6.73 max = 8.55 avg = 6.81
+ shufflenet_v2 min = 4.94 max = 6.65 avg = 6.32
+ mnasnet min = 7.38 max = 10.77 avg = 8.82
+ proxylessnasnet min = 8.57 max = 9.72 avg = 8.63
+ efficientnet_b0 min = 18.61 max = 22.53 avg = 20.42
+ efficientnetv2_b0 min = 18.75 max = 21.93 avg = 20.79
+ regnety_400m min = 11.86 max = 15.09 avg = 14.60
+ blazeface min = 1.95 max = 3.37 avg = 2.06
+ googlenet min = 28.66 max = 32.24 avg = 28.94
+ googlenet_int8 min = 27.64 max = 32.15 avg = 30.84
+ resnet18 min = 20.33 max = 20.77 avg = 20.47
+ resnet18_int8 min = 22.63 max = 23.72 avg = 22.88
+ alexnet min = 20.41 max = 29.37 avg = 27.22
+ vgg16 min = 101.72 max = 140.33 avg = 103.29
+ vgg16_int8 min = 187.56 max = 211.44 avg = 189.92
+ resnet50 min = 51.07 max = 59.25 avg = 58.35
+ resnet50_int8 min = 46.50 max = 52.55 avg = 48.93
+ squeezenet_ssd min = 22.48 max = 28.59 avg = 22.98
+ squeezenet_ssd_int8 min = 25.56 max = 26.82 avg = 25.99
+ mobilenet_ssd min = 22.81 max = 26.21 avg = 24.88
+ mobilenet_ssd_int8 min = 19.31 max = 25.53 avg = 21.74
+ mobilenet_yolo min = 59.58 max = 62.04 avg = 59.99
+ mobilenetv2_yolov3 min = 33.26 max = 35.74 avg = 33.51
+ yolov4-tiny min = 41.14 max = 45.34 avg = 42.46
+ nanodet_m min = 12.10 max = 16.69 avg = 15.02
+ yolo-fastest-1.1 min = 5.44 max = 7.78 avg = 7.24
+ yolo-fastestv2 min = 5.03 max = 8.08 avg = 6.75
+ vision_transformer min = 994.46 max = 1090.68 avg = 1045.50
+ FastestDet min = 6.76 max = 6.91 avg = 6.83
+root@8d46e508165f:/home/lkl/ARM_CHAR/ncnn/benchmark# ../build/benchmark/benchncnn 300 4 0 -1 0
+loop_count = 300
+num_threads = 4
+powersave = 0
+gpu_device = -1
+cooling_down = 0
+ squeezenet min = 3.79 max = 6.99 avg = 4.55
+ squeezenet_int8 min = 5.13 max = 5.68 avg = 5.20
+ mobilenet min = 6.25 max = 6.55 avg = 6.30
+ mobilenet_int8 min = 5.96 max = 6.10 avg = 6.03
+ mobilenet_v2 min = 5.34 max = 7.15 avg = 5.62
+ mobilenet_v3 min = 4.05 max = 5.74 avg = 5.01
+ shufflenet min = 3.69 max = 5.81 avg = 5.15
+ shufflenet_v2 min = 4.31 max = 6.02 avg = 4.56
+ mnasnet min = 4.48 max = 6.05 avg = 5.54
+ proxylessnasnet min = 5.05 max = 8.08 avg = 6.03
+ efficientnet_b0 min = 10.17 max = 12.21 avg = 11.58
+ efficientnetv2_b0 min = 10.86 max = 15.78 avg = 12.70
+ regnety_400m min = 9.24 max = 14.13 avg = 11.98
+ blazeface min = 1.89 max = 1.97 avg = 1.93
+ googlenet min = 15.19 max = 20.31 avg = 16.90
+ googlenet_int8 min = 17.97 max = 19.40 avg = 18.11
+ resnet18 min = 11.18 max = 11.48 avg = 11.29
+ resnet18_int8 min = 12.26 max = 12.78 avg = 12.44
+ alexnet min = 14.43 max = 16.94 avg = 14.68
+ vgg16 min = 62.40 max = 78.42 avg = 64.96
+ vgg16_int8 min = 101.52 max = 109.42 avg = 104.46
+ resnet50 min = 29.19 max = 39.69 avg = 32.99
+ resnet50_int8 min = 26.94 max = 28.82 avg = 27.16
+ squeezenet_ssd min = 12.90 max = 16.52 avg = 15.20
+ squeezenet_ssd_int8 min = 15.58 max = 18.40 avg = 16.28
+ mobilenet_ssd min = 13.68 max = 14.45 avg = 13.87
+ mobilenet_ssd_int8 min = 12.20 max = 14.58 avg = 12.84
+ mobilenet_yolo min = 34.85 max = 36.54 avg = 35.05
+ mobilenetv2_yolov3 min = 18.61 max = 20.93 avg = 19.92
+ yolov4-tiny min = 26.09 max = 32.32 avg = 28.03
+ nanodet_m min = 7.85 max = 12.48 avg = 11.00
+ yolo-fastest-1.1 min = 6.19 max = 6.49 avg = 6.31
+ yolo-fastestv2 min = 3.66 max = 6.83 avg = 5.11
+ vision_transformer min = 605.95 max = 624.99 avg = 609.79
+ FastestDet min = 4.32 max = 5.41 avg = 5.17
+root@8d46e508165f:/home/lkl/ARM_CHAR/ncnn/benchmark# ../build/benchmark/benchncnn 300 8 0 -1 0
+loop_count = 300
+num_threads = 8
+powersave = 0
+gpu_device = -1
+cooling_down = 0
+ squeezenet min = 2.72 max = 3.74 avg = 3.05
+ squeezenet_int8 min = 3.80 max = 4.71 avg = 4.03
+ mobilenet min = 3.94 max = 5.15 avg = 4.00
+ mobilenet_int8 min = 3.73 max = 3.87 avg = 3.80
+ mobilenet_v2 min = 4.51 max = 6.57 avg = 4.68
+ mobilenet_v3 min = 4.12 max = 4.38 avg = 4.28
+ shufflenet min = 4.60 max = 6.27 avg = 4.88
+ shufflenet_v2 min = 4.07 max = 4.20 avg = 4.11
+ mnasnet min = 4.26 max = 4.51 avg = 4.36
+ proxylessnasnet min = 4.71 max = 7.40 avg = 4.80
+ efficientnet_b0 min = 8.49 max = 8.74 avg = 8.56
+ efficientnetv2_b0 min = 9.34 max = 9.68 avg = 9.41
+ regnety_400m min = 8.00 max = 12.85 avg = 10.64
+ blazeface min = 1.76 max = 1.84 avg = 1.80
+ googlenet min = 10.89 max = 11.33 avg = 10.98
+ googlenet_int8 min = 11.66 max = 14.07 avg = 11.83
+ resnet18 min = 6.48 max = 6.61 avg = 6.54
+ resnet18_int8 min = 7.30 max = 7.79 avg = 7.51
+ alexnet min = 8.33 max = 8.95 avg = 8.62
+ vgg16 min = 29.94 max = 47.54 avg = 31.95
+ vgg16_int8 min = 54.67 max = 60.76 avg = 56.03
+ resnet50 min = 16.13 max = 20.79 avg = 20.03
+ resnet50_int8 min = 15.64 max = 20.13 avg = 16.11
+ squeezenet_ssd min = 11.58 max = 12.02 avg = 11.77
+ squeezenet_ssd_int8 min = 11.14 max = 13.72 avg = 12.10
+ mobilenet_ssd min = 8.27 max = 10.77 avg = 8.76
+ mobilenet_ssd_int8 min = 8.13 max = 9.09 avg = 8.29
+ mobilenet_yolo min = 23.90 max = 24.69 avg = 24.17
+ mobilenetv2_yolov3 min = 14.83 max = 15.72 avg = 15.19
+ yolov4-tiny min = 19.78 max = 23.66 avg = 20.05
+ nanodet_m min = 8.92 max = 10.76 avg = 9.09
+ yolo-fastest-1.1 min = 5.49 max = 5.77 avg = 5.63
+ yolo-fastestv2 min = 5.04 max = 5.21 avg = 5.10
+ vision_transformer min = 318.42 max = 379.40 avg = 363.66
+ FastestDet min = 4.18 max = 4.54 avg = 4.38
+root@8d46e508165f:/home/lkl/ARM_CHAR/ncnn/benchmark# ../build/benchmark/benchncnn 300 16 0 -1 0
+loop_count = 300
+num_threads = 16
+powersave = 0
+gpu_device = -1
+cooling_down = 0
+ squeezenet min = 2.70 max = 3.14 avg = 2.81
+ squeezenet_int8 min = 3.21 max = 4.22 avg = 3.39
+ mobilenet min = 3.13 max = 3.26 avg = 3.20
+ mobilenet_int8 min = 3.17 max = 5.05 avg = 3.30
+ mobilenet_v2 min = 4.31 max = 6.24 avg = 4.62
+ mobilenet_v3 min = 3.57 max = 3.77 avg = 3.68
+ shufflenet min = 4.70 max = 6.45 avg = 4.80
+ shufflenet_v2 min = 3.73 max = 4.27 avg = 3.87
+ mnasnet min = 3.67 max = 3.87 avg = 3.75
+ proxylessnasnet min = 4.28 max = 4.81 avg = 4.35
+ efficientnet_b0 min = 7.31 max = 7.77 avg = 7.53
+ efficientnetv2_b0 min = 9.87 max = 12.33 avg = 10.07
+ regnety_400m min = 17.95 max = 18.53 avg = 18.26
+ blazeface min = 2.26 max = 2.40 avg = 2.33
+ googlenet min = 9.51 max = 9.99 avg = 9.68
+ googlenet_int8 min = 10.98 max = 11.36 avg = 11.18
+ resnet18 min = 5.59 max = 6.08 avg = 5.71
+ resnet18_int8 min = 6.55 max = 7.28 avg = 6.77
+ alexnet min = 6.26 max = 6.50 avg = 6.36
+ vgg16 min = 23.98 max = 27.37 avg = 24.89
+ vgg16_int8 min = 38.07 max = 39.66 avg = 39.02
+ resnet50 min = 12.81 max = 14.19 avg = 13.76
+ resnet50_int8 min = 12.42 max = 12.84 avg = 12.55
+ squeezenet_ssd min = 10.80 max = 11.49 avg = 11.12
+ squeezenet_ssd_int8 min = 11.57 max = 12.21 avg = 11.74
+ mobilenet_ssd min = 7.46 max = 8.08 avg = 7.84
+ mobilenet_ssd_int8 min = 7.47 max = 8.07 avg = 7.63
+ mobilenet_yolo min = 21.70 max = 23.43 avg = 21.92
+ mobilenetv2_yolov3 min = 12.55 max = 14.56 avg = 12.90
+ yolov4-tiny min = 17.68 max = 19.85 avg = 18.18
+ nanodet_m min = 8.35 max = 8.70 avg = 8.45
+ yolo-fastest-1.1 min = 5.70 max = 7.11 avg = 6.05
+ yolo-fastestv2 min = 4.85 max = 5.70 avg = 5.37
+ vision_transformer min = 214.36 max = 259.56 avg = 245.47
+ FastestDet min = 5.01 max = 5.42 avg = 5.17
+root@8d46e508165f:/home/lkl/ARM_CHAR/ncnn/benchmark# ../build/benchmark/benchncnn 300 32 0 -1 0
+loop_count = 300
+num_threads = 32
+powersave = 0
+gpu_device = -1
+cooling_down = 0
+ squeezenet min = 2.30 max = 2.94 avg = 2.46
+ squeezenet_int8 min = 3.08 max = 4.88 avg = 4.03
+ mobilenet min = 2.49 max = 2.76 avg = 2.53
+ mobilenet_int8 min = 2.86 max = 3.73 avg = 2.95
+ mobilenet_v2 min = 4.51 max = 5.20 avg = 4.74
+ mobilenet_v3 min = 5.11 max = 6.91 avg = 6.10
+ shufflenet min = 5.57 max = 6.51 avg = 5.78
+ shufflenet_v2 min = 4.37 max = 4.66 avg = 4.48
+ mnasnet min = 3.72 max = 4.08 avg = 3.90
+ proxylessnasnet min = 4.19 max = 6.18 avg = 4.79
+ efficientnet_b0 min = 6.80 max = 7.22 avg = 6.89
+ efficientnetv2_b0 min = 13.98 max = 17.55 avg = 15.06
+ regnety_400m min = 16.10 max = 16.72 avg = 16.26
+ blazeface min = 2.12 max = 2.53 avg = 2.17
+ googlenet min = 8.63 max = 9.89 avg = 8.77
+ googlenet_int8 min = 9.90 max = 11.09 avg = 10.08
+ resnet18 min = 6.54 max = 6.99 avg = 6.73
+ resnet18_int8 min = 8.34 max = 9.00 avg = 8.67
+ alexnet min = 6.64 max = 7.15 avg = 6.93
+ vgg16 min = 22.79 max = 23.91 avg = 23.50
+ vgg16_int8 min = 32.37 max = 37.51 avg = 33.13
+ resnet50 min = 11.19 max = 16.40 avg = 11.47
+ resnet50_int8 min = 11.92 max = 12.55 avg = 12.13
+ squeezenet_ssd min = 10.75 max = 12.28 avg = 11.12
+ squeezenet_ssd_int8 min = 11.31 max = 12.29 avg = 11.57
+ mobilenet_ssd min = 10.25 max = 11.26 avg = 10.79
+ mobilenet_ssd_int8 min = 11.39 max = 16.99 avg = 11.98
+ mobilenet_yolo min = 52.11 max = 60.46 avg = 53.84
+ mobilenetv2_yolov3 min = 12.07 max = 12.47 avg = 12.20
+ yolov4-tiny min = 17.48 max = 17.79 avg = 17.58
+ nanodet_m min = 13.06 max = 14.71 avg = 13.64
+ yolo-fastest-1.1 min = 5.70 max = 5.89 avg = 5.79
+ yolo-fastestv2 min = 8.89 max = 9.99 avg = 9.21
+ vision_transformer min = 158.92 max = 187.40 avg = 168.21
+ FastestDet min = 8.70 max = 9.43 avg = 9.00
+root@8d46e508165f:/home/lkl/ARM_CHAR/ncnn/benchmark# ../build/benchmark/benchncnn 300 64 0 -1 0
+loop_count = 300
+num_threads = 64
+powersave = 0
+gpu_device = -1
+cooling_down = 0
+ squeezenet min = 6.85 max = 78.56 avg = 7.81
+ squeezenet_int8 min = 8.06 max = 88.91 avg = 9.23
+ mobilenet min = 3.02 max = 86.86 avg = 5.89
+ mobilenet_int8 min = 3.58 max = 4.55 avg = 3.68
+ mobilenet_v2 min = 5.05 max = 150.06 avg = 13.04
+ mobilenet_v3 min = 4.85 max = 125.22 avg = 8.34
+ shufflenet min = 17.80 max = 220.55 avg = 21.01
+ shufflenet_v2 min = 11.23 max = 381.95 avg = 13.71
+ mnasnet min = 9.83 max = 128.42 avg = 11.10
+ proxylessnasnet min = 10.53 max = 68.52 avg = 12.03
+ efficientnet_b0 min = 16.78 max = 968.87 avg = 23.94
+ efficientnetv2_b0 min = 26.23 max = 551.18 avg = 31.34
+ regnety_400m min = 70.14 max = 407.92 avg = 78.30
+ blazeface min = 7.27 max = 191.44 avg = 9.37
+ googlenet min = 16.69 max = 820.58 avg = 25.06
+ googlenet_int8 min = 20.58 max = 849.09 avg = 29.87
+ resnet18 min = 8.67 max = 349.00 avg = 11.33
+ resnet18_int8 min = 10.40 max = 128.98 avg = 11.45
+ alexnet min = 6.15 max = 196.01 avg = 10.24
+ vgg16 min = 21.11 max = 288.66 avg = 29.37
+ vgg16_int8 min = 30.72 max = 251.95 avg = 37.68
+ resnet50 min = 19.10 max = 114.08 avg = 22.00
+ resnet50_int8 min = 18.99 max = 436.89 avg = 24.36
+ squeezenet_ssd min = 22.22 max = 510.52 avg = 28.76
+ squeezenet_ssd_int8 min = 23.42 max = 614.70 avg = 30.82
+ mobilenet_ssd min = 7.62 max = 202.66 avg = 14.59
+ mobilenet_ssd_int8 min = 7.89 max = 109.82 avg = 8.80
+ mobilenet_yolo min = 31.43 max = 742.10 avg = 45.52
+ mobilenetv2_yolov3 min = 18.31 max = 273.05 avg = 20.78
+ yolov4-tiny min = 21.03 max = 400.05 avg = 33.64
+ nanodet_m min = 19.94 max = 114.18 avg = 21.89
+ yolo-fastest-1.1 min = 7.20 max = 174.60 avg = 9.13
+ yolo-fastestv2 min = 7.50 max = 170.55 avg = 9.01
+ vision_transformer min = 126.90 max = 335.71 avg = 157.38
+ FastestDet min = 6.59 max = 19.77 avg = 6.77
+```
+
### Intel Atom x5-Z8350
```
nihui@nihui-ROCK-Pi-X:~/ncnn/build/benchmark$ ./benchncnn 20 4 0 -1 1
diff --git a/docs/developer-guide/operators.md b/docs/developer-guide/operators.md
index 05996f8d7354..de4d6b428e99 100644
--- a/docs/developer-guide/operators.md
+++ b/docs/developer-guide/operators.md
@@ -71,6 +71,7 @@
* [Reorg](#reorg)
* [Requantize](#requantize)
* [Reshape](#reshape)
+* [RMSNorm](#rmsnorm)
* [RNN](#rnn)
* [Scale](#scale)
* [SELU](#selu)
@@ -836,11 +837,13 @@ y = embedding(x)
| 1 | input_dim | int | 0 | |
| 2 | bias_term | int | 0 | |
| 3 | weight_data_size | int | 0 | |
+| 18 | int8_scale_term| int | 0 | |
| weight | type | shape |
| ------------- | ----- | --------------------- |
| weight_data | float | [weight_data_size] |
| bias_term | float | [num_output] |
+| weight_data_int8_scales| float | [1] |
# Exp
```
@@ -1670,6 +1673,26 @@ Reshape flag:
- -1 = remaining
- -233 = drop this dim(default)
+# RMSNorm
+```
+split x along outmost axis into part x0, x1 ...
+root mean square normalize for each part x0, x1 ...
+y = x * gamma by elementwise
+```
+
+* one_blob_only
+* support_inplace
+
+| param id | name | type | default | description |
+| --------- | ------------- | ----- | --------- | ----------------- |
+| 0 | affine_size | int | 0 | |
+| 1 | eps | float | 0.001f | x = x / sqrt(var + eps) |
+| 2 | affine | int | 1 | |
+
+| weight | type | shape |
+| ------------- | ----- | --------------------- |
+| gamma_data | float | [affine_size] |
+
# RNN
Apply a single-layer RNN to a feature sequence of `T` timesteps. The input blob shape is `[w=input_size, h=T]` and the output blob shape is `[w=num_output, h=T]`.
diff --git a/docs/faq.en.md b/docs/faq.en.md
index 807c4a9e3ee6..44d0068263b6 100644
--- a/docs/faq.en.md
+++ b/docs/faq.en.md
@@ -262,7 +262,7 @@ Fully customizable op, first change to one that can export (e.g. concat slice),
Set net.opt.use_vulkan_compute = true before load_param / load_model;
-- ## How to ececute multiple blob inputs, multiple blob outputs?
+- ## How to execute multiple blob inputs, multiple blob outputs?
Multiple execute `ex.input()` and `ex.extract()` like following
```
ex.input("data1", in_1);
diff --git a/docs/how-to-use-and-FAQ/use-ncnn-with-pytorch-or-onnx.md b/docs/how-to-use-and-FAQ/use-ncnn-with-pytorch-or-onnx.md
index 9b0559a8eb8f..e0195aa1403c 100644
--- a/docs/how-to-use-and-FAQ/use-ncnn-with-pytorch-or-onnx.md
+++ b/docs/how-to-use-and-FAQ/use-ncnn-with-pytorch-or-onnx.md
@@ -2,8 +2,114 @@ Here is a practical guide for converting pytorch model to ncnn
resnet18 is used as the example
-## pytorch to onnx
-
+## pytorch to ncnn, onnx to ncnn
+
+### What's the pnnx?
+PyTorch Neural Network eXchange(PNNX) is an open standard for PyTorch model interoperability. PNNX provides an open model format for PyTorch. It defines computation graph as well as high level operators strictly matches PyTorch.
+It is recommended to use the `pnnx` tool to convert your `onnx` or `pytorch` model into a ncnn model now.
+
+### How to install pnnx?
+* A. python pip (recommended)
+ * Windows/Linux/macOS 64bit
+ * python 3.7 or later
+
+ ```shell
+ pip3 install pnnx
+ ```
+
+* B. portable binary package (recommended if you hate python)
+ * Windows/Linux/macOS 64bit
+ * For Linux, glibc 2.17+
+
+ Download portable pnnx binary package from https://github.com/pnnx/pnnx/releases and extract it.
+
+* C. build from source
+ 1. install pytorch
+ 2. (optional) install torchvision for pnnx torchvision operator support
+ 3. (optional) install protobuf for pnnx onnx-zero support
+ 4. clone https://github.com/Tencent/ncnn.git
+ 5. build pnnx in ncnn/tools/pnnx with cmake
+
+ You will probably refer https://github.com/pnnx/pnnx/blob/main/.github/workflows/release.yml for detailed steps
+
+ ```shell
+ git clone https://github.com/Tencent/ncnn.git
+ mkdir ncnn/tools/pnnx/build
+ cd ncnn/tools/pnnx/build
+ cmake -DCMAKE_INSTALL_PREFIX=install -DTorch_INSTALL_DIR= -DTorchVision_INSTALL_DIR= ..
+ cmake --build . --config Release -j 4
+ cmake --build . --config Release --target install
+ ```
+
+### How to use pnnx?
+* A. python
+ 1. optimize and export your torch model with pnnx.export()
+ ```python
+ import torch
+ import torchvision.models as models
+ import pnnx
+
+ model = models.resnet18(pretrained=True)
+
+ x = torch.rand(1, 3, 224, 224)
+
+ opt_model = pnnx.export(model, "resnet18.pt", x)
+
+ # use tuple for model with multiple inputs
+ # opt_model = pnnx.export(model, "resnet18.pt", (x, y, z))
+ ```
+ 2. use optimized module just like the normal one
+ ```python
+ result = opt_model(x)
+ ```
+ 3. pick resnet18_pnnx.py for pnnx-optimized torch model
+ 4. pick resnet18.ncnn.param and resnet18.ncnn.bin for ncnn inference
+
+B. command line
+ 1. export your torch model to torchscript / onnx
+ ```python
+ import torch
+ import torchvision.models as models
+
+ net = models.resnet18(pretrained=True)
+ net = net.eval()
+
+ x = torch.rand(1, 3, 224, 224)
+
+ # You could try disabling checking when tracing raises error
+ # mod = torch.jit.trace(net, x, check_trace=False)
+ mod = torch.jit.trace(net, x)
+
+ mod.save("resnet18.pt")
+
+ # You could also try exporting to the good-old onnx
+ torch.onnx.export(net, x, 'resnet18.onnx')
+ ```
+
+ 2. pnnx convert torchscript / onnx to optimized pnnx model and ncnn model files
+ ```shell
+ ./pnnx resnet18.pt inputshape=[1,3,224,224]
+ ./pnnx resnet18.onnx inputshape=[1,3,224,224]
+ ```
+ macOS zsh user may need double quotes to prevent ambiguity
+ ```shell
+ ./pnnx resnet18.pt "inputshape=[1,3,224,224]"
+ ```
+ For model with multiple inputs, use list
+ ```shell
+ ./pnnx resnet18.pt inputshape=[1,3,224,224],[1,32]
+ ```
+ For model with non-fp32 input data type, add type suffix
+ ```shell
+ ./pnnx resnet18.pt inputshape=[1,3,224,224]f32,[1,32]i64
+ ```
+ 3. pick resnet18_pnnx.py for pnnx-optimized torch model
+ 4. pick resnet18.ncnn.param and resnet18.ncnn.bin for ncnn inference
+
+see more pnnx informations: https://github.com/pnnx/pnnx
+
+## pytorch to onnx (deprecated)
+pytorch to onnx
The official pytorch tutorial for exporting onnx model
https://pytorch.org/tutorials/advanced/super_resolution_with_caffe2.html
@@ -22,9 +128,10 @@ x = torch.rand(1, 3, 224, 224)
# Export the model
torch_out = torch.onnx._export(model, x, "resnet18.onnx", export_params=True)
```
+
-## simplify onnx model
-
+## simplify onnx model (deprecated)
+simplify onnx model
The exported resnet18.onnx model may contains many redundant operators such as Shape, Gather and Unsqueeze that is not supported in ncnn
```
@@ -37,19 +144,36 @@ Unsqueeze not supported yet!
# axes 7
```
-Fortunately, daquexian developed a handy tool to eliminate them. cheers!
+### onnxsim
-https://github.com/daquexian/onnx-simplifier
+Fortunately, [@daquexian](https://github.com/daquexian) developed a handy tool to eliminate them. cheers!
+#### how to use onnxsim?
+```shell
+pip install onnxsim
+python -m onnxsim resnet18.onnx resnet18-sim.onnx
```
-python3 -m onnxsim resnet18.onnx resnet18-sim.onnx
-```
+more informations: https://github.com/daquexian/onnx-simplifier
-## onnx to ncnn
+### onnxslim
-Finally, you can convert the model to ncnn using tools/onnx2ncnn
+Or you can use another powerful model simplification tool implemented in pure Python development by [@inisis](https://github.com/inisis):
+#### how to use onnxslim?
+```shell
+pip install onnxslim
+python -m onnxslim resnet18.onnx resnet18-slim.onnx
```
-onnx2ncnn resnet18-sim.onnx resnet18.param resnet18.bin
-```
+more informations: https://github.com/inisis/OnnxSlim
+
+
+## onnx2ncnn (deprecated)
+
+~~The onnx2ncnn tool has stopped maintenance. It is recommended to use the PNNX tool~~
+
+onnx2ncnn tool
+
+~~Finally, you can convert the model to ncnn using tools/onnx2ncnn~~
+~~onnx2ncnn resnet18-sim.onnx resnet18.param resnet18.bin~~
+
\ No newline at end of file
diff --git a/examples/CMakeLists.txt b/examples/CMakeLists.txt
index a7739be27e51..bf3017dbe680 100644
--- a/examples/CMakeLists.txt
+++ b/examples/CMakeLists.txt
@@ -69,6 +69,7 @@ if(NCNN_PIXEL)
ncnn_add_example(yolov4)
ncnn_add_example(rvm)
ncnn_add_example(p2pnet)
+ ncnn_add_example(yolov8)
endif()
else()
message(WARNING "OpenCV not found and NCNN_SIMPLEOCV disabled, examples won't be built")
diff --git a/examples/yolov8.cpp b/examples/yolov8.cpp
new file mode 100644
index 000000000000..e166e6c1d174
--- /dev/null
+++ b/examples/yolov8.cpp
@@ -0,0 +1,410 @@
+// Tencent is pleased to support the open source community by making ncnn available.
+//
+// Copyright (C) 2024 THL A29 Limited, a Tencent company. All rights reserved.
+//
+// Copyright (C) 2024 whyb(https://github.com/whyb). All rights reserved.
+//
+// Licensed under the BSD 3-Clause License (the "License"); you may not use this file except
+// in compliance with the License. You may obtain a copy of the License at
+//
+// https://opensource.org/licenses/BSD-3-Clause
+//
+// Unless required by applicable law or agreed to in writing, software distributed
+// under the License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR
+// CONDITIONS OF ANY KIND, either express or implied. See the License for the
+// specific language governing permissions and limitations under the License.
+
+// ReadMe
+// Convert yolov8 model to ncnn model workflow:
+//
+// step 1:
+// If you don't want to train the model yourself. You should go to the ultralytics website download the pretrained model file.
+// original pretrained model from https://docs.ultralytics.com/models/yolov8/#supported-tasks-and-modes
+//
+// step 2:
+// run this command.
+// conda create --name yolov8 python=3.11
+// conda activate yolov8
+// pip install ultralytics onnx numpy protobuf
+//
+// step 3:
+// save source code file(export_model_to_ncnn.py):
+// from ultralytics import YOLO
+// detection_models = [
+// ["./Detection-pt/yolov8n.pt", "./Detection-pt/"],
+// ["./Detection-pt/yolov8s.pt", "./Detection-pt/"],
+// ["./Detection-pt/yolov8m.pt", "./Detection-pt/"],
+// ["./Detection-pt/yolov8l.pt", "./Detection-pt/"],
+// ["./Detection-pt/yolov8x.pt", "./Detection-pt/"]
+// ]
+// for model_dict in detection_models:
+// model = YOLO(model_dict[0]) # load an official pretrained weight model
+// model.export(format="ncnn", dynamic=True, save_dir=model_dict[1], simplify=True)
+//
+// step 4:
+// run command: python export_model_to_ncnn.py
+
+#include
+#include
+#include
+#include "layer.h"
+#include "net.h"
+
+#include
+#include
+#include
+#include
+#include
+
+#define MAX_STRIDE 32
+
+struct Object
+{
+ cv::Rect_ rect;
+ int label;
+ float prob;
+};
+
+static inline float intersection_area(const Object& a, const Object& b)
+{
+ cv::Rect_ inter = a.rect & b.rect;
+ return inter.area();
+}
+
+static void qsort_descent_inplace(std::vector |