-
Notifications
You must be signed in to change notification settings - Fork 3
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
lichenggang
committed
Dec 11, 2024
1 parent
5e15a25
commit d5c7179
Showing
4,851 changed files
with
228,690 additions
and
847,470 deletions.
The diff you're trying to view is too large. We only load the first 3000 changed files.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,35 @@ | ||
# astyle -n -r "benchmark/*.h,*.cpp" "src/*.h,*.cpp" "tests/*.h,*.cpp" "tools/*.h,*.cpp" "examples/*.h,*.cpp" | ||
|
||
# brace style | ||
--style=allman | ||
|
||
# tab | ||
--attach-namespaces | ||
--attach-extern-c | ||
--attach-closing-while | ||
|
||
# indentation | ||
--indent-preproc-define | ||
--indent-col1-comments | ||
--min-conditional-indent=0 | ||
--max-continuation-indent=120 | ||
|
||
# padding | ||
--pad-oper | ||
--pad-comma | ||
--pad-header | ||
--align-pointer=type | ||
--align-reference=type | ||
|
||
# formatting | ||
--break-closing-braces | ||
--attach-return-type | ||
--attach-return-type-decl | ||
--keep-one-line-blocks | ||
--keep-one-line-statements | ||
--convert-tabs | ||
--max-code-length=200 | ||
--mode=c | ||
|
||
# other | ||
--lineend=linux |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,127 @@ | ||
name: linux-x64-cpu-gcc | ||
on: | ||
push: | ||
branches: [master] | ||
paths: | ||
- '.ci/linux-x64-cpu-gcc.yml' | ||
- 'CMakeLists.txt' | ||
- 'cmake/**' | ||
- 'src/*' | ||
- 'src/layer/*' | ||
- 'src/layer/x86/**' | ||
- 'tests/**' | ||
- 'tools/**' | ||
- '!tools/pnnx/**' | ||
- 'examples/**' | ||
mr: | ||
target-branches: [master] | ||
paths: | ||
- '.ci/linux-x64-cpu-gcc.yml' | ||
- 'CMakeLists.txt' | ||
- 'cmake/**' | ||
- 'src/*' | ||
- 'src/layer/*' | ||
- 'src/layer/x86/**' | ||
- 'tests/**' | ||
- 'tools/**' | ||
- '!tools/pnnx/**' | ||
- 'examples/**' | ||
concurrency: | ||
group: linux-x64-cpu-gcc-${{ ci.head_ref }} | ||
|
||
jobs: | ||
linux-gcc: | ||
name: linux-gcc | ||
strategy: | ||
matrix: | ||
include: | ||
- { SSE2: 'OFF', AVX: 'OFF', AVX2: 'OFF', AVX512: 'OFF' } | ||
- { SSE2: 'ON', AVX: 'OFF', AVX2: 'OFF', AVX512: 'OFF' } | ||
- { SSE2: 'ON', AVX: 'ON', AVX2: 'OFF', AVX512: 'OFF' } | ||
- { SSE2: 'ON', AVX: 'ON', AVX2: 'ON', AVX512: 'OFF' } | ||
- { SSE2: 'ON', AVX: 'ON', AVX2: 'ON', AVX512: 'ON' } | ||
|
||
runs-on: | ||
pool-name: docker | ||
container: | ||
image: bkci/ci:ubuntu | ||
steps: | ||
- name: checkout | ||
checkout: self | ||
with: | ||
strategy: FRESH_CHECKOUT | ||
enableSubmodule: false | ||
enableGitLfs: false | ||
|
||
- name: install-deps | ||
run: | | ||
apt-get update | ||
apt-get install -y libprotobuf-dev protobuf-compiler libopencv-dev | ||
- name: build | ||
run: | | ||
mkdir build && cd build | ||
cmake -DNCNN_SSE2=${{matrix.SSE2}} -DNCNN_AVX=${{matrix.AVX}} -DNCNN_AVX2=${{matrix.AVX2}} -DNCNN_AVX512=${{matrix.AVX512}} -DNCNN_BUILD_TESTS=ON .. | ||
cmake --build . -j 4 | ||
- name: test | ||
run: cd build && ctest --output-on-failure -j 4 | ||
- name: build-shared | ||
run: | | ||
mkdir build-shared && cd build-shared | ||
cmake -DNCNN_SSE2=${{matrix.SSE2}} -DNCNN_AVX=${{matrix.AVX}} -DNCNN_AVX2=${{matrix.AVX2}} -DNCNN_AVX512=${{matrix.AVX512}} -DNCNN_SHARED_LIB=ON .. | ||
cmake --build . -j 4 | ||
- name: build-noint8 | ||
run: | | ||
mkdir build-noint8 && cd build-noint8 | ||
cmake -DNCNN_SSE2=${{matrix.SSE2}} -DNCNN_AVX=${{matrix.AVX}} -DNCNN_AVX2=${{matrix.AVX2}} -DNCNN_AVX512=${{matrix.AVX512}} -DNCNN_INT8=OFF -DNCNN_BUILD_TESTS=ON .. | ||
cmake --build . -j 4 | ||
- name: test-noint8 | ||
run: cd build-noint8 && ctest --output-on-failure -j 4 | ||
|
||
linux-gcc-cpp03-nostdio-nostring-simplestl: | ||
runs-on: | ||
pool-name: docker | ||
container: | ||
image: bkci/ci:ubuntu | ||
steps: | ||
- name: checkout | ||
checkout: self | ||
with: | ||
strategy: FRESH_CHECKOUT | ||
enableSubmodule: false | ||
enableGitLfs: false | ||
|
||
- name: build-nostdio | ||
run: | | ||
mkdir build-nostdio && cd build-nostdio | ||
cmake -DCMAKE_TOOLCHAIN_FILE=../toolchains/host.gcc-c++03.toolchain.cmake -DNCNN_BUILD_TESTS=ON -DNCNN_BUILD_TOOLS=OFF -DNCNN_BUILD_EXAMPLES=OFF .. | ||
cmake --build . -j 4 | ||
- name: test-nostdio | ||
run: cd build-nostdio && ctest --output-on-failure -j 4 | ||
- name: build-nostdio-nostring | ||
run: | | ||
mkdir build-nostdio-nostring && cd build-nostdio-nostring | ||
cmake -DNCNN_STDIO=OFF -DNCNN_STRING=OFF -DNCNN_BUILD_TESTS=OFF -DNCNN_BUILD_BENCHMARK=OFF -DNCNN_BUILD_TOOLS=OFF -DNCNN_BUILD_EXAMPLES=OFF .. | ||
cmake --build . -j 4 | ||
- name: build-simplestl | ||
run: | | ||
mkdir build-simplestl && cd build-simplestl | ||
cmake -DCMAKE_TOOLCHAIN_FILE=../toolchains/host-c.gcc.toolchain.cmake -DNCNN_STDIO=ON -DNCNN_STRING=ON -DNCNN_SIMPLESTL=ON -DNCNN_BUILD_TESTS=ON -DNCNN_BUILD_BENCHMARK=OFF -DNCNN_BUILD_TOOLS=OFF -DNCNN_BUILD_EXAMPLES=OFF .. | ||
cmake --build . -j 4 | ||
- name: test-simplestl | ||
run: cd build-simplestl && ctest --output-on-failure -j 4 | ||
- name: build-simplestl-simpleomp | ||
run: | | ||
mkdir build-simplestl-simpleomp && cd build-simplestl-simpleomp | ||
cmake -DCMAKE_TOOLCHAIN_FILE=../toolchains/host-c.gcc.toolchain.cmake -DNCNN_STDIO=ON -DNCNN_STRING=ON -DNCNN_SIMPLESTL=ON -DNCNN_SIMPLEOMP=ON -DNCNN_BUILD_TESTS=ON -DNCNN_BUILD_BENCHMARK=OFF -DNCNN_BUILD_TOOLS=OFF -DNCNN_BUILD_EXAMPLES=OFF .. | ||
cmake --build . -j 4 | ||
- name: test-simplestl-simpleomp | ||
run: cd build-simplestl-simpleomp && ctest --output-on-failure -j 4 | ||
- name: build-simplestl-simplemath | ||
run: | | ||
mkdir build-simplestl-simplemath && cd build-simplestl-simplemath | ||
cmake -DCMAKE_TOOLCHAIN_FILE=../toolchains/host-c.gcc.toolchain.cmake -DNCNN_STDIO=ON -DNCNN_STRING=ON -DNCNN_SIMPLESTL=ON -DNCNN_SIMPLEMATH=ON -DNCNN_BUILD_TESTS=ON -DNCNN_BUILD_BENCHMARK=OFF -DNCNN_BUILD_TOOLS=OFF -DNCNN_BUILD_EXAMPLES=OFF .. | ||
cmake --build . -j 4 | ||
- name: test-simplestl-simplemath | ||
run: cd build-simplestl-simplemath && ctest --output-on-failure -j 4 | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,207 @@ | ||
name: pnnx | ||
on: | ||
push: | ||
branches: [master] | ||
paths: | ||
- '.ci/pnnx.yml' | ||
- 'tools/pnnx/**' | ||
- '!tools/pnnx/README.md' | ||
mr: | ||
target-branches: [master] | ||
paths: | ||
- '.ci/pnnx.yml' | ||
- 'tools/pnnx/**' | ||
- '!tools/pnnx/README.md' | ||
concurrency: | ||
group: pnnx-${{ ci.head_ref }} | ||
|
||
variables: | ||
protobuf_version: 21.12 | ||
libtorch_version: 2.4.0 | ||
libtorchvision_version: 0.19.0 | ||
onnxruntime_version: 1.18.1 | ||
cache_date: 20240804 | ||
|
||
jobs: | ||
ubuntu: | ||
strategy: | ||
matrix: | ||
include: | ||
- torch-version: 1.8.1 | ||
torchvision-version: 0.9.1 | ||
|
||
- torch-version: 1.9.1 | ||
torchvision-version: 0.10.1 | ||
|
||
- torch-version: 1.10.0 | ||
torchvision-version: 0.11.1 | ||
|
||
- torch-version: 1.11.0 | ||
torchvision-version: 0.12.0 | ||
|
||
- torch-version: 1.12.0 | ||
torchvision-version: 0.13.0 | ||
|
||
- torch-version: 1.13.0 | ||
torchvision-version: 0.14.0 | ||
|
||
- torch-version: 2.0.0 | ||
torchvision-version: 0.15.1 | ||
|
||
- torch-version: 2.1.0 | ||
torchvision-version: 0.16.0 | ||
|
||
- torch-version: 2.2.1 | ||
torchvision-version: 0.17.1 | ||
|
||
- 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: | ||
image: bkci/ci:ubuntu | ||
steps: | ||
- name: checkout | ||
checkout: self | ||
with: | ||
strategy: FRESH_CHECKOUT | ||
enableGitLfs: false | ||
|
||
- name: install-deps | ||
run: | | ||
apt-get update | ||
apt-get install -y python3-pip libjpeg-dev libpng-dev | ||
python3 -m pip install --upgrade pip | ||
apt-get remove -y python3-setuptools | ||
pip3 install -U setuptools==69.5.1 | ||
pip3 install -U pytest wheel twine requests einops numpy==1.26.4 | ||
cd ${{ci.workspace}} | ||
wget -q https://github.com/Kitware/CMake/releases/download/v3.29.3/cmake-3.29.3-linux-x86_64.tar.gz | ||
tar -xf cmake-3.29.3-linux-x86_64.tar.gz | ||
- name: cache-pnnx-deps-torch | ||
id: cache-pnnx-deps-torch | ||
uses: cache@1.* | ||
with: | ||
cachePaths: pnnx-deps-torch-install | ||
cacheKey: pnnx-deps-torch-linux-install-${{variables.cache_date}} | ||
|
||
- name: cache-pnnx-deps-onnx | ||
id: cache-pnnx-deps-onnx | ||
uses: cache@1.* | ||
with: | ||
cachePaths: pnnx-deps-onnx-install | ||
cacheKey: pnnx-deps-onnx-linux-install-${{variables.cache_date}} | ||
|
||
- name: checkout-pnnx-patches | ||
if: steps.cache-pnnx-deps-torch.outputs.cacheHit != 'true' || steps.cache-pnnx-deps-onnx.outputs.cacheHit != 'true' | ||
checkout: https://github.com/pnnx/pnnx.git | ||
with: | ||
refName: main | ||
localPath: pnnx-patches | ||
enableSubmodule: false | ||
enableGitLfs: false | ||
|
||
- name: pnnx-deps-torch-libtorch | ||
if: steps.cache-pnnx-deps-torch.outputs.cacheHit != 'true' | ||
run: | | ||
export PATH=${{ci.workspace}}/cmake-3.29.3-linux-x86_64/bin:$PATH | ||
wget -q https://github.com/pytorch/pytorch/releases/download/v${{variables.libtorch_version}}/pytorch-v${{variables.libtorch_version}}.tar.gz | ||
tar -xf pytorch-v${{variables.libtorch_version}}.tar.gz | ||
cd pytorch-v${{variables.libtorch_version}} | ||
pip3 install -r requirements.txt | ||
patch -p1 -i ${{ci.workspace}}/pnnx-patches/pytorch-v${{variables.libtorch_version}}-fix-mobile-build.patch | ||
patch -p1 -i ${{ci.workspace}}/pnnx-patches/pytorch-v${{variables.libtorch_version}}-no-link-system-lib.patch | ||
patch -p1 -i ${{ci.workspace}}/pnnx-patches/pytorch-v${{variables.libtorch_version}}-fix-pocketfft-build.patch | ||
mkdir -p build && cd build | ||
cmake -DCMAKE_INSTALL_PREFIX=${{ci.workspace}}/pnnx-deps-torch-install -DCMAKE_BUILD_TYPE=MinSizeRel -DBUILD_SHARED_LIBS=OFF -DBUILD_CAFFE2_OPS=OFF -DBUILD_CUSTOM_PROTOBUF=OFF -DBUILD_LITE_INTERPRETER=OFF -DBUILD_PYTHON=OFF -DINTERN_BUILD_MOBILE=ON -DINTERN_DISABLE_AUTOGRAD=ON -DINTERN_DISABLE_ONNX=ON -DUSE_CUDA=OFF -DUSE_DISTRIBUTED=OFF -DUSE_ITT=OFF -DUSE_KINETO=OFF -DUSE_LITE_INTERPRETER_PROFILER=OFF -DUSE_MKLDNN=OFF -DUSE_MPS=OFF -DUSE_NUMPY=OFF -DUSE_OPENMP=OFF -DUSE_SOURCE_DEBUG_ON_MOBILE=OFF -DUSE_XNNPACK=OFF .. | ||
cmake --build . -j $(nproc) | ||
cmake --build . -j $(nproc) --target install/strip | ||
- name: pnnx-deps-torch-libtorchvision | ||
if: steps.cache-pnnx-deps-torch.outputs.cacheHit != 'true' | ||
run: | | ||
export PATH=${{ci.workspace}}/cmake-3.29.3-linux-x86_64/bin:$PATH | ||
wget -q https://github.com/pytorch/vision/archive/v${{variables.libtorchvision_version}}.zip -O vision-${{variables.libtorchvision_version}}.zip | ||
unzip -q vision-${{variables.libtorchvision_version}}.zip | ||
cd vision-${{variables.libtorchvision_version}} | ||
patch -p1 -i ${{ci.workspace}}/pnnx-patches/vision-${{variables.libtorchvision_version}}-ops-only.patch | ||
patch -p1 -i ${{ci.workspace}}/pnnx-patches/vision-${{variables.libtorchvision_version}}-no-cuda-version.patch | ||
mkdir -p build && cd build | ||
cmake -DCMAKE_INSTALL_PREFIX=${{ci.workspace}}/pnnx-deps-torch-install -DTorch_DIR=${{ci.workspace}}/pnnx-deps-torch-install/share/cmake/Torch -DCMAKE_BUILD_TYPE=MinSizeRel -DWITH_PNG=OFF -DWITH_JPEG=OFF .. | ||
cmake --build . -j $(nproc) | ||
cmake --build . -j $(nproc) --target install/strip | ||
- name: pnnx-deps-onnx-protobuf | ||
if: steps.cache-pnnx-deps-onnx.outputs.cacheHit != 'true' | ||
run: | | ||
export PATH=${{ci.workspace}}/cmake-3.29.3-linux-x86_64/bin:$PATH | ||
wget -q https://github.com/protocolbuffers/protobuf/archive/v${{variables.protobuf_version}}.zip -O protobuf-${{variables.protobuf_version}}.zip | ||
unzip -q protobuf-${{variables.protobuf_version}}.zip | ||
cd protobuf-${{variables.protobuf_version}} | ||
mkdir -p build2 && cd build2 | ||
cmake -DCMAKE_INSTALL_PREFIX=${{ci.workspace}}/pnnx-deps-onnx-install -Dprotobuf_BUILD_TESTS=OFF -DCMAKE_BUILD_TYPE=MinSizeRel -DCMAKE_POSITION_INDEPENDENT_CODE=ON .. | ||
cmake --build . -j $(nproc) | ||
cmake --build . --target install/strip | ||
- name: pnnx-deps-onnx-onnxruntime | ||
if: steps.cache-pnnx-deps-onnx.outputs.cacheHit != 'true' | ||
run: | | ||
export PATH=${{ci.workspace}}/cmake-3.29.3-linux-x86_64/bin:$PATH | ||
wget -q https://github.com/microsoft/onnxruntime/archive/v${{variables.onnxruntime_version}}.zip -O onnxruntime-${{variables.onnxruntime_version}}.zip | ||
unzip -q onnxruntime-${{variables.onnxruntime_version}}.zip | ||
cd onnxruntime-${{variables.onnxruntime_version}} | ||
patch -p1 -i ${{ci.workspace}}/pnnx-patches/onnxruntime-${{variables.onnxruntime_version}}-less-mlas-features.patch | ||
patch -p1 -i ${{ci.workspace}}/pnnx-patches/onnxruntime-${{variables.onnxruntime_version}}-monolithic-static-library.patch | ||
mkdir -p build && cd build | ||
cmake -DCMAKE_INSTALL_PREFIX=${{ci.workspace}}/pnnx-deps-onnx-install -DCMAKE_BUILD_TYPE=MinSizeRel -Donnxruntime_USE_FULL_PROTOBUF=ON -Donnxruntime_BUILD_SHARED_LIB=ON -Donnxruntime_BUILD_UNIT_TESTS=OFF -Donnxruntime_ENABLE_CPUINFO=OFF -Donnxruntime_DISABLE_CONTRIB_OPS=ON -Donnxruntime_DISABLE_ML_OPS=ON -Donnxruntime_DISABLE_SPARSE_TENSORS=ON --compile-no-warning-as-error ../cmake | ||
cmake --build . -j $(nproc) | ||
cmake --build . -j $(nproc) --target install/strip | ||
- 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 --index-url https://download.pytorch.org/whl/cpu | ||
pip3 install --user onnx | ||
pip3 install --user onnxscript | ||
- name: build-ncnn | ||
run: | | ||
export PATH=${{ci.workspace}}/cmake-3.29.3-linux-x86_64/bin:$PATH | ||
export PYTHONUSERBASE=${{ci.workspace}}/torch-${{matrix.torch-version}} | ||
mkdir build && cd build | ||
cmake -DCMAKE_BUILD_TYPE=Release -DNCNN_PYTHON=ON -DNCNN_BUILD_TOOLS=OFF -DNCNN_BUILD_EXAMPLES=OFF .. | ||
cmake --build . -j 16 | ||
cd .. | ||
export CMAKE_BUILD_PARALLEL_LEVEL=16 | ||
pip3 install --user . | ||
- name: build-pnnx | ||
run: | | ||
export PATH=${{ci.workspace}}/cmake-3.29.3-linux-x86_64/bin:$PATH | ||
export PYTHONUSERBASE=${{ci.workspace}}/torch-${{matrix.torch-version}} | ||
cd tools/pnnx | ||
mkdir build && cd build | ||
cmake -DCMAKE_BUILD_TYPE=Release -DTorch_INSTALL_DIR=${{ci.workspace}}/pnnx-deps-torch-install -DTorchVision_INSTALL_DIR=${{ci.workspace}}/pnnx-deps-torch-install -Donnxruntime_INSTALL_DIR=${{ci.workspace}}/pnnx-deps-onnx-install -Dprotobuf_DIR=${{ci.workspace}}/pnnx-deps-onnx-install/lib/cmake/protobuf .. | ||
cmake --build . -j 16 --verbose | ||
- name: test | ||
run: | | ||
export PATH=${{ci.workspace}}/cmake-3.29.3-linux-x86_64/bin:$PATH | ||
export PYTHONUSERBASE=${{ci.workspace}}/torch-${{matrix.torch-version}} | ||
export OMP_NUM_THREADS=1 | ||
export MKL_NUM_THREADS=1 | ||
export MKL_ENABLE_INSTRUCTIONS=SSE4_2 | ||
cd tools/pnnx | ||
cd build && ctest --output-on-failure -j 16 | ||
- name: python-pnnx | ||
run: | | ||
export PYTHONUSERBASE=${{ci.workspace}}/torch-${{matrix.torch-version}} | ||
export PNNX_WHEEL_WITHOUT_BUILD=ON | ||
cd tools/pnnx/python | ||
cp ../build/src/pnnx pnnx/ | ||
python3 setup.py install --user | ||
pytest tests |
Oops, something went wrong.