Skip to content

Commit

Permalink
Merge pull request #8 from howjmay/ci
Browse files Browse the repository at this point in the history
feat: Enable CI in cross compiled environment
  • Loading branch information
howjmay authored Oct 20, 2023
2 parents 1017a35 + 28f47db commit c9ad0e5
Show file tree
Hide file tree
Showing 4 changed files with 32 additions and 10 deletions.
22 changes: 21 additions & 1 deletion .github/workflows/github_actions.yml
Original file line number Diff line number Diff line change
@@ -1,11 +1,31 @@
name: Github Actions

on:
push:
branches: [main]
pull_request:
branches: [main]

jobs:
# for validate test cases
# run riscv tests
host_x86:
runs-on: ubuntu-20.04
steps:
- name: checkout code
uses: actions/[email protected]
- name: setup riscv toolchain
run: |
mkdir /opt/riscv
export PATH=$PATH:/opt/riscv/bin
wget https://github.com/riscv-collab/riscv-gnu-toolchain/releases/download/2023.10.18/riscv64-elf-ubuntu-20.04-gcc-nightly-2023.10.18-nightly.tar.gz
sudo tar -xzf riscv64-elf-ubuntu-20.04-gcc-nightly-2023.10.18-nightly.tar.gz -C /opt/
- name: run tests
run: |
export PATH=$PATH:/opt/riscv/bin
sh scripts/cross-test.sh qemu
# for validate test cases only
host_arm:
runs-on: ubuntu-20.04
strategy:
Expand Down
16 changes: 9 additions & 7 deletions Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -29,13 +29,15 @@ else # CROSS_COMPILE was set
endif

ARCH_CFLAGS = -march=$(processor)gcv_zba
EXEC_WRAPPER_FLAGS = --isa=$(processor)gcv_zba
endif

EXEC_WRAPPER =
ifdef CROSS_COMPILE
EXEC_WRAPPER = spike
PROXY_KERNEL = pk
ifeq ($(SIMULATOR_TYPE), qemu)
SIMULATOR += qemu-riscv64
SIMULATOR_FLAGS = -cpu $(processor),v=true,zba=true,vlen=128
else
SIMULATOR = spike
SIMULATOR_FLAGS = --isa=$(processor)gcv_zba
PROXY_KERNEL = pk
endif
endif

CXXFLAGS += -Wall -Wcast-qual -I. $(ARCH_CFLAGS)
Expand All @@ -60,7 +62,7 @@ test: tests/main
ifeq ($(processor),$(filter $(processor),rv32 rv64))
$(CC) $(ARCH_CFLAGS) -c neon2rvv.h
endif
$(EXEC_WRAPPER) $(EXEC_WRAPPER_FLAGS) $(PROXY_KERNEL) $^
$(SIMULATOR) $(SIMULATOR_FLAGS) $(PROXY_KERNEL) $^

build-test: tests/main
ifeq ($(processor),$(filter $(processor),rv32 rv64))
Expand Down
2 changes: 1 addition & 1 deletion neon2rvv.h
Original file line number Diff line number Diff line change
Expand Up @@ -174,7 +174,7 @@ FORCE_INLINE uint32x4_t vaddq_u32(uint32x4_t __a, uint32x4_t __b) { return __ris
FORCE_INLINE uint64x2_t vaddq_u64(uint64x2_t __a, uint64x2_t __b) { return __riscv_vadd_vv_u64m1(__a, __b, 2); }

FORCE_INLINE int16x8_t vaddl_s8(int8x8_t __a, int8x8_t __b) {
return __riscv_vget_v_i16m2_i16m1(__riscv_vwadd_vv_i16m2(__a, __b, 8), 0);
return __riscv_vwadd_vv_i16m1(__a, __b, 8);
}

// FORCE_INLINE int32x4_t vaddl_s16(int16x4_t __a, int16x4_t __b);
Expand Down
2 changes: 1 addition & 1 deletion scripts/cross-test.sh
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@ fi
set -x

make clean
make CROSS_COMPILE=riscv64-unknown-elf- test || exit 1 # riscv64
make CROSS_COMPILE=riscv64-unknown-elf- SIMULATOR_TYPE=$1 test || exit 1 # riscv64

# make clean
# make CROSS_COMPILE=riscv32-unknown-elf- test || exit 1 # riscv32

0 comments on commit c9ad0e5

Please sign in to comment.