Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

port rvv intrinsic 1.0+ #5642

Merged
merged 79 commits into from
Dec 4, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
79 commits
Select commit Hold shift + click to select a range
e434c85
rvv intrinsic 1.0+
nihui Aug 21, 2024
a2a6f81
apply code-format changes
nihui Aug 21, 2024
1bf24a7
w
nihui Aug 21, 2024
085d63f
ww
nihui Aug 21, 2024
46cd351
p
nihui Aug 21, 2024
270951e
z
nihui Aug 21, 2024
95561b4
NCNN_ZVFH macro
nihui Aug 21, 2024
2092d66
some zvfh infra
nihui Aug 21, 2024
d1ff67f
zfh to zvfh
nihui Aug 21, 2024
cfd92c3
q
nihui Aug 25, 2024
1b32abe
c
nihui Aug 25, 2024
505abcf
x
nihui Aug 25, 2024
f190d06
z
nihui Aug 25, 2024
8c063d4
z
nihui Aug 25, 2024
d765e85
apply code-format changes
nihui Aug 25, 2024
b5eb8d6
c
nihui Aug 26, 2024
49a3194
cc
nihui Aug 26, 2024
7e1f6b0
x
nihui Aug 26, 2024
8c68cf4
x
nihui Aug 26, 2024
401a2dd
x
nihui Aug 26, 2024
9117c40
x
nihui Aug 26, 2024
2463454
disable rvv dispatch
nihui Aug 26, 2024
a9f8d24
fix floor ceil
nihui Aug 26, 2024
e3d5104
fix m
nihui Aug 26, 2024
ad9d977
apply code-format changes
nihui Aug 26, 2024
7a3e9bd
fix selu
nihui Aug 27, 2024
30e79c2
dispatch for rvv and xtheadvector
nihui Aug 30, 2024
ddb7090
apply code-format changes
nihui Aug 30, 2024
454e647
Merge branch 'master' into ci-android-riscv
nihui Aug 30, 2024
e511dbc
Merge branch 'master' into ci-android-riscv
nihui Sep 4, 2024
4070966
Merge branch 'master' into ci-android-riscv
nihui Sep 18, 2024
2a462fe
Merge branch 'master' into ci-android-riscv
nihui Oct 12, 2024
97ff591
port xtheadvector recp rsqrt trunc
nihui Nov 16, 2024
c8add51
Merge branch 'master' into ci-android-riscv
nihui Nov 16, 2024
de0cf29
Merge branch 'master' into ci-android-riscv
nihui Nov 30, 2024
1ba5670
dispatch for zfh
nihui Nov 30, 2024
ee5a191
apply code-format changes
nihui Nov 30, 2024
0e3f4ee
cc
nihui Nov 30, 2024
b49bb82
apply code-format changes
nihui Nov 30, 2024
af5cb1b
z
nihui Nov 30, 2024
01eadf2
general rvv gemm
nihui Dec 1, 2024
152bb76
f
nihui Dec 2, 2024
39bea8d
apply code-format changes
nihui Dec 2, 2024
0afd063
c906 ci
nihui Dec 2, 2024
8d742a3
c
nihui Dec 2, 2024
808ad44
ci c910
nihui Dec 2, 2024
fefea29
define __riscv_zvfh
nihui Dec 2, 2024
cd493c5
cast zfh
nihui Dec 2, 2024
c3b9078
w
nihui Dec 2, 2024
c651d48
apply code-format changes
nihui Dec 2, 2024
13deef6
tuple clean
nihui Dec 2, 2024
94421cc
ff
nihui Dec 2, 2024
032b07a
apply code-format changes
nihui Dec 2, 2024
df7e93f
riscv64 clang ci
nihui Dec 3, 2024
36dc2c3
rename ci
nihui Dec 3, 2024
2b8e0f5
Merge branch 'master' into ci-android-riscv
nihui Dec 3, 2024
87573b4
reject xuantie gcc
nihui Dec 3, 2024
2a33a4a
qwq
nihui Dec 3, 2024
932fa71
s
nihui Dec 3, 2024
8f6f48f
coverage ci
nihui Dec 3, 2024
69e69f2
ff
nihui Dec 3, 2024
3b0565e
O1
nihui Dec 3, 2024
d4e9b72
z
nihui Dec 3, 2024
38121ef
o2
nihui Dec 3, 2024
0962199
rco
nihui Dec 3, 2024
54609bc
d
nihui Dec 3, 2024
ac53182
fix
nihui Dec 3, 2024
4aa6e7e
xtheadvector packing
nihui Dec 3, 2024
6aed213
c906 zfh off
nihui Dec 3, 2024
37be473
c906 hack
nihui Dec 3, 2024
bc4ec08
enable fp16
nihui Dec 3, 2024
8754523
ci
nihui Dec 3, 2024
d4785c4
update doc
nihui Dec 3, 2024
c8aa3d1
try newer compiler
nihui Dec 3, 2024
df6c7ba
Revert "try newer compiler"
nihui Dec 3, 2024
867cbe6
drop old th1520 toolchain
nihui Dec 4, 2024
fd2ffe1
fix gcov
nihui Dec 4, 2024
05b9ae8
u
nihui Dec 4, 2024
11b1e86
cc
nihui Dec 4, 2024
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
143 changes: 0 additions & 143 deletions .ci/test-coverage.yml
Original file line number Diff line number Diff line change
Expand Up @@ -840,149 +840,6 @@ jobs:
- name: codecov
run: ./codecov -t ${{settings.CODECOV_TOKEN.access_token}} -C ${{ ci.sha }} -B ${{ ci.head_ref }} -f build/lcov.info

