diff --git a/.gitlab-ci.yml b/.gitlab-ci.yml index df58016..59d5188 100644 --- a/.gitlab-ci.yml +++ b/.gitlab-ci.yml @@ -10,65 +10,40 @@ variables: APPS: "tests" PATH: '/home/gitlabci/.cargo/bin:/usr/local/bin:/usr/bin:/usr/sbin:/sbin:/usr/local/condor/bin:/usr/sepp/bin:$CI_PROJECT_DIR/install/verilator/bin:/home/gitlabci/.local/bin' OBJCACHE: '' - CC: 'gcc-11.2.0' - CXX: 'g++-11.2.0' + CC: '/usr/pack/gcc-11.2.0-af/linux-x64/bin/gcc' + CXX: '/usr/pack/gcc-11.2.0-af/linux-x64/bin/g++' CMAKE: 'cmake-3.28.3' python: 'python3' python3: 'python3' +default: + tags: [dolent] + stages: - build - # - sim-vsim - -cache: - paths: - - install/ - key: "$CI_COMMIT_REF_SLUG-toolchain-v1" # Recommended key structure - policy: pull-push .base: artifacts: when: always expire_in: 1 day -build-tmp: +build-vsim: extends: .base stage: build script: - - echo "CI WIP, no check available now" - -# build-tc: -# extends: .base -# stage: build -# timeout: 3h -# script: -# # Check if the cache was restored (i.e., if 'install/bin' exists) -# - if [ ! -d "install/llvm" ]; then -# - echo "Toolchain not found in cache. Building dependencies..." -# - make bender -# - make toolchain -# - echo "Toolchain built. Will be cached." -# - else -# - echo "Toolchain found in cache. Skipping build." -# - fi + - echo "Using CC=$CC" + - echo "Using CXX=$CXX" + - test -x "$CC" + - test -x "$CXX" + - make quick-tool + - make init + - make dram-build + - cd util/auto-benchmark + - chmod +x ./run_ci.sh + - ./run_ci.sh -# build-vsim: -# extends: .base -# needs: [ build-tc ] -# stage: build -# script: -# - make init -# - make dram-build CMAKE=cmake-3.28.3 -# - make generate config=cachepool_fpu_512 -# - make vsim config=cachepool_fpu_512 -# artifacts: -# paths: [ "software/build", "sim/bin" ] - -# run_dotp: -# extends: .base -# needs: [ build-vsim ] -# stage: sim-vsim -# script: -# - ./sim/bin/cachepool_cluster.vsim ./software/build/CachePoolTests/test-cachepool-fdotp-32b_M1024 -# artifacts: -# paths: [ "software/build", "sim/bin" ] + artifacts: + paths: + - software/build + - sim/bin + - util/auto-benchmark/logs diff --git a/util/auto-benchmark/configs-ci.sh b/util/auto-benchmark/configs-ci.sh new file mode 100644 index 0000000..961a3fe --- /dev/null +++ b/util/auto-benchmark/configs-ci.sh @@ -0,0 +1,5 @@ +# Configs and kernel suffixes (without prefix) +CONFIGS="cachepool_fpu_128 cachepool_fpu_256 cachepool_fpu_512" +KERNELS="spin-lock fdotp-32b_M32768 gemv-col_M256_N128_K32 fmatmul-32b_M32_N32_K32" +PREFIX="test-cachepool-" # common prefix for all kernels +ROOT_PATH=../.. # adjust if needed (path to repo root) diff --git a/util/auto-benchmark/run_ci.sh b/util/auto-benchmark/run_ci.sh new file mode 100755 index 0000000..8066d4f --- /dev/null +++ b/util/auto-benchmark/run_ci.sh @@ -0,0 +1,59 @@ +#!/usr/bin/env bash +set -e + +# Load user configs +source ./configs-ci.sh + +# Derived paths +SIM_CMD="${ROOT_PATH}/sim/bin/cachepool_cluster.vsim" +SW_PATH="${ROOT_PATH}/software/build/CachePoolTests" +SIM_LOG_DIR="./sim/bin/logs" # where perf logs appear +LOG_DIR="logs/$(date +%Y%m%d-%H%M%S)" +mkdir -p "$LOG_DIR" +ln -sfn "$(realpath "$LOG_DIR")" logs/latest + +echo "== CachePool batch run ==" +echo "ROOT_PATH : $ROOT_PATH" +echo "CONFIGS : $CONFIGS" +echo "KERNELS : $KERNELS" +echo "PREFIX : $PREFIX" +echo "Logs : $LOG_DIR (also at logs/latest)" +echo + +for cfg in $CONFIGS; do + echo "==== Building $cfg ====" + make -C "$ROOT_PATH" -s clean generate vsim config=$cfg + + summary_file="${LOG_DIR}/${cfg}_summary.txt" + rm -f "$summary_file" # start fresh for each config + + for k in $KERNELS; do + kernel_name="${PREFIX}${k}" + bin_path="${SW_PATH}/${kernel_name}" + log_file="${LOG_DIR}/${cfg}_${k}.log" + + echo "---- Running $cfg / $kernel_name ----" + if [[ ! -f "$bin_path" ]]; then + echo " [WARN] Binary not found: $bin_path" | tee "$log_file" + continue + fi + + # Run simulation and capture output + "$SIM_CMD" "$bin_path" 2>&1 | tee "$log_file" + + # Move generated perf logs if any + if [[ -d "$SIM_LOG_DIR" && "$(ls -A "$SIM_LOG_DIR")" ]]; then + new_pm_dir="${LOG_DIR}/${cfg}_${k}_pm" + mv "$SIM_LOG_DIR" "$new_pm_dir" + echo " [INFO] Moved perf logs to $new_pm_dir" + fi + + # Extract UART summary + python3 write_results.py "$log_file" "$summary_file" "$cfg" "$k" + done + + echo "---- Summary for $cfg written to $summary_file ----" +done + +echo +echo "All runs complete. Logs stored in $LOG_DIR"