Open and answer this issue on GitHub.
performance, blocked · opened 2026-11-15 · updated 2026-11-18 · 4 comments
Part of #1611 (Benchmarks Game programs in benches/game/), which holds the method, the harness and the rules for findings. Built after the harness of #1611 (step 1), or together with it as the first program.
What it measures. Float arithmetic in a tight loop over a small fixed array of structs: the planets’ positions, velocities and masses, advanced step by step.
Starting point. examples/n-body/src/main.nika (169 lines) exists. Check first whether it is the Benchmarks Game algorithm with the same output; reuse it if so.
To build
benches/game/n-body/, as a Nikaia programmer writes it first; a second version written for speed only if it differs.callgrind_annotate, filed as an issue.Done when benches/game/game.sh prints n-body’s rows next to the Rust entry with the same output, and each loss names its issue.
Brief queued: issue-1612
agent: builder model: opus max_turns: 200 budget_usd: 30 effort: medium —
Your work order is issue #1612, inlined below with its comments. There is no
brief written around it: plan your own steps from its To build list, build
them in order, commit after each finished step, and end when its Done when
holds (or at the limits of builder.md, reporting what is left). The
facts in your prompt are Core of docs/builder-facts.md; more on a topic:
nikaia run scripts/syntax.nika -- KEYWORD, a probe: nikaia run scripts/probe.nika -- SNIPPET.
Measure the issue against docs/issues.md while you work: what it lacked,
what was wrong in it. That answer goes into the report’s Issue: field.
A finding, a changed plan or a finished item also goes into the issue as a
comment (gh api repos/Nikaia-Foundation/Nikaia/issues/1612/comments -F body=@file,
ending with the Claude Code footer), rule I13.
develop in the main checkout; other agents’ uncommitted files are not yours: never touch or stage them.target/fast/nikaia run scripts/commit.nika -- REPORT (it adds exactly the report’s Files:); the driver pushes.cargo build --profile fast -p nikaia, lower-std and its fixpoint when a tools/*.nika changed, cargo fmt, cargo clippy --all-targets -- -D warnings, nikaia run scripts/pre-push.nika, the tests the issue names and the ones your change touches.CHANGELOG.md, badges and NK codes are the supervisor’s. New tests in Nikaia only.Body:. Found: is only for what lies outside the area, cannot be fixed this run or needs a decision; the driver files it as an issue.std or the toolchain lacks stops the work, unless an ADR or Part I-III refuses it (name it): Result: blocked, Found: the gap with a probe, Needs: supervisor decision.NIKAIA_CACHE_LIMIT=2G; at the end delete your own clone’s target/ and target/release/nikaia-scratch.Result: partial with what you ruled out, the probe, and the suspected file and function./home/user/Nikaia/docs/briefs/performance/issue-1612.md.report.md)Fields: Result, Files, Commit, Body (optional), Fixes, Pushed, Tests, Gate, Deviation, Found, Needs, Changelog, Issue, Owner (a question for the owner), Friction, Disk freed, and last Attribution: with your commit trailer lines below it.
Result:, Gate: (green or red <check>), Deviation:, Found: and the other fields with nothing to say hold the bare word: done, none. Anything after it reads as content.Result: done only when the issue’s Done when holds; partial with the items left otherwise.Deviation: only for an item of the issue built otherwise than written, or not built. Found: only for a defect outside your area, or one this run cannot fix. Everything else goes into Body:; how you verified goes into Tests:.Issue: by docs/issues.md, How a run judges its issue: complete, or broke I<n>: ..., rules-gap: ..., wrong I<n>: ..., joined with ;.done <sha>, report <path> (or BLOCKED: ... / PUSH REJECTED ...).benches/game/game.nika, run with nikaia run, not game.sh: CLAUDE.md, Helper tools (Nikaia only) stands over the issue’s wording; benches/brc/brc.sh is the pattern for what it does, not for the language. What the harness cannot yet say in Nikaia is a finding (fix or Found:), not a reason for shell.benchmarksgame-team.pages.debian.net, salsa.debian.org); take the fastest Rust entry as listed there today and name its URL and number in the copied header.Generated by Claude Code
Run: issue-1612, Result: partial: the loss’s issue number is not in the table yet (the driver files it from Found:); the rest of Done when holds
Tokens: input 72, cache read 2180588, cache write 77632, output 19858 Cost: 2.95 USD, time 6 min 28 s, turns 36
Result: partial: the loss’s issue number is not in the table yet (the driver files it from Found:); the rest of Done when holds
Files: benches/game/Cargo.toml benches/game/Cargo.lock benches/game/game.nika benches/game/n-body/rust-9.rs
Commit: benches/game: n-body counted against the fastest Rust entry, harness game.nika
Body: New benches/game/game.nika (run with nikaia run, a Nikaia program like benches/yaml/bench.nika; -- NAME runs one problem) holds the list of problems. For each it builds the Rust entry the way the game does (opt-level 3, one codegen unit, its target-cpu) and the Nikaia program at –cpu=x86-64 and x86-64-v3, each with overflow checks on and off. It checks that all of them print the same bytes, counts them with callgrind and prints the table with tokens. Rust #9 (the fastest Rust n-body, 2026-11-16) is copied unchanged into benches/game/n-body/rust-9.rs with its URL and licence link, built by benches/game/Cargo.toml (a workspace of its own). examples/n-body/src/main.nika is the game’s algorithm and prints the same, so it is reused, not copied. Per step at 1M steps, checks on/off: Rust #9 196.4/196.4 instructions; Nikaia x86-64 410.4/410.5 (2.09x); Nikaia v3 326.4/326.5 (1.66x); mispredicted 0.008 everywhere; tokens Rust 1768, Nikaia 1057. Output is -0.169075164 / -0.169086185 for all six binaries.
Part: #1612, #1611
Pushed: local b063c560208805f8b514668de698e58a4b313556
Tests: built and ran NIKAIA=target/fast/nikaia nikaia run benches/game/game.nika twice: same output byte for byte, table above. nikaia check and fmt --check pass on game.nika. pre-push green with the files staged. No compiler change, so no fails-before run.
Gate: green
Deviation: the harness is game.nika, not game.sh (supervisor’s note, CLAUDE.md Helper tools). Item 1: no copy of the Nikaia program in benches/game/n-body/; the harness reads examples/n-body/src/main.nika (the issue: reuse it if it is the game’s algorithm). No second Nikaia version written for speed: the speed comes from float SIMD lanes, which Nikaia lacks (Found). #1611’s text was not in my prompt; the table’s columns follow benches/yaml.
Found: n-body loses 1.66x in instructions (x86-64-v3) to Rust #9. Cause from callgrind_annotate and objdump: every count is in main, with no checks left (1 branch per step). Nikaia’s loop is LLVM’s 2-lane SLP with vsqrtpd and vdivsd per pair. Rust #9 computes the 10 pair distances 4 lanes wide (__m256d, vhaddpd) and replaces sqrt and division with vrsqrtps plus a Newton step. Nikaia cannot say this: std::simd has no floating-point lanes, which ADR-377 §4 leaves undecided, and std has no approximate rsqrt. Probe: let v: simd::Fixed[f64, 4] = simd::splat(1.0) is refused (f64 is no lane type, spec Part I §simd). Needs a decision on f64/f32 lanes with + - * / and sqrt/rsqrt.
Needs: supervisor decision on floating-point lanes in std::simd (ADR-377 §4) for the n-body loss; the loss’s issue number then goes into the #1611 table
Changelog: benches/game: n-body against the Benchmarks Game’s fastest Rust entry. nikaia run benches/game/game.nika counts n-body (examples/n-body) against Rust #9 with callgrind, overflow checks on and off: 1.66x the instructions at x86-64-v3, 2.09x at x86-64, at 60 % of the tokens.
Issue: broke I3: the issue’s frame (#1611: the table’s columns, the harness) was not inlined, so the columns follow benches/yaml; wrong: names game.sh where CLAUDE.md wants Nikaia (the supervisor corrected it)
Owner: none
Friction: none
Disk freed: removed benches/game/target (a stray cargo build); target/game-bench 5 MB kept for reruns; target/nikaia-project-tests not created in this run; disk 28G free
Attribution:
Co-Authored-By: Claude Opus 5.5 noreply@anthropic.com
Claude-Session: https://claude.ai/code/session_01UVxJDukWgopUzVU2M1TjK7
nikaia build of the scratch project. I spent few turns; nothing went in circles.benches/yaml/bench.nika as the pattern.--cpu takes only x86-64 levels, not ivybridge.check, fmt --check, the harness (twice), pre-push, and the simd probe.cargo build inside benches/game left a target/ that I had to delete.broke I3: #1611 (method, columns, rules for findings) was not inlined. It holds the frame the work depends on.wrong: the issue names game.sh, but CLAUDE.md (Helper tools) wants Nikaia. The supervisor’s note corrected it.rules-gap: the issue doesn’t say whether the Nikaia side should also be built at the Rust entry’s target-cpu. Nikaia’s --cpu can’t name ivybridge.| Fact: Core | nikaia build --cpu takes only x86-64, x86-64-v2, -v3, -v4 or native; to match a Rust entry built for target-cpu=ivybridge, use x86-64-v3, the least level that holds it. |
| Fact: Core | std::simd has only integer lanes (ADR-377 D1, floats left open in §4), so simd::Fixed[f64, N] is refused; float-heavy benchmarks can’t match hand-written AVX Rust. |
| Fact: Core | Running cargo build inside a bench crate that is its own workspace leaves a target/ in that directory; pass CARGO_TARGET_DIR under the repository’s target/. |
Generated by Claude Code
Driver: not queued, this issue waits for #1611, which is still open (#1819). Set ready again when it is closed.
Generated by Claude Code
Driver: not queued, this issue waits for #1611, which is still open (#1819). Set ready again when it is closed.
Generated by Claude Code