Skip to content

Commit d3978c3

Browse files
authored
Merge branch 'Tencent:master' into fix-bof
2 parents 9021fb7 + b284dbd commit d3978c3

File tree

1,040 files changed

+72315
-59679
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

1,040 files changed

+72315
-59679
lines changed

.ci/pnnx.yml

+23-7
Original file line numberDiff line numberDiff line change
@@ -19,10 +19,10 @@ concurrency:
1919

2020
variables:
2121
protobuf_version: 21.12
22-
libtorch_version: 2.4.0
23-
libtorchvision_version: 0.19.0
24-
onnxruntime_version: 1.18.1
25-
cache_date: 20240804
22+
libtorch_version: 2.5.0
23+
libtorchvision_version: 0.20.0
24+
onnxruntime_version: 1.19.2
25+
cache_date: 20241018
2626

2727
jobs:
2828
ubuntu:
@@ -31,36 +31,51 @@ jobs:
3131
include:
3232
- torch-version: 1.8.1
3333
torchvision-version: 0.9.1
34+
torchaudio-version: 0.8.1
3435

3536
- torch-version: 1.9.1
3637
torchvision-version: 0.10.1
38+
torchaudio-version: 0.9.1
3739

3840
- torch-version: 1.10.0
3941
torchvision-version: 0.11.1
42+
torchaudio-version: '0.10.0+cpu'
4043

4144
- torch-version: 1.11.0
4245
torchvision-version: 0.12.0
46+
torchaudio-version: '0.11.0+cpu'
4347

4448
- torch-version: 1.12.0
4549
torchvision-version: 0.13.0
50+
torchaudio-version: '0.12.0+cpu'
4651

4752
- torch-version: 1.13.0
4853
torchvision-version: 0.14.0
54+
torchaudio-version: '0.13.0+cpu'
4955

5056
- torch-version: 2.0.0
5157
torchvision-version: 0.15.1
58+
torchaudio-version: '2.0.0+cpu'
5259

5360
- torch-version: 2.1.0
5461
torchvision-version: 0.16.0
62+
torchaudio-version: '2.1.0+cpu'
5563

5664
- torch-version: 2.2.1
5765
torchvision-version: 0.17.1
66+
torchaudio-version: '2.2.1+cpu'
5867

5968
- torch-version: 2.3.0
6069
torchvision-version: 0.18.0
70+
torchaudio-version: '2.3.0+cpu'
6171

6272
- torch-version: 2.4.0
6373
torchvision-version: 0.19.0
74+
torchaudio-version: '2.4.0+cpu'
75+
76+
- torch-version: 2.5.0
77+
torchvision-version: 0.20.0
78+
torchaudio-version: '2.5.0+cpu'
6479

6580
runs-on:
6681
pool-name: docker
@@ -157,6 +172,7 @@ jobs:
157172
cd onnxruntime-${{variables.onnxruntime_version}}
158173
patch -p1 -i ${{ci.workspace}}/pnnx-patches/onnxruntime-${{variables.onnxruntime_version}}-less-mlas-features.patch
159174
patch -p1 -i ${{ci.workspace}}/pnnx-patches/onnxruntime-${{variables.onnxruntime_version}}-monolithic-static-library.patch
175+
patch -p1 -i ${{ci.workspace}}/pnnx-patches/onnxruntime-${{variables.onnxruntime_version}}-fix-gcc-avxvnni-check.patch
160176
mkdir -p build && cd build
161177
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
162178
cmake --build . -j $(nproc)
@@ -165,7 +181,7 @@ jobs:
165181
- name: setup-pytorch
166182
run: |
167183
export PYTHONUSERBASE=${{ci.workspace}}/torch-${{matrix.torch-version}}
168-
pip3 install --user torch==${{matrix.torch-version}}+cpu torchvision==${{matrix.torchvision-version}}+cpu --index-url https://download.pytorch.org/whl/cpu
184+
pip3 install --user torch==${{matrix.torch-version}}+cpu torchvision==${{matrix.torchvision-version}}+cpu torchaudio==${{matrix.torchaudio-version}} --index-url https://download.pytorch.org/whl/cpu
169185
pip3 install --user onnx
170186
pip3 install --user onnxscript
171187
@@ -196,8 +212,8 @@ jobs:
196212
export OMP_NUM_THREADS=1
197213
export MKL_NUM_THREADS=1
198214
export MKL_ENABLE_INSTRUCTIONS=SSE4_2
199-
cd tools/pnnx
200-
cd build && ctest --output-on-failure -j 16
215+
cd tools/pnnx/build
216+
ctest --output-on-failure -j 16
201217
202218
- name: python-pnnx
203219
run: |

