Skip to content

Commit 0281808

Browse files
committed
[CI] Update CI flow.
1 parent 0782e24 commit 0281808

3 files changed

Lines changed: 81 additions & 16 deletions

File tree

.gitlab-ci.yml

Lines changed: 64 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -8,29 +8,32 @@ variables:
88
GIT_SUBMODULE_STRATEGY: none
99
ROOT_DIR: '$CI_PROJECT_DIR'
1010
APPS: "tests"
11-
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'
11+
PATH: '$HOME/.cargo/bin:/usr/local/bin:/usr/bin:/usr/sbin:/sbin:/usr/local/condor/bin:/usr/sepp/bin:$CI_PROJECT_DIR/install/verilator/bin:$HOME/.local/bin'
1212
OBJCACHE: ''
1313
CC: '/usr/pack/gcc-11.2.0-af/linux-x64/bin/gcc'
1414
CXX: '/usr/pack/gcc-11.2.0-af/linux-x64/bin/g++'
1515
CMAKE: 'cmake-3.28.3'
1616
python: 'python3'
1717
python3: 'python3'
18+
# Config to build and test
19+
CI_CONFIG: 'cachepool_fpu_2g'
20+
SW_PREFIX: 'test-cachepool-'
1821

1922
default:
20-
tags: [dolent]
23+
tags: [shared]
2124

2225
stages:
2326
- build
27+
- test
2428

25-
.base:
26-
artifacts:
27-
when: always
28-
expire_in: 1 day
29-
30-
build-vsim:
31-
extends: .base
29+
# ---------------------------------------------------------------------------
30+
# Build stage: compile RTL and software for CI_CONFIG.
31+
# Parallel jobs within the same pipeline share $HOME, so the toolchain
32+
# installed by make quick-tool is automatically available to all test jobs.
33+
# ---------------------------------------------------------------------------
34+
build:
3235
stage: build
33-
timeout: 5h
36+
timeout: 4h 30m
3437
script:
3538
- echo "Using CC=$CC"
3639
- echo "Using CXX=$CXX"
@@ -39,10 +42,57 @@ build-vsim:
3942
- make quick-tool
4043
- make init
4144
- make dram-build
42-
- cd util/auto-benchmark
43-
- chmod +x ./run_ci.sh
44-
- ./run_ci.sh
45+
- python3 -m pip install --quiet -r requirements.txt
46+
- make clean generate vsim config=$CI_CONFIG
47+
artifacts:
48+
when: always
49+
expire_in: 1 day
50+
paths:
51+
# QuestaSim compiled work library
52+
- sim/work/
53+
# vsim wrapper scripts (exclude sim/bin/logs/ — not needed by test jobs)
54+
- sim/bin/cachepool_cluster.vsim
55+
- sim/bin/cachepool_cluster.vsim.gui
56+
# DPI shared library
57+
- sim/work-dpi/
58+
# Software binaries for all kernels
59+
- software/build/CachePoolTests/
60+
# DRAMSys shared libraries and config files (referenced by vsim at runtime)
61+
- hardware/deps/dram_rtl_sim/dramsys_lib/DRAMSys/build/lib/
62+
- hardware/deps/dram_rtl_sim/dramsys_lib/DRAMSys/configs/
4563

64+
# ---------------------------------------------------------------------------
65+
# Test stage: run each kernel in parallel on a separate runner.
66+
# Each job downloads the build artifacts, runs one simulation, and checks
67+
# the output log for failures.
68+
# ---------------------------------------------------------------------------
69+
test:
70+
stage: test
71+
timeout: 1h
72+
needs: [build]
73+
parallel:
74+
matrix:
75+
- KERNEL:
76+
- spin-lock
77+
- load-store_M16
78+
- fdotp-32b_M32768
79+
- gemv_M512_N128_K32
80+
- fmatmul-32b_M64_N64_K64
81+
- fft-32b_M1024_N16
82+
- multi_producer_single_consumer_double_linked_list_M1_N1350_K10
83+
- byte-enable
84+
script:
85+
# The vsim script writes a .rtlbinary marker here; ensure the dir exists.
86+
- mkdir -p sim/bin/logs
87+
- chmod +x sim/bin/cachepool_cluster.vsim
88+
- BIN="${SW_PREFIX}${KERNEL}"
89+
- sim/bin/cachepool_cluster.vsim software/build/CachePoolTests/$BIN 2>&1 | tee test_${KERNEL}.log
90+
- python3 util/auto-benchmark/check-ci.py test_${KERNEL}.log
4691
artifacts:
92+
when: always
93+
expire_in: 1 day
4794
paths:
48-
- util/auto-benchmark/logs
95+
# Full simulation log
96+
- test_*.log
97+
# Performance-monitor trace files written by the simulator
98+
- sim/bin/logs/

