Skip to content

Commit

Permalink
util: CI: add valgrind check for ideal config
Browse files Browse the repository at this point in the history
use coremark to run valgrind

Change-Id: I42770e1121f0149ac57d397600b9de56fc48608d
  • Loading branch information
jensen-yan committed Jan 7, 2025
1 parent 851b820 commit 49504c2
Show file tree
Hide file tree
Showing 2 changed files with 44 additions and 19 deletions.
24 changes: 24 additions & 0 deletions .github/workflows/gem5.yml
Original file line number Diff line number Diff line change
Expand Up @@ -31,6 +31,30 @@ jobs:
bash util/memory_check/run-xs-with-valgrind.sh
cd $GEM5_HOME
valgrind_memory_check_ideal:
runs-on: self-hosted
continue-on-error: false
name: XS-GEM5 - Check memory corruption with ideal-kmhv3
steps:
- uses: actions/checkout@v2
- name: Build DRAMSim
run: |
export GEM5_HOME=$(pwd)
cd ext/dramsim3
git clone https://github.com/umd-memsys/DRAMsim3.git DRAMsim3
cd DRAMsim3 && mkdir -p build
cd build
cmake ..
make -j 48
cd $GEM5_HOME
- name: Build GEM5 debug
run: CC=gcc CXX=g++ scons build/RISCV/gem5.debug --linker=gold -j64
- name: Memory check
run: |
export GEM5_HOME=$(pwd)
bash util/memory_check/run-xs-with-valgrind.sh ideal
cd $GEM5_HOME
new_sim_script_test_gcb:
runs-on: self-hosted
continue-on-error: false
Expand Down
39 changes: 20 additions & 19 deletions util/memory_check/run-xs-with-valgrind.sh
Original file line number Diff line number Diff line change
@@ -1,32 +1,33 @@
set -x

gem5_home=$(pwd)
gcpt_restore_path=/nfs/home/share/gem5_shared_tools/normal-gcb-restorer.bin
ref_so_path=/nfs-nvme/home/share/zhenhao/ref-h/build/riscv64-nemu-interpreter-so
test_cpt=/nfs/home/share/jiaxiaoyu/simpoint_checkpoint_archive/spec06_rv64gcb_O3_20m_gcc12.2.0-intFpcOff-jeMalloc/checkpoint-0-0-0/GemsFDTD/30385/_30385_0.268180_.gz
ref_so_path=/nfs/home/share/gem5_ci/ref/normal/riscv64-nemu-interpreter-so
export GCBV_REF_SO=$ref_so_path

export NEMU_HOME=$ref_so_path # dummy
raw_cpt=/nfs/home/share/gem5_ci/checkpoints/coremark-riscv64-xs.bin
# ideal config, $1 means ideal-kmhv3
IDEAL_CONFIG=""
if [ "$1" ]; then
IDEAL_CONFIG="--ideal-kmhv3"
fi
echo "IDEAL_CONFIG: $IDEAL_CONFIG"

mkdir -p $gem5_home/valgrind-test
cd $gem5_home/valgrind-test

valgrind -s --track-origins=yes --log-file=valgrind-out.txt --error-limit=no \
--suppressions=$gem5_home/util/valgrind-suppressions \
$gem5_home/build/RISCV/gem5.debug $gem5_home/configs/example/fs.py \
--xiangshan-system --cpu-type=DerivO3CPU --mem-size=8GB --caches --cacheline_size=64 \
--l1i_size=64kB --l1i_assoc=8 --l1d_size=64kB --l1d_assoc=8 \
--l1d-hwp-type=XSCompositePrefetcher --short-stride-thres=0 \
--l2cache --l2_size=1MB --l2_assoc=8 \
--l3cache --l3_size=16MB --l3_assoc=16 \
--l1-to-l2-pf-hint --l2-hwp-type=CompositeWithWorkerPrefetcher \
--l2-to-l3-pf-hint --l3-hwp-type=WorkerPrefetcher \
--mem-type=DRAMsim3 \
--dramsim3-ini=$gem5_home/ext/dramsim3/xiangshan_configs/xiangshan_DDR4_8Gb_x8_3200_2ch.ini \
--bp-type=DecoupledBPUWithFTB --enable-loop-predictor \
--enable-difftest --difftest-ref-so=$ref_so_path \
--generic-rv-cpt=$test_cpt \
--gcpt-restorer=$gcpt_restore_path \
--warmup-insts-no-switch=40000 --maxinsts=80000
$gem5_home/build/RISCV/gem5.debug \
$gem5_home/configs/example/xiangshan.py \
$IDEAL_CONFIG \
--raw-cpt \
--generic-rv-cpt=$raw_cpt

# if $? != 0, exit
if [ $? -ne 0 ]; then
echo "Valgrind test failed"
exit 1
fi

python3 $gem5_home/util/memory_check/check-memory-error.py $gem5_home/valgrind-test/valgrind-out.txt

0 comments on commit 49504c2

Please sign in to comment.