Browse Source

update ci qemu (#3756)

* update ci qemu

* update rvv qemu args

* fix bus error on armv7

* apply downstream qemu patches
tags/20220701
nihui GitHub 4 years ago
parent
commit
b516485528
No known key found for this signature in database GPG Key ID: 4AEE18F83AFDEB23
12 changed files with 256 additions and 234 deletions
  1. +16
    -8
      .github/workflows/linux-aarch64-cpu-gcc.yml
  2. +24
    -12
      .github/workflows/linux-arm-cpu-gcc.yml
  3. +16
    -8
      .github/workflows/linux-mips-cpu-gcc.yml
  4. +28
    -8
      .github/workflows/linux-mips64-cpu-gcc.yml
  5. +8
    -4
      .github/workflows/linux-ppc64-cpu-gcc.yml
  6. +19
    -22
      .github/workflows/linux-riscv64-cpu-gcc.yml
  7. +87
    -50
      .github/workflows/test-coverage.yml
  8. +22
    -22
      src/layer/arm/convolution_sgemm_bf16s.h
  9. +4
    -4
      src/layer/arm/convolution_sgemm_pack4_bf16s.h
  10. +2
    -2
      src/layer/arm/convolution_sgemm_pack4to1_bf16s.h
  11. +20
    -20
      src/layer/arm/packing_arm.cpp
  12. +10
    -74
      src/mat.h

+ 16
- 8
.github/workflows/linux-aarch64-cpu-gcc.yml View File

@@ -39,22 +39,26 @@ jobs:
uses: actions/cache@v3
with:
path: qemu-install
key: qemu-aarch64-install-1
key: qemu-aarch64-install-20220502
- name: install-qemu-build-deps
if: steps.cache-qemu.outputs.cache-hit != 'true'
run: |
sudo apt-get update
sudo apt-get install autoconf automake autotools-dev ninja-build
- name: checkout-qemu
if: steps.cache-qemu.outputs.cache-hit != 'true'
uses: actions/checkout@v3
with:
repository: qemu/qemu
path: qemu
ref: 8746309137ba470d1b2e8f5ce86ac228625db940
ref: f5643914a9e8f79c606a76e6a9d7ea82a3fc3e65
- name: qemu
if: steps.cache-qemu.outputs.cache-hit != 'true'
run: |
cd qemu
./configure --prefix=install --target-list=aarch64-linux-user --disable-system
./configure --prefix=$GITHUB_WORKSPACE/qemu-install --target-list=aarch64-linux-user --disable-system
make -j2
make install
cp -r aarch64-linux-user/install $GITHUB_WORKSPACE/qemu-install

- name: aarch64-gnu-toolchain
run: |
@@ -93,22 +97,26 @@ jobs:
uses: actions/cache@v3
with:
path: qemu-install
key: qemu-aarch64-install-1
key: qemu-aarch64-install-20220502
- name: install-qemu-build-deps
if: steps.cache-qemu.outputs.cache-hit != 'true'
run: |
sudo apt-get update
sudo apt-get install autoconf automake autotools-dev ninja-build
- name: checkout-qemu
if: steps.cache-qemu.outputs.cache-hit != 'true'
uses: actions/checkout@v3
with:
repository: qemu/qemu
path: qemu
ref: 8746309137ba470d1b2e8f5ce86ac228625db940
ref: f5643914a9e8f79c606a76e6a9d7ea82a3fc3e65
- name: qemu
if: steps.cache-qemu.outputs.cache-hit != 'true'
run: |
cd qemu
./configure --prefix=install --target-list=aarch64-linux-user --disable-system
./configure --prefix=$GITHUB_WORKSPACE/qemu-install --target-list=aarch64-linux-user --disable-system
make -j2
make install
cp -r aarch64-linux-user/install $GITHUB_WORKSPACE/qemu-install

- name: aarch64-gnu-toolchain
run: |


+ 24
- 12
.github/workflows/linux-arm-cpu-gcc.yml View File

@@ -41,22 +41,26 @@ jobs:
uses: actions/cache@v3
with:
path: qemu-install
key: qemu-arm-install-1
key: qemu-arm-install-20220502
- name: install-qemu-build-deps
if: steps.cache-qemu.outputs.cache-hit != 'true'
run: |
sudo apt-get update
sudo apt-get install autoconf automake autotools-dev ninja-build
- name: checkout-qemu
if: steps.cache-qemu.outputs.cache-hit != 'true'
uses: actions/checkout@v3
with:
repository: qemu/qemu
path: qemu
ref: 8746309137ba470d1b2e8f5ce86ac228625db940
ref: f5643914a9e8f79c606a76e6a9d7ea82a3fc3e65
- name: qemu
if: steps.cache-qemu.outputs.cache-hit != 'true'
run: |
cd qemu
./configure --prefix=install --target-list=arm-linux-user --disable-system
./configure --prefix=$GITHUB_WORKSPACE/qemu-install --target-list=arm-linux-user --disable-system
make -j2
make install
cp -r arm-linux-user/install $GITHUB_WORKSPACE/qemu-install

- name: arm-gnu-toolchain
run: |
@@ -95,22 +99,26 @@ jobs:
uses: actions/cache@v3
with:
path: qemu-install
key: qemu-arm-install-1
key: qemu-arm-install-20220502
- name: install-qemu-build-deps
if: steps.cache-qemu.outputs.cache-hit != 'true'
run: |
sudo apt-get update
sudo apt-get install autoconf automake autotools-dev ninja-build
- name: checkout-qemu
if: steps.cache-qemu.outputs.cache-hit != 'true'
uses: actions/checkout@v3
with:
repository: qemu/qemu
path: qemu
ref: 8746309137ba470d1b2e8f5ce86ac228625db940
ref: f5643914a9e8f79c606a76e6a9d7ea82a3fc3e65
- name: qemu
if: steps.cache-qemu.outputs.cache-hit != 'true'
run: |
cd qemu
./configure --prefix=install --target-list=arm-linux-user --disable-system
./configure --prefix=$GITHUB_WORKSPACE/qemu-install --target-list=arm-linux-user --disable-system
make -j2
make install
cp -r arm-linux-user/install $GITHUB_WORKSPACE/qemu-install

- name: arm-gnu-toolchain
run: |
@@ -149,22 +157,26 @@ jobs:
uses: actions/cache@v3
with:
path: qemu-install
key: qemu-arm-install-1
key: qemu-arm-install-20220502
- name: install-qemu-build-deps
if: steps.cache-qemu.outputs.cache-hit != 'true'
run: |
sudo apt-get update
sudo apt-get install autoconf automake autotools-dev ninja-build
- name: checkout-qemu
if: steps.cache-qemu.outputs.cache-hit != 'true'
uses: actions/checkout@v3
with:
repository: qemu/qemu
path: qemu
ref: 8746309137ba470d1b2e8f5ce86ac228625db940
ref: f5643914a9e8f79c606a76e6a9d7ea82a3fc3e65
- name: qemu
if: steps.cache-qemu.outputs.cache-hit != 'true'
run: |
cd qemu
./configure --prefix=install --target-list=arm-linux-user --disable-system
./configure --prefix=$GITHUB_WORKSPACE/qemu-install --target-list=arm-linux-user --disable-system
make -j2
make install
cp -r arm-linux-user/install $GITHUB_WORKSPACE/qemu-install

- name: arm-gnu-toolchain
run: |


+ 16
- 8
.github/workflows/linux-mips-cpu-gcc.yml View File

@@ -41,22 +41,26 @@ jobs:
uses: actions/cache@v3
with:
path: qemu-install
key: qemu-mipsel-install-1
key: qemu-mipsel-install-20220502
- name: install-qemu-build-deps
if: steps.cache-qemu.outputs.cache-hit != 'true'
run: |
sudo apt-get update
sudo apt-get install autoconf automake autotools-dev ninja-build
- name: checkout-qemu
if: steps.cache-qemu.outputs.cache-hit != 'true'
uses: actions/checkout@v3
with:
repository: qemu/qemu
path: qemu
ref: 8746309137ba470d1b2e8f5ce86ac228625db940
ref: f5643914a9e8f79c606a76e6a9d7ea82a3fc3e65
- name: qemu
if: steps.cache-qemu.outputs.cache-hit != 'true'
run: |
cd qemu
./configure --prefix=install --target-list=mipsel-linux-user --disable-system
./configure --prefix=$GITHUB_WORKSPACE/qemu-install --target-list=mipsel-linux-user --disable-system
make -j2
make install
cp -r mipsel-linux-user/install $GITHUB_WORKSPACE/qemu-install

- name: mipsel-gnu-toolchain
run: |
@@ -84,22 +88,26 @@ jobs:
uses: actions/cache@v3
with:
path: qemu-install
key: qemu-mipsel-install-1
key: qemu-mipsel-install-20220502
- name: install-qemu-build-deps
if: steps.cache-qemu.outputs.cache-hit != 'true'
run: |
sudo apt-get update
sudo apt-get install autoconf automake autotools-dev ninja-build
- name: checkout-qemu
if: steps.cache-qemu.outputs.cache-hit != 'true'
uses: actions/checkout@v3
with:
repository: qemu/qemu
path: qemu
ref: 8746309137ba470d1b2e8f5ce86ac228625db940
ref: f5643914a9e8f79c606a76e6a9d7ea82a3fc3e65
- name: qemu
if: steps.cache-qemu.outputs.cache-hit != 'true'
run: |
cd qemu
./configure --prefix=install --target-list=mipsel-linux-user --disable-system
./configure --prefix=$GITHUB_WORKSPACE/qemu-install --target-list=mipsel-linux-user --disable-system
make -j2
make install
cp -r mipsel-linux-user/install $GITHUB_WORKSPACE/qemu-install

- name: mipsisa32r6el-gnu-toolchain
run: |


+ 28
- 8
.github/workflows/linux-mips64-cpu-gcc.yml View File

@@ -41,22 +41,26 @@ jobs:
uses: actions/cache@v3
with:
path: qemu-install
key: qemu-mips64el-install-1
key: qemu-mips64el-install-20220502
- name: install-qemu-build-deps
if: steps.cache-qemu.outputs.cache-hit != 'true'
run: |
sudo apt-get update
sudo apt-get install autoconf automake autotools-dev ninja-build
- name: checkout-qemu
if: steps.cache-qemu.outputs.cache-hit != 'true'
uses: actions/checkout@v3
with:
repository: qemu/qemu
path: qemu
ref: 8746309137ba470d1b2e8f5ce86ac228625db940
ref: f5643914a9e8f79c606a76e6a9d7ea82a3fc3e65
- name: qemu
if: steps.cache-qemu.outputs.cache-hit != 'true'
run: |
cd qemu
./configure --prefix=install --target-list=mips64el-linux-user --disable-system
./configure --prefix=$GITHUB_WORKSPACE/qemu-install --target-list=mips64el-linux-user --disable-system
make -j2
make install
cp -r mips64el-linux-user/install $GITHUB_WORKSPACE/qemu-install

- name: mips64el-gnuabi64-toolchain
run: |
@@ -84,22 +88,38 @@ jobs:
uses: actions/cache@v3
with:
path: qemu-install
key: qemu-mips64el-install-1
key: qemu-mips64el-install-20220502-3
- name: install-qemu-build-deps
if: steps.cache-qemu.outputs.cache-hit != 'true'
run: |
sudo apt-get update
sudo apt-get install autoconf automake autotools-dev ninja-build
- name: checkout-qemu
if: steps.cache-qemu.outputs.cache-hit != 'true'
uses: actions/checkout@v3
with:
repository: qemu/qemu
path: qemu
ref: 8746309137ba470d1b2e8f5ce86ac228625db940
ref: f5643914a9e8f79c606a76e6a9d7ea82a3fc3e65
- name: qemu
if: steps.cache-qemu.outputs.cache-hit != 'true'
run: |
cd qemu
./configure --prefix=install --target-list=mips64el-linux-user --disable-system
wget https://raw.githubusercontent.com/nihui/ncnn-assets/master/qemu-patches/0001-target-mips-Fix-SAT_S-trans-helper.patch
wget https://raw.githubusercontent.com/nihui/ncnn-assets/master/qemu-patches/0002-target-mips-Fix-df_extract_val-and-df_extract_df-dfe.patch
wget https://raw.githubusercontent.com/nihui/ncnn-assets/master/qemu-patches/0003-target-mips-Fix-msa-checking-condition-in-trans_msa_.patch
wget https://raw.githubusercontent.com/nihui/ncnn-assets/master/qemu-patches/0004-target-mips-Do-not-treat-msa-INSERT-as-NOP-when-wd-i.patch
wget https://raw.githubusercontent.com/nihui/ncnn-assets/master/qemu-patches/0005-target-mips-Fix-FTRUNC_S-and-FTRUNC_U-trans-helper.patch
wget https://raw.githubusercontent.com/nihui/ncnn-assets/master/qemu-patches/0006-target-mips-Fix-store-adress-of-high-64bit-in-helper.patch
patch -p1 -i 0001-target-mips-Fix-SAT_S-trans-helper.patch
patch -p1 -i 0002-target-mips-Fix-df_extract_val-and-df_extract_df-dfe.patch
patch -p1 -i 0003-target-mips-Fix-msa-checking-condition-in-trans_msa_.patch
patch -p1 -i 0004-target-mips-Do-not-treat-msa-INSERT-as-NOP-when-wd-i.patch
patch -p1 -i 0005-target-mips-Fix-FTRUNC_S-and-FTRUNC_U-trans-helper.patch
patch -p1 -i 0006-target-mips-Fix-store-adress-of-high-64bit-in-helper.patch
./configure --prefix=$GITHUB_WORKSPACE/qemu-install --target-list=mips64el-linux-user --disable-system
make -j2
make install
cp -r mips64el-linux-user/install $GITHUB_WORKSPACE/qemu-install

- name: mipsisa64r6el-gnuabi64-toolchain
run: |


+ 8
- 4
.github/workflows/linux-ppc64-cpu-gcc.yml View File

@@ -37,22 +37,26 @@ jobs:
uses: actions/cache@v3
with:
path: qemu-install
key: qemu-ppc64le-install-1
key: qemu-ppc64le-install-20220502
- name: install-qemu-build-deps
if: steps.cache-qemu.outputs.cache-hit != 'true'
run: |
sudo apt-get update
sudo apt-get install autoconf automake autotools-dev ninja-build
- name: checkout-qemu
if: steps.cache-qemu.outputs.cache-hit != 'true'
uses: actions/checkout@v3
with:
repository: qemu/qemu
path: qemu
ref: 8746309137ba470d1b2e8f5ce86ac228625db940
ref: f5643914a9e8f79c606a76e6a9d7ea82a3fc3e65
- name: qemu
if: steps.cache-qemu.outputs.cache-hit != 'true'
run: |
cd qemu
./configure --prefix=install --target-list=ppc64le-linux-user --disable-system
./configure --prefix=$GITHUB_WORKSPACE/qemu-install --target-list=ppc64le-linux-user --disable-system
make -j2
make install
cp -r ppc64le-linux-user/install $GITHUB_WORKSPACE/qemu-install

- name: powerpc64le-gnu-toolchain
run: |


+ 19
- 22
.github/workflows/linux-riscv64-cpu-gcc.yml View File

@@ -41,22 +41,28 @@ jobs:
uses: actions/cache@v3
with:
path: qemu-install
key: qemu-riscv64-install-1
key: qemu-riscv64-install-20220502-3
- name: install-qemu-build-deps
if: steps.cache-qemu.outputs.cache-hit != 'true'
run: |
sudo apt-get update
sudo apt-get install autoconf automake autotools-dev ninja-build
- name: checkout-qemu
if: steps.cache-qemu.outputs.cache-hit != 'true'
uses: actions/checkout@v3
with:
repository: qemu/qemu
path: qemu
ref: 8746309137ba470d1b2e8f5ce86ac228625db940
ref: f5643914a9e8f79c606a76e6a9d7ea82a3fc3e65
- name: qemu
if: steps.cache-qemu.outputs.cache-hit != 'true'
run: |
cd qemu
./configure --prefix=install --target-list=riscv64-linux-user --disable-system
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=$GITHUB_WORKSPACE/qemu-install --target-list=riscv64-linux-user --disable-system
make -j2
make install
cp -r riscv64-linux-user/install $GITHUB_WORKSPACE/qemu-install

- name: riscv64-gnu-toolchain
run: |
@@ -84,37 +90,28 @@ jobs:
uses: actions/cache@v3
with:
path: qemu-install
key: qemu-riscv64-rvv-install-20210610

key: qemu-riscv64-install-20220502-3
- name: install-qemu-build-deps
if: steps.cache-qemu.outputs.cache-hit != 'true'
run: |
sudo apt-get update
sudo apt-get install autoconf automake autotools-dev ninja-build

- name: checkout-qemu
if: steps.cache-qemu.outputs.cache-hit != 'true'
uses: actions/checkout@v3
with:
repository: sifive/qemu
repository: qemu/qemu
path: qemu
ref: 7a3e8e23b4cf1422ec48e9d4b4009337a05a635d
ref: f5643914a9e8f79c606a76e6a9d7ea82a3fc3e65
- name: qemu
if: steps.cache-qemu.outputs.cache-hit != 'true'
run: |
wget https://download.qemu.org/qemu-6.0.0.tar.xz
tar -xf qemu-6.0.0.tar.xz
cp -r qemu/fpu qemu-6.0.0/
cp -r qemu/include/fpu qemu-6.0.0/include/
cp -r qemu/target/riscv qemu-6.0.0/target/
cp -r qemu/linux-user/elfload.c qemu-6.0.0/linux-user/
cd qemu-6.0.0
mkdir build
cd build
../configure --prefix=`pwd`/install --target-list=riscv64-linux-user --disable-system
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=$GITHUB_WORKSPACE/qemu-install --target-list=riscv64-linux-user --disable-system
make -j2
make install
cp -r install $GITHUB_WORKSPACE/qemu-install

- name: cache-riscv
id: cache-riscv
@@ -167,10 +164,10 @@ jobs:
run: |
export PATH=$GITHUB_WORKSPACE/qemu-install/bin:$PATH
cd build
TESTS_EXECUTABLE_LOADER=qemu-riscv64 TESTS_EXECUTABLE_LOADER_ARGUMENTS="-cpu;rv64,x-v=true,x-Zfh=true,vlen=256,elen=64,vext_spec=v1.0;-L;$GITHUB_WORKSPACE/rv64gcv-install/sysroot" ctest --output-on-failure -j 2
TESTS_EXECUTABLE_LOADER=qemu-riscv64 TESTS_EXECUTABLE_LOADER_ARGUMENTS="-cpu;rv64,v=true,Zfh=true,vlen=256,elen=64,vext_spec=v1.0;-L;$GITHUB_WORKSPACE/rv64gcv-install/sysroot" ctest --output-on-failure -j 2

- name: test-vlen128
run: |
export PATH=$GITHUB_WORKSPACE/qemu-install/bin:$PATH
cd build
TESTS_EXECUTABLE_LOADER=qemu-riscv64 TESTS_EXECUTABLE_LOADER_ARGUMENTS="-cpu;rv64,x-v=true,x-Zfh=true,vlen=128,elen=64,vext_spec=v1.0;-L;$GITHUB_WORKSPACE/rv64gcv-install/sysroot" ctest --output-on-failure -j 2
TESTS_EXECUTABLE_LOADER=qemu-riscv64 TESTS_EXECUTABLE_LOADER_ARGUMENTS="-cpu;rv64,v=true,Zfh=true,vlen=128,elen=64,vext_spec=v1.0;-L;$GITHUB_WORKSPACE/rv64gcv-install/sysroot" ctest --output-on-failure -j 2

+ 87
- 50
.github/workflows/test-coverage.yml View File

@@ -278,22 +278,26 @@ jobs:
uses: actions/cache@v3
with:
path: qemu-install
key: qemu-arm-install-1
key: qemu-arm-install-20220502
- name: install-qemu-build-deps
if: steps.cache-qemu.outputs.cache-hit != 'true'
run: |
sudo apt-get update
sudo apt-get install autoconf automake autotools-dev ninja-build
- name: checkout-qemu
if: steps.cache-qemu.outputs.cache-hit != 'true'
uses: actions/checkout@v3
with:
repository: qemu/qemu
path: qemu
ref: 8746309137ba470d1b2e8f5ce86ac228625db940
ref: f5643914a9e8f79c606a76e6a9d7ea82a3fc3e65
- name: qemu
if: steps.cache-qemu.outputs.cache-hit != 'true'
run: |
cd qemu
./configure --prefix=install --target-list=arm-linux-user --disable-system
./configure --prefix=$GITHUB_WORKSPACE/qemu-install --target-list=arm-linux-user --disable-system
make -j2
make install
cp -r arm-linux-user/install $GITHUB_WORKSPACE/qemu-install

- name: arm-gnu-toolchain
run: |
@@ -336,22 +340,26 @@ jobs:
uses: actions/cache@v3
with:
path: qemu-install
key: qemu-aarch64-install-1
key: qemu-aarch64-install-20220502
- name: install-qemu-build-deps
if: steps.cache-qemu.outputs.cache-hit != 'true'
run: |
sudo apt-get update
sudo apt-get install autoconf automake autotools-dev ninja-build
- name: checkout-qemu
if: steps.cache-qemu.outputs.cache-hit != 'true'
uses: actions/checkout@v3
with:
repository: qemu/qemu
path: qemu
ref: 8746309137ba470d1b2e8f5ce86ac228625db940
ref: f5643914a9e8f79c606a76e6a9d7ea82a3fc3e65
- name: qemu
if: steps.cache-qemu.outputs.cache-hit != 'true'
run: |
cd qemu
./configure --prefix=install --target-list=aarch64-linux-user --disable-system
./configure --prefix=$GITHUB_WORKSPACE/qemu-install --target-list=aarch64-linux-user --disable-system
make -j2
make install
cp -r aarch64-linux-user/install $GITHUB_WORKSPACE/qemu-install

- name: aarch64-gnu-toolchain
run: |
@@ -394,22 +402,26 @@ jobs:
uses: actions/cache@v3
with:
path: qemu-install
key: qemu-aarch64-install-1
key: qemu-aarch64-install-20220502
- name: install-qemu-build-deps
if: steps.cache-qemu.outputs.cache-hit != 'true'
run: |
sudo apt-get update
sudo apt-get install autoconf automake autotools-dev ninja-build
- name: checkout-qemu
if: steps.cache-qemu.outputs.cache-hit != 'true'
uses: actions/checkout@v3
with:
repository: qemu/qemu
path: qemu
ref: 8746309137ba470d1b2e8f5ce86ac228625db940
ref: f5643914a9e8f79c606a76e6a9d7ea82a3fc3e65
- name: qemu
if: steps.cache-qemu.outputs.cache-hit != 'true'
run: |
cd qemu
./configure --prefix=install --target-list=aarch64-linux-user --disable-system
./configure --prefix=$GITHUB_WORKSPACE/qemu-install --target-list=aarch64-linux-user --disable-system
make -j2
make install
cp -r aarch64-linux-user/install $GITHUB_WORKSPACE/qemu-install

- name: aarch64-gnu-toolchain
run: |
@@ -451,22 +463,26 @@ jobs:
uses: actions/cache@v3
with:
path: qemu-install
key: qemu-aarch64-install-1
key: qemu-aarch64-install-20220502
- name: install-qemu-build-deps
if: steps.cache-qemu.outputs.cache-hit != 'true'
run: |
sudo apt-get update
sudo apt-get install autoconf automake autotools-dev ninja-build
- name: checkout-qemu
if: steps.cache-qemu.outputs.cache-hit != 'true'
uses: actions/checkout@v3
with:
repository: qemu/qemu
path: qemu
ref: 8746309137ba470d1b2e8f5ce86ac228625db940
ref: f5643914a9e8f79c606a76e6a9d7ea82a3fc3e65
- name: qemu
if: steps.cache-qemu.outputs.cache-hit != 'true'
run: |
cd qemu
./configure --prefix=install --target-list=aarch64-linux-user --disable-system
./configure --prefix=$GITHUB_WORKSPACE/qemu-install --target-list=aarch64-linux-user --disable-system
make -j2
make install
cp -r aarch64-linux-user/install $GITHUB_WORKSPACE/qemu-install

- name: aarch64-gnu-toolchain
run: |
@@ -508,22 +524,26 @@ jobs:
uses: actions/cache@v3
with:
path: qemu-install
key: qemu-aarch64-install-1
key: qemu-aarch64-install-20220502
- name: install-qemu-build-deps
if: steps.cache-qemu.outputs.cache-hit != 'true'
run: |
sudo apt-get update
sudo apt-get install autoconf automake autotools-dev ninja-build
- name: checkout-qemu
if: steps.cache-qemu.outputs.cache-hit != 'true'
uses: actions/checkout@v3
with:
repository: qemu/qemu
path: qemu
ref: 8746309137ba470d1b2e8f5ce86ac228625db940
ref: f5643914a9e8f79c606a76e6a9d7ea82a3fc3e65
- name: qemu
if: steps.cache-qemu.outputs.cache-hit != 'true'
run: |
cd qemu
./configure --prefix=install --target-list=aarch64-linux-user --disable-system
./configure --prefix=$GITHUB_WORKSPACE/qemu-install --target-list=aarch64-linux-user --disable-system
make -j2
make install
cp -r aarch64-linux-user/install $GITHUB_WORKSPACE/qemu-install

- name: aarch64-gnu-toolchain
run: |
@@ -565,22 +585,26 @@ jobs:
uses: actions/cache@v3
with:
path: qemu-install
key: qemu-mipsel-install-1
key: qemu-mipsel-install-20220502
- name: install-qemu-build-deps
if: steps.cache-qemu.outputs.cache-hit != 'true'
run: |
sudo apt-get update
sudo apt-get install autoconf automake autotools-dev ninja-build
- name: checkout-qemu
if: steps.cache-qemu.outputs.cache-hit != 'true'
uses: actions/checkout@v3
with:
repository: qemu/qemu
path: qemu
ref: 8746309137ba470d1b2e8f5ce86ac228625db940
ref: f5643914a9e8f79c606a76e6a9d7ea82a3fc3e65
- name: qemu
if: steps.cache-qemu.outputs.cache-hit != 'true'
run: |
cd qemu
./configure --prefix=install --target-list=mipsel-linux-user --disable-system
./configure --prefix=$GITHUB_WORKSPACE/qemu-install --target-list=mipsel-linux-user --disable-system
make -j2
make install
cp -r mipsel-linux-user/install $GITHUB_WORKSPACE/qemu-install

- name: mipsisa32r6el-gnu-toolchain
run: |
@@ -623,22 +647,38 @@ jobs:
uses: actions/cache@v3
with:
path: qemu-install
key: qemu-mips64el-install-1
key: qemu-mips64el-install-20220502-3
- name: install-qemu-build-deps
if: steps.cache-qemu.outputs.cache-hit != 'true'
run: |
sudo apt-get update
sudo apt-get install autoconf automake autotools-dev ninja-build
- name: checkout-qemu
if: steps.cache-qemu.outputs.cache-hit != 'true'
uses: actions/checkout@v3
with:
repository: qemu/qemu
path: qemu
ref: 8746309137ba470d1b2e8f5ce86ac228625db940
ref: f5643914a9e8f79c606a76e6a9d7ea82a3fc3e65
- name: qemu
if: steps.cache-qemu.outputs.cache-hit != 'true'
run: |
cd qemu
./configure --prefix=install --target-list=mips64el-linux-user --disable-system
wget https://raw.githubusercontent.com/nihui/ncnn-assets/master/qemu-patches/0001-target-mips-Fix-SAT_S-trans-helper.patch
wget https://raw.githubusercontent.com/nihui/ncnn-assets/master/qemu-patches/0002-target-mips-Fix-df_extract_val-and-df_extract_df-dfe.patch
wget https://raw.githubusercontent.com/nihui/ncnn-assets/master/qemu-patches/0003-target-mips-Fix-msa-checking-condition-in-trans_msa_.patch
wget https://raw.githubusercontent.com/nihui/ncnn-assets/master/qemu-patches/0004-target-mips-Do-not-treat-msa-INSERT-as-NOP-when-wd-i.patch
wget https://raw.githubusercontent.com/nihui/ncnn-assets/master/qemu-patches/0005-target-mips-Fix-FTRUNC_S-and-FTRUNC_U-trans-helper.patch
wget https://raw.githubusercontent.com/nihui/ncnn-assets/master/qemu-patches/0006-target-mips-Fix-store-adress-of-high-64bit-in-helper.patch
patch -p1 -i 0001-target-mips-Fix-SAT_S-trans-helper.patch
patch -p1 -i 0002-target-mips-Fix-df_extract_val-and-df_extract_df-dfe.patch
patch -p1 -i 0003-target-mips-Fix-msa-checking-condition-in-trans_msa_.patch
patch -p1 -i 0004-target-mips-Do-not-treat-msa-INSERT-as-NOP-when-wd-i.patch
patch -p1 -i 0005-target-mips-Fix-FTRUNC_S-and-FTRUNC_U-trans-helper.patch
patch -p1 -i 0006-target-mips-Fix-store-adress-of-high-64bit-in-helper.patch
./configure --prefix=$GITHUB_WORKSPACE/qemu-install --target-list=mips64el-linux-user --disable-system
make -j2
make install
cp -r mips64el-linux-user/install $GITHUB_WORKSPACE/qemu-install

- name: mipsisa64r6el-gnuabi64-toolchain
run: |
@@ -682,22 +722,28 @@ jobs:
uses: actions/cache@v3
with:
path: qemu-install
key: qemu-riscv64-install-1
key: qemu-riscv64-install-20220502-3
- name: install-qemu-build-deps
if: steps.cache-qemu.outputs.cache-hit != 'true'
run: |
sudo apt-get update
sudo apt-get install autoconf automake autotools-dev ninja-build
- name: checkout-qemu
if: steps.cache-qemu.outputs.cache-hit != 'true'
uses: actions/checkout@v3
with:
repository: qemu/qemu
path: qemu
ref: 8746309137ba470d1b2e8f5ce86ac228625db940
ref: f5643914a9e8f79c606a76e6a9d7ea82a3fc3e65
- name: qemu
if: steps.cache-qemu.outputs.cache-hit != 'true'
run: |
cd qemu
./configure --prefix=install --target-list=riscv64-linux-user --disable-system
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=$GITHUB_WORKSPACE/qemu-install --target-list=riscv64-linux-user --disable-system
make -j2
make install
cp -r riscv64-linux-user/install $GITHUB_WORKSPACE/qemu-install

- name: riscv64-gnu-toolchain
run: |
@@ -741,37 +787,28 @@ jobs:
uses: actions/cache@v3
with:
path: qemu-install
key: qemu-riscv64-rvv-install-20210610

key: qemu-riscv64-install-20220502-3
- name: install-qemu-build-deps
if: steps.cache-qemu.outputs.cache-hit != 'true'
run: |
sudo apt-get update
sudo apt-get install autoconf automake autotools-dev ninja-build

- name: checkout-qemu
if: steps.cache-qemu.outputs.cache-hit != 'true'
uses: actions/checkout@v3
with:
repository: sifive/qemu
repository: qemu/qemu
path: qemu
ref: 7a3e8e23b4cf1422ec48e9d4b4009337a05a635d
ref: f5643914a9e8f79c606a76e6a9d7ea82a3fc3e65
- name: qemu
if: steps.cache-qemu.outputs.cache-hit != 'true'
run: |
wget https://download.qemu.org/qemu-6.0.0.tar.xz
tar -xf qemu-6.0.0.tar.xz
cp -r qemu/fpu qemu-6.0.0/
cp -r qemu/include/fpu qemu-6.0.0/include/
cp -r qemu/target/riscv qemu-6.0.0/target/
cp -r qemu/linux-user/elfload.c qemu-6.0.0/linux-user/
cd qemu-6.0.0
mkdir build
cd build
../configure --prefix=`pwd`/install --target-list=riscv64-linux-user --disable-system
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=$GITHUB_WORKSPACE/qemu-install --target-list=riscv64-linux-user --disable-system
make -j2
make install
cp -r install $GITHUB_WORKSPACE/qemu-install

- name: cache-riscv
id: cache-riscv
@@ -824,7 +861,7 @@ jobs:
run: |
export PATH=$GITHUB_WORKSPACE/qemu-install/bin:$PATH
cd build
TESTS_EXECUTABLE_LOADER=qemu-riscv64 TESTS_EXECUTABLE_LOADER_ARGUMENTS="-cpu;rv64,x-v=true,x-Zfh=true,vlen=128,elen=64,vext_spec=v1.0;-L;$GITHUB_WORKSPACE/rv64gcv-install/sysroot" ctest --output-on-failure -j 2
TESTS_EXECUTABLE_LOADER=qemu-riscv64 TESTS_EXECUTABLE_LOADER_ARGUMENTS="-cpu;rv64,v=true,Zfh=true,vlen=128,elen=64,vext_spec=v1.0;-L;$GITHUB_WORKSPACE/rv64gcv-install/sysroot" ctest --output-on-failure -j 2

- name: lcov-collect-vlen128
run: |
@@ -844,7 +881,7 @@ jobs:
run: |
export PATH=$GITHUB_WORKSPACE/qemu-install/bin:$PATH
cd build
TESTS_EXECUTABLE_LOADER=qemu-riscv64 TESTS_EXECUTABLE_LOADER_ARGUMENTS="-cpu;rv64,x-v=true,x-Zfh=true,vlen=256,elen=64,vext_spec=v1.0;-L;$GITHUB_WORKSPACE/rv64gcv-install/sysroot" ctest --output-on-failure -j 2
TESTS_EXECUTABLE_LOADER=qemu-riscv64 TESTS_EXECUTABLE_LOADER_ARGUMENTS="-cpu;rv64,v=true,Zfh=true,vlen=256,elen=64,vext_spec=v1.0;-L;$GITHUB_WORKSPACE/rv64gcv-install/sysroot" ctest --output-on-failure -j 2

- name: lcov-collect-vlen256
run: |


+ 22
- 22
src/layer/arm/convolution_sgemm_bf16s.h View File

@@ -56,7 +56,7 @@ static void im2col_sgemm_bf16s_neon(const Mat& bottom_im2col, Mat& top_blob, con
#else
asm volatile(
"pld [%0, #128] \n"
"vld1.u16 {d0-d1}, [%0 :64] \n"
"vld1.u16 {d0-d1}, [%0] \n"
"vst1.u16 {d0-d1}, [%1 :64]! \n"
: "=r"(img0), // %0
"=r"(tmpptr) // %1
@@ -104,7 +104,7 @@ static void im2col_sgemm_bf16s_neon(const Mat& bottom_im2col, Mat& top_blob, con
#else
asm volatile(
"pld [%0, #64] \n"
"vld1.u16 {d0}, [%0 :64] \n"
"vld1.u16 {d0}, [%0] \n"
"vst1.u16 {d0}, [%1 :64]! \n"
: "=r"(img0), // %0
"=r"(tmpptr) // %1
@@ -931,18 +931,18 @@ static void im2col_sgemm_bf16s_neon(const Mat& bottom_im2col, Mat& top_blob, con
"pld [%4, #256] \n"
"vld1.u16 {d12-d15}, [%4 :64]! \n"

"vshll.u16 q4, d12, #16 \n"
"vshll.u16 q5, d13, #16 \n"
"vshll.u16 q6, d14, #16 \n"
"vshll.u16 q7, d15, #16 \n"
"vshll.u16 q4, d12, #16 \n"
"vshll.u16 q5, d13, #16 \n"
"vshll.u16 q6, d14, #16 \n"
"vshll.u16 q7, d15, #16 \n"

"pld [%5, #256] \n"
"vld1.u16 {d4-d7}, [%5 :64]! \n"

"vshll.u16 q0, d4, #16 \n"
"vshll.u16 q1, d5, #16 \n"
"vshll.u16 q2, d6, #16 \n"
"vshll.u16 q3, d7, #16 \n"
"vshll.u16 q0, d4, #16 \n"
"vshll.u16 q1, d5, #16 \n"
"vshll.u16 q2, d6, #16 \n"
"vshll.u16 q3, d7, #16 \n"

"vmla.f32 q8, q4, d0[0] \n"
"vmla.f32 q10, q4, d0[1] \n"
@@ -967,10 +967,10 @@ static void im2col_sgemm_bf16s_neon(const Mat& bottom_im2col, Mat& top_blob, con
"pld [%4, #256] \n"
"vld1.u16 {d12-d15}, [%4 :64]! \n"

"vshll.u16 q4, d12, #16 \n"
"vshll.u16 q5, d13, #16 \n"
"vshll.u16 q6, d14, #16 \n"
"vshll.u16 q7, d15, #16 \n"
"vshll.u16 q4, d12, #16 \n"
"vshll.u16 q5, d13, #16 \n"
"vshll.u16 q6, d14, #16 \n"
"vshll.u16 q7, d15, #16 \n"

"vmla.f32 q8, q4, d4[0] \n"
"vmla.f32 q10, q4, d4[1] \n"
@@ -1324,18 +1324,18 @@ static void im2col_sgemm_bf16s_neon(const Mat& bottom_im2col, Mat& top_blob, con
"pld [%4, #256] \n"
"vld1.u16 {d12-d15}, [%4 :64]! \n"

"vshll.u16 q4, d12, #16 \n"
"vshll.u16 q5, d13, #16 \n"
"vshll.u16 q6, d14, #16 \n"
"vshll.u16 q7, d15, #16 \n"
"vshll.u16 q4, d12, #16 \n"
"vshll.u16 q5, d13, #16 \n"
"vshll.u16 q6, d14, #16 \n"
"vshll.u16 q7, d15, #16 \n"

"pld [%5, #256] \n"
"vld1.u16 {d4-d7}, [%5 :64]! \n"

"vshll.u16 q0, d4, #16 \n"
"vshll.u16 q1, d5, #16 \n"
"vshll.u16 q2, d6, #16 \n"
"vshll.u16 q3, d7, #16 \n"
"vshll.u16 q0, d4, #16 \n"
"vshll.u16 q1, d5, #16 \n"
"vshll.u16 q2, d6, #16 \n"
"vshll.u16 q3, d7, #16 \n"

"vmla.f32 q8, q4, d0[0] \n"
"vmla.f32 q9, q4, d0[1] \n"


+ 4
- 4
src/layer/arm/convolution_sgemm_pack4_bf16s.h View File

@@ -181,7 +181,7 @@ static void im2col_sgemm_pack4_bf16s_neon(const Mat& bottom_im2col, Mat& top_blo
#else
asm volatile(
"pld [%0, #256] \n"
"vld1.u16 {d0-d3}, [%0 :128] \n"
"vld1.u16 {d0-d3}, [%0 :64] \n"
"vst1.u16 {d0-d3}, [%1 :128]! \n"
: "=r"(img0), // %0
"=r"(tmpptr) // %1
@@ -227,7 +227,7 @@ static void im2col_sgemm_pack4_bf16s_neon(const Mat& bottom_im2col, Mat& top_blo
#else
asm volatile(
"pld [%0, #128] \n"
"vld1.u16 {d0-d1}, [%0 :128] \n"
"vld1.u16 {d0-d1}, [%0 :64] \n"
"vst1.u16 {d0-d1}, [%1 :128]! \n"
: "=r"(img0), // %0
"=r"(tmpptr) // %1
@@ -1574,7 +1574,7 @@ static void im2col_sgemm_pack4_bf16s_neon(const Mat& bottom_im2col, Mat& top_blo
"0: \n"

"pld [%2, #128] \n"
"vld1.u16 {d4-d5}, [%2 :128]! \n"
"vld1.u16 {d4-d5}, [%2 :64]! \n"

"vshll.u16 q0, d4, #16 \n"
"vshll.u16 q1, d5, #16 \n"
@@ -1606,7 +1606,7 @@ static void im2col_sgemm_pack4_bf16s_neon(const Mat& bottom_im2col, Mat& top_blo
"vshrn.u32 d16, q8, #16 \n"
"vshrn.u32 d17, q9, #16 \n"

"vst1.u16 {d16-d17}, [%1 :128]! \n"
"vst1.u16 {d16-d17}, [%1 :64]! \n"

: "=r"(nn), // %0
"=r"(outptr0), // %1


+ 2
- 2
src/layer/arm/convolution_sgemm_pack4to1_bf16s.h View File

@@ -180,8 +180,8 @@ static void im2col_sgemm_pack4to1_bf16s_neon(const Mat& bottom_im2col, Mat& top_
#else
asm volatile(
"pld [%0, #256] \n"
"vld4.u16 {d0-d3}, [%0 :128] \n"
"vst1.u16 {d0-d3}, [%1 :128]! \n"
"vld4.u16 {d0-d3}, [%0 :64] \n"
"vst1.u16 {d0-d3}, [%1 :64]! \n"
: "=r"(img0), // %0
"=r"(tmpptr) // %1
: "0"(img0),


+ 20
- 20
src/layer/arm/packing_arm.cpp View File

@@ -522,14 +522,14 @@ int Packing_arm::forward_bf16s_fp16s(const Mat& bottom_blob, Mat& top_blob, cons
: "memory", "v0", "v1", "v2", "v3", "v4", "v5", "v6", "v7", "v16", "v17", "v18", "v19", "v20", "v21", "v22", "v23");
#else
asm volatile(
"vld1.u16 {d16-d17}, [%0 : 128]! \n"
"vld1.u16 {d18-d19}, [%1 : 128]! \n"
"vld1.u16 {d20-d21}, [%2 : 128]! \n"
"vld1.u16 {d22-d23}, [%3 : 128]! \n"
"vld1.u16 {d24-d25}, [%4 : 128]! \n"
"vld1.u16 {d26-d27}, [%5 : 128]! \n"
"vld1.u16 {d28-d29}, [%6 : 128]! \n"
"vld1.u16 {d30-d31}, [%7 : 128]! \n"
"vld1.u16 {d16-d17}, [%0]! \n"
"vld1.u16 {d18-d19}, [%1]! \n"
"vld1.u16 {d20-d21}, [%2]! \n"
"vld1.u16 {d22-d23}, [%3]! \n"
"vld1.u16 {d24-d25}, [%4]! \n"
"vld1.u16 {d26-d27}, [%5]! \n"
"vld1.u16 {d28-d29}, [%6]! \n"
"vld1.u16 {d30-d31}, [%7]! \n"

"vtrn.u16 q8, q9 \n"
"vtrn.u16 q10, q11 \n"
@@ -667,14 +667,14 @@ int Packing_arm::forward_bf16s_fp16s(const Mat& bottom_blob, Mat& top_blob, cons
"vswp d21, d28 \n"
"vswp d23, d30 \n"

"vst1.u16 {d16-d17}, [%1 : 128]! \n"
"vst1.u16 {d18-d19}, [%2 : 128]! \n"
"vst1.u16 {d20-d21}, [%3 : 128]! \n"
"vst1.u16 {d22-d23}, [%4 : 128]! \n"
"vst1.u16 {d24-d25}, [%5 : 128]! \n"
"vst1.u16 {d26-d27}, [%6 : 128]! \n"
"vst1.u16 {d28-d29}, [%7 : 128]! \n"
"vst1.u16 {d30-d31}, [%8 : 128]! \n"
"vst1.u16 {d16-d17}, [%1]! \n"
"vst1.u16 {d18-d19}, [%2]! \n"
"vst1.u16 {d20-d21}, [%3]! \n"
"vst1.u16 {d22-d23}, [%4]! \n"
"vst1.u16 {d24-d25}, [%5]! \n"
"vst1.u16 {d26-d27}, [%6]! \n"
"vst1.u16 {d28-d29}, [%7]! \n"
"vst1.u16 {d30-d31}, [%8]! \n"
: "=r"(r0), // %0
"=r"(outptr0), // %1
"=r"(outptr1), // %2
@@ -744,8 +744,8 @@ int Packing_arm::forward_bf16s_fp16s(const Mat& bottom_blob, Mat& top_blob, cons
: "memory", "v0", "v1", "v2", "v3");
#else
asm volatile(
"vld1.u16 {d0-d1}, [%0 :128]! \n"
"vld1.u16 {d2-d3}, [%1 :128]! \n"
"vld1.u16 {d0-d1}, [%0 :64]! \n"
"vld1.u16 {d2-d3}, [%1 :64]! \n"

"vswp d1, d2 \n"

@@ -813,8 +813,8 @@ int Packing_arm::forward_bf16s_fp16s(const Mat& bottom_blob, Mat& top_blob, cons

"vswp d1, d2 \n"

"vst1.u16 {d0-d1}, [%1 :128]! \n"
"vst1.u16 {d2-d3}, [%2 :128]! \n"
"vst1.u16 {d0-d1}, [%1 :64]! \n"
"vst1.u16 {d2-d3}, [%2 :64]! \n"
: "=r"(r0), // %0
"=r"(outptr0), // %1
"=r"(outptr1) // %2


+ 10
- 74
src/mat.h View File

@@ -913,48 +913,16 @@ NCNN_FORCEINLINE void Mat::fill(float _v)
int size = (int)total();
float* ptr = (float*)data;

#if __ARM_NEON
int nn = size >> 2;
int remain = size - (nn << 2);
#else
int remain = size;
#endif // __ARM_NEON

int i = 0;
#if __ARM_NEON
float32x4_t _c = vdupq_n_f32(_v);
#if __aarch64__
if (nn > 0)
for (; i + 3 < size; i += 4)
{
asm volatile(
"0: \n"
"subs %w0, %w0, #1 \n"
"st1 {%4.4s}, [%1], #16 \n"
"bne 0b \n"
: "=r"(nn), // %0
"=r"(ptr) // %1
: "0"(nn),
"1"(ptr),
"w"(_c) // %4
: "cc", "memory");
}
#else
if (nn > 0)
{
asm volatile(
"0: \n"
"subs %0, #1 \n"
"vst1.f32 {%e4-%f4}, [%1 :128]!\n"
"bne 0b \n"
: "=r"(nn), // %0
"=r"(ptr) // %1
: "0"(nn),
"1"(ptr),
"w"(_c) // %4
: "cc", "memory");
vst1q_f32(ptr, _c);
ptr += 4;
}
#endif // __aarch64__
#endif // __ARM_NEON
for (; remain > 0; remain--)
for (; i < size; i++)
{
*ptr++ = _v;
}
@@ -965,48 +933,16 @@ NCNN_FORCEINLINE void Mat::fill(int _v)
int size = (int)total();
int* ptr = (int*)data;

#if __ARM_NEON
int nn = size >> 2;
int remain = size - (nn << 2);
#else
int remain = size;
#endif // __ARM_NEON

int i = 0;
#if __ARM_NEON
int32x4_t _c = vdupq_n_s32(_v);
#if __aarch64__
if (nn > 0)
for (; i + 3 < size; i += 4)
{
asm volatile(
"0: \n"
"subs %w0, %w0, #1 \n"
"st1 {%4.4s}, [%1], #16 \n"
"bne 0b \n"
: "=r"(nn), // %0
"=r"(ptr) // %1
: "0"(nn),
"1"(ptr),
"w"(_c) // %4
: "cc", "memory");
}
#else
if (nn > 0)
{
asm volatile(
"0: \n"
"subs %0, #1 \n"
"vst1.s32 {%e4-%f4}, [%1 :128]!\n"
"bne 0b \n"
: "=r"(nn), // %0
"=r"(ptr) // %1
: "0"(nn),
"1"(ptr),
"w"(_c) // %4
: "cc", "memory");
vst1q_s32(ptr, _c);
ptr += 4;
}
#endif // __aarch64__
#endif // __ARM_NEON
for (; remain > 0; remain--)
for (; i < size; i++)
{
*ptr++ = _v;
}


Loading…
Cancel
Save