linux-gcc-riscv64-rvv:
name: linux-gcc-riscv64-rvv
strategy:
matrix:
OPENMP: ['OFF', '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 lcov libcapstone4 libglib2.0-0
curl https://uploader.codecov.io/verification.gpg | gpg --no-default-keyring --keyring trustedkeys.gpg --import
curl -Os https://uploader.codecov.io/latest/linux/codecov
curl -Os https://uploader.codecov.io/latest/linux/codecov.SHA256SUM
curl -Os https://uploader.codecov.io/latest/linux/codecov.SHA256SUM.sig
gpgv codecov.SHA256SUM.sig codecov.SHA256SUM
shasum -a 256 -c codecov.SHA256SUM
chmod +x codecov

- name: cache-qemu
id: cache-qemu
uses: cache@1.*
with:
cachePaths: qemu-install
cacheKey: qemu-riscv64-install-20230624-1

- name: checkout-qemu
if: steps.cache-qemu.outputs.cacheHit != 'true'
checkout: https://github.com/qemu/qemu.git
with:
pullType: COMMIT_ID
refName: b455ce4c2f300c8ba47cba7232dd03261368a4cb
localPath: qemu
enableSubmodule: false
enableGitLfs: false

- name: qemu
if: steps.cache-qemu.outputs.cacheHit != 'true'
run: |
echo 'deb-src http://mirrors.cloud.tencent.com/debian bullseye main' | tee -a /etc/apt/sources.list
echo 'deb-src http://mirrors.cloud.tencent.com/debian bullseye-updates main' | tee -a /etc/apt/sources.list
apt-get update
apt-get build-dep -y qemu
apt-get install -y python3-pip
python3 -m pip install --upgrade pip
apt-get remove -y python3-setuptools
pip3 install -U setuptools
cd qemu
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
patch -p1 -i 0007-linux-user-Expose-risc-v-V-isa-bit-in-get_elf_hwcap.patch
./configure --prefix=${{ci.workspace}}/qemu-install --target-list=riscv64-linux-user --disable-system
make -j$(nproc)
make install

- name: cache-rv64gcv
id: cache-rv64gcv
uses: cache@1.*
with:
cachePaths: rv64gcv-install
cacheKey: rv64gcv-linux-install-20221029-1

- name: checkout-riscv-gnu-toolchain
if: steps.cache-rv64gcv.outputs.cacheHit != 'true'
checkout: https://github.com/riscv/riscv-gnu-toolchain.git
with:
pullType: COMMIT_ID
refName: da01ba455ce3802ffa84fdca3a089079996dbfc3
localPath: riscv-gnu-toolchain
enableSubmodule: false
enableGitLfs: false

- name: riscv-gnu-toolchain
if: steps.cache-rv64gcv.outputs.cacheHit != 'true'
run: |
apt-get update
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
cd riscv-gnu-toolchain
git submodule update --init --recursive --depth 1 glibc
git submodule update --init --recursive --depth 1 newlib
#git submodule update --init --recursive --depth 1 riscv-binutils
#git submodule update --init --recursive --depth 1 riscv-gcc
git submodule update --init --recursive --depth 1 riscv-dejagnu
git submodule update --init --recursive --depth 1 riscv-gdb
rm -rf riscv-binutils
git clone -b binutils-2_39-branch https://sourceware.org/git/binutils-gdb.git riscv-binutils
rm -rf riscv-gcc
git clone -b riscv-gcc-rvv-next https://github.com/riscv-collab/riscv-gcc.git riscv-gcc
cd riscv-gcc
git checkout 8a0c1b106f01c455a8fb478cfe52d859a69020fd
cd ..
sed -i '/__OBSOLETE_MATH/d' newlib/newlib/libm/common/math_errf.c
./configure --prefix=${{ci.workspace}}/rv64gcv-install --with-arch=rv64gcv_zfh
make linux -j$(nproc)
find ${{ci.workspace}}/rv64gcv-install -type f | xargs -i strip -g {} || true

- name: build
run: |
export RISCV_ROOT_PATH=${{ci.workspace}}/rv64gcv-install
mkdir build && cd build
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 ..
cmake --build . -j 4
- name: test-vlen128
run: |
export PATH=${{ci.workspace}}/qemu-install/bin:$PATH
cd build
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
- name: lcov-collect-vlen128
run: |
cd build
lcov --gcov-tool ${{ci.workspace}}/rv64gcv-install/bin/riscv64-unknown-linux-gnu-gcov -d ./src -c -o lcov.info
lcov -r lcov.info '/usr/*' -o lcov.info
lcov -r lcov.info '*/build/*' -o lcov.info
lcov -r lcov.info '*/rv64gcv-install/*' -o lcov.info
lcov --list lcov.info
- name: codecov-vlen128
run: ./codecov -t ${{settings.CODECOV_TOKEN.access_token}} -C ${{ ci.sha }} -B ${{ ci.head_ref }} -f build/lcov.info
- name: test-vlen256
run: |
export PATH=${{ci.workspace}}/qemu-install/bin:$PATH
cd build
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
- name: lcov-collect-vlen256
run: |
cd build
lcov --gcov-tool ${{ci.workspace}}/rv64gcv-install/bin/riscv64-unknown-linux-gnu-gcov -d ./src -c -o lcov.info
lcov -r lcov.info '/usr/*' -o lcov.info
lcov -r lcov.info '*/build/*' -o lcov.info
lcov -r lcov.info '*/rv64gcv-install/*' -o lcov.info
lcov --list lcov.info
- name: codecov-vlen256
run: ./codecov -t ${{settings.CODECOV_TOKEN.access_token}} -C ${{ ci.sha }} -B ${{ ci.head_ref }} -f build/lcov.info

linux-gcc-loongarch64:
name: linux-gcc-loongarch64
strategy:
Expand Down
12 changes: 12 additions & 0 deletions .github/workflows/android.yml
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,7 @@ on:
- 'src/*'
- 'src/layer/*'
- 'src/layer/arm/**'
- 'src/layer/riscv/**'
- 'src/layer/x86/**'
- 'src/layer/vulkan/**'
pull_request:
Expand All @@ -20,6 +21,7 @@ on:
- 'src/*'
- 'src/layer/*'
- 'src/layer/arm/**'
- 'src/layer/riscv/**'
- 'src/layer/x86/**'
- 'src/layer/vulkan/**'
concurrency:
Expand Down Expand Up @@ -64,6 +66,11 @@ jobs:
mkdir build-x86_64 && cd build-x86_64
cmake ${{ env.NCNN_CMAKE_OPTIONS }} -DANDROID_ABI="x86_64" ..
cmake --build . -j $(nproc)
- name: riscv64
run: |
mkdir build-riscv64 && cd build-riscv64
cmake ${{ env.NCNN_CMAKE_OPTIONS }} -DANDROID_ABI="riscv64" ..
cmake --build . -j $(nproc)

- name: armeabi-v7a-shared
run: |
Expand All @@ -85,6 +92,11 @@ jobs:
mkdir build-x86_64-shared && cd build-x86_64-shared
cmake ${{ env.NCNN_CMAKE_OPTIONS }} -DANDROID_ABI="x86_64" -DNCNN_SHARED_LIB=ON ..
cmake --build . -j $(nproc)
- name: riscv64-shared
run: |
mkdir build-riscv64-shared && cd build-riscv64-shared
cmake ${{ env.NCNN_CMAKE_OPTIONS }} -DANDROID_ABI="riscv64" -DNCNN_SHARED_LIB=ON ..
cmake --build . -j $(nproc)

ndk-r16b:
runs-on: ubuntu-latest
Expand Down
Original file line number Diff line number Diff line change
@@ -1,9 +1,9 @@
name: elf-riscv32-cpu-gcc
name: elf-riscv32
on:
push:
branches: [master]
paths:
- '.github/workflows/elf-riscv32-cpu-gcc.yml'
- '.github/workflows/elf-riscv32.yml'
- 'toolchains/riscv32-unknown-elf.toolchain.cmake'
- 'CMakeLists.txt'
- 'cmake/**'
Expand All @@ -14,7 +14,7 @@ on:
pull_request:
branches: [master]
paths:
- '.github/workflows/elf-riscv32-cpu-gcc.yml'
- '.github/workflows/elf-riscv32.yml'
- 'toolchains/riscv32-unknown-elf.toolchain.cmake'
- 'CMakeLists.txt'
- 'cmake/**'
Expand All @@ -23,7 +23,7 @@ on:
- 'src/layer/riscv/**'
- 'tests/**'
concurrency:
group: elf-riscv32-cpu-gcc-${{ github.ref }}
group: elf-riscv32-${{ github.ref }}
cancel-in-progress: true
permissions:
contents: read
Expand Down
Original file line number Diff line number Diff line change
@@ -1,9 +1,9 @@
name: elf-riscv64-cpu-gcc
name: elf-riscv64
on:
push:
branches: [master]
paths:
- '.github/workflows/elf-riscv64-cpu-gcc.yml'
- '.github/workflows/elf-riscv64.yml'
- 'toolchains/riscv64-unknown-elf.toolchain.cmake'
- 'CMakeLists.txt'
- 'cmake/**'
Expand All @@ -14,7 +14,7 @@ on:
pull_request:
branches: [master]
paths:
- '.github/workflows/elf-riscv64-cpu-gcc.yml'
- '.github/workflows/elf-riscv64.yml'
- 'toolchains/riscv64-unknown-elf.toolchain.cmake'
- 'CMakeLists.txt'
- 'cmake/**'
Expand All @@ -23,7 +23,7 @@ on:
- 'src/layer/riscv/**'
- 'tests/**'
concurrency:
group: elf-riscv64-cpu-gcc-${{ github.ref }}
group: elf-riscv64-${{ github.ref }}
cancel-in-progress: true
permissions:
contents: read
Expand Down
Original file line number Diff line number Diff line change
@@ -1,9 +1,9 @@
name: linux-aarch64-cpu-gcc
name: linux-aarch64
on:
push:
branches: [master]
paths:
- '.github/workflows/linux-aarch64-cpu-gcc.yml'
- '.github/workflows/linux-aarch64.yml'
- 'toolchains/aarch64-linux-gnu.toolchain.cmake'
- 'CMakeLists.txt'
- 'cmake/**'
Expand All @@ -14,7 +14,7 @@ on:
pull_request:
branches: [master]
paths:
- '.github/workflows/linux-aarch64-cpu-gcc.yml'
- '.github/workflows/linux-aarch64.yml'
- 'toolchains/aarch64-linux-gnu.toolchain.cmake'
- 'CMakeLists.txt'
- 'cmake/**'
Expand All @@ -23,13 +23,13 @@ on:
- 'src/layer/arm/**'
- 'tests/**'
concurrency:
group: linux-aarch64-cpu-gcc-${{ github.ref }}
group: linux-aarch64-${{ github.ref }}
cancel-in-progress: true
permissions:
contents: read

jobs:
linux-gcc:
gcc-aarch64:
runs-on: ubuntu-20.04
steps:
- uses: actions/checkout@v4
Expand Down Expand Up @@ -98,7 +98,7 @@ jobs:
cd build-simplestl-simplemath
TESTS_EXECUTABLE_LOADER=qemu-aarch64 TESTS_EXECUTABLE_LOADER_ARGUMENTS="-L;/usr/aarch64-linux-gnu" ctest --output-on-failure -j $(nproc)

linux-gcc-arm82:
gcc-arm82:
runs-on: ubuntu-20.04
steps:
- uses: actions/checkout@v4
Expand Down Expand Up @@ -156,7 +156,7 @@ jobs:
cd build-noint8
TESTS_EXECUTABLE_LOADER=qemu-aarch64 TESTS_EXECUTABLE_LOADER_ARGUMENTS="-L;/usr/aarch64-linux-gnu" ctest --output-on-failure -j $(nproc)

linux-gcc-arm86:
gcc-arm86:
runs-on: ubuntu-22.04
steps:
- uses: actions/checkout@v4
Expand Down
Original file line number Diff line number Diff line change
@@ -1,9 +1,9 @@
name: linux-arm-cpu-gcc
name: linux-arm
on:
push:
branches: [master]
paths:
- '.github/workflows/linux-arm-cpu-gcc.yml'
- '.github/workflows/linux-arm.yml'
- 'toolchains/arm-linux-gnueabi.toolchain.cmake'
- 'toolchains/arm-linux-gnueabihf.toolchain.cmake'
- 'CMakeLists.txt'
Expand All @@ -15,7 +15,7 @@ on:
pull_request:
branches: [master]
paths:
- '.github/workflows/linux-arm-cpu-gcc.yml'
- '.github/workflows/linux-arm.yml'
- 'toolchains/arm-linux-gnueabi.toolchain.cmake'
- 'toolchains/arm-linux-gnueabihf.toolchain.cmake'
- 'CMakeLists.txt'
Expand All @@ -25,13 +25,13 @@ on:
- 'src/layer/arm/**'
- 'tests/**'
concurrency:
group: linux-arm-cpu-gcc-${{ github.ref }}
group: linux-arm-${{ github.ref }}
cancel-in-progress: true
permissions:
contents: read

jobs:
linux-gcc-arm:
gcc-arm:
runs-on: ubuntu-20.04
steps:
- uses: actions/checkout@v4
Expand Down Expand Up @@ -89,7 +89,7 @@ jobs:
cd build-noint8
TESTS_EXECUTABLE_LOADER=qemu-arm TESTS_EXECUTABLE_LOADER_ARGUMENTS="-L;/usr/arm-linux-gnueabi" ctest --output-on-failure -j $(nproc)

linux-gcc-armhf:
gcc-armhf:
runs-on: ubuntu-20.04
steps:
- uses: actions/checkout@v4
Expand Down Expand Up @@ -147,7 +147,7 @@ jobs:
cd build-noint8
TESTS_EXECUTABLE_LOADER=qemu-arm TESTS_EXECUTABLE_LOADER_ARGUMENTS="-L;/usr/arm-linux-gnueabihf" ctest --output-on-failure -j $(nproc)

linux-gcc-armhf-vfpv3-d16:
gcc-armhf-vfpv3-d16:
runs-on: ubuntu-20.04
steps:
- uses: actions/checkout@v4
Expand Down
Original file line number Diff line number Diff line change
@@ -1,9 +1,9 @@
name: linux-loongarch64-cpu-gcc
name: linux-loongarch64
on:
push:
branches: [master]
paths:
- '.github/workflows/linux-loongarch64-cpu-gcc.yml'
- '.github/workflows/linux-loongarch64.yml'
- 'toolchains/loongarch64-linux-gnu.toolchain.cmake'
- 'toolchains/loongarch64-unknown-linux-gnu.toolchain.cmake'
- 'CMakeLists.txt'
Expand All @@ -15,7 +15,7 @@ on:
pull_request:
branches: [master]
paths:
- '.github/workflows/linux-loongarch64-cpu-gcc.yml'
- '.github/workflows/linux-loongarch64.yml'
- 'toolchains/loongarch64-linux-gnu.toolchain.cmake'
- 'toolchains/loongarch64-unknown-linux-gnu.toolchain.cmake'
- 'CMakeLists.txt'
Expand All @@ -25,13 +25,13 @@ on:
- 'src/layer/loongarch/**'
- 'tests/**'
concurrency:
group: linux-loongarch64-cpu-gcc-${{ github.ref }}
group: linux-loongarch64-${{ github.ref }}
cancel-in-progress: true
permissions:
contents: read

jobs:
linux-gcc-loongarch64:
gcc-loongarch64:
runs-on: [self-hosted, linux, centos]

steps:
Expand Down
Loading
Loading