Repository navigation
Conversation
Quest-Claim: 3b8305fe8b5ecdeb
… and host The dev shell no longer links an RPATH to <checkout>/outputs/out/lib, and instructions.sh remaps CARGO_HOME, so bench binaries are byte-identical across checkout paths and hosts. Records what still moves counts (random seeds, the host clock, the job environment) and the rust2-bench fix it needs in the quest. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Collaborator
Author
|
Maintainer decision (/quest-run pick, 2026-11-24):
(Written by Claude Opus 5.5) |
This was referenced Nov 25, 2026
…bench-determinism Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Collaborator
Author
|
Applied the maintainer decision in c20f90d: the quest records it, and the Maintainer wait is gone since kixel-ai/rust2's (Written by Claude Opus 5.5) |
This branch has not been deployed
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
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Problem
The same code read different instruction counts from one run to the next, at different host loads, and in different checkouts and hosts. Noisy series feed Kixel Quest's regression filing and bisects (quest).
Findings
Diffing Callgrind profiles of runs that disagree: nearly every disagreement is the same code path hitting a different glibc malloc state (
_int_mallocagainst a tcache hit). So any work before the measured iteration that varies will move the count. Three sources:RandomStatetakes freshgetrandombytes per process, which changes HashMap iteration and free order. A preloadedgetrandomreturning a fixed-seed stream steadied everystats,retirement, andannouncecount. Full-load agreement rose from 527 to 900 of 1,284. A constant stream is not enough: it hangs QUIC connection-ID generation.authincluded. Compared with today's counts, 53 shift by more than 1% (the worst isauth/waitingat -26%).nix developlinked an RPATH to<checkout>/outputs/out/libinto every binary, and$CARGO_HOMEregistry paths land in panic locations. That meant the same code built a different binary per checkout and per host. At run time, rust2-bench also passes the host's whole environment, and its size moves the stack (up to 12 instructions onjitter_handoff::4[64]).Approach
This PR fixes the build-side location dependence, which moq owns:
NIX_NO_SELF_RPATH, which drops the stdenv RPATH to a directory that never exists.sh/rs/instructions.shremaps$CARGO_HOMEto/cargo. It fails loud ifCARGO_ENCODED_RUSTFLAGSwould silently drop the remap.The quest is rewritten to what remains: deterministic entropy and clock plus a canonical job environment in rust2-bench, then a
rust2bump and the two-checkout proof here.Impact
$CARGO_HOMEpaths. Counts may step once at the next nightly, since the binaries' data layout changes.Validation
CARGO_HOMEat another path, built byte-identicaljitter,varint, and bothcodecbench binaries (cmp), with no/homepaths (strings).rust2-bench compare HEADreadmoq-json codec full[big_static]0.33% apart across worktrees.shellcheck,shfmt -d, andnixfmt --checkpass on the changed files. I did not runjust cior a full nightly-equivalent count on this head.Alternatives
RandomStateinside library code, so seeds would need rust2-bench anyway. It also leaves every future bench to get this right on its own.Decisions
quest/m0/bench-determinism.md, planned in kixel-ai/rust2#1016, owns it together with the canonical job environment.Waiting
quest/m0/bench-determinism.md(deterministic randomness and clock for counted jobs, launched with a canonical environment, cwd, and fixed-length workspace-root path), claimed by kixel-ai/rust2#1023, a draft holding only its claim as of 2026-11-25. Check: that PR merged. Then bumprust2here and count every benchmark twice in two checkouts, idle and loaded.Follow-ups
Models
Size: M
Implementer: Claude Code, claude-opus-5-5, unknown
Implementer: Claude Code, claude-opus-5-5, unknown (iterate, S)
(Written by Claude Opus 5.5)