[Leo] Fix polybench-segmented.yml — correct ELF filenames and benchma… #22
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: Performance Regression Detection | |
| on: | |
| pull_request: | |
| types: [opened, synchronize, ready_for_review] | |
| push: | |
| branches: [main] | |
| jobs: | |
| performance-regression: | |
| name: Detect Performance Regressions | |
| runs-on: ubuntu-latest | |
| timeout-minutes: 20 | |
| steps: | |
| - name: Checkout PR code | |
| uses: actions/checkout@v4 | |
| - name: Set up Go | |
| uses: actions/setup-go@v5 | |
| with: | |
| go-version: '1.25' | |
| - name: Run current benchmarks | |
| run: | | |
| go test -run='XXX_NO_MATCH' -bench=BenchmarkPipeline -benchtime=1000x -count=3 \ | |
| ./timing/pipeline/ | tee current-bench.txt | |
| - name: Checkout baseline (main) | |
| run: | | |
| git fetch origin main | |
| git checkout FETCH_HEAD | |
| - name: Run baseline benchmarks | |
| run: | | |
| go test -run='XXX_NO_MATCH' -bench=BenchmarkPipeline -benchtime=1000x -count=3 \ | |
| ./timing/pipeline/ | tee baseline-bench.txt | |
| - name: Install benchstat | |
| run: go install golang.org/x/perf/cmd/benchstat@latest | |
| - name: Compare performance | |
| id: compare | |
| run: | | |
| # benchstat expects old first, then new | |
| benchstat baseline-bench.txt current-bench.txt > benchstat-output.txt 2>&1 || true | |
| cat benchstat-output.txt | |
| # Check for significant regressions (>15% slower) | |
| REGRESSION=false | |
| if grep -E '\+[1-9][5-9]\.[0-9]+%|\+[2-9][0-9]+\.[0-9]+%|\+[0-9]{3,}\.[0-9]+%' benchstat-output.txt; then | |
| REGRESSION=true | |
| fi | |
| echo "regression=$REGRESSION" >> "$GITHUB_OUTPUT" | |
| - name: Generate report | |
| if: always() | |
| run: | | |
| echo "## Performance Benchmark Comparison" > report.md | |
| echo "" >> report.md | |
| echo "Compares PR benchmarks against main branch baseline." >> report.md | |
| echo "Benchmarks: pipeline tick throughput across ALU, memory, mixed workloads." >> report.md | |
| echo "" >> report.md | |
| echo '```' >> report.md | |
| cat benchstat-output.txt >> report.md | |
| echo '```' >> report.md | |
| echo "" >> report.md | |
| if [ "${{ steps.compare.outputs.regression }}" = "true" ]; then | |
| echo "**Warning:** Significant performance regression detected (>15%)." >> report.md | |
| else | |
| echo "No significant regressions detected." >> report.md | |
| fi | |
| cat report.md >> "$GITHUB_STEP_SUMMARY" | |
| - name: Upload benchmark data | |
| if: always() | |
| uses: actions/upload-artifact@v4 | |
| with: | |
| name: performance-benchmark-data | |
| path: | | |
| current-bench.txt | |
| baseline-bench.txt | |
| benchstat-output.txt | |
| report.md | |
| retention-days: 30 | |
| - name: Comment on PR | |
| if: github.event_name == 'pull_request' && always() | |
| uses: actions/github-script@v7 | |
| with: | |
| script: | | |
| const fs = require('fs'); | |
| let body = '## Performance Regression Analysis\n\n'; | |
| if (fs.existsSync('report.md')) { | |
| body += fs.readFileSync('report.md', 'utf8'); | |
| } else { | |
| body += 'Performance analysis failed - check workflow logs.'; | |
| } | |
| body += '\n\n---\n*Automated benchmark comparison via `go test -bench` + benchstat*'; | |
| github.rest.issues.createComment({ | |
| issue_number: context.issue.number, | |
| owner: context.repo.owner, | |
| repo: context.repo.repo, | |
| body: body | |
| }); |