| 1 | name: elf-riscv64-cpu-gcc |
| 2 | on: |
| 3 | push: |
| 4 | branches: [master] |
| 5 | paths: |
| 6 | - '.github/workflows/elf-riscv64-cpu-gcc.yml' |
| 7 | - 'toolchains/riscv64-unknown-elf.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/elf-riscv64-cpu-gcc.yml' |
| 18 | - 'toolchains/riscv64-unknown-elf.toolchain.cmake' |
| 19 | - 'CMakeLists.txt' |
| 20 | - 'cmake/**' |
| 21 | - 'src/*' |
| 22 | - 'src/layer/*' |
| 23 | - 'src/layer/riscv/**' |
| 24 | - 'tests/**' |
| 25 | concurrency: |
| 26 | group: elf-riscv64-cpu-gcc-${{ github.ref }} |
| 27 | cancel-in-progress: true |
| 28 | permissions: |
| 29 | contents: read |
| 30 | |
| 31 | jobs: |
| 32 | newlib-rv64gc-gcc: |
| 33 | runs-on: [self-hosted, linux, centos] |
| 34 | steps: |
| 35 | - uses: actions/checkout@v4 |
| 36 | |
| 37 | #- name: cache-riscv |
| 38 | #id: cache-riscv |
| 39 | #uses: actions/cache@v3 |
| 40 | #with: |
| 41 | #path: rv64gc-install |
| 42 | #key: rv64gc-newlib-install-20210425 |
| 43 | |
| 44 | #- name: install-riscv-build-deps |
| 45 | #if: steps.cache-riscv.outputs.cache-hit != 'true' |
| 46 | #run: | |
| 47 | #sudo apt-get update |
| 48 | #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 |
| 49 | |
| 50 | #- name: checkout-riscv-gnu-toolchain |
| 51 | #if: steps.cache-riscv.outputs.cache-hit != 'true' |
| 52 | #uses: actions/checkout@v4 |
| 53 | #with: |
| 54 | #repository: riscv/riscv-gnu-toolchain |
| 55 | #path: riscv-gnu-toolchain |
| 56 | #ref: b715e4f01b43efef487166f75d5d85d3c33fa7ef |
| 57 | #- name: checkout-riscv-gnu-toolchain-submodules |
| 58 | #if: steps.cache-riscv.outputs.cache-hit != 'true' |
| 59 | #run: | |
| 60 | #cd riscv-gnu-toolchain |
| 61 | #git submodule update --init --recursive --depth 1 riscv-binutils |
| 62 | #git submodule update --init --recursive --depth 1 riscv-gcc |
| 63 | #git submodule update --init --recursive --depth 1 riscv-glibc |
| 64 | #git submodule update --init --recursive --depth 1 riscv-dejagnu |
| 65 | #git submodule update --init --recursive --depth 1 riscv-newlib |
| 66 | #git submodule update --init --recursive --depth 1 riscv-gdb |
| 67 | #- name: riscv-gnu-toolchain |
| 68 | #if: steps.cache-riscv.outputs.cache-hit != 'true' |
| 69 | #run: | |
| 70 | #cd riscv-gnu-toolchain |
| 71 | #sed -i '/__OBSOLETE_MATH/d' riscv-newlib/newlib/libm/common/math_errf.c |
| 72 | #./configure --prefix=$GITHUB_WORKSPACE/rv64gc-install --with-arch=rv64gc |
| 73 | #make -j2 |
| 74 | |
| 75 | #- name: checkout-riscv-pk |
| 76 | #if: steps.cache-riscv.outputs.cache-hit != 'true' |
| 77 | #uses: actions/checkout@v4 |
| 78 | #with: |
| 79 | #repository: riscv/riscv-pk |
| 80 | #path: riscv-pk |
| 81 | #ref: ef7bebaf9bf24d3e90bcaae96387ce418e136b6d |
| 82 | #- name: riscv-pk |
| 83 | #if: steps.cache-riscv.outputs.cache-hit != 'true' |
| 84 | #run: | |
| 85 | #cd riscv-pk |
| 86 | #mkdir build |
| 87 | #cd build |
| 88 | #export PATH=$GITHUB_WORKSPACE/rv64gc-install/bin:$PATH |
| 89 | #../configure --prefix=$GITHUB_WORKSPACE/rv64gc-install --with-arch=rv64gc --host=riscv64-unknown-elf |
| 90 | #make -j2 |
| 91 | #make install |
| 92 | |
| 93 | #- name: checkout-riscv-isa-sim |
| 94 | #if: steps.cache-riscv.outputs.cache-hit != 'true' |
| 95 | #uses: actions/checkout@v4 |
| 96 | #with: |
| 97 | #repository: riscv/riscv-isa-sim |
| 98 | #path: riscv-isa-sim |
| 99 | #ref: 9d4f45c2ebf105503974fc80a42590ca1584c354 |
| 100 | #- name: riscv-isa-sim |
| 101 | #if: steps.cache-riscv.outputs.cache-hit != 'true' |
| 102 | #run: | |
| 103 | #cd riscv-isa-sim |
| 104 | #mkdir build |
| 105 | #cd build |
| 106 | #export PATH=$GITHUB_WORKSPACE/rv64gc-install/bin:$PATH |
| 107 | #../configure --prefix=$GITHUB_WORKSPACE/rv64gc-install --with-isa=rv64gc |
| 108 | #make -j2 |
| 109 | #make install |
| 110 | |
| 111 | #- name: riscv-strip-install |
| 112 | #if: steps.cache-riscv.outputs.cache-hit != 'true' |
| 113 | #run: find $GITHUB_WORKSPACE/rv64gc-install -type f | xargs -i strip -g {} || true |
| 114 | |
| 115 | - name: configure |
| 116 | run: export RISCV_ROOT_PATH=/data/action/osd/rv64gc-install && mkdir build && cd build && cmake -DCMAKE_TOOLCHAIN_FILE=../toolchains/riscv64-unknown-elf.toolchain.cmake -DNCNN_THREADS=OFF -DNCNN_OPENMP=OFF -DNCNN_BUILD_TOOLS=OFF -DNCNN_BUILD_EXAMPLES=OFF -DNCNN_BUILD_TESTS=ON .. |
| 117 | - name: build |
| 118 | run: cmake --build build -j 4 |
| 119 | - name: test |
| 120 | run: | |
| 121 | export PATH=/data/action/osd/rv64gc-install/bin:$PATH |
| 122 | cd build |
| 123 | TESTS_EXECUTABLE_LOADER=spike TESTS_EXECUTABLE_LOADER_ARGUMENTS=/data/action/osd/rv64gc-install/riscv64-unknown-elf/bin/pk ctest --output-on-failure -j 4 |