Skip to content

Add arczi84's NFS3 floating-point kernels - #5

Merged
codewiz merged 6 commits into
mainfrom
nfs3-bench
Oct 12, 2026
Merged

codewiz merged 6 commits into
mainfrom
nfs3-bench

Conversation

@codewiz

@codewiz codewiz commented Oct 12, 2026 •

Copy link
Copy Markdown
Owner

Adds two floating-point benchmarks from arczi84's 68k port of Need for Speed III, contributed under 0BSD:

  • nfs3-project: projectObjectVertex(), a vertex through a 3x3 matrix, a translation and the perspective divide, every result checked by testing its float bits.
  • nfs3-clip: PolygonClipWork::run(), a triangle clipped against the near plane and the four screen edges, with float compares, divides and interpolation.

The kernels are C++, so only gcc builds them. Built with -fno-exceptions -fno-rtti -fno-threadsafe-statics, they need nothing from libstdc++, and the existing C link takes them. vbcc and SAS/C skip both rows. kernel.cpp is arczi84's file with his main() replaced by two entry points. Those set the FPCR to single precision, as the game does, and restore it afterwards. source.sha256 records the hash of the file as received.

Results, 25 MHz 68040 under volamos:

  • 1064 and 951 ms at -O2; gcc 16.2-rc14 beats 6.5.0b by 8.90% and 5.40%.
  • -Os makes both kernels 2.5 times slower: it keeps the GuardedFloatMath operations out of line, so every float operation becomes a call.
  • The check values agree across every build, soft float and gcc 6.5.0b included. Five rounds of arczi84's sizes give 449f5330 and 4352ff86, the sums his README lists for x86-64 rather than his PiStorm ones. Every result is rounded to IEEE single, as SSE does, so the PiStorm (Emu68) may not apply the FPCR's precision control like a real FPU.

Also in this PR:

  • RESULTS.md gets the new rows, and its gcc columns are rerun on the current tree. The compiler comparison's geomean leaves the C++ rows out (new --geomean-skip in the results tools), so it still covers the same 16 benchmarks for every compiler.
  • The harness stops on Ctrl-C between benchmarks. libnix's stdio used to do this; newlib's does not.
  • The name column is widened to 16 characters, and the header is now uppercase and aligned.

Generated with Claude Code


Note

Low Risk
Benchmark and build/doc additions; no changes to existing benchmark logic beyond optional registration and reporting layout.

Overview
Adds two gcc-only C++ benchmarks from arczi84’s NFS3 68k port: nfs3-project (vertex projection with guarded float math) and nfs3-clip (triangle clipping). Vendored code lives under third_party/nfs3/ with 0BSD license; the build wires in NFS3_SRCS, a %.cpp compile rule, and BENCH_HAVE_NFS3 so vbcc/SAS/C builds skip these rows.

The harness widens benchmark names to 16 columns, checks Ctrl-C between benchmarks (for newlib), and registers the new benches when NFS3 is enabled. Results tooling gains --geomean-skip so compiler-comparison geomeans exclude benchmarks not every toolchain builds; README, RESULTS.md, charts, and Aminet readme are updated with the new rows and refreshed timings.

Reviewed by Cursor Bugbot for commit 11a7984. Bugbot is set up for automated code reviews on this repo. Configure here.

codewiz and others added 5 commits October 13, 2026 01:20
memcpy-var-small and the memmove rows overflowed 12 columns; MEAN MS sat one column right of its values.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
libnix checked for it in its stdio; newlib, the C library since 0e07c1d, does not.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
The skipped rows stay out of every geomean; the chart labels a missing one "not built" rather than failing the column.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Two floating-point benchmarks from his Need for Speed III port, C++ and 0BSD, so only the gcc build has them; the FPU runs them in single precision, as the game does.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
The compiler comparison's geomean leaves the C++ rows out; the LHa rows move a few ms with the prototypes of 80f469d. Measured with volamos 0.9.0, which matches 0.8.0 cycle for cycle.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
@chatgpt-codex-connector

chatgpt-codex-connector Bot commented Oct 12, 2026 •

Copy link
Copy Markdown

Codex Review Summary

This comment shows the latest Codex review activity on this pull request.

Review Status Commit Review trigger
📝 Code Review ✅ Completed 2026-10-12T16:24:29.548574Z d80e266 PR opened
ℹ️ About Codex in GitHub

Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you

  • Open a pull request for review
  • Mark a draft as ready
  • Comment "@codex review" or "@codex security review".

Codex reacts with 👀 while any review is running, comments if it has suggestions, and reacts with 👍 once all reviews finish with no findings.

Copilot AI left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

🟡 Changes recommended

Skipped benchmarks with checksum mismatches incorrectly suppress the chart’s otherwise valid geomean.

1 open finding
What changed in this PR

Adds two gcc-only NFS3 floating-point benchmarks and integrates them into builds, reporting, and documentation.

Changes:

  • Adds projection and clipping kernels with benchmark harnesses.
  • Extends build and results tooling for C++ and selective geomeans.
  • Refreshes benchmark results and adds Ctrl-C handling.
File Description
tools/​results-table.py Adds geomean exclusions.
tools/​results-chart.py Charts excluded benchmarks.
third_party/​nfs3/​source.sha256 Records upstream source hash.
third_party/​nfs3/​README.md Documents kernel provenance.
third_party/​nfs3/​nfs3.h Declares C-compatible entry points.
third_party/​nfs3/​LICENSE Adds the 0BSD license.
third_party/​nfs3/​kernel.cpp Implements both floating-point kernels.
third_party/​LICENSE.md Registers the NFS3 license.
src/​main.c Registers benchmarks and handles Ctrl-C.
src/​bench.h Exposes benchmark descriptors.
results/​opt-levels-size-040.svg Updates code-size results.
results/​opt-levels-040.svg Updates optimization charts.
results/​compilers-040.svg Updates compiler comparison chart.
RESULTS.md Documents refreshed measurements.
README.md Lists the new benchmarks.
Makefile Adds C++ object compilation.
compiler.mk Configures gcc-only C++ builds.
benches/​nfs3.c Adapts kernels to the harness.
aminet/​benchwork.readme.in Updates package documentation.

🧠 Review effort: Balanced


💡 Add a code-review agent skill or configure MCP servers for context-aware, tailored reviews. Learn more in the docs.

Comment thread tools/results-chart.py Outdated
Comment on lines 186 to 188
complete = [all(isinstance(r[1][i], float) or r[1][i] == "not built"
for r in rows)
for i in range(len(columns))]
A wrong output there no longer hides the geomean either, as Copilot noted on the PR.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
@codewiz
codewiz merged commit e5b3def into main Oct 12, 2026
3 checks passed
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