WIP: perf(build): optimize shared A64 helpers independently of cold chunks #756

Draft
siantm wants to merge 1 commit from siantm/Longshot:perf/shared-a64-helpers-o2 into main
First-time contributor

Type: perf · Risk: medium · Tested on: Windows 11 Pro 26300, game-free planning only · Needs: current-main build/gameplay A/B and full suite

Why

Shared instruction helpers can receive stronger optimization without imposing that compile cost on giant cold game chunks. This proposal changes only the two shared helpers, not hot-list coverage, runtime PGO, register localization or renderer settings.

What changed

nx2/build.py selects O2 for a64_rt.c and a64_suyu.c, preserving every other semantic flag. Cold chunks remain O1; RX_A64_RT_O2=0 restores the prior helper level.

  • nx2/make_game.py: classify the existing rollback knob as compile-only, so it does not invalidate translation.
  • A regression drives the real build planner and object keys, proving exact helper isolation, rollback and unchanged cold/hot jobs.
  • Existing development documentation describes the switch.

Measurements

Verdict: compiler-job and cache isolation are proven game-free; actual performance benefit against current main is not measured. Keep WIP.
Hardware: Windows 11 Pro 26300, Intel Core i7-9700, 31.8 GiB usable RAM, Python 3.14.7; no GPU used.
Method: identical authored planning fixture against main and this staged branch. No compiler/game is launched by that fixture.

Check Before: main @ 9e6f231d After: this PR @ a9269637ec
Three planning tests Fail in seven enabled-helper subcases: helpers remain O1 All three pass
Default helper level O1 O2
Explicit rollback O1 O1
Other jobs / semantic flags Unchanged baseline Unchanged; only two helper object keys change
Current-main gameplay/compile-time benefit Not measured Not measured

Observed: patched planner Ran 3 tests ... OK; build hash cache 9 tests, build times 19 tests, and kept translation 7 tests pass; lift-cache driver passes. Existing upstream file reads emit resource warnings. Older integrated-local FPS observations are not measurements of this branch and are not used to claim a current-main speedup.

Flags and settings

RX_A64_RT_O2: previous helpers O1; this proposal defaults to O2, 0 restores O1. Recommendation is provisional until isolated A/B validates the proposed default; do not mark ready without that evidence. No runtime quality/preferences change.

Testing

Tested: real build.main/plan_jobs/object-key consumer, rollback/flag isolation, lift-cache/hash-cache/build-times/kept-translation checks; catalogue renderer accepts the new record.
Not tested: full build, executable size, current-main FPS/frame times, Linux, or full suite. An existing game was running; it was not stopped or modified for benchmarking. Catalogue unit driver has a Windows CRLF-vs-LF fixture failure.
Must be tested: author or Test Farm builds main and this isolated branch, then performs at least two interleaved same-scene pairs with identical save/settings, reporting median FPS, 1% low, median/p99 frame time, executable size and compile timing. Complete game-free suite on Windows/Linux before readiness.

Risks

What could break: optimizer-sensitive helper behavior, larger code, compile cost, or no real performance gain.
Turning it off: RX_A64_RT_O2=0.
Compatibility: only helper compile keys should change. No intended save/settings/shader-cache-format, renderer ABI or required-tool changes.

Checklist

Everyone

  • One topic.
  • Conventional Commit title: perf(build): optimize shared A64 helpers independently of cold chunks.
  • Issue search completed; related build/cache PRs reviewed, issue search pending.
  • Measurements distinguish proven planning behavior from unmeasured FPS benefit.
  • Testing names tested, untested and required work.
  • Recheck current main before publishing; prepared on 9e6f231d.
  • Complete game-free suite recorded; not run.
  • No game files, dumps, generated game files or build output.
  • Third-party sources untouched.
  • Existing Longshot source and authored fixtures; GPL-3.0-or-later.

When it applies

  • Source commit records Assisted-by: OpenAI Codex.
  • Same-PC, same-scene interleaved performance measurements; pending.
  • Proposed default backed by measurements before readiness; switch is documented.
  • Game-free measured run recorded under docs/tested/.
  • Planning regression fails on main and passes here.
  • Development documentation updated.