.ci/test-coverage.yml

-224
Original file line numberDiff line numberDiff line change
@@ -96,87 +96,6 @@ jobs:
9696
- name: codecov
9797
run: ./codecov -t ${{settings.CODECOV_TOKEN.access_token}} -C ${{ ci.sha }} -B ${{ ci.head_ref }} -f build/lcov.info
9898

99-
linux-gcc-gpu-lavapipe:
100-
name: linux-gcc-gpu-lavapipe
101-
runs-on:
102-
pool-name: docker
103-
container:
104-
image: bkci/ci:ubuntu
105-
steps:
106-
- name: checkout
107-
checkout: self
108-
with:
109-
strategy: FRESH_CHECKOUT
110-
enableGitLfs: false
111-
112-
- name: install-deps
113-
run: |
114-
apt-get update
115-
apt-get install -y lcov libvulkan-dev libxcb-shm0
116-
curl https://uploader.codecov.io/verification.gpg | gpg --no-default-keyring --keyring trustedkeys.gpg --import
117-
curl -Os https://uploader.codecov.io/latest/linux/codecov
118-
curl -Os https://uploader.codecov.io/latest/linux/codecov.SHA256SUM
119-
curl -Os https://uploader.codecov.io/latest/linux/codecov.SHA256SUM.sig
120-
gpgv codecov.SHA256SUM.sig codecov.SHA256SUM
121-
shasum -a 256 -c codecov.SHA256SUM
122-
chmod +x codecov
123-
124-
- name: cache-lavapipe
125-
id: cache-lavapipe
126-
uses: cache@1.*
127-
with:
128-
cachePaths: lavapipe-install
129-
cacheKey: lavapipe-linux-install-20211127-4
130-
131-
- name: checkout-lavapipe
132-
if: steps.cache-lavapipe.outputs.cacheHit != 'true'
133-
checkout: https://github.com/mesa3d/mesa.git
134-
with:
135-
pullType: COMMIT_ID
136-
refName: cd39180cfab20734744b379b085cc3b5c2cecd3a
137-
localPath: mesa
138-
enableSubmodule: false
139-
enableGitLfs: false
140-
141-
- name: lavapipe
142-
if: steps.cache-lavapipe.outputs.cacheHit != 'true'
143-
run: |
144-
echo 'deb-src http://mirrors.cloud.tencent.com/debian bullseye main' | tee -a /etc/apt/sources.list
145-
echo 'deb-src http://mirrors.cloud.tencent.com/debian bullseye-updates main' | tee -a /etc/apt/sources.list
146-
apt-get update
147-
apt-get build-dep -y mesa
148-
mkdir -p "${{ci.workspace}}/lavapipe-install"
149-
cd mesa
150-
mkdir build
151-
cd build
152-
meson -Dprefix="${{ci.workspace}}/lavapipe-install" -Dbuildtype=release -Db_lto=true -Db_ndebug=true -Dplatforms="x11" -Ddri3=enabled -Ddri-drivers="" -Dgallium-drivers=swrast -Dgallium-vdpau=disabled -Dgallium-xvmc=disabled -Dgallium-omx=disabled -Dgallium-va=disabled -Dgallium-xa=disabled -Dgallium-opencl=disabled -Dopencl-native=false -Dvulkan-drivers=swrast -Dshader-cache=disabled -Dgles1=disabled -Dgles2=disabled -Dopengl=false -Dgbm=disabled -Dglx=disabled -Degl=disabled -Dllvm=enabled -Dvalgrind=disabled -Dlibunwind=disabled -Dlmsensors=disabled ..
153-
ninja -j$(nproc)
154-
ninja install
155-
find ${{ci.workspace}}/lavapipe-install
156-
cat ${{ci.workspace}}/lavapipe-install/share/vulkan/icd.d/lvp_icd.x86_64.json
157-
158-
- name: build
159-
run: |
160-
mkdir build && cd build
161-
cmake -DCMAKE_BUILD_TYPE=debug -DNCNN_COVERAGE=ON -DNCNN_RUNTIME_CPU=OFF -DNCNN_AVX2=ON -DNCNN_AVX512=OFF -DNCNN_XOP=OFF -DNCNN_OPENMP=OFF -DNCNN_VULKAN=ON -DNCNN_BUILD_TOOLS=OFF -DNCNN_BUILD_EXAMPLES=OFF -DNCNN_BUILD_TESTS=ON ..
162-
cmake --build . -j 4
163-
- name: test
164-
run: |
165-
export LP_NUM_THREADS=4
166-
export VK_ICD_FILENAMES="${{ci.workspace}}/lavapipe-install/share/vulkan/icd.d/lvp_icd.x86_64.json"
167-
cd build
168-
ctest --output-on-failure -j 4
169-
- name: lcov-collect
170-
run: |
171-
cd build
172-
lcov -d ./src -c -o lcov.info
173-
lcov -r lcov.info '/usr/*' -o lcov.info
174-
lcov -r lcov.info '*/build/*' -o lcov.info
175-
lcov -r lcov.info '*/glslang/*' -o lcov.info
176-
lcov --list lcov.info
177-
- name: codecov
178-
run: ./codecov -t ${{settings.CODECOV_TOKEN.access_token}} -C ${{ ci.sha }} -B ${{ ci.head_ref }} -f build/lcov.info
179-
18099
linux-gcc-x64:
181100
name: linux-gcc-x64
182101
strategy:
@@ -840,149 +759,6 @@ jobs:
840759
- name: codecov
841760
run: ./codecov -t ${{settings.CODECOV_TOKEN.access_token}} -C ${{ ci.sha }} -B ${{ ci.head_ref }} -f build/lcov.info
842761

