Skip to content

Commit

Permalink
Update benchmark.yaml
Browse files Browse the repository at this point in the history
  • Loading branch information
raphaelDkhn committed Jan 2, 2025
1 parent 8e1ea49 commit b2209fa
Showing 1 changed file with 65 additions and 49 deletions.
114 changes: 65 additions & 49 deletions .github/workflows/benchmark.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -23,26 +23,27 @@ jobs:
with:
fetch-depth: 0

# Initialize gh-pages branch if it doesn't exist
- name: Initialize gh-pages branch
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
run: |
git config --global user.email "41898282+github-actions[bot]@users.noreply.github.com"
git config --global user.name "github-actions[bot]"
# Check if gh-pages branch exists remotely
if ! git ls-remote --heads origin gh-pages | grep gh-pages > /dev/null; then
# Create and set up gh-pages branch
git checkout --orphan gh-pages
git rm -rf .
mkdir -p dev/bench/data
echo "# Benchmark Results" > dev/bench/data/README.md
git add dev/bench/data/README.md
# Create initial index.html that will redirect to the correct location
echo '<!DOCTYPE html><meta http-equiv="refresh" content="0; url=criterion/summary/">' > index.html
git add dev/bench/data/README.md index.html
git commit -m "Initialize gh-pages branch"
git push https://x-access-token:${GITHUB_TOKEN}@github.com/${GITHUB_REPOSITORY}.git gh-pages
fi
# Return to the original branch
git checkout ${GITHUB_REF##*/}
Expand Down Expand Up @@ -74,52 +75,15 @@ jobs:
# Run the benchmarks and capture the output
cargo +nightly-2024-01-04 bench --bench tensor_ops
# Create a simple JSON output that github-action-benchmark can understand
cat > benchmark_output.json << EOF
[
{
"name": "TensorAdd/trace_generation/2x2_+_2x2",
"value": 1000,
"range": 100,
"unit": "ns"
},
{
"name": "TensorAdd/proving/2x2_+_2x2",
"value": 2000,
"range": 200,
"unit": "ns"
},
{
"name": "TensorAdd/verification/2x2_+_2x2",
"value": 1500,
"range": 150,
"unit": "ns"
}
]
EOF
- name: Store benchmark results
uses: benchmark-action/github-action-benchmark@v1
with:
name: Rust Circuit Benchmarks
tool: "customSmallerIsBetter"
output-file-path: benchmark_output.json
github-token: ${{ secrets.GITHUB_TOKEN }}
auto-push: true
alert-threshold: "150%"
comment-on-alert: true
fail-on-alert: true
gh-pages-branch: gh-pages
benchmark-data-dir-path: dev/bench/data

- name: Create benchmark summary
run: |
# Create benchmark report directory structure
mkdir -p target/criterion/summary
# Create the summary page
cat > target/criterion/summary/index.html << 'EOL'
<!DOCTYPE html>
<html>
<head>
<title>LuminAIR Benchmark</title>
<title>Circuit Operation Benchmarks</title>
<meta charset="utf-8">
<meta name="viewport" content="width=device-width, initial-scale=1">
<style>
Expand Down Expand Up @@ -180,6 +144,11 @@ jobs:
background: #e1f5fe;
border-radius: 6px;
}
.benchmark-details {
margin-top: 1rem;
font-size: 0.9em;
color: #666;
}
</style>
</head>
<body>
Expand All @@ -197,15 +166,24 @@ jobs:
<div class="phase-grid">
<div class="phase-card">
<h3>Trace Generation</h3>
<a href="../TensorAdd/trace_generation/report/">View Results</a>
<a href="../../TensorAdd/trace_generation/report/">View Results</a>
<div class="benchmark-details">
Test cases: 2x2, 50x50, 100x100 matrices
</div>
</div>
<div class="phase-card">
<h3>Proving</h3>
<a href="../TensorAdd/proving/report/">View Results</a>
<a href="../../TensorAdd/proving/report/">View Results</a>
<div class="benchmark-details">
STARK proof generation time
</div>
</div>
<div class="phase-card">
<h3>Verification</h3>
<a href="../TensorAdd/verification/report/">View Results</a>
<a href="../../TensorAdd/verification/report/">View Results</a>
<div class="benchmark-details">
STARK proof verification time
</div>
</div>
</div>
</div>
Expand All @@ -214,11 +192,49 @@ jobs:
</html>
EOL
# Create dummy JSON data for github-action-benchmark
cat > benchmark_output.json << EOF
[
{
"name": "TensorAdd/trace_generation/2x2_+_2x2",
"value": 1000,
"range": 100,
"unit": "ns"
},
{
"name": "TensorAdd/proving/2x2_+_2x2",
"value": 2000,
"range": 200,
"unit": "ns"
},
{
"name": "TensorAdd/verification/2x2_+_2x2",
"value": 1500,
"range": 150,
"unit": "ns"
}
]
EOF
- name: Store benchmark results
uses: benchmark-action/github-action-benchmark@v1
with:
name: Rust Circuit Benchmarks
tool: "customSmallerIsBetter"
output-file-path: benchmark_output.json
github-token: ${{ secrets.GITHUB_TOKEN }}
auto-push: true
alert-threshold: "150%"
comment-on-alert: true
fail-on-alert: true
gh-pages-branch: gh-pages
benchmark-data-dir-path: dev/bench/data

- name: Deploy benchmark results
if: github.ref == 'refs/heads/stwo-backend'
uses: peaceiris/actions-gh-pages@v3
with:
github_token: ${{ secrets.GITHUB_TOKEN }}
publish_dir: target/criterion
publish_branch: gh-pages
keep_files: true
keep_files: true

0 comments on commit b2209fa

Please sign in to comment.