**Type:** perf · **Risk:** medium · **Tested on:** Windows 11 Pro 26300, game-free planning only · **Needs:** current-main build/gameplay A/B and full suite ## Why Shared instruction helpers can receive stronger optimization without imposing that compile cost on giant cold game chunks. This proposal changes only the two shared helpers, not hot-list coverage, runtime PGO, register localization or renderer settings. ## What changed `nx2/build.py` selects O2 for `a64_rt.c` and `a64_suyu.c`, preserving every other semantic flag. Cold chunks remain O1; `RX_A64_RT_O2=0` restores the prior helper level. - `nx2/make_game.py`: classify the existing rollback knob as compile-only, so it does not invalidate translation. - A regression drives the real build planner and object keys, proving exact helper isolation, rollback and unchanged cold/hot jobs. - Existing development documentation describes the switch. ## Measurements **Verdict:** compiler-job and cache isolation are proven game-free; actual performance benefit against current main is not measured. Keep WIP. Hardware: Windows 11 Pro 26300, Intel Core i7-9700, 31.8 GiB usable RAM, Python 3.14.7; no GPU used. Method: identical authored planning fixture against main and this staged branch. No compiler/game is launched by that fixture. | Check | Before: main @ 9e6f231d | After: this PR @ a9269637ec | |---|---|---| | Three planning tests | Fail in seven enabled-helper subcases: helpers remain O1 | All three pass | | Default helper level | O1 | O2 | | Explicit rollback | O1 | O1 | | Other jobs / semantic flags | Unchanged baseline | Unchanged; only two helper object keys change | | Current-main gameplay/compile-time benefit | Not measured | Not measured | Observed: patched planner `Ran 3 tests ... OK`; build hash cache 9 tests, build times 19 tests, and kept translation 7 tests pass; lift-cache driver passes. Existing upstream file reads emit resource warnings. Older integrated-local FPS observations are not measurements of this branch and are not used to claim a current-main speedup. ### Flags and settings `RX_A64_RT_O2`: previous helpers O1; this proposal defaults to O2, `0` restores O1. Recommendation is provisional until isolated A/B validates the proposed default; do not mark ready without that evidence. No runtime quality/preferences change. ## Testing **Tested:** real build.main/plan_jobs/object-key consumer, rollback/flag isolation, lift-cache/hash-cache/build-times/kept-translation checks; catalogue renderer accepts the new record. **Not tested:** full build, executable size, current-main FPS/frame times, Linux, or full suite. An existing game was running; it was not stopped or modified for benchmarking. Catalogue unit driver has a Windows CRLF-vs-LF fixture failure. **Must be tested:** author or Test Farm builds main and this isolated branch, then performs at least two interleaved same-scene pairs with identical save/settings, reporting median FPS, 1% low, median/p99 frame time, executable size and compile timing. Complete game-free suite on Windows/Linux before readiness. ## Risks **What could break:** optimizer-sensitive helper behavior, larger code, compile cost, or no real performance gain. **Turning it off:** `RX_A64_RT_O2=0`. **Compatibility:** only helper compile keys should change. No intended save/settings/shader-cache-format, renderer ABI or required-tool changes. ## Checklist ### Everyone - [x] One topic. - [x] Conventional Commit title: `perf(build): optimize shared A64 helpers independently of cold chunks`. - [ ] Issue search completed; related build/cache PRs reviewed, issue search pending. - [x] Measurements distinguish proven planning behavior from unmeasured FPS benefit. - [x] Testing names tested, untested and required work. - [ ] Recheck current main before publishing; prepared on 9e6f231d. - [ ] Complete game-free suite recorded; not run. - [x] No game files, dumps, generated game files or build output. - [x] Third-party sources untouched. - [x] Existing Longshot source and authored fixtures; GPL-3.0-or-later. ### When it applies - [x] Source commit records `Assisted-by: OpenAI Codex`. - [ ] Same-PC, same-scene interleaved performance measurements; pending. - [ ] Proposed default backed by measurements before readiness; switch is documented. - [x] Game-free measured run recorded under docs/tested/. - [x] Planning regression fails on main and passes here. - [x] Development documentation updated.
perf(build): optimize shared A64 helpers independently of cold chunks
Some checks failed
PR description / Description follows the template (pull_request_target) Successful in 16s
Website / Website on Cloudflare (pull_request_target) Has been skipped
CI / Conventional Commit title (pull_request) Has been cancelled
CI / Python source checks (ubuntu-24.04, part 1/2) (pull_request) Has been cancelled
CI / Python source checks (ubuntu-24.04, part 2/2) (pull_request) Has been cancelled
CI / SPIR-V fixtures (global narrow load/store, direct surface atomics, F2I immediate) (pull_request) Has been cancelled
CI / Workflow lint (actionlint) (pull_request) Has been cancelled
Guide screenshots / Guide images and local UI source review (pull_request) Has been cancelled
Third-party parts / As their notes say (pull_request) Has been cancelled
Third-party parts / The same as upstream (pull_request) Has been cancelled
Website / Website on Cloudflare (pull_request) Has been cancelled
a9269637ec
Focused extraction of local Longshot changes: 0b9680a3. Authored tests and verification limits included; no game-derived artifacts.

