Summary
This PR introduces a comprehensive head-to-head benchmarking protocol and harness for comparing Omega against llama.cpp on the same GPU hardware. It includes GPU clock locking to ensure stable measurements, precision declaration and verification, and a complete testing framework.
Key Changes
tools/h2h/clock_lock.sh: New shell script that locks GPU clocks during benchmark runs usingnvidia-smi -lgc/-rgc. Provides four operations:lock: Set GPU clock to a target frequency and verify it's heldcheck: Verify the clock hasn't drifted from the targetrelease: Reset GPU clocks to defaultrun: Execute a command with automatic lock/check/release lifecycle- Exits with status 3 for hardware blocks (lock refused, unreadable clock) and 4 for clock drift during execution
- Logs all state changes and clock readings to
clock-lock.txt
docs/perf/HEAD_TO_HEAD_PROTOCOL.md: Comprehensive protocol document defining:- What is compared (two engines, one machine, one model, greedy decoding)
- Machine state recording (GPU clock, power, temperature, performance state)
- Clock locking requirements (not just logging) to prevent drift
- Precision naming end-to-end (weights format, dtype, KV cache dtype)
- Tokenization consistency requirements
- Declaration and parity checking process
- Round structure (warm-up + 5 timed rounds, alternating engines)
- Publication requirements and receipt contents
tools/h2h/parity_check.sh: New script that validates two benchmark declarations are equivalent:- Reads key=value declaration files from both sides
- Verifies required fields are present and non-placeholder values
- Checks that critical fields match (dtypes, tokenizer, prompt tokens, etc.)
- Exits 0 for
SAME_WORK, 1 forDIFFERENT_WORK(format rows), 3 for incomplete declarations - Handles case-insensitive dtype comparisons
tools/h2h/selftest.sh: Host-only test suite with 33 checks:- Tests clock_lock.sh logic against a scripted
nvidia-smistand-in - Validates lock acceptance, target from driver maximum, command status passthrough
- Tests failure modes: refused lock, unreadable clock, lock not held, drift detection
- Tests signal handling (INT/TERM/HUP)
- Tests parity_check.sh verdicts (same work, format differences, missing fields)
- Requires no GPU or driver; validates harness logic only
- Tests clock_lock.sh logic against a scripted
docs/OMEGA.md: Updated bar P0 reference to point to the new protocol documentCONTRIBUTORS.md: Added Drake Stapleton credit for the head-to-head protocol work
Notable Implementation Details
- Clock locking uses tolerance-based verification (
H2H_CLOCK_TOL_MHZ, default 10 MHz) to account for minor driver variations - Configurable settle time after lock (
H2H_SETTLE_S, default 1 second) before verification - Comprehensive logging with ISO 8601 timestamps for reproducibility
- Signal handlers ensure clock is released even if command is interrupted
- Parity check normalizes values to lowercase for robust comparison
- Protocol explicitly blocks Q4_K_M against F16 comparisons and requires format labeling for different encodings
- Tokenization must be identical on both sides; prompt tokens are pre-computed and verified