Repository navigation
dashboard 融合 history.html — 增加趋势折线图 + 优化时间线 + 占比信息 #66
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| name: CI | |
| on: | |
| push: | |
| branches: [main, wjy_dev, jzj_dev] | |
| pull_request: | |
| branches: [main] | |
| env: | |
| FORCE_JAVASCRIPT_ACTIONS_TO_NODE24: true | |
| permissions: | |
| contents: read | |
| pages: write | |
| id-token: write | |
| jobs: | |
| # ═════════════════════════════════════════════════════════════════════════ | |
| # 课题功能测试:所有14个模块的单元测试 + 集成测试 | |
| # ═════════════════════════════════════════════════════════════════════════ | |
| test: | |
| runs-on: self-hosted | |
| timeout-minutes: 10 | |
| steps: | |
| - uses: actions/checkout@v4 | |
| - name: Install dependencies | |
| run: | | |
| python3.12 -m pip install --upgrade pip | |
| python3.12 -m pip install -e ".[all]" | |
| - name: Run all topic tests | |
| run: | | |
| mkdir -p benchmark_reports | |
| python3.12 -m pytest tests/ -v --tb=short \ | |
| --junit-xml=benchmark_reports/test_results.xml | |
| - name: Generate test visualization page | |
| if: github.ref == 'refs/heads/main' | |
| run: | | |
| python3.12 scratchv/ci/test_page.py \ | |
| --junit benchmark_reports/test_results.xml \ | |
| -o benchmark_reports/tests.html | |
| - name: Upload test reports | |
| if: github.ref == 'refs/heads/main' | |
| uses: actions/upload-artifact@v4 | |
| with: | |
| name: test-reports | |
| path: | | |
| benchmark_reports/test_results.xml | |
| benchmark_reports/tests.html | |
| retention-days: 30 | |
| # ═════════════════════════════════════════════════════════════════════════ | |
| # 模型性能测试:ONNX模型管线 + DSL用例 + CNN RISC-V编译 | |
| # ═════════════════════════════════════════════════════════════════════════ | |
| benchmark: | |
| runs-on: self-hosted | |
| timeout-minutes: 30 | |
| steps: | |
| - uses: actions/checkout@v4 | |
| - name: Install dependencies | |
| run: | | |
| python3.12 -m pip install --upgrade pip | |
| python3.12 -m pip install -e ".[all]" | |
| # ── 3.1 ONNX 模型管线基准测试 ────────────────────────────────────── | |
| - name: ONNX model pipeline benchmarks | |
| run: python3.12 -m pytest benchmarks/test_benchmark.py -v --tb=short | |
| # ── 3.2 DSL 用例编译 + 模拟基准 ──────────────────────────────────── | |
| - name: DSL case compilation benchmarks | |
| run: | | |
| mkdir -p benchmark_reports | |
| python3.12 benchmarks/bench_runner.py benchmarks/cases \ | |
| --output-json benchmark_reports/dsl_bench.json \ | |
| --output-html benchmark_reports/dsl_bench.html \ | |
| --output-md benchmark_reports/dsl_bench.md | |
| # ── 3.3 CNN RISC-V 编译 + 性能估算 ──────────────────────────────── | |
| - name: CNN RISC-V compilation & estimation | |
| run: | | |
| mkdir -p benchmark_reports models/graph | |
| MODEL=models/graph/cnn.onnx | |
| if [ ! -f "$MODEL" ]; then | |
| echo "::warning::cnn.onnx not found, generating minimal CNN test model" | |
| python3.12 scripts/gen_minimal_cnn.py 2>&1 | |
| fi | |
| python3.12 scratchv/standalone/onnx_to_riscv_standalone.py \ | |
| "$MODEL" -o /tmp/cnn_riscv.bin --estimate --report | |
| # ── 3.4 LLVM vs ScratchV + TinyFive + Dashboard ────────────────── | |
| - name: LLVM vs ScratchV comparison | |
| run: | | |
| mkdir -p benchmark_reports | |
| # Generate ScratchV assembly if not already present | |
| if [ ! -f benchmark_reports/cnn_scratchv.s ] && [ -f models/graph/cnn.onnx ]; then | |
| python3.12 scratchv/standalone/onnx_to_riscv_standalone.py \ | |
| models/graph/cnn.onnx -o /tmp/cnn_riscv.bin \ | |
| --asm benchmark_reports/cnn_scratchv.s --estimate 2>&1 | tail -3 | |
| fi | |
| python3.12 scratchv/standalone/llvm_cache_compare.py \ | |
| --json-output benchmark_reports/llvm_vs_scratchv.json \ | |
| --markdown benchmark_reports/llvm_vs_scratchv.md \ | |
| || echo "WARNING: llvm_cache_compare failed" | |
| python3.12 scratchv/standalone/tinyfive_compare.py \ | |
| --json benchmark_reports/tinyfive_compare.json \ | |
| --markdown benchmark_reports/tinyfive_compare.md \ | |
| --scratchv-asm benchmark_reports/cnn_scratchv.s \ | |
| || echo "WARNING: tinyfive_compare failed" | |
| # ── 3.5 ONNX 模型拆分为单算子 ──────────────────────────────────── | |
| - name: Split CNN model into single operators | |
| run: | | |
| python3.12 scripts/split_cnn_to_single_ops.py \ | |
| || echo "WARNING: split_cnn_to_single_ops failed" | |
| # ── 3.6 单算子 benchmark ──────────────────────────────────────── | |
| - name: Single-operator benchmarks | |
| run: | | |
| python3.12 scripts/bench_single_ops.py \ | |
| || echo "WARNING: bench_single_ops failed" | |
| # ── 3.7 生成仪表盘 HTML (版本vsLLVM + 指令分类 + 算子对比) ───── | |
| - name: Generate dashboard | |
| run: | | |
| python3.12 scratchv/ci/dashboard.py \ | |
| --llvm-json benchmark_reports/llvm_vs_scratchv.json \ | |
| --history-json benchmark_reports/optimization_history.json \ | |
| -o benchmark_reports/dashboard.html \ | |
| || echo "WARNING: dashboard generation failed" | |
| # ── 上报 ────────────────────────────────────────────────────────── | |
| - name: Upload benchmark reports | |
| uses: actions/upload-artifact@v4 | |
| with: | |
| name: benchmark-reports | |
| path: benchmark_reports/ | |
| retention-days: 30 | |
| # ── 保留推广主页(docs/ScratchV.html 不会被顶替) ──────────────── | |
| - name: Copy promotional page into Pages artifact | |
| if: github.ref == 'refs/heads/main' | |
| run: cp docs/ScratchV.html benchmark_reports/ScratchV.html | |
| # ── 优化历史页面 ────────────────────────────────────────────────── | |
| - name: Generate optimization history page | |
| if: github.ref == 'refs/heads/main' | |
| run: python3.12 scratchv/ci/history_page.py -o benchmark_reports/history.html | |
| # ── 测试可视化页面 ──────────────────────────────────────────────── | |
| - name: Generate test visualization page | |
| if: github.ref == 'refs/heads/main' | |
| run: | | |
| python3.12 scratchv/ci/test_page.py \ | |
| --junit benchmark_reports/test_results.xml \ | |
| -o benchmark_reports/tests.html | |
| # ── 上传 Pages 产物 ────────────────────────────────────────────── | |
| - name: Upload Pages artifact | |
| if: github.ref == 'refs/heads/main' | |
| uses: actions/upload-pages-artifact@v3 | |
| with: | |
| path: benchmark_reports/ | |
| - name: Write job summary | |
| run: | | |
| if [ -f benchmark_reports/github_summary.md ]; then | |
| cat benchmark_reports/github_summary.md >> $GITHUB_STEP_SUMMARY | |
| fi | |
| echo "" >> $GITHUB_STEP_SUMMARY | |
| echo "### LLVM vs ScratchV" >> $GITHUB_STEP_SUMMARY | |
| if [ -f benchmark_reports/llvm_vs_scratchv.md ]; then | |
| tail -20 benchmark_reports/llvm_vs_scratchv.md >> $GITHUB_STEP_SUMMARY | |
| fi | |
| # ═════════════════════════════════════════════════════════════════════════ | |
| # GitHub Pages 部署 (仅 main 分支) | |
| # ═════════════════════════════════════════════════════════════════════════ | |
| deploy-pages: | |
| needs: benchmark | |
| if: github.ref == 'refs/heads/main' | |
| runs-on: ubuntu-latest | |
| permissions: | |
| pages: write | |
| id-token: write | |
| environment: | |
| name: github-pages | |
| url: ${{ steps.deployment.outputs.page_url }} | |
| steps: | |
| - name: Deploy to GitHub Pages | |
| id: deployment | |
| uses: actions/deploy-pages@v4 |