requirements.txt

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,8 @@
1+
# Python packages required for hardware code generation (make generate).
2+
# dataclasses is a stdlib backport needed on Python 3.6; it is a no-op on 3.7+.
3+
dataclasses
4+
hjson
5+
jsonref
6+
jsonschema
7+
mako
8+
termcolor

sim/sim.mk

Lines changed: 9 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -100,17 +100,24 @@ ${WORK_DIR}/compile.vsim.tcl: ${SNLIB_DIR}/rtl_lib.cc ${SNLIB_DIR}/common_lib.cc
100100
echo 'return 0' >> $@
101101

102102
# Wrapper script & GUI script
103+
# The generated scripts derive ROOT_DIR from their own location at runtime so
104+
# that they remain portable across different checkout paths (CI runners, moved
105+
# repos). All absolute paths baked in by make are replaced by a single sed pass.
103106
define QUESTASIM
104107
${VSIM} -c -do "source $<; quit" | tee $(dir $<)vsim.log
105108
@! grep -P "Errors: [1-9]*," $(dir $<)vsim.log
106109
@mkdir -p $(SIMBIN_DIR) $(SIMBIN_DIR)/logs
107-
@echo "#!/bin/bash" > $(SIMBIN_DIR)/cachepool_cluster.vsim
110+
@echo '#!/bin/bash' > $(SIMBIN_DIR)/cachepool_cluster.vsim
111+
@echo 'ROOT_DIR="$$(cd "$$(dirname "$$(readlink -f "$$0")")/../.." && pwd)"' >> $(SIMBIN_DIR)/cachepool_cluster.vsim
108112
@echo 'echo `realpath $$1` > ${SIMBIN_DIR}/logs/.rtlbinary' >> $(SIMBIN_DIR)/cachepool_cluster.vsim
109113
@echo '${VSIM} +permissive ${VSIM_FLAGS} -do "run -a" -work ${WORK_DIR} -c -ldflags "-Wl,-rpath,${GCC_LIB} -L${FESVR}/lib -lfesvr_vsim -lutil" $1 +permissive-off ++$$1 +PRELOAD=$$1' >> $(SIMBIN_DIR)/cachepool_cluster.vsim
114+
@sed -i 's|$(CACHEPOOL_DIR)|$${ROOT_DIR}|g' $(SIMBIN_DIR)/cachepool_cluster.vsim
110115
@chmod +x $(SIMBIN_DIR)/cachepool_cluster.vsim
111-
@echo "#!/bin/bash" > $(SIMBIN_DIR)/cachepool_cluster.vsim.gui
116+
@echo '#!/bin/bash' > $(SIMBIN_DIR)/cachepool_cluster.vsim.gui
117+
@echo 'ROOT_DIR="$$(cd "$$(dirname "$$(readlink -f "$$0")")/../.." && pwd)"' >> $(SIMBIN_DIR)/cachepool_cluster.vsim.gui
112118
@echo 'echo `realpath $$1` > ${SIMBIN_DIR}/logs/.rtlbinary' >> $(SIMBIN_DIR)/cachepool_cluster.vsim.gui
113119
@echo '${VSIM} +permissive ${VSIM_FLAGS} -do "log -r /*; source ${WAVE_FILE}; run -a" -work ${WORK_DIR} -ldflags "-Wl,-rpath,${GCC_LIB} -L${FESVR}/lib -lfesvr_vsim -lutil" $1 +permissive-off ++$$1 +PRELOAD=$$1' >> $(SIMBIN_DIR)/cachepool_cluster.vsim.gui
120+
@sed -i 's|$(CACHEPOOL_DIR)|$${ROOT_DIR}|g' $(SIMBIN_DIR)/cachepool_cluster.vsim.gui
114121
@chmod +x $(SIMBIN_DIR)/cachepool_cluster.vsim.gui
115122
endef
116123

0 commit comments

Comments
 (0)