843-
linux-gcc-riscv64-rvv:
844-
name: linux-gcc-riscv64-rvv
845-
strategy:
846-
matrix:
847-
OPENMP: ['OFF', 'ON']
848-
849-
runs-on:
850-
pool-name: docker
851-
container:
852-
image: bkci/ci:ubuntu
853-
steps:
854-
- name: checkout
855-
checkout: self
856-
with:
857-
strategy: FRESH_CHECKOUT
858-
enableSubmodule: false
859-
enableGitLfs: false
860-
861-
- name: install-deps
862-
run: |
863-
apt-get update
864-
apt-get install -y lcov libcapstone4 libglib2.0-0
865-
curl https://uploader.codecov.io/verification.gpg | gpg --no-default-keyring --keyring trustedkeys.gpg --import
866-
curl -Os https://uploader.codecov.io/latest/linux/codecov
867-
curl -Os https://uploader.codecov.io/latest/linux/codecov.SHA256SUM
868-
curl -Os https://uploader.codecov.io/latest/linux/codecov.SHA256SUM.sig
869-
gpgv codecov.SHA256SUM.sig codecov.SHA256SUM
870-
shasum -a 256 -c codecov.SHA256SUM
871-
chmod +x codecov
872-
873-
- name: cache-qemu
874-
id: cache-qemu
875-
uses: cache@1.*
876-
with:
877-
cachePaths: qemu-install
878-
cacheKey: qemu-riscv64-install-20230624-1
879-
880-
- name: checkout-qemu
881-
if: steps.cache-qemu.outputs.cacheHit != 'true'
882-
checkout: https://github.com/qemu/qemu.git
883-
with:
884-
pullType: COMMIT_ID
885-
refName: b455ce4c2f300c8ba47cba7232dd03261368a4cb
886-
localPath: qemu
887-
enableSubmodule: false
888-
enableGitLfs: false
889-
890-
- name: qemu
891-
if: steps.cache-qemu.outputs.cacheHit != 'true'
892-
run: |
893-
echo 'deb-src http://mirrors.cloud.tencent.com/debian bullseye main' | tee -a /etc/apt/sources.list
894-
echo 'deb-src http://mirrors.cloud.tencent.com/debian bullseye-updates main' | tee -a /etc/apt/sources.list
895-
apt-get update
896-
apt-get build-dep -y qemu
897-
apt-get install -y python3-pip
898-
python3 -m pip install --upgrade pip
899-
apt-get remove -y python3-setuptools
900-
pip3 install -U setuptools
901-
cd qemu
902-
wget https://raw.githubusercontent.com/nihui/ncnn-assets/master/qemu-patches/0007-linux-user-Expose-risc-v-V-isa-bit-in-get_elf_hwcap.patch
903-
patch -p1 -i 0007-linux-user-Expose-risc-v-V-isa-bit-in-get_elf_hwcap.patch
904-
./configure --prefix=${{ci.workspace}}/qemu-install --target-list=riscv64-linux-user --disable-system
905-
make -j$(nproc)
906-
make install
907-
908-
- name: cache-rv64gcv
909-
id: cache-rv64gcv
910-
uses: cache@1.*
911-
with:
912-
cachePaths: rv64gcv-install
913-
cacheKey: rv64gcv-linux-install-20221029-1
914-
915-
- name: checkout-riscv-gnu-toolchain
916-
if: steps.cache-rv64gcv.outputs.cacheHit != 'true'
917-
checkout: https://github.com/riscv/riscv-gnu-toolchain.git
918-
with:
919-
pullType: COMMIT_ID
920-
refName: da01ba455ce3802ffa84fdca3a089079996dbfc3
921-
localPath: riscv-gnu-toolchain
922-
enableSubmodule: false
923-
enableGitLfs: false
924-
925-
- name: riscv-gnu-toolchain
926-
if: steps.cache-rv64gcv.outputs.cacheHit != 'true'
927-
run: |
928-
apt-get update
929-
apt-get install -y autoconf automake autotools-dev curl python3 libmpc-dev libmpfr-dev libgmp-dev gawk build-essential bison flex texinfo gperf libtool patchutils bc zlib1g-dev libexpat-dev device-tree-compiler
930-
cd riscv-gnu-toolchain
931-
git submodule update --init --recursive --depth 1 glibc
932-
git submodule update --init --recursive --depth 1 newlib
933-
#git submodule update --init --recursive --depth 1 riscv-binutils
934-
#git submodule update --init --recursive --depth 1 riscv-gcc
935-
git submodule update --init --recursive --depth 1 riscv-dejagnu
936-
git submodule update --init --recursive --depth 1 riscv-gdb
937-
rm -rf riscv-binutils
938-
git clone -b binutils-2_39-branch https://sourceware.org/git/binutils-gdb.git riscv-binutils
939-
rm -rf riscv-gcc
940-
git clone -b riscv-gcc-rvv-next https://github.com/riscv-collab/riscv-gcc.git riscv-gcc
941-
cd riscv-gcc
942-
git checkout 8a0c1b106f01c455a8fb478cfe52d859a69020fd
943-
cd ..
944-
sed -i '/__OBSOLETE_MATH/d' newlib/newlib/libm/common/math_errf.c
945-
./configure --prefix=${{ci.workspace}}/rv64gcv-install --with-arch=rv64gcv_zfh
946-
make linux -j$(nproc)
947-
find ${{ci.workspace}}/rv64gcv-install -type f | xargs -i strip -g {} || true
948-
949-
- name: build
950-
run: |
951-
export RISCV_ROOT_PATH=${{ci.workspace}}/rv64gcv-install
952-
mkdir build && cd build
953-
cmake -DCMAKE_TOOLCHAIN_FILE=../toolchains/riscv64-unknown-linux-gnu.toolchain.cmake -DCMAKE_BUILD_TYPE=debug -DCMAKE_C_FLAGS="-O1" -DCMAKE_CXX_FLAGS="-O1" -DNCNN_COVERAGE=ON -DNCNN_RUNTIME_CPU=OFF -DNCNN_RVV=ON -DNCNN_OPENMP=${{matrix.OPENMP}} -DNCNN_BUILD_TOOLS=OFF -DNCNN_BUILD_EXAMPLES=OFF -DNCNN_BUILD_TESTS=ON ..
954-
cmake --build . -j 4
955-
- name: test-vlen128
956-
run: |
957-
export PATH=${{ci.workspace}}/qemu-install/bin:$PATH
958-
cd build
959-
TESTS_EXECUTABLE_LOADER=qemu-riscv64 TESTS_EXECUTABLE_LOADER_ARGUMENTS="-cpu;rv64,v=true,Zfh=true,x-zvfh=true,vlen=128,elen=64,vext_spec=v1.0;-L;${{ci.workspace}}/rv64gcv-install/sysroot" ctest --output-on-failure -j 4
960-
- name: lcov-collect-vlen128
961-
run: |
962-
cd build
963-
lcov --gcov-tool ${{ci.workspace}}/rv64gcv-install/bin/riscv64-unknown-linux-gnu-gcov -d ./src -c -o lcov.info
964-
lcov -r lcov.info '/usr/*' -o lcov.info
965-
lcov -r lcov.info '*/build/*' -o lcov.info
966-
lcov -r lcov.info '*/rv64gcv-install/*' -o lcov.info
967-
lcov --list lcov.info
968-
- name: codecov-vlen128
969-
run: ./codecov -t ${{settings.CODECOV_TOKEN.access_token}} -C ${{ ci.sha }} -B ${{ ci.head_ref }} -f build/lcov.info
970-
- name: test-vlen256
971-
run: |
972-
export PATH=${{ci.workspace}}/qemu-install/bin:$PATH
973-
cd build
974-
TESTS_EXECUTABLE_LOADER=qemu-riscv64 TESTS_EXECUTABLE_LOADER_ARGUMENTS="-cpu;rv64,v=true,Zfh=true,x-zvfh=true,vlen=256,elen=64,vext_spec=v1.0;-L;${{ci.workspace}}/rv64gcv-install/sysroot" ctest --output-on-failure -j 4
975-
- name: lcov-collect-vlen256
976-
run: |
977-
cd build
978-
lcov --gcov-tool ${{ci.workspace}}/rv64gcv-install/bin/riscv64-unknown-linux-gnu-gcov -d ./src -c -o lcov.info
979-
lcov -r lcov.info '/usr/*' -o lcov.info
980-
lcov -r lcov.info '*/build/*' -o lcov.info
981-
lcov -r lcov.info '*/rv64gcv-install/*' -o lcov.info
982-
lcov --list lcov.info
983-
- name: codecov-vlen256
984-
run: ./codecov -t ${{settings.CODECOV_TOKEN.access_token}} -C ${{ ci.sha }} -B ${{ ci.head_ref }} -f build/lcov.info
985-
986762
linux-gcc-loongarch64:
987763
name: linux-gcc-loongarch64
988764
strategy:

