| 1 | name: linux-riscv64-cpu-gnu-clang |
| 2 | on: |
| 3 | push: |
| 4 | branches: [master] |
| 5 | paths: |
| 6 | - '.github/workflows/linux-riscv64-cpu-gnu-clang.yml' |
| 7 | - 'toolchains/riscv64-unknown-linux-gnu.llvm-toolchain.cmake' |
| 8 | - 'CMakeLists.txt' |
| 9 | - 'cmake/**' |
| 10 | - 'src/*' |
| 11 | - 'src/layer/*' |
| 12 | - 'src/layer/riscv/**' |
| 13 | - 'tests/**' |
| 14 | pull_request: |
| 15 | branches: [master] |
| 16 | paths: |
| 17 | - '.github/workflows/linux-riscv64-cpu-gnu-clang.yml' |
| 18 | - 'toolchains/riscv64-unknown-linux-gnu.llvm-toolchain.cmake' |
| 19 | - 'CMakeLists.txt' |
| 20 | - 'cmake/**' |
| 21 | - 'src/*' |
| 22 | - 'src/layer/*' |
| 23 | - 'src/layer/riscv/**' |
| 24 | - 'tests/**' |
| 25 | concurrency: |
| 26 | group: linux-riscv64-cpu-gnu-clang-${{ github.ref }} |
| 27 | cancel-in-progress: true |
| 28 | permissions: |
| 29 | contents: read |
| 30 | |
| 31 | jobs: |
| 32 | linux-gcc-riscv64-rvv: |
| 33 | runs-on: [self-hosted, linux, centos] |
| 34 | steps: |
| 35 | - uses: actions/checkout@v4 |
| 36 | |
| 37 | #- name: cache-qemu |
| 38 | #id: cache-qemu |
| 39 | #uses: actions/cache@v3 |
| 40 | #with: |
| 41 | #path: qemu-install |
| 42 | #key: qemu-riscv64-install-20220502-3 |
| 43 | #- name: install-qemu-build-deps |
| 44 | #if: steps.cache-qemu.outputs.cache-hit != 'true' |
| 45 | #run: | |
| 46 | #sudo apt-get update |
| 47 | #sudo apt-get install autoconf automake autotools-dev ninja-build |
| 48 | #- name: checkout-qemu |
| 49 | #if: steps.cache-qemu.outputs.cache-hit != 'true' |
| 50 | #uses: actions/checkout@v4 |
| 51 | #with: |
| 52 | #repository: qemu/qemu |
| 53 | #path: qemu |
| 54 | #ref: f5643914a9e8f79c606a76e6a9d7ea82a3fc3e65 |
| 55 | #- name: qemu |
| 56 | #if: steps.cache-qemu.outputs.cache-hit != 'true' |
| 57 | #run: | |
| 58 | #cd qemu |
| 59 | #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 |
| 60 | #patch -p1 -i 0007-linux-user-Expose-risc-v-V-isa-bit-in-get_elf_hwcap.patch |
| 61 | #./configure --prefix=$GITHUB_WORKSPACE/qemu-install --target-list=riscv64-linux-user --disable-system |
| 62 | #make -j2 |
| 63 | #make install |
| 64 | |
| 65 | #- name: cache-riscv |
| 66 | #id: cache-riscv |
| 67 | #uses: actions/cache@v3 |
| 68 | #with: |
| 69 | #path: rv64gcv-install-next |
| 70 | #key: rv64gcv-linux-install-20210504 |
| 71 | |
| 72 | #- name: install-riscv-build-deps |
| 73 | #if: steps.cache-riscv.outputs.cache-hit != 'true' |
| 74 | #run: | |
| 75 | #sudo apt-get update |
| 76 | #sudo apt-get install 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 |
| 77 | |
| 78 | #- name: checkout-riscv-gnu-toolchain |
| 79 | #if: steps.cache-riscv.outputs.cache-hit != 'true' |
| 80 | #uses: actions/checkout@v4 |
| 81 | #with: |
| 82 | #repository: riscv/riscv-gnu-toolchain |
| 83 | #path: riscv-gnu-toolchain |
| 84 | #ref: da01ba455ce3802ffa84fdca3a089079996dbfc3 |
| 85 | #- name: checkout-riscv-gnu-toolchain-submodules |
| 86 | #if: steps.cache-riscv.outputs.cache-hit != 'true' |
| 87 | #run: | |
| 88 | #cd riscv-gnu-toolchain |
| 89 | #git submodule update --init --recursive --depth 1 glibc |
| 90 | #git submodule update --init --recursive --depth 1 newlib |
| 91 | #git submodule update --init --recursive --depth 1 riscv-binutils |
| 92 | #git submodule update --init --recursive --depth 1 riscv-gcc |
| 93 | #git submodule update --init --recursive --depth 1 riscv-dejagnu |
| 94 | #git submodule update --init --recursive --depth 1 riscv-gdb |
| 95 | #- name: riscv-gnu-toolchain |
| 96 | #if: steps.cache-riscv.outputs.cache-hit != 'true' |
| 97 | #run: | |
| 98 | #cd riscv-gnu-toolchain |
| 99 | #sed -i '/__OBSOLETE_MATH/d' newlib/newlib/libm/common/math_errf.c |
| 100 | #./configure --prefix=$GITHUB_WORKSPACE/rv64gcv-install-next --with-arch=rv64gcv_zfh |
| 101 | #make linux |
| 102 | |
| 103 | #- name: riscv-strip-install |
| 104 | #if: steps.cache-riscv.outputs.cache-hit != 'true' |
| 105 | #run: find $GITHUB_WORKSPACE/rv64gcv-install-next -type f | xargs -i strip -g {} || true |
| 106 | |
| 107 | # - name: install-clang |
| 108 | # run: | |
| 109 | # wget https://github.com/llvm/llvm-project/releases/download/llvmorg-15.0.1/llvm-project-15.0.1.src.tar.xz |
| 110 | # tar -xf llvm-project-15.0.1.src.tar.xz |
| 111 | # cd llvm-project-15.0.1.src |
| 112 | # mkdir build |
| 113 | # cd build |
| 114 | # cmake -DCMAKE_INSTALL_PREFIX=install -DCMAKE_BUILD_TYPE=Release -DBUILD_SHARED_LIBS=ON -DLLVM_ENABLE_PROJECTS="clang" -DLLVM_TARGETS_TO_BUILD="RISCV" -DLLVM_INCLUDE_EXAMPLES=OFF -DLLVM_INCLUDE_TESTS=OFF ../llvm/ |
| 115 | # make -j16 |
| 116 | # make install |
| 117 | |
| 118 | - name: build |
| 119 | env: |
| 120 | LD_LIBRARY_PATH: /data/action/install/lib64 |
| 121 | run: | |
| 122 | export RISCV_ROOT_PATH=/data/action/osd/rv64gcv-install-next |
| 123 | export PATH=/data/action/osd/llvm-project-15.0.1.src/build/install/bin:$PATH |
| 124 | mkdir build && cd build |
| 125 | cmake -DCMAKE_TOOLCHAIN_FILE=../toolchains/riscv64-unknown-linux-gnu.llvm-toolchain.cmake -DNCNN_BUILD_TOOLS=OFF -DNCNN_BUILD_EXAMPLES=OFF -DNCNN_BUILD_TESTS=ON .. |
| 126 | cmake --build . -j 4 |
| 127 | |
| 128 | - name: test-vlen256 |
| 129 | env: |
| 130 | LD_LIBRARY_PATH: /data/action/install/lib64 |
| 131 | run: | |
| 132 | export PATH=/data/action/osd/qemu-install/bin:$PATH |
| 133 | cd build |
| 134 | TESTS_EXECUTABLE_LOADER=qemu-riscv64 TESTS_EXECUTABLE_LOADER_ARGUMENTS="-cpu;rv64,v=true,Zfh=true,vlen=256,elen=64,vext_spec=v1.0;-L;/data/action/osd/rv64gcv-install-next/sysroot" ctest --output-on-failure -j 4 |
| 135 | |
| 136 | - name: test-vlen128 |
| 137 | env: |
| 138 | LD_LIBRARY_PATH: /data/action/install/lib64 |
| 139 | run: | |
| 140 | export PATH=/data/action/osd/qemu-install/bin:$PATH |
| 141 | cd build |
| 142 | TESTS_EXECUTABLE_LOADER=qemu-riscv64 TESTS_EXECUTABLE_LOADER_ARGUMENTS="-cpu;rv64,v=true,Zfh=true,vlen=128,elen=64,vext_spec=v1.0;-L;/data/action/osd/rv64gcv-install-next/sysroot" ctest --output-on-failure -j 4 |