Skip to content

Commit

Permalink
wip
Browse files Browse the repository at this point in the history
  • Loading branch information
nihui committed Oct 31, 2023
1 parent 278135f commit 485bda9
Show file tree
Hide file tree
Showing 4 changed files with 105 additions and 49 deletions.
1 change: 1 addition & 0 deletions .ci/linux-mips-cpu-gcc.yml
Original file line number Diff line number Diff line change
Expand Up @@ -111,6 +111,7 @@ jobs:
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 install -y python3-venv
apt-get build-dep -y qemu
cd qemu
./configure --prefix=${{ci.workspace}}/qemu-install --target-list=${{matrix.QEMU_TARGET}} --disable-system
Expand Down
1 change: 1 addition & 0 deletions .ci/linux-powerpc-cpu-gcc.yml
Original file line number Diff line number Diff line change
Expand Up @@ -111,6 +111,7 @@ jobs:
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 install -y python3-venv
apt-get build-dep -y qemu
cd qemu
./configure --prefix=${{ci.workspace}}/qemu-install --target-list=${{matrix.QEMU_TARGET}} --disable-system
Expand Down
103 changes: 103 additions & 0 deletions .ci/linux-riscv-cpu-gcc.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,103 @@
name: linux-riscv-cpu-gcc
on:
push:
branches: [master]
paths:
- '.ci/linux-riscv-cpu-gcc.yml'
- 'toolchains/riscv64-linux-gnu.toolchain.cmake'
- 'CMakeLists.txt'
- 'cmake/**'
- 'src/*'
- 'src/layer/*'
- 'src/layer/riscv/**'
- 'tests/**'
- 'tools/**'
- '!tools/pnnx/**'
- 'examples/**'
mr:
target-branches: [master]
paths:
- '.ci/linux-riscv-cpu-gcc.yml'
- 'toolchains/riscv64-linux-gnu.toolchain.cmake'
- 'CMakeLists.txt'
- 'cmake/**'
- 'src/*'
- 'src/layer/*'
- 'src/layer/riscv/**'
- 'tests/**'
- 'tools/**'
- '!tools/pnnx/**'
- 'examples/**'
concurrency:
group: linux-riscv-cpu-gcc-${{ ci.head_ref }}

jobs:
linux-gcc:
name: linux-gcc
strategy:
matrix:
include:
- ID: riscvel
CROSS_COMPILER: g++-riscv64-linux-gnu
CMAKE_TOOLCHAIN_FILE: riscv64-linux-gnu.toolchain.cmake
QEMU_TARGET: riscv64-linux-user
QEMU_LOADER: qemu-riscv64
QEMU_LOADER_ARGUMENTS: '-L;/usr/riscv64-linux-gnu'

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 ${{matrix.CROSS_COMPILER}}
- name: cache-qemu
id: cache-qemu
uses: cache@1.*
with:
cachePaths: qemu-install
cacheKey: qemu-${{matrix.QEMU_TARGET}}-install-20231001

- name: checkout-qemu
if: steps.cache-qemu.outputs.cacheHit != 'true'
checkout: https://github.com/qemu/qemu.git
with:
pullType: COMMIT_ID
refName: 78385bc738108a9b5b20e639520dc60425ca2a5a
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 install -y python3-venv
apt-get build-dep -y qemu
cd qemu
./configure --prefix=${{ci.workspace}}/qemu-install --target-list=${{matrix.QEMU_TARGET}} --disable-system
make -j$(nproc)
make install
- name: build
run: |
mkdir build && cd build
cmake -DCMAKE_TOOLCHAIN_FILE=../toolchains/${{matrix.CMAKE_TOOLCHAIN_FILE}} -DNCNN_BUILD_TOOLS=OFF -DNCNN_BUILD_EXAMPLES=OFF -DNCNN_BUILD_TESTS=ON ..
cmake --build . -j $(nproc)
- name: test
run: |
export PATH=${{ci.workspace}}/qemu-install/bin:$PATH
cd build
TESTS_EXECUTABLE_LOADER=${{matrix.QEMU_LOADER}} TESTS_EXECUTABLE_LOADER_ARGUMENTS="${{matrix.QEMU_LOADER_ARGUMENTS}}" ctest --output-on-failure -j $(nproc)
49 changes: 0 additions & 49 deletions .github/workflows/linux-riscv64-cpu-gcc.yml
Original file line number Diff line number Diff line change
Expand Up @@ -31,55 +31,6 @@ permissions:
contents: read

jobs:
linux-gcc-riscv64:
runs-on: ubuntu-20.04
steps:
- uses: actions/checkout@v4

- name: cache-qemu
id: cache-qemu
uses: actions/cache@v3
with:
path: qemu-install
key: qemu-riscv64-install-20220502-4
- 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@v4
with:
repository: qemu/qemu
path: qemu
ref: f5643914a9e8f79c606a76e6a9d7ea82a3fc3e65
- name: qemu
if: steps.cache-qemu.outputs.cache-hit != 'true'
run: |
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
- name: riscv64-gnu-toolchain
run: |
sudo apt-get update
sudo apt-get install g++-riscv64-linux-gnu
- name: configure
run: mkdir build && cd build && cmake -DCMAKE_TOOLCHAIN_FILE=../toolchains/riscv64-linux-gnu.toolchain.cmake -DNCNN_BUILD_TOOLS=OFF -DNCNN_BUILD_EXAMPLES=OFF -DNCNN_BUILD_TESTS=ON ..
- name: build
run: cmake --build build -j 2

- name: test
run: |
export PATH=$GITHUB_WORKSPACE/qemu-install/bin:$PATH
cd build
TESTS_EXECUTABLE_LOADER=qemu-riscv64 TESTS_EXECUTABLE_LOADER_ARGUMENTS="-L;/usr/riscv64-linux-gnu" ctest --output-on-failure -j 2
linux-gcc-riscv64-c906:
runs-on: [self-hosted, linux, centos]
steps:
Expand Down

0 comments on commit 485bda9

Please sign in to comment.