Skip to content

Commit 918c23f

Browse files
authored
Merge pull request #505 from sarchlab/athena/cleanup-actions
[Athena] Clean up and split CI actions (Issue #504)
2 parents c0ee1fb + ad8e774 commit 918c23f

21 files changed

Lines changed: 497 additions & 2903 deletions
Lines changed: 113 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,113 @@
1+
name: Accuracy - EmBench
2+
3+
on:
4+
push:
5+
branches: [main]
6+
paths:
7+
- 'benchmarks/aha-mont64-m2sim/**'
8+
- 'benchmarks/crc32-m2sim/**'
9+
- 'benchmarks/edn-m2sim/**'
10+
- 'benchmarks/huffbench-m2sim/**'
11+
- 'benchmarks/matmult-int-m2sim/**'
12+
- 'benchmarks/statemate-m2sim/**'
13+
- 'benchmarks/primecount-m2sim/**'
14+
- 'benchmarks/embench_test.go'
15+
- 'timing/**'
16+
workflow_dispatch:
17+
18+
concurrency:
19+
group: accuracy-embench-${{ github.ref }}
20+
cancel-in-progress: false
21+
22+
jobs:
23+
embench-accuracy:
24+
name: EmBench Accuracy
25+
runs-on: macos-14
26+
timeout-minutes: 30
27+
28+
steps:
29+
- uses: actions/checkout@v4
30+
- uses: actions/setup-go@v5
31+
with:
32+
go-version: '1.25'
33+
34+
- name: Verify EmBench ELFs
35+
run: |
36+
echo "Checking EmBench ELF files..."
37+
ls -la benchmarks/aha-mont64-m2sim/*.elf 2>/dev/null || echo "aha-mont64 missing"
38+
ls -la benchmarks/crc32-m2sim/*.elf 2>/dev/null || echo "crc32 missing"
39+
ls -la benchmarks/edn-m2sim/*.elf 2>/dev/null || echo "edn missing"
40+
ls -la benchmarks/huffbench-m2sim/*.elf 2>/dev/null || echo "huffbench missing"
41+
ls -la benchmarks/matmult-int-m2sim/*.elf 2>/dev/null || echo "matmult-int missing"
42+
ls -la benchmarks/statemate-m2sim/*.elf 2>/dev/null || echo "statemate missing"
43+
ls -la benchmarks/primecount-m2sim/*.elf 2>/dev/null || echo "primecount missing"
44+
45+
- name: Run EmBench tests
46+
run: |
47+
TESTS=(
48+
TestEmbenchAhaMont64
49+
TestEmbenchCRC32
50+
TestEmbenchEDN
51+
TestEmbenchHuffbench
52+
TestEmbenchMatmultInt
53+
TestEmbenchStatemate
54+
TestEmbenchPrimecount
55+
)
56+
57+
> embench_output.txt
58+
for TEST in "${TESTS[@]}"; do
59+
echo "--- $TEST ---"
60+
go test -v -run "^${TEST}$" -count=1 -timeout 5m ./benchmarks/ 2>&1 | tee -a embench_output.txt || true
61+
done
62+
63+
- name: Extract CPI results
64+
if: always()
65+
run: |
66+
python3 - <<'PYEOF'
67+
import json, re
68+
69+
results = {}
70+
with open("embench_output.txt") as f:
71+
for line in f:
72+
if "CPI=" not in line:
73+
continue
74+
# Try to extract benchmark name and CPI
75+
match = re.search(r'(\w+):\s+.*CPI=([\d.]+)', line)
76+
if match:
77+
name = match.group(1)
78+
cpi = float(match.group(2))
79+
results[name] = {"cpi": cpi}
80+
81+
output = {"benchmarks_run": len(results), "results": results}
82+
with open("embench_results.json", "w") as f:
83+
json.dump(output, f, indent=2)
84+
print(json.dumps(output, indent=2))
85+
PYEOF
86+
87+
- name: Post summary
88+
if: always()
89+
run: |
90+
echo "## EmBench Accuracy Results" >> $GITHUB_STEP_SUMMARY
91+
if [ -f embench_results.json ]; then
92+
python3 -c "
93+
import json
94+
d = json.load(open('embench_results.json'))
95+
print(f'**Benchmarks measured:** {d[\"benchmarks_run\"]}/7')
96+
if d['results']:
97+
print()
98+
print('| Benchmark | CPI |')
99+
print('|-----------|-----|')
100+
for name, r in sorted(d['results'].items()):
101+
print(f'| {name} | {r[\"cpi\"]:.3f} |')
102+
" >> $GITHUB_STEP_SUMMARY
103+
fi
104+
105+
- name: Upload results
106+
if: always()
107+
uses: actions/upload-artifact@v4
108+
with:
109+
name: embench-accuracy
110+
path: |
111+
embench_results.json
112+
embench_output.txt
113+
retention-days: 90
Lines changed: 82 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,82 @@
1+
name: Accuracy - Microbenchmarks
2+
3+
on:
4+
push:
5+
branches: [main]
6+
paths:
7+
- 'benchmarks/**'
8+
- 'timing/**'
9+
- 'emu/**'
10+
workflow_dispatch:
11+
12+
concurrency:
13+
group: accuracy-microbench-${{ github.ref }}
14+
cancel-in-progress: false
15+
16+
jobs:
17+
microbench-accuracy:
18+
name: Microbenchmark Accuracy
19+
runs-on: macos-14
20+
timeout-minutes: 15
21+
22+
steps:
23+
- name: Checkout code
24+
uses: actions/checkout@v4
25+
26+
- name: Set up Go
27+
uses: actions/setup-go@v5
28+
with:
29+
go-version: '1.25'
30+
31+
- name: Set up Python
32+
uses: actions/setup-python@v5
33+
with:
34+
python-version: '3.12'
35+
36+
- name: Install Python dependencies
37+
run: pip install matplotlib numpy scipy
38+
39+
- name: Run microbenchmark CPI tests
40+
run: |
41+
cd benchmarks
42+
echo "=== Running microbenchmark CPI tests ==="
43+
44+
# Without D-cache (ALU, branch, throughput benchmarks)
45+
go test -v -run TestTimingPredictions_CPIBounds -count=1 -timeout 5m ./ 2>&1 | tee micro_no_cache.txt
46+
47+
# With D-cache (memory-latency benchmarks)
48+
go test -v -run TestAccuracyCPI_WithDCache -count=1 -timeout 5m ./ 2>&1 | tee micro_dcache.txt
49+
50+
- name: Generate accuracy report
51+
run: |
52+
python3 benchmarks/native/accuracy_report.py --suite microbench 2>&1 || true
53+
# If the script doesn't support --suite yet, run it and it will
54+
# naturally process microbenchmarks from test output
55+
56+
- name: Post summary
57+
if: always()
58+
run: |
59+
echo "## Microbenchmark Accuracy Results" >> $GITHUB_STEP_SUMMARY
60+
echo "" >> $GITHUB_STEP_SUMMARY
61+
if [ -f benchmarks/native/accuracy_results.json ]; then
62+
python3 -c "
63+
import json
64+
d = json.load(open('benchmarks/native/accuracy_results.json'))
65+
print(f\"**Average Error:** {d['summary']['average_error']*100:.1f}%\")
66+
print(f\"**Benchmarks:** {d['summary']['benchmark_count']}\")
67+
" >> $GITHUB_STEP_SUMMARY
68+
else
69+
echo "No results generated." >> $GITHUB_STEP_SUMMARY
70+
fi
71+
72+
- name: Upload results
73+
if: always()
74+
uses: actions/upload-artifact@v4
75+
with:
76+
name: accuracy-microbench
77+
path: |
78+
benchmarks/native/accuracy_report.md
79+
benchmarks/native/accuracy_results.json
80+
benchmarks/native/accuracy_figure.png
81+
benchmarks/native/accuracy_normalized.pdf
82+
retention-days: 90
Lines changed: 176 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,176 @@
1+
name: Accuracy - PolyBench
2+
3+
on:
4+
push:
5+
branches: [main]
6+
paths:
7+
- 'benchmarks/polybench/**'
8+
- 'benchmarks/polybench_test.go'
9+
- 'benchmarks/timing_harness.go'
10+
- 'timing/**'
11+
workflow_dispatch:
12+
13+
concurrency:
14+
group: accuracy-polybench-${{ github.ref }}
15+
cancel-in-progress: false
16+
17+
jobs:
18+
polybench-group-1:
19+
name: PolyBench Group 1 (ATAX, BiCG, Jacobi1D)
20+
runs-on: macos-14
21+
timeout-minutes: 30
22+
steps:
23+
- uses: actions/checkout@v4
24+
- uses: actions/setup-go@v5
25+
with:
26+
go-version: '1.25'
27+
28+
- name: Verify ELFs
29+
run: |
30+
ls -la benchmarks/polybench/atax_m2sim.elf
31+
ls -la benchmarks/polybench/bicg_m2sim.elf
32+
ls -la benchmarks/polybench/jacobi-1d_m2sim.elf
33+
34+
- name: Run tests
35+
run: |
36+
for TEST in TestPolybenchATAX TestPolybenchBiCG TestPolybenchJacobi1D; do
37+
echo "--- $TEST ---"
38+
go test -v -run "^${TEST}$" -count=1 -timeout 8m ./benchmarks/ 2>&1 | tee -a group1_output.txt || true
39+
done
40+
41+
- name: Upload results
42+
if: always()
43+
uses: actions/upload-artifact@v4
44+
with:
45+
name: polybench-group-1
46+
path: group1_output.txt
47+
retention-days: 30
48+
49+
polybench-group-2:
50+
name: PolyBench Group 2 (MVT, GEMM)
51+
runs-on: macos-14
52+
timeout-minutes: 30
53+
steps:
54+
- uses: actions/checkout@v4
55+
- uses: actions/setup-go@v5
56+
with:
57+
go-version: '1.25'
58+
59+
- name: Verify ELFs
60+
run: |
61+
ls -la benchmarks/polybench/mvt_m2sim.elf
62+
ls -la benchmarks/polybench/gemm_m2sim.elf
63+
64+
- name: Run tests
65+
run: |
66+
for TEST in TestPolybenchMVT TestPolybenchGEMM; do
67+
echo "--- $TEST ---"
68+
go test -v -run "^${TEST}$" -count=1 -timeout 8m ./benchmarks/ 2>&1 | tee -a group2_output.txt || true
69+
done
70+
71+
- name: Upload results
72+
if: always()
73+
uses: actions/upload-artifact@v4
74+
with:
75+
name: polybench-group-2
76+
path: group2_output.txt
77+
retention-days: 30
78+
79+
polybench-group-3:
80+
name: PolyBench Group 3 (2MM, 3MM)
81+
runs-on: macos-14
82+
timeout-minutes: 30
83+
steps:
84+
- uses: actions/checkout@v4
85+
- uses: actions/setup-go@v5
86+
with:
87+
go-version: '1.25'
88+
89+
- name: Verify ELFs
90+
run: |
91+
ls -la benchmarks/polybench/2mm_m2sim.elf
92+
ls -la benchmarks/polybench/3mm_m2sim.elf
93+
94+
- name: Run tests
95+
run: |
96+
for TEST in TestPolybench2MM TestPolybench3MM; do
97+
echo "--- $TEST ---"
98+
go test -v -run "^${TEST}$" -count=1 -timeout 8m ./benchmarks/ 2>&1 | tee -a group3_output.txt || true
99+
done
100+
101+
- name: Upload results
102+
if: always()
103+
uses: actions/upload-artifact@v4
104+
with:
105+
name: polybench-group-3
106+
path: group3_output.txt
107+
retention-days: 30
108+
109+
consolidate:
110+
name: Consolidate PolyBench Results
111+
runs-on: ubuntu-latest
112+
needs: [polybench-group-1, polybench-group-2, polybench-group-3]
113+
if: always()
114+
steps:
115+
- uses: actions/checkout@v4
116+
117+
- name: Download results
118+
uses: actions/download-artifact@v4
119+
with:
120+
path: group-results
121+
122+
- name: Extract CPI results
123+
run: |
124+
cat group-results/polybench-group-1/group1_output.txt > combined.txt 2>/dev/null || true
125+
cat group-results/polybench-group-2/group2_output.txt >> combined.txt 2>/dev/null || true
126+
cat group-results/polybench-group-3/group3_output.txt >> combined.txt 2>/dev/null || true
127+
128+
python3 - <<'PYEOF'
129+
import json, re
130+
131+
results = {}
132+
with open("combined.txt") as f:
133+
for line in f:
134+
if "CPI=" not in line:
135+
continue
136+
match = re.search(r'(polybench_\w+):\s+cycles=(\d+),\s+insts=(\d+),\s+CPI=([\d.]+)', line)
137+
if match:
138+
name = match.group(1).replace("polybench_", "")
139+
if name == "jacobi1d":
140+
name = "jacobi-1d"
141+
results[name] = {
142+
"cycles": int(match.group(2)),
143+
"instructions": int(match.group(3)),
144+
"cpi": float(match.group(4)),
145+
}
146+
147+
output = {"benchmarks_run": len(results), "results": results}
148+
with open("polybench_results.json", "w") as f:
149+
json.dump(output, f, indent=2)
150+
print(json.dumps(output, indent=2))
151+
PYEOF
152+
153+
- name: Post summary
154+
if: always()
155+
run: |
156+
echo "## PolyBench Accuracy Results" >> $GITHUB_STEP_SUMMARY
157+
if [ -f polybench_results.json ]; then
158+
python3 -c "
159+
import json
160+
d = json.load(open('polybench_results.json'))
161+
print(f'**Benchmarks measured:** {d[\"benchmarks_run\"]}/7')
162+
if d['results']:
163+
print()
164+
print('| Benchmark | CPI |')
165+
print('|-----------|-----|')
166+
for name, r in sorted(d['results'].items()):
167+
print(f'| {name} | {r[\"cpi\"]:.3f} |')
168+
" >> $GITHUB_STEP_SUMMARY
169+
fi
170+
171+
- name: Upload consolidated results
172+
uses: actions/upload-artifact@v4
173+
with:
174+
name: polybench-consolidated
175+
path: polybench_results.json
176+
retention-days: 90

0 commit comments

Comments
 (0)