Assisted-by: OpenAI Codex
HumanBean force-pushed perf/shared-a64-helpers-o2 from a9269637ec
Some checks failed
PR description / Description follows the template (pull_request_target) Successful in 16s
Website / Website on Cloudflare (pull_request_target) Has been skipped
CI / Conventional Commit title (pull_request) Has been cancelled
CI / Python source checks (ubuntu-24.04, part 1/2) (pull_request) Has been cancelled
CI / Python source checks (ubuntu-24.04, part 2/2) (pull_request) Has been cancelled
CI / SPIR-V fixtures (global narrow load/store, direct surface atomics, F2I immediate) (pull_request) Has been cancelled
CI / Workflow lint (actionlint) (pull_request) Has been cancelled
Guide screenshots / Guide images and local UI source review (pull_request) Has been cancelled
Third-party parts / As their notes say (pull_request) Has been cancelled
Third-party parts / The same as upstream (pull_request) Has been cancelled
Website / Website on Cloudflare (pull_request) Has been cancelled
to 16ea5060cc
Some checks failed
CI / Python source checks (ubuntu-24.04, part 1/2) (pull_request) Has been skipped
CI / Python source checks (ubuntu-24.04, part 2/2) (pull_request) Has been skipped
CI / SPIR-V fixtures (global narrow load/store, direct surface atomics, F2I immediate) (pull_request) Has been skipped
Third-party parts / The same as upstream (pull_request) Has been skipped
Website / Website on Cloudflare (pull_request) Has been skipped
PR description / Description follows the template (pull_request_target) Successful in 3s
CI / Conventional Commit title (pull_request) Successful in 3s
CI / Workflow lint (actionlint) (pull_request) Successful in 5s
Guide screenshots / Guide images and local UI source review (pull_request) Failing after 5s
Third-party parts / As their notes say (pull_request) Successful in 10s
Website / Website on Cloudflare (pull_request_target) Has been skipped
2026-11-15 18:45:05 +00:00
Compare
Some checks failed
CI / Python source checks (ubuntu-24.04, part 1/2) (pull_request) Has been skipped
CI / Python source checks (ubuntu-24.04, part 2/2) (pull_request) Has been skipped
CI / SPIR-V fixtures (global narrow load/store, direct surface atomics, F2I immediate) (pull_request) Has been skipped
Third-party parts / The same as upstream (pull_request) Has been skipped
Website / Website on Cloudflare (pull_request) Has been skipped
PR description / Description follows the template (pull_request_target) Successful in 3s
CI / Conventional Commit title (pull_request) Successful in 3s
CI / Workflow lint (actionlint) (pull_request) Successful in 5s
Guide screenshots / Guide images and local UI source review (pull_request) Failing after 5s
Third-party parts / As their notes say (pull_request) Successful in 10s
Website / Website on Cloudflare (pull_request_target) Has been skipped
This pull request is marked as a work in progress.
This branch is out-of-date with the base branch
View command line instructions

Checkout

From your project repository, check out a new branch and test the changes.
git fetch -u 'perf/shared-a64-helpers-o2:siantm-perf/shared-a64-helpers-o2'
git switch 'siantm-perf/shared-a64-helpers-o2'
Sign in to join this conversation.
No reviewers
No milestone
No project
No assignees
2 participants
Notifications
Due date
The due date is invalid or out of range. Please use the format "yyyy-mm-dd".

No due date set.

Dependencies

No dependencies set

Reference
MagicBeanDev/Longshot!756
No description provided.