Skip to content

Commit 2294581

Browse files
authored
util: update ci to use config paths instead of script paths (#610)
- Replaced `script_path` with `config_path` in multiple workflow files to streamline configuration management. - Updated benchmark types and paths in `gem5-ideal-btb-0.3c.yml`, `gem5-ideal-btb-perf-weekly.yml`, `gem5-ideal-btb-perf.yml`, `gem5-ideal-rvv-simple-perf.yml`, `gem5-perf.yml`, and `manual-perf.yml`. - Enhanced `gem5-perf-template.yml` to support new config path requirements and added extra arguments handling for gem5 configurations. - Modified `parallel_sim.sh` to accommodate the new config file structure and improve usability for both legacy and new modes. Change-Id: I5208b7159a160cc08b8a0e347c5f2c412df11e96
1 parent e0a2739 commit 2294581

File tree

9 files changed

+102
-51
lines changed

9 files changed

+102
-51
lines changed

.github/workflows/gem5-ideal-btb-0.3c.yml

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -16,5 +16,5 @@ jobs:
1616
perf_test:
1717
uses: ./.github/workflows/gem5-perf-template.yml
1818
with:
19-
script_path: ../kmh_v3_btb.sh
20-
benchmark_type: "spec06-0.3c"
19+
config_path: configs/example/kmhv3.py
20+
benchmark_type: "spec06-0.3c"

.github/workflows/gem5-ideal-btb-perf-weekly.yml

Lines changed: 6 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -11,31 +11,24 @@ jobs:
1111
align_test_spec06:
1212
uses: ./.github/workflows/gem5-perf-template.yml
1313
with:
14-
script_path: ../kmh_v3_btb.sh
14+
config_path: configs/example/kmhv3.py
1515
benchmark_type: "spec06-1.0c"
1616

1717
align_test_spec17:
1818
uses: ./.github/workflows/gem5-perf-template.yml
1919
with:
20-
script_path: ../kmh_v3_btb.sh
20+
config_path: configs/example/kmhv3.py
2121
benchmark_type: "spec17-1.0c"
2222

2323
perf_test_spec06:
2424
uses: ./.github/workflows/gem5-perf-template.yml
2525
with:
26-
script_path: ../kmh_v3_ideal.sh
26+
config_path: configs/example/idealkmhv3.py
2727
benchmark_type: "spec06-1.0c"
28-
28+
2929
perf_test_spec17:
3030
uses: ./.github/workflows/gem5-perf-template.yml
3131
with:
32-
script_path: ../kmh_v3_ideal.sh
32+
config_path: configs/example/idealkmhv3.py
3333
benchmark_type: "spec17-1.0c"
34-
35-
# perf_test_spec06_vector:
36-
# uses: ./.github/workflows/gem5-perf-template.yml
37-
# with:
38-
# script_path: ../kmh_v3_ideal.sh
39-
# benchmark_type: "spec06-rvv-1.0c"
40-
# vector_type: "simple"
41-
# check_result: false
34+

.github/workflows/gem5-ideal-btb-perf.yml

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -18,5 +18,5 @@ jobs:
1818
perf_test:
1919
uses: ./.github/workflows/gem5-perf-template.yml
2020
with:
21-
script_path: ../kmh_v3_ideal.sh
22-
benchmark_type: "spec06-0.8c"
21+
config_path: configs/example/idealkmhv3.py
22+
benchmark_type: "spec06-0.8c"

.github/workflows/gem5-ideal-rvv-simple-perf.yml

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,7 @@ jobs:
77
perf_test:
88
uses: ./.github/workflows/gem5-perf-template.yml
99
with:
10-
script_path: ../kmh_v3_ideal.sh
10+
config_path: configs/example/idealkmhv3.py
1111
benchmark_type: "spec06int-rvv-0.8c"
1212
vector_type: "simple"
13-
check_result: false # Warning: rvv test will not show the difftest failure
13+
check_result: false # Warning: rvv test will not show the difftest failure

.github/workflows/gem5-perf-template.yml

Lines changed: 28 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -3,9 +3,15 @@ name: gem5 Performance Test Template (Unified)
33
on:
44
workflow_call:
55
inputs:
6-
script_path:
6+
config_path:
77
required: true
88
type: string
9+
description: "gem5 config file path (relative to repo root), e.g. configs/example/idealkmhv3.py"
10+
extra_args:
11+
required: false
12+
type: string
13+
default: ""
14+
description: "Extra arguments for gem5 (e.g., --disable-mgsc). Only works with .py config files."
915
benchmark_type:
1016
required: true
1117
type: string
@@ -116,17 +122,32 @@ jobs:
116122
117123
- name: XS-GEM5 - Run performance test
118124
# ${{ steps.config.outputs.comment }}
125+
env:
126+
GCBV_REF_SO: "/nfs/home/share/gem5_ci/ref/normal/riscv64-nemu-notama-tvalref-so"
127+
GCB_RESTORER: ""
128+
GEM5_HOME: ${{ github.workspace }}
129+
GEM5_BUILD_TYPE: fast
119130
run: |
120-
export GCBV_REF_SO="/nfs/home/share/gem5_ci/ref/normal/riscv64-nemu-notama-tvalref-so"
121-
export GCB_RESTORER=""
122-
export GEM5_HOME=$(pwd)
123-
export GEM5_BUILD_TYPE=fast
124131
mkdir -p $GEM5_HOME/util/xs_scripts/test
125132
cd $GEM5_HOME/util/xs_scripts/test
126-
bash ../parallel_sim.sh `realpath ${{ inputs.script_path }}` \
133+
134+
CONFIG_PATH="${{ inputs.config_path }}"
135+
if [[ "$CONFIG_PATH" == /* ]]; then
136+
echo "Error: config_path must be repo-root-relative, got absolute path: '$CONFIG_PATH'"
137+
exit 1
138+
fi
139+
if [[ "$CONFIG_PATH" != *.py ]]; then
140+
echo "Error: config_path must be a .py gem5 config file path, got: '$CONFIG_PATH'"
141+
exit 1
142+
fi
143+
144+
CONFIG_PATH="$GEM5_HOME/$CONFIG_PATH"
145+
146+
bash ../parallel_sim.sh "$(realpath "$CONFIG_PATH")" \
127147
${{ steps.config.outputs.checkpoint_list }} \
128148
${{ steps.config.outputs.checkpoint_root_node}} \
129-
spec_all
149+
spec_all \
150+
"${{ inputs.extra_args }}"
130151
- name: Setup gem5_data_proc environment
131152
run: |
132153
# 使用本地数据处理仓库,避免GitHub网络问题

.github/workflows/gem5-perf.yml

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -15,5 +15,5 @@ jobs:
1515
perf_test:
1616
uses: ./.github/workflows/gem5-perf-template.yml
1717
with:
18-
script_path: ../kmh_6wide.sh
19-
benchmark_type: "spec06-0.8c"
18+
config_path: configs/example/kmhv2.py
19+
benchmark_type: "spec06-0.8c"

.github/workflows/manual-perf.yml

Lines changed: 3 additions & 17 deletions
Original file line numberDiff line numberDiff line change
@@ -41,27 +41,13 @@ jobs:
4141
setup:
4242
runs-on: ubuntu-latest
4343
outputs:
44-
script_path: ${{ steps.resolve.outputs.script_path }}
44+
config_path: ${{ steps.resolve.outputs.config_path }}
4545
pr_sha: ${{ steps.resolve.outputs.pr_sha }}
4646
steps:
4747
- name: Resolve parameters
4848
id: resolve
4949
run: |
50-
case "${{ github.event.inputs.configuration }}" in
51-
"kmhv2.py")
52-
echo "script_path=../kmh_6wide.sh" >> $GITHUB_OUTPUT
53-
;;
54-
"kmhv3.py")
55-
echo "script_path=../kmh_v3_btb.sh" >> $GITHUB_OUTPUT
56-
;;
57-
"idealkmhv3.py")
58-
echo "script_path=../kmh_v3_ideal.sh" >> $GITHUB_OUTPUT
59-
;;
60-
*)
61-
echo "Error: unsupported configuration '${{ github.event.inputs.configuration }}'" >&2
62-
exit 1
63-
;;
64-
esac
50+
echo "config_path=configs/example/${{ github.event.inputs.configuration }}" >> $GITHUB_OUTPUT
6551
6652
if [ -n "${{ github.event.inputs.branch }}" ]; then
6753
echo "pr_sha=${{ github.event.inputs.branch }}" >> $GITHUB_OUTPUT
@@ -73,7 +59,7 @@ jobs:
7359
needs: setup
7460
uses: ./.github/workflows/gem5-perf-template.yml
7561
with:
76-
script_path: ${{ needs.setup.outputs.script_path }}
62+
config_path: ${{ needs.setup.outputs.config_path }}
7763
benchmark_type: ${{ github.event.inputs.benchmark_type }}
7864
vector_type: ${{ github.event.inputs.vector_type }}
7965
pr_sha: ${{ needs.setup.outputs.pr_sha }}

.github/workflows/on-demand-spec.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -83,7 +83,7 @@ jobs:
8383
needs: trigger
8484
uses: ./.github/workflows/gem5-perf-template.yml
8585
with:
86-
script_path: ../kmh_v3_ideal.sh
86+
config_path: configs/example/idealkmhv3.py
8787
benchmark_type: ${{ needs.trigger.outputs.benchmark_type }}
8888
vector_type: ${{ needs.trigger.outputs.vector_type }}
8989
pr_sha: ${{ needs.trigger.outputs.pr_sha }}

util/xs_scripts/parallel_sim.sh

Lines changed: 56 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,28 @@
1+
#!/usr/bin/env bash
12
# DO NOT track your local updates in this script!
23

34
function print_help() {
45
printf "Usage:
5-
bash $0 arch_script.sh workload_list.lst checkpoint_top_dir task_tag\n"
6+
bash $0 <config_file_or_script> workload_list.lst checkpoint_top_dir task_tag [extra_gem5_args]
7+
8+
Arguments:
9+
config_file_or_script: Config file (*.py) or wrapper script (*.sh).
10+
If relative, it is resolved relative to the repo root (gem5_home).
11+
workload_list.lst: List of workloads to run
12+
checkpoint_top_dir: Root directory for checkpoints
13+
task_tag: Tag for this experiment
14+
extra_gem5_args: Optional extra arguments for gem5 (only for .py mode)
15+
16+
Examples:
17+
# Legacy mode (using .sh script)
18+
bash $0 kmh_v3_btb.sh workload.lst /cpt/dir my_exp
19+
20+
# New mode (using .py config)
21+
bash $0 configs/example/idealkmhv3.py workload.lst /cpt/dir my_exp
22+
23+
# New mode with extra args
24+
bash $0 configs/example/idealkmhv3.py workload.lst /cpt/dir my_exp_nosc \"--disable-mgsc\"
25+
\n"
626
exit 1
727
}
828

@@ -13,7 +33,31 @@ fi
1333

1434
set -x
1535

16-
export arch_script=`realpath $1`
36+
script_dir=$(dirname -- "$( readlink -f -- "$0"; )")
37+
source "$script_dir/common.sh"
38+
39+
# Detect if first parameter is a script (.sh) or config file (.py)
40+
first_param="$1"
41+
if [[ "$first_param" != /* ]] && [[ -f "$gem5_home/$first_param" ]]; then
42+
first_param="$gem5_home/$first_param"
43+
fi
44+
export first_param=$(realpath "$first_param")
45+
46+
if [[ "$first_param" == *.sh ]]; then
47+
# Legacy mode: using wrapper script
48+
export use_legacy_mode=true
49+
export arch_script="$first_param"
50+
echo "Legacy mode: using script $arch_script"
51+
else
52+
# New mode: using config file directly
53+
export use_legacy_mode=false
54+
export config_file="$first_param"
55+
export extra_gem5_args="${5:-}" # Optional 5th parameter
56+
echo "Config mode: using $config_file"
57+
if [ -n "$extra_gem5_args" ]; then
58+
echo "Extra gem5 args: $extra_gem5_args"
59+
fi
60+
fi
1761

1862
# Note 1: workload list contains the workload name, checkpoint path, and parameters, looks like:
1963
# astar_biglakes_122060000000 astar_biglakes_122060000000_0.244818/0/ 0 0 20 20
@@ -70,9 +114,16 @@ function run() {
70114

71115
touch running
72116

73-
script_dir=$(dirname -- "$( readlink -f -- "$0"; )")
74-
bash $arch_script $1 # checkpoint
75-
check $?
117+
if [ "$use_legacy_mode" = true ]; then
118+
# Legacy mode: call wrapper script
119+
bash $arch_script $1 # checkpoint
120+
check $?
121+
else
122+
# New mode: directly call gem5 with config file
123+
# config_file is already an absolute path from realpath
124+
$gem5 "$config_file" --generic-rv-cpt="$1" $extra_gem5_args
125+
check $?
126+
fi
76127

77128
rm running
78129
touch completed

0 commit comments

Comments
 (0)