Skip to content

Commit 0f53e65

Browse files
committed
Merge branch 'main' into gpu_integration
2 parents fd31fc9 + f9db93e commit 0f53e65

80 files changed

Lines changed: 11458 additions & 1445 deletions

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

.github/workflows/bench-abba.yml

Lines changed: 122 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,122 @@
1+
name: Bench ABBA tiebreaker
2+
3+
# Drift-free paired (A/B/B/A) prover benchmark for resolving small (~1%) deltas the
4+
# cheap PR benchmark can't confirm. It builds both binaries and runs ~20 interleaved
5+
# pairs, so it OCCUPIES THE SINGLE BENCH SERVER FOR ~30-40 MIN. For that reason it
6+
# NEVER auto-triggers -- it runs only on an explicit `/bench-abba` comment on a PR.
7+
on:
8+
issue_comment:
9+
types: [created]
10+
11+
# One ABBA run per PR; a re-trigger cancels the stale one. (The single self-hosted
12+
# bench runner serializes across PRs on its own.)
13+
concurrency:
14+
group: bench-abba-${{ github.event.issue.number }}
15+
cancel-in-progress: true
16+
17+
permissions:
18+
contents: read
19+
pull-requests: write
20+
issues: write
21+
22+
jobs:
23+
abba:
24+
# Manual-only: a "/bench-abba" comment on a PR, from a repo member. Never auto.
25+
if: >-
26+
github.event.issue.pull_request &&
27+
startsWith(github.event.comment.body, '/bench-abba') &&
28+
contains(fromJSON('["MEMBER","OWNER","COLLABORATOR"]'), github.event.comment.author_association)
29+
runs-on: [self-hosted, bench]
30+
# Generous ceiling so a hang/OOM can't strand the single bench runner; the
31+
# workload itself is ~30-40 min at the default 20 pairs (clamped to <=40).
32+
timeout-minutes: 120
33+
steps:
34+
- name: Acknowledge (react + occupancy notice)
35+
uses: actions/github-script@v7
36+
with:
37+
script: |
38+
await github.rest.reactions.createForIssueComment({
39+
owner: context.repo.owner, repo: context.repo.repo,
40+
comment_id: context.payload.comment.id, content: 'eyes'
41+
});
42+
await github.rest.issues.createComment({
43+
owner: context.repo.owner, repo: context.repo.repo,
44+
issue_number: context.issue.number,
45+
body: '⏳ **ABBA tiebreaker started** on the bench server (~30–40 min). The bench server is occupied until it finishes.'
46+
});
47+
48+
- name: Resolve PR head + pair count
49+
id: cfg
50+
env:
51+
GH_TOKEN: ${{ github.token }}
52+
PR_NUM: ${{ github.event.issue.number }}
53+
COMMENT_BODY: ${{ github.event.comment.body }}
54+
run: |
55+
# Resolve the head SHA (not the branch name): pinning the commit works for
56+
# fork PRs too (the branch lives in the fork, not origin/) and avoids a
57+
# force-push race mid-run.
58+
HEAD_SHA=$(gh pr view "$PR_NUM" --repo "$GITHUB_REPOSITORY" --json headRefOid -q .headRefOid)
59+
echo "head_sha=$HEAD_SHA" >> "$GITHUB_OUTPUT"
60+
# Optional pair count, e.g. "/bench-abba 32"; default 20. Clamp to [2,40]
61+
# so a "/bench-abba 10000" can't monopolize the single bench server.
62+
N=$(echo "$COMMENT_BODY" | sed -n 's|^/bench-abba[[:space:]]*\([0-9]\+\).*|\1|p')
63+
N=${N:-20}
64+
if [ "$N" -lt 2 ] 2>/dev/null || [ "$N" -gt 40 ] 2>/dev/null; then
65+
echo "::warning::pair count $N out of range [2,40]; using 20"
66+
N=20
67+
fi
68+
echo "pairs=$N" >> "$GITHUB_OUTPUT"
69+
70+
- name: Checkout (full history for ref resolution)
71+
uses: actions/checkout@v4
72+
with:
73+
fetch-depth: 0
74+
75+
- name: Fetch PR head commit (works for fork PRs)
76+
env:
77+
PR_NUM: ${{ github.event.issue.number }}
78+
run: git fetch origin "pull/$PR_NUM/head" --quiet
79+
80+
- name: Add cargo to PATH
81+
run: echo "$HOME/.cargo/bin" >> "$GITHUB_PATH"
82+
83+
- name: Run ABBA tiebreaker
84+
id: run
85+
env:
86+
HEAD_SHA: ${{ steps.cfg.outputs.head_sha }}
87+
PAIRS: ${{ steps.cfg.outputs.pairs }}
88+
run: |
89+
export SYSROOT_DIR="$HOME/.lambda-vm-sysroot"
90+
set -o pipefail
91+
# bench_abba.sh builds the cli at both refs (isolated worktree), runs the
92+
# interleaved pairs, and prints the paired-t CI + exact Wilcoxon test.
93+
# Pass the head SHA (pinned above) so fork PRs resolve.
94+
scripts/bench_abba.sh "$HEAD_SHA" origin/main "$PAIRS" 2>&1 | tee /tmp/abba_out.txt
95+
sed -n '/=== ABBA paired result/,$p' /tmp/abba_out.txt > /tmp/abba_result.txt
96+
97+
- name: Post result
98+
if: always()
99+
uses: actions/github-script@v7
100+
env:
101+
HEAD_SHA: ${{ steps.cfg.outputs.head_sha }}
102+
PAIRS: ${{ steps.cfg.outputs.pairs }}
103+
OUTCOME: ${{ steps.run.outcome }}
104+
with:
105+
script: |
106+
const fs = require('fs');
107+
const read = (p) => { try { return fs.readFileSync(p, 'utf8').trim(); } catch { return ''; } };
108+
const head = (process.env.HEAD_SHA || '').slice(0, 10), pairs = process.env.PAIRS;
109+
let body = `## ABBA tiebreaker — \`${head}\` vs \`main\` (${pairs} pairs)\n\n`;
110+
if (process.env.OUTCOME === 'success') {
111+
const res = read('/tmp/abba_result.txt') || read('/tmp/abba_out.txt');
112+
body += '```\n' + res + '\n```\n';
113+
body += '\n<sub>Drift-free interleaved A/B/B/A measurement. + = PR faster. ';
114+
body += 'Trust the verdict when paired-t and Wilcoxon agree.</sub>\n';
115+
} else {
116+
const tail = read('/tmp/abba_out.txt').split('\n').slice(-30).join('\n');
117+
body += `❌ Run failed. Last log lines:\n\n` + '```\n' + tail + '\n```\n';
118+
}
119+
await github.rest.issues.createComment({
120+
owner: context.repo.owner, repo: context.repo.repo,
121+
issue_number: context.issue.number, body
122+
});

0 commit comments

Comments
 (0)