Skip to content

Shard the zero-cost gate and reuse baseline work across runs - #2365

Merged
ctate merged 2 commits into
mainfrom
fast-validate
Oct 27, 2026
Merged

ctate merged 2 commits into
mainfrom
fast-validate

Conversation

@cramforce

Copy link
Copy Markdown
Contributor

A full validation round for a large change took agents about 3 hours in one 8-vCPU Sandbox; the zero-cost gate alone took 30 to 75 minutes of it. This makes the gate shardable and lets runs share baseline work.

  • --shard=i/n now splits the bench and corpus programs (the self-hosted compiler runs in shard 1, or alone with --set=self). scripts/zero-cost-merge.mjs merges shard --json reports into one verdict and recomputes the compile-time intervals over all shards.
  • --record-baseline-cache=<file> builds only the baseline and records per-program artifact hashes; --baseline-cache=<file> skips the baseline build when the candidate's artifacts hash the same (or both sides fail with the same error). The record is keyed on a fingerprint of the built baseline checkout, toolchain and paths and is ignored on mismatch. The self program always builds both sides (its builds are timed).
  • The candidate-source self build overlaps the comparison builds on hosts with at least 40 GB.
  • pnpm test:sandbox: SCRIPTC_SANDBOX_NATIVE_REFERENCE reuses a prepared snapshot's LLVM helper and runtime pack when their source inputs are identical, and rate-limited Sandbox creation (the team limit is a few hundred vCPUs per minute) retries with backoff instead of failing the lane.
  • AGENTS.md documents the above.

Measured on om/s3-pr1 (dc1e8ac) against 641f779, with six 32-vCPU gate shards plus a self shard: each bench+corpus shard took 3.0–5.1 min, the self shard 9.7 min, against 52 min for the unsharded gate in one 8-vCPU Sandbox.

Tests: tests/harness/zero-cost-gate.test.ts (cache settlement, merge), tests/harness/sandbox-config.test.ts (native reference); lint and format clean.

🤖 Generated with Claude Code

The full gate takes 30 to 75 minutes on one Sandbox, which made it the
longest step of a validation round. It can now be split and merged:

- --shard=i/n splits the bench and corpus programs (the self-hosted
  compiler runs in shard 1, or alone with --set=self), and
  scripts/zero-cost-merge.mjs merges the shards' --json reports into one
  verdict, recomputing the compile-time intervals over every shard.
- --record-baseline-cache records the baseline's artifact hashes once;
  --baseline-cache skips the baseline build of every program whose
  candidate artifacts hash the same. The record is tied to the built
  baseline checkout, toolchain and paths.
- The candidate-source self build overlaps the comparison builds on
  hosts with room for it.

pnpm test:sandbox can reuse a prepared snapshot's LLVM helper and runtime
pack (SCRIPTC_SANDBOX_NATIVE_REFERENCE) when their inputs are identical,
and retries rate-limited Sandbox creation with backoff.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
@vercel

vercel Bot commented Oct 27, 2026 •

Copy link
Copy Markdown
Contributor

The latest updates on your projects. Learn more about Vercel for GitHub.

Project Deployment Actions Updated
scriptc Ready Ready Preview, v0 Oct 27, 2026 12:54am UTC

Comment thread scripts/zero-cost-gate.mjs Outdated
A recorded baseline entry now holds a hash of its program's inputs: the
entry file and its relative imports (paths and contents) and the
optimization level. --baseline-cache uses an entry only when the program
still hashes the same, so a program or an import that changed since the
record builds its baseline, instead of a recorded build error or artifact
hash of the old sources settling the comparison as both-fail or identical.
Records take schema 2; older records are ignored.
@cramforce
cramforce requested a review from ctate October 27, 2026 01:24
@ctate
ctate merged commit 807f5f6 into main Oct 27, 2026
67 checks passed
@ctate
ctate deleted the fast-validate branch October 27, 2026 01:29

This branch was successfully deployed

1 active deployment
Preview — cd606e96 Deployed Oct 27, 2026 by vercel[bot]
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants