forked from rarias/nixos-riscv
Add kernel arguments from host to QEMU. Enable CI functionality.
Some checks failed
CI / build:qemu-lagarto-ox (push) Has been cancelled
Some checks failed
CI / build:qemu-lagarto-ox (push) Has been cancelled
This commit is contained in:
parent
6185599b70
commit
492c540bf5
9
.gitea/workflows/ci.yaml
Normal file
9
.gitea/workflows/ci.yaml
Normal file
@ -0,0 +1,9 @@
|
|||||||
|
name: CI
|
||||||
|
on: push
|
||||||
|
|
||||||
|
jobs:
|
||||||
|
build:qemu-lagarto-ox:
|
||||||
|
runs-on: native
|
||||||
|
steps:
|
||||||
|
- uses: https://gitea.com/ScMi1/checkout@v1.4
|
||||||
|
- run: nix develop -L .#qemu-lagarto-ox --command ./boot.sh bench2
|
11
README.md
11
README.md
@ -58,6 +58,17 @@ Then, simply run boot.sh to start the QEMU system.
|
|||||||
```
|
```
|
||||||
$ ./boot.sh
|
$ ./boot.sh
|
||||||
```
|
```
|
||||||
|
To execute the RISC-V benchmark suite on boot stage 2, run boot.sh with the bench2 option.
|
||||||
|
|
||||||
|
```
|
||||||
|
$ ./boot.sh bench2
|
||||||
|
```
|
||||||
|
|
||||||
|
To open a debug shell on boot stage 2, run boot.sh with the debug2 option.
|
||||||
|
|
||||||
|
```
|
||||||
|
$ ./boot.sh debug2
|
||||||
|
```
|
||||||
|
|
||||||
## Lagarto Hun
|
## Lagarto Hun
|
||||||
|
|
||||||
|
42
boot.sh
42
boot.sh
@ -2,6 +2,8 @@
|
|||||||
|
|
||||||
set -ex
|
set -ex
|
||||||
|
|
||||||
|
QEMU_KERNEL_PARAMS="$@"
|
||||||
|
|
||||||
#export PATH=/nix/store/c5xwy0rllg4lcw61mh20glairjz7ibv4-qemu-8.0.4/bin/:$PATH
|
#export PATH=/nix/store/c5xwy0rllg4lcw61mh20glairjz7ibv4-qemu-8.0.4/bin/:$PATH
|
||||||
|
|
||||||
CDIR=$(readlink -f "$PWD")
|
CDIR=$(readlink -f "$PWD")
|
||||||
@ -22,8 +24,6 @@ if [ -z "$TMPDIR" ] || [ -z "$USE_TMPDIR" ]; then
|
|||||||
TMPDIR=$(mktemp -d nix-vm.XXXXXXXXXX --tmpdir)
|
TMPDIR=$(mktemp -d nix-vm.XXXXXXXXXX --tmpdir)
|
||||||
fi
|
fi
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
# Create a directory for exchanging data with the VM.
|
# Create a directory for exchanging data with the VM.
|
||||||
mkdir -p "$TMPDIR/xchg"
|
mkdir -p "$TMPDIR/xchg"
|
||||||
|
|
||||||
@ -32,16 +32,15 @@ echo "Booting $system"
|
|||||||
|
|
||||||
cd "$TMPDIR"
|
cd "$TMPDIR"
|
||||||
|
|
||||||
|
|
||||||
#QEMU_KERNEL_PARAMS="boot.debug1devices"
|
#QEMU_KERNEL_PARAMS="boot.debug1devices"
|
||||||
#QEMU_KERNEL_PARAMS="boot.trace boot.debug1"
|
#QEMU_KERNEL_PARAMS="boot.trace boot.debug1"
|
||||||
QEMU_KERNEL_PARAMS=bench2
|
#QEMU_KERNEL_PARAMS=bench2
|
||||||
#QEMU_KERNEL_PARAMS=debug2
|
#QEMU_KERNEL_PARAMS=debug2
|
||||||
|
|
||||||
# Trap the CPU on compressed instructions?
|
# Trap the CPU on compressed instructions?
|
||||||
#TRAP_COMPRESSED="-cpu rv64,c=false"
|
#TRAP_COMPRESSED="-cpu rv64,c=false"
|
||||||
|
|
||||||
CUSTOM_BIOS="-bios $OPENSBI/share/opensbi/lp64/generic/firmware/fw_payload.bin"
|
#CUSTOM_BIOS="-bios $OPENSBI/share/opensbi/lp64/generic/firmware/fw_payload.bin"
|
||||||
#CUSTOM_BIOS="-bios $OPENSBI/share/opensbi/lp64/generic/firmware/fw_jump.elf"
|
#CUSTOM_BIOS="-bios $OPENSBI/share/opensbi/lp64/generic/firmware/fw_jump.elf"
|
||||||
#CUSTOM_BIOS="-bios $CDIR/bios-nc.bin"
|
#CUSTOM_BIOS="-bios $CDIR/bios-nc.bin"
|
||||||
#CUSTOM_BIOS="-bios $CDIR/bios.bin"
|
#CUSTOM_BIOS="-bios $CDIR/bios.bin"
|
||||||
@ -50,8 +49,9 @@ CUSTOM_BIOS="-bios $OPENSBI/share/opensbi/lp64/generic/firmware/fw_payload.bin"
|
|||||||
#DEBUG_CPU="-d cpu_reset"
|
#DEBUG_CPU="-d cpu_reset"
|
||||||
#DEBUG_CPU="-d in_asm,cpu,cpu_reset"
|
#DEBUG_CPU="-d in_asm,cpu,cpu_reset"
|
||||||
|
|
||||||
|
run_qemu () {
|
||||||
|
|
||||||
exec qemu-system-riscv64 \
|
CMD='qemu-system-riscv64 \
|
||||||
$DEBUG_GDB \
|
$DEBUG_GDB \
|
||||||
$DEBUG_CPU \
|
$DEBUG_CPU \
|
||||||
-name nixos-riscv \
|
-name nixos-riscv \
|
||||||
@ -70,30 +70,42 @@ exec qemu-system-riscv64 \
|
|||||||
-device virtio-blk-device,drive=hd0 \
|
-device virtio-blk-device,drive=hd0 \
|
||||||
-kernel $system/kernel \
|
-kernel $system/kernel \
|
||||||
-initrd $system/initrd \
|
-initrd $system/initrd \
|
||||||
-append "$(cat $system/kernel-params) init=$system/init console=ttyS0,115200n8 loglevel=7 $QEMU_KERNEL_PARAMS" \
|
-device vhost-vsock-pci,id=vhost-vsock-pci0,guest-cid=123 \
|
||||||
$QEMU_OPTS \
|
-serial mon:stdio \
|
||||||
"$@"
|
-append "$(cat $system/kernel-params) init=$system/init console=ttyS0 loglevel=7 $QEMU_KERNEL_PARAMS" \
|
||||||
|
$QEMU_OPTS'
|
||||||
|
|
||||||
|
if [[ "$QEMU_KERNEL_PARAMS" =~ bench2 ]]; then
|
||||||
|
eval "$CMD &"
|
||||||
|
echo "$!" > qemu.pid
|
||||||
|
else
|
||||||
|
eval "$CMD"
|
||||||
|
fi
|
||||||
|
}
|
||||||
|
|
||||||
|
if [[ "$QEMU_KERNEL_PARAMS" =~ bench2 ]]; then
|
||||||
|
run_qemu | awk -f $CDIR/verify-bench2.awk
|
||||||
|
else
|
||||||
|
run_qemu
|
||||||
|
fi
|
||||||
|
|
||||||
|
# QEMU OPTIONS GRAVEYARD
|
||||||
|
|
||||||
# -kernel $system/kernel \
|
# -kernel $system/kernel \
|
||||||
# -initrd $system/initrd \
|
# -initrd $system/initrd \
|
||||||
# -append "$(cat $system/kernel-params) init=$system/init regInfo=/nix/store/x3zpwfbk2wkiisxhgi7zwsfwbdfxk0w1-closure-info-riscv64-unknown-linux-gnu/registration console=ttyS0,115200n8 loglevel=7 $QEMU_KERNEL_PARAMS"
|
# -append "$(cat $system/kernel-params) init=$system/init regInfo=/nix/store/x3zpwfbk2wkiisxhgi7zwsfwbdfxk0w1-closure-info-riscv64-unknown-linux-gnu/registration console=ttyS0,115200n8 loglevel=7 $QEMU_KERNEL_PARAMS"
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
# -kernel ${NIXPKGS_QEMU_KERNEL_visionfive_nix:-/nix/store/8n5fakqq44nsmbcn0vdm3mzsvcq9ihbi-nixos-system-visionfive-nix-24.05.20240115.c3e128f/kernel} \
|
# -kernel ${NIXPKGS_QEMU_KERNEL_visionfive_nix:-/nix/store/8n5fakqq44nsmbcn0vdm3mzsvcq9ihbi-nixos-system-visionfive-nix-24.05.20240115.c3e128f/kernel} \
|
||||||
# -initrd /nix/store/96058frp51dn0xxfci4kyvzz0rvd5ngy-initrd-linux-riscv64-unknown-linux-gnu-6.1.72/initrd \
|
# -initrd /nix/store/96058frp51dn0xxfci4kyvzz0rvd5ngy-initrd-linux-riscv64-unknown-linux-gnu-6.1.72/initrd \
|
||||||
# -append "$(cat /nix/store/8n5fakqq44nsmbcn0vdm3mzsvcq9ihbi-nixos-system-visionfive-nix-24.05.20240115.c3e128f/kernel-params) init=/nix/store/8n5fakqq44nsmbcn0vdm3mzsvcq9ihbi-nixos-system-visionfive-nix-24.05.20240115.c3e128f/init regInfo=/nix/store/bgqa92gznhcr9aryx6ac4ycx4s2385cr-closure-info-riscv64-unknown-linux-gnu/registration console=ttyS0,115200n8 console=tty0 $QEMU_KERNEL_PARAMS" \
|
# -append "$(cat /nix/store/8n5fakqq44nsmbcn0vdm3mzsvcq9ihbi-nixos-system-visionfive-nix-24.05.20240115.c3e128f/kernel-params) init=/nix/store/8n5fakqq44nsmbcn0vdm3mzsvcq9ihbi-nixos-system-visionfive-nix-24.05.20240115.c3e128f/init regInfo=/nix/store/bgqa92gznhcr9aryx6ac4ycx4s2385cr-closure-info-riscv64-unknown-linux-gnu/registration console=ttyS0,115200n8 console=tty0 $QEMU_KERNEL_PARAMS" \
|
||||||
|
|
||||||
|
|
||||||
# -drive "file=$NIX_DISK_IMAGE,if=virtio,id=hd0" \
|
# -drive "file=$NIX_DISK_IMAGE,if=virtio,id=hd0" \
|
||||||
# -hda "$NIX_DISK_IMAGE" \
|
# -hda "$NIX_DISK_IMAGE" \
|
||||||
#-net nic,model=virtio,macaddr=16:da:11:b4:44:c9 -net user \
|
#-net nic,model=virtio,macaddr=16:da:11:b4:44:c9 -net user \
|
||||||
# -net nic,netdev=user.0,model=virtio -netdev user,id=user.0,"$QEMU_NET_OPTS" \
|
# -net nic,netdev=user.0,model=virtio -netdev user,id=user.0,"$QEMU_NET_OPTS" \
|
||||||
#console=tty0
|
#console=tty0
|
||||||
#console=ttyS0,115200n8
|
#console=ttyS0,115200n8
|
||||||
#
|
|
||||||
# -fsdev local,id=fsdev1,path=/nix/store,security_model=none \
|
|
||||||
# -device virtio-9p-pci,fsdev=fsdev1,mount_tag=store,bus=pcie.1 \
|
# -device virtio-9p-pci,fsdev=fsdev1,mount_tag=store,bus=pcie.1 \
|
||||||
#
|
#
|
||||||
# -drive cache=writeback,file="$NIX_DISK_IMAGE",id=drive1,if=none,index=1,werror=report -device virtio-blk-pci,drive=drive1 \
|
# -drive cache=writeback,file="$NIX_DISK_IMAGE",id=drive1,if=none,index=1,werror=report -device virtio-blk-pci,drive=drive1 \
|
||||||
|
@ -407,6 +407,16 @@
|
|||||||
};
|
};
|
||||||
|
|
||||||
bench2 = final.writeShellScript "bench2" ''
|
bench2 = final.writeShellScript "bench2" ''
|
||||||
|
#Tests if a benchmark exection was successful
|
||||||
|
function bench_test {
|
||||||
|
$@
|
||||||
|
local status=$?
|
||||||
|
if (( status != 0)); then
|
||||||
|
echo "BENCHMARK-ERROR-STATE"
|
||||||
|
fi
|
||||||
|
return $status
|
||||||
|
}
|
||||||
|
|
||||||
echo --------BENCHMARKING PHASE---------
|
echo --------BENCHMARKING PHASE---------
|
||||||
# Performs minimal FS setup and runs the SPEC benchmark
|
# Performs minimal FS setup and runs the SPEC benchmark
|
||||||
mkdir /tmp /bin /root
|
mkdir /tmp /bin /root
|
||||||
@ -420,42 +430,41 @@
|
|||||||
#cat /tmp/spec/time.csv
|
#cat /tmp/spec/time.csv
|
||||||
# hpc_benchmarks
|
# hpc_benchmarks
|
||||||
set -x
|
set -x
|
||||||
axpy-autovect 800 1000
|
|
||||||
axpy-cblas 800 1000
|
bench_test "axpy-autovect 800 1000"
|
||||||
axpy-omp-simd 800 1000
|
bench_test "axpy-cblas 800 1000"
|
||||||
axpy-scalar 800 1000
|
bench_test "axpy-omp-simd 800 1000"
|
||||||
|
bench_test "axpy-scalar 800 1000"
|
||||||
|
|
||||||
gemm-autovect 256
|
bench_test "gemm-autovect 256"
|
||||||
gemm-omp-simd 256
|
bench_test "gemm-omp-simd 256"
|
||||||
gemm-scalar 256
|
bench_test "gemm-scalar 256"
|
||||||
|
|
||||||
somier-autovect 4 32
|
bench_test "somier-autovect 4 32"
|
||||||
somier-omp-simd 4 32
|
bench_test "somier-omp-simd 4 32"
|
||||||
somier-scalar 4 32
|
bench_test "somier-scalar 4 32"
|
||||||
|
|
||||||
lulesh2.0 -s 4
|
bench_test "lulesh2.0 -s 4"
|
||||||
|
|
||||||
jacobi2d_scalar_vanilla 16 2
|
bench_test "jacobi2d_scalar_vanilla 16 2"
|
||||||
|
|
||||||
hacckernels-autovectorisation 10
|
bench_test "hacckernels-scalar 10"
|
||||||
hacckernels-scalar 10
|
|
||||||
|
|
||||||
# desktop_benchmarks
|
# desktop_benchmarks
|
||||||
|
|
||||||
blackscholes_scalar 1 ${final.blackscholesInput} /dev/null
|
bench_test "blackscholes_scalar 1 ${final.blackscholesInput} /dev/null"
|
||||||
|
|
||||||
|
bench_test "streamcluster_scalar 3 10 16 16 16 10 none output.txt 1"
|
||||||
|
|
||||||
streamcluster_scalar 3 10 16 16 16 10 none output.txt 1
|
bench_test "pathfinder_serial.exe 64 64 output_64_64.txt"
|
||||||
|
bench_test "pathfinder_vector.exe 64 64 output_64_64.txt"
|
||||||
canneal_scalar 1 100 300
|
|
||||||
canneal_vectorial_intrinsics
|
|
||||||
|
|
||||||
pathfinder_serial.exe 64 64 output_64_64.txt
|
bench_test "swaptions_scalar -ns 2 -sm 1024 -nt 1"
|
||||||
pathfinder_vector.exe 64 64 output_64_64.txt
|
|
||||||
|
|
||||||
swaptions_scalar -ns 2 -sm 1024 -nt 1
|
|
||||||
|
|
||||||
# micro_benchmarks (NO WORKING BENCHMARKS FOR NOW...)
|
# micro_benchmarks (NO WORKING BENCHMARKS FOR NOW...)
|
||||||
|
|
||||||
|
echo "BENCHMARK-SUCESS-STATE"
|
||||||
|
|
||||||
# Give me a shell at the end
|
# Give me a shell at the end
|
||||||
bash -l
|
bash -l
|
||||||
'';
|
'';
|
||||||
|
20
verify-bench2.awk
Normal file
20
verify-bench2.awk
Normal file
@ -0,0 +1,20 @@
|
|||||||
|
BEGIN {
|
||||||
|
bench_success_flag = 0
|
||||||
|
}
|
||||||
|
|
||||||
|
function terminate_qemu() {
|
||||||
|
system("kill $(cat qemu.pid)");
|
||||||
|
|
||||||
|
if (bench_success_flag) {
|
||||||
|
print "Benchmark execution has finished successfully. \n"
|
||||||
|
exit 0;
|
||||||
|
} else {
|
||||||
|
print "Benchmark execution has been interrupted by an error. \n"
|
||||||
|
exit 1;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
/^BENCHMARK-SUCESS-STATE/ { bench_success_flag = 1; terminate_qemu()}
|
||||||
|
/^BENCHMARK-ERROR-STATE/ { bench_success_flag = 0; terminate_qemu()}
|
||||||
|
{print $0}
|
||||||
|
|
Loading…
Reference in New Issue
Block a user