.github/workflows/android.yml

+17-2
Original file line numberDiff line numberDiff line change
@@ -9,6 +9,7 @@ on:
99
- 'src/*'
1010
- 'src/layer/*'
1111
- 'src/layer/arm/**'
12+
- 'src/layer/riscv/**'
1213
- 'src/layer/x86/**'
1314
- 'src/layer/vulkan/**'
1415
pull_request:
@@ -20,6 +21,7 @@ on:
2021
- 'src/*'
2122
- 'src/layer/*'
2223
- 'src/layer/arm/**'
24+
- 'src/layer/riscv/**'
2325
- 'src/layer/x86/**'
2426
- 'src/layer/vulkan/**'
2527
concurrency:
@@ -35,6 +37,7 @@ jobs:
3537
NCNN_CMAKE_OPTIONS: |
3638
-DCMAKE_TOOLCHAIN_FILE=$ANDROID_NDK_LATEST_HOME/build/cmake/android.toolchain.cmake \
3739
-DANDROID_PLATFORM=android-21 \
40+
-DANDROID_SUPPORT_FLEXIBLE_PAGE_SIZES=ON \
3841
-DCMAKE_INSTALL_PREFIX=install \
3942
-DCMAKE_BUILD_TYPE=Release \
4043
-DNCNN_VULKAN=ON \
@@ -64,6 +67,11 @@ jobs:
6467
mkdir build-x86_64 && cd build-x86_64
6568
cmake ${{ env.NCNN_CMAKE_OPTIONS }} -DANDROID_ABI="x86_64" ..
6669
cmake --build . -j $(nproc)
70+
- name: riscv64
71+
run: |
72+
mkdir build-riscv64 && cd build-riscv64
73+
cmake ${{ env.NCNN_CMAKE_OPTIONS }} -DANDROID_ABI="riscv64" ..
74+
cmake --build . -j $(nproc)
6775
6876
- name: armeabi-v7a-shared
6977
run: |
@@ -85,6 +93,11 @@ jobs:
8593
mkdir build-x86_64-shared && cd build-x86_64-shared
8694
cmake ${{ env.NCNN_CMAKE_OPTIONS }} -DANDROID_ABI="x86_64" -DNCNN_SHARED_LIB=ON ..
8795
cmake --build . -j $(nproc)
96+
- name: riscv64-shared
97+
run: |
98+
mkdir build-riscv64-shared && cd build-riscv64-shared
99+
cmake ${{ env.NCNN_CMAKE_OPTIONS }} -DANDROID_ABI="riscv64" -DNCNN_SHARED_LIB=ON ..
100+
cmake --build . -j $(nproc)
88101
89102
ndk-r16b:
90103
runs-on: ubuntu-latest
@@ -105,8 +118,10 @@ jobs:
105118
env:
106119
DEBIAN_FRONTEND: noninteractive
107120
run: |
108-
sudo apt-get update
109-
sudo apt-get install -y libncurses5
121+
pushd /usr/lib/x86_64-linux-gnu/
122+
sudo ln -s libncurses.so.6 libncurses.so.5
123+
sudo ln -s libtinfo.so.6 libtinfo.so.5
124+
popd
110125
wget -q https://dl.google.com/android/repository/android-ndk-r16b-linux-x86_64.zip -O $GITHUB_WORKSPACE/android-ndk-r16b-linux-x86_64.zip
111126
cd $GITHUB_WORKSPACE && unzip -q android-ndk-r16b-linux-x86_64.zip
112127

0 commit comments

Comments
 (0)