Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
17 changes: 16 additions & 1 deletion .github/workflows/ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -73,7 +73,8 @@ jobs:
--ignore=tests/test_simulator.py

- name: Run PR #37 register-allocation regressions
run: python3.12 -m pytest tests/test_pr37_regression.py -v --tb=short
run: |
python3.12 -m pytest tests/test_pr37_regression.py -v --tb=short

- name: Generate test visualization page
if: github.ref == 'refs/heads/main'
Expand Down Expand Up @@ -209,6 +210,15 @@ jobs:
-o benchmark_reports/dashboard.html \
|| echo "WARNING: dashboard generation failed"

# ── 3.8 寄存器分配 benchmark(线性扫描:simple/dense/cnn + LLVM对比) ──
- name: Register allocation benchmarks
run: |
python3.12 -m benchmarks.test_regalloc.bench_regalloc_linear \
--repeats 30 \
--output-json benchmark_reports/regalloc_bench.json \
--output-html benchmark_reports/regalloc_bench.html \
--output-md benchmark_reports/regalloc_bench.md

# ── 上报 ──────────────────────────────────────────────────────────
- name: Upload benchmark reports
uses: actions/upload-artifact@v4
Expand Down Expand Up @@ -270,6 +280,11 @@ jobs:
if [ -f benchmark_reports/llvm_vs_scratchv.md ]; then
tail -20 benchmark_reports/llvm_vs_scratchv.md >> $GITHUB_STEP_SUMMARY
fi
echo "" >> $GITHUB_STEP_SUMMARY
echo "### Register Allocation Benchmarks" >> $GITHUB_STEP_SUMMARY
if [ -f benchmark_reports/regalloc_bench.md ]; then
cat benchmark_reports/regalloc_bench.md >> $GITHUB_STEP_SUMMARY
fi

# ═════════════════════════════════════════════════════════════════════════
# GitHub Pages 部署 (仅 main 分支)
Expand Down
20 changes: 20 additions & 0 deletions benchmarks/test_regalloc/__init__.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,20 @@
# flake8: noqa
"""
Register Allocation Benchmarks for ScratchV.

This package contains three benchmark suites for the linear scan
register allocator (``LinearScanAllocator``):

1. **bench1_simple** — Simple arithmetic (3-5 vregs, no spills)
2. **bench2_dense** — Dense computation (20+ vregs, triggers spilling)
3. **bench3_cnn** — CNN model integration (operations from ``models/graph/cnn.onnx``)

Each suite measures allocation time, spill count, peak register pressure,
and validates output correctness.

Usage::

python -m benchmarks.test_regalloc.run_all
"""

from __future__ import annotations
Loading
Loading