| 1 | name: linux-mips64-cpu-gcc |
| 2 | on: |
| 3 | push: |
| 4 | branches: [master] |
| 5 | paths: |
| 6 | - '.github/workflows/linux-mips64-cpu-gcc.yml' |
| 7 | - 'toolchains/mips64el-linux-gnuabi64.toolchain.cmake' |
| 8 | - 'toolchains/mipsisa64r6el-linux-gnuabi64.toolchain.cmake' |
| 9 | - 'CMakeLists.txt' |
| 10 | - 'cmake/**' |
| 11 | - 'src/*' |
| 12 | - 'src/layer/*' |
| 13 | - 'src/layer/mips/**' |
| 14 | - 'tests/**' |
| 15 | pull_request: |
| 16 | branches: [master] |
| 17 | paths: |
| 18 | - '.github/workflows/linux-mips64-cpu-gcc.yml' |
| 19 | - 'toolchains/mips64el-linux-gnuabi64.toolchain.cmake' |
| 20 | - 'toolchains/mipsisa64r6el-linux-gnuabi64.toolchain.cmake' |
| 21 | - 'CMakeLists.txt' |
| 22 | - 'cmake/**' |
| 23 | - 'src/*' |
| 24 | - 'src/layer/*' |
| 25 | - 'src/layer/mips/**' |
| 26 | - 'tests/**' |
| 27 | concurrency: |
| 28 | group: linux-mips64-cpu-gcc-${{ github.ref }} |
| 29 | cancel-in-progress: true |
| 30 | permissions: |
| 31 | contents: read |
| 32 | |
| 33 | jobs: |
| 34 | linux-gcc-mips64el: |
| 35 | runs-on: ubuntu-20.04 |
| 36 | steps: |
| 37 | - uses: actions/checkout@v4 |
| 38 | |
| 39 | - name: cache-qemu |
| 40 | id: cache-qemu |
| 41 | uses: actions/cache@v4 |
| 42 | with: |
| 43 | path: qemu-install |
| 44 | key: qemu-mips64el-install-20220502-2 |
| 45 | - name: install-qemu-build-deps |
| 46 | if: steps.cache-qemu.outputs.cache-hit != 'true' |
| 47 | run: | |
| 48 | sudo apt-get update |
| 49 | sudo apt-get install autoconf automake autotools-dev ninja-build |
| 50 | - name: checkout-qemu |
| 51 | if: steps.cache-qemu.outputs.cache-hit != 'true' |
| 52 | uses: actions/checkout@v4 |
| 53 | with: |
| 54 | repository: qemu/qemu |
| 55 | path: qemu |
| 56 | ref: f5643914a9e8f79c606a76e6a9d7ea82a3fc3e65 |
| 57 | - name: qemu |
| 58 | if: steps.cache-qemu.outputs.cache-hit != 'true' |
| 59 | run: | |
| 60 | cd qemu |
| 61 | ./configure --prefix=$GITHUB_WORKSPACE/qemu-install --target-list=mips64el-linux-user --disable-system |
| 62 | make -j$(nproc) |
| 63 | make install |
| 64 | |
| 65 | - name: mips64el-gnuabi64-toolchain |
| 66 | run: | |
| 67 | sudo apt-get update |
| 68 | sudo apt-get install g++-mips64el-linux-gnuabi64 |
| 69 | |
| 70 | - name: configure |
| 71 | run: mkdir build && cd build && cmake -DCMAKE_TOOLCHAIN_FILE=../toolchains/mips64el-linux-gnuabi64.toolchain.cmake -DNCNN_BUILD_TOOLS=OFF -DNCNN_BUILD_EXAMPLES=OFF -DNCNN_BUILD_TESTS=ON .. |
| 72 | - name: build |
| 73 | run: cmake --build build -j $(nproc) |
| 74 | |
| 75 | - name: test |
| 76 | run: | |
| 77 | export PATH=$GITHUB_WORKSPACE/qemu-install/bin:$PATH |
| 78 | cd build |
| 79 | TESTS_EXECUTABLE_LOADER=qemu-mips64el TESTS_EXECUTABLE_LOADER_ARGUMENTS="-L;/usr/mips64el-linux-gnuabi64" ctest --output-on-failure -j $(nproc) |
| 80 | |
| 81 | linux-gcc-mipsisa64r6el: |
| 82 | runs-on: ubuntu-20.04 |
| 83 | steps: |
| 84 | - uses: actions/checkout@v4 |
| 85 | |
| 86 | - name: cache-qemu |
| 87 | id: cache-qemu |
| 88 | uses: actions/cache@v4 |
| 89 | with: |
| 90 | path: qemu-install |
| 91 | key: qemu-mips64el-install-20220502-4 |
| 92 | - name: install-qemu-build-deps |
| 93 | if: steps.cache-qemu.outputs.cache-hit != 'true' |
| 94 | run: | |
| 95 | sudo apt-get update |
| 96 | sudo apt-get install autoconf automake autotools-dev ninja-build |
| 97 | - name: checkout-qemu |
| 98 | if: steps.cache-qemu.outputs.cache-hit != 'true' |
| 99 | uses: actions/checkout@v4 |
| 100 | with: |
| 101 | repository: qemu/qemu |
| 102 | path: qemu |
| 103 | ref: f5643914a9e8f79c606a76e6a9d7ea82a3fc3e65 |
| 104 | - name: qemu |
| 105 | if: steps.cache-qemu.outputs.cache-hit != 'true' |
| 106 | run: | |
| 107 | cd qemu |
| 108 | wget https://raw.githubusercontent.com/nihui/ncnn-assets/master/qemu-patches/0001-target-mips-Fix-SAT_S-trans-helper.patch |
| 109 | wget https://raw.githubusercontent.com/nihui/ncnn-assets/master/qemu-patches/0002-target-mips-Fix-df_extract_val-and-df_extract_df-dfe.patch |
| 110 | wget https://raw.githubusercontent.com/nihui/ncnn-assets/master/qemu-patches/0003-target-mips-Fix-msa-checking-condition-in-trans_msa_.patch |
| 111 | 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 |
| 112 | wget https://raw.githubusercontent.com/nihui/ncnn-assets/master/qemu-patches/0005-target-mips-Fix-FTRUNC_S-and-FTRUNC_U-trans-helper.patch |
| 113 | wget https://raw.githubusercontent.com/nihui/ncnn-assets/master/qemu-patches/0006-target-mips-Fix-store-adress-of-high-64bit-in-helper.patch |
| 114 | patch -p1 -i 0001-target-mips-Fix-SAT_S-trans-helper.patch |
| 115 | patch -p1 -i 0002-target-mips-Fix-df_extract_val-and-df_extract_df-dfe.patch |
| 116 | patch -p1 -i 0003-target-mips-Fix-msa-checking-condition-in-trans_msa_.patch |
| 117 | patch -p1 -i 0004-target-mips-Do-not-treat-msa-INSERT-as-NOP-when-wd-i.patch |
| 118 | patch -p1 -i 0005-target-mips-Fix-FTRUNC_S-and-FTRUNC_U-trans-helper.patch |
| 119 | patch -p1 -i 0006-target-mips-Fix-store-adress-of-high-64bit-in-helper.patch |
| 120 | ./configure --prefix=$GITHUB_WORKSPACE/qemu-install --target-list=mips64el-linux-user --disable-system |
| 121 | make -j$(nproc) |
| 122 | make install |
| 123 | |
| 124 | - name: mipsisa64r6el-gnuabi64-toolchain |
| 125 | run: | |
| 126 | sudo apt-get update |
| 127 | sudo apt-get install g++-mipsisa64r6el-linux-gnuabi64 |
| 128 | |
| 129 | - name: configure |
| 130 | run: mkdir build && cd build && cmake -DCMAKE_TOOLCHAIN_FILE=../toolchains/mipsisa64r6el-linux-gnuabi64.toolchain.cmake -DNCNN_BUILD_TOOLS=OFF -DNCNN_BUILD_EXAMPLES=OFF -DNCNN_BUILD_TESTS=ON .. |
| 131 | - name: build |
| 132 | run: cmake --build build -j $(nproc) |
| 133 | |
| 134 | - name: test |
| 135 | run: | |
| 136 | export PATH=$GITHUB_WORKSPACE/qemu-install/bin:$PATH |
| 137 | cd build |
| 138 | TESTS_EXECUTABLE_LOADER=qemu-mips64el TESTS_EXECUTABLE_LOADER_ARGUMENTS="-L;/usr/mipsisa64r6el-linux-gnuabi64" ctest --output-on-failure -j $(nproc) |