Lit world on an 18 GB M3 Pro: wave64 lighting translation, checkpoint on bf99e72, written-page copies, run tooling #6

Manually merged
github merged 23 commits from github-bot/gh-6 into main 2026-11-27 01:31:12 +00:00 AGit
Owner

@⁠AeroUp on GitHub · 2026-11-26 19:28 UTC · original
AeroUp:tools/run-harness-and-baseline → main · +5585 −565 · 40 files · 23 commits · merged 2026-11-27 00:56 UTC

The world now renders lit on an 18 GB M3 Pro. This PR moves the November 26 checkpoint onto upstream bf99e72 and adds the shader translation that lets the lighting passes run, the copy reduction this PR started with, and the run tooling used to measure all of it.

Shaded car at night: reflections on the paint and a lit street lamp

The lighting fix

The world's lighting, shadow and AO passes are compute shaders written for the console's 64-lane waves. On the Mac's 32-lane GPU the translator refused them, so their targets stayed at their clear and every lit surface was black. Checkpoint patches 0013-0015 add VICTORY_WAVE64_REDUCE=1, which translates wave reductions, first-lane reads and cross-half lane reads wherever both 32-lane host waves provably run the same path (a lane branch runs both sides masked, so it does not split them; an indirect exit does). Patches 0004-0005 port Belobug's wave32 cascade shadows and LDS flag regions.

Measured on a MacBook Pro M3 Pro, 18 GB, CrossOver Wine + D3DMetal, 1280x720 output, 420 s runs through tools/world-run.sh:

before with VICTORY_WAVE64_REDUCE=1
distinct compute shaders dropped in world frames 50 28
most dropped dispatches in one frame 185 124
the opening's night street black silhouettes shaded: car paint, lamp light, character
world reached 240-306 s 197-292 s

The README gains a short before/after section with three captures. Nothing else in it changes.

Still not gameplay

On 18 GB the title's footprint reaches about 14 GB (6.9 GB GPU, 3.7 GB title memory, 2.8 GB runtime heap) and the Mac swaps 7-9 GB. World frames take 2-30 s, mostly copying title memory and waiting on a GPU that is paging. 28 compute shaders are still refused: lane masks read as data, and LDS shared without barriers. Both are being worked on.

Checkpoint series

runtime-preview/checkpoint/UPSTREAM now pins bf99e72. Patch 0001 is the earlier 0001-0005 (picker marker, GameInput timeline, mesh limit and GPU wait, product name, copy written pages) rebased onto it, plus the DirectStorage held-read release. ./build.sh --checkpoint --prepare fetches the pin, applies the series, and reproduces exactly the tested tree (tree 920af342).

Copy only the written pages (the original change of this PR)

Under Rosetta the runtime copied every tracked range of title memory before each host submission, about 170 MB per submission through the loading screens. Fault tracking is now on by default for builds whose 256-bit stores are patched, so a refresh copies only the pages the title wrote: 170.32 to 1.27 MB per submission, 10.3 to 14.7 submissions/s, highest frame in 300 s 2199 to 4775 (docs/measurements/2026-11-26-copy-written-pages.md).

Tooling

  • tools/scarlett-run.sh: one title at a time behind a lock with a queue. Its time limit stops only its own title. Wine defaults to .toolchain/wine-cx.
  • tools/world-run.sh / window-shot.swift: screenshots of the game window during a run.
  • tools/scarlett-hud.sh: an always-on-top window that follows the newest run every 0.1 s (run and loading progress, fps, frame time and interval, copy and GPU cost, lock and queue, CPU, RAM, swap, GPU use, the title's footprint). --cli shows it in a terminal.
  • tools/fps-report.py: crash detection from the title's crash log, and comparison over shared frame spans.
  • tools/import-patch.sh, tools/agent-worktree.sh: carry a fix as a numbered patch, and build a correctly patched tree.
  • docs/runbook.md, and the baseline in docs/measurements/.
**@⁠AeroUp** on GitHub · 2026-11-26 19:28 UTC · [original](https://github.com/paveledits/ScarlettMac/pull/6) `AeroUp:tools/run-harness-and-baseline` → `main` · +5585 −565 · 40 files · 23 commits · merged 2026-11-27 00:56 UTC The world now renders lit on an 18 GB M3 Pro. This PR moves the November 26 checkpoint onto upstream bf99e72 and adds the shader translation that lets the lighting passes run, the copy reduction this PR started with, and the run tooling used to measure all of it. ![Shaded car at night: reflections on the paint and a lit street lamp](https://raw.githubusercontent.com/AeroUp/ScarlettMac/tools/run-harness-and-baseline/assets/captures/m3pro-lit-car-wave64.png) ## The lighting fix The world's lighting, shadow and AO passes are compute shaders written for the console's 64-lane waves. On the Mac's 32-lane GPU the translator refused them, so their targets stayed at their clear and every lit surface was black. Checkpoint patches 0013-0015 add `VICTORY_WAVE64_REDUCE=1`, which translates wave reductions, first-lane reads and cross-half lane reads wherever both 32-lane host waves provably run the same path (a lane branch runs both sides masked, so it does not split them; an indirect exit does). Patches 0004-0005 port Belobug's wave32 cascade shadows and LDS flag regions. Measured on a MacBook Pro M3 Pro, 18 GB, CrossOver Wine + D3DMetal, 1280x720 output, 420 s runs through `tools/world-run.sh`: | | before | with `VICTORY_WAVE64_REDUCE=1` | |---|---|---| | distinct compute shaders dropped in world frames | 50 | 28 | | most dropped dispatches in one frame | 185 | 124 | | the opening's night street | black silhouettes | shaded: car paint, lamp light, character | | world reached | 240-306 s | 197-292 s | The README gains a short before/after section with three captures. Nothing else in it changes. ## Still not gameplay On 18 GB the title's footprint reaches about 14 GB (6.9 GB GPU, 3.7 GB title memory, 2.8 GB runtime heap) and the Mac swaps 7-9 GB. World frames take 2-30 s, mostly copying title memory and waiting on a GPU that is paging. 28 compute shaders are still refused: lane masks read as data, and LDS shared without barriers. Both are being worked on. ## Checkpoint series `runtime-preview/checkpoint/UPSTREAM` now pins bf99e72. Patch 0001 is the earlier 0001-0005 (picker marker, GameInput timeline, mesh limit and GPU wait, product name, copy written pages) rebased onto it, plus the DirectStorage held-read release. `./build.sh --checkpoint --prepare` fetches the pin, applies the series, and reproduces exactly the tested tree (tree `920af342`). ## Copy only the written pages (the original change of this PR) Under Rosetta the runtime copied every tracked range of title memory before each host submission, about 170 MB per submission through the loading screens. Fault tracking is now on by default for builds whose 256-bit stores are patched, so a refresh copies only the pages the title wrote: 170.32 to 1.27 MB per submission, 10.3 to 14.7 submissions/s, highest frame in 300 s 2199 to 4775 (`docs/measurements/2026-11-26-copy-written-pages.md`). ## Tooling - `tools/scarlett-run.sh`: one title at a time behind a lock with a queue. Its time limit stops only its own title. Wine defaults to `.toolchain/wine-cx`. - `tools/world-run.sh` / `window-shot.swift`: screenshots of the game window during a run. - `tools/scarlett-hud.sh`: an always-on-top window that follows the newest run every 0.1 s (run and loading progress, fps, frame time and interval, copy and GPU cost, lock and queue, CPU, RAM, swap, GPU use, the title's footprint). `--cli` shows it in a terminal. - `tools/fps-report.py`: crash detection from the title's crash log, and comparison over shared frame spans. - `tools/import-patch.sh`, `tools/agent-worktree.sh`: carry a fix as a numbered patch, and build a correctly patched tree. - `docs/runbook.md`, and the baseline in `docs/measurements/`.
tools/scarlett-run.sh is the only permitted way to run the title: a
single-instance lock, the Wine/D3DMetal environment, the offline picker
confirmation from a file marker, and a log per run. It now takes --runtime
to run a build from another source tree and --tag to name the log, so
several candidate builds can be compared without touching the running
binary.

tools/fps-report.py parses a log into presents, fps segments, title-memory
refresh cost and the work the runtime drops. --compare prints one number
per quantity for two runs with the change, so a claim about a fix can be
checked against the same measurement that produced the baseline.

docs/measurements/2026-11-26-runtime-preview-baseline.md records run B:
2048 presents, mean 19.41 fps over 176.5 s, median segment 24.79 fps,
169.8 MB refreshed per submission (3.6 GB/s), 81 refused shaders. It also
states what the baseline does not establish: no 3D world, no gameplay.
Run B translated 126 shaders for the first time in the run. Those 126 account
for 266.8 s of caller wait and 783.4 s of user CPU in a 176 s run, and 39 of
them took 3-10 s each. The 26.35 s hitch between frames 128 and 256 holds 25 of
them, summing 51.4 s of wait, so about two translate at once.

The stall is a translation storm on the frame thread, not the present path. It
also means a refused shader that is made translatable costs seconds on first
use, so coverage and translation cost have to be improved together.
The first version said no 3D world had been captured on this track. That was a
run-length artifact. The title's own crash dump shows Game Running at frame
1379 in the Prologue intro, with 8520 buildings, 244 vehicles, 87 peds, 630
lights and 899 streaming requests, before an access violation (write to 0x0) at
game image +0x23cf683 ends the run.

Runs must last 300 s to reach the world, screenshots belong at 220-270 s, and
every run has to report its last frame because a crash makes fps totals
incomparable.
A log that stops looks exactly like a stall, and that misled the first
baseline: a run reached the Prologue intro at frame 1379 and died of an
access violation, while 180 s runs that ended early were read as 'the world
never renders'.

The report now reads crashes.log from the Wine prefix and prints whether any
crash entry falls inside the run's time window, with the exception line. Run B
reports no crash in its window; the 17:25 entry (write to 0x0 at game image
+0x23cf683, then a fault inside dbghelp while reporting) is dated by it.
Four workers share one Mac and one title instance, so every run has to wait
for the lock and retrying by hand wastes the slot. --wait N queues instead:
the lock stays the only guard, a run that reaches the timeout still refuses,
and a stale lock still needs a human to remove it.
Three tools that the next round of measurements needs.

tools/window-shot.swift (build: xcrun swiftc -O -o .build/window-shot
tools/window-shot.swift) lists windows by pid and saves one as a full-resolution
PNG without raising or activating it. It resolves CGWindowListCreateImage at
run time because the symbol is obsoleted at compile time on macOS 15 but still
present, which keeps the tool out of ScreenCaptureKit's permission flow.

tools/world-run.sh runs the title through the one-instance lock and photographs
the window at chosen seconds. The window only draws the world between about
two and four minutes; a shot at the end of a 180 s run is the loading artwork,
which is how the first baseline mistook a run-length artifact for a rendering
limit.

tools/import-patch.sh turns a worker worktree's difference from the pinned
upstream into the next numbered patch under runtime-preview/checkpoint/patches,
after proving it applies on top of the whole series in a scratch checkout.

Verified here: the capture tool listed a live title window and saved a
3008x1696 PNG of it mid-run; world-run.sh started, queued for the lock and
captured on schedule.
Two runs that die at different frames cannot be compared by totals: the one
killed at frame 273 and the one killed at 3952 report wildly different means
for the same work. Presents are logged only at power-of-two frame counts, so
each consecutive pair is a span both runs can be measured on. --compare now
prints fps for the spans the two runs share, with their mean.

This changed a judgement here: a 6% cut in MB per submission looked neutral
until the spans showed the storm had moved from 64-128 into 128-256 and the
world phase (1024-2048) had lost a third of its fps.
The launch changes into the runtime directory, so a relative path made Wine
fail to open victory.exe and the run ended in its first second.
Four workers share the single-instance lock and a run takes about six
minutes, so --wait 900 gave up behind two runs.
Turn fault tracking on by default under Rosetta for a build whose plain
256-bit stores are listed and patched, so a refresh copies the pages the
title wrote instead of whole ranges: 170.32 MB to 1.27 MB per submission,
submissions per second +43%, highest frame 2199 to 4775 in 300 s.

Also: the patch importer diffs against the Checkpoint base so it does not
carry the four checkpoint patches into a new one, a script that makes a
correctly patched worker tree, and the runbook.
With runs queued back to back, the 120 s look-back caught the previous
run's fault and reported a clean run as a crash.
A launcher killed outright skips its exit trap and leaves the lock with no
run behind it, which stalled every queued worker. The lock now holds its
owner's pid, and a waiting run takes over a lock whose owner is dead.
github-bot locked as GitHub sync and limited conversation to collaborators 2026-11-26 19:45:06 +00:00
github-bot changed title from Copy only the title pages that were written: 170 MB to 1.3 MB per submission to Lit world on an 18 GB M3 Pro: wave64 lighting translation, checkpoint on bf99e72, written-page copies, run tooling 2026-11-27 00:49:39 +00:00
The native port's cache that held the CrossOver Wine is gone, so the
launcher now defaults to the copy under .toolchain/wine-cx. A stale lock
is only taken over if its pid file still names the dead owner, and an
alternate Wine (SCARLETT_WINE) gets its own wineserver started and
stopped around the run.
tools/scarlett-hud.sh opens a floating terminal-style panel (or --cli in
the current terminal) that reads the newest runs/*.log every second:
run and loading progress, fps, frame time and interval, frame number,
copy/texture/GPU cost, an fps sparkline and the world median, the lock
and the queue, plus CPU (title and wineserver), RAM, swap and GPU
utilisation from ioreg.
The window keeps one scarlett-hud.py --stream running and shows its
newest frame; the script reads only the log bytes added since the last
frame and samples processes and system counters twice a second, so a
tenth-of-a-second redraw costs about 3% of a core. The terminal mode
redraws in place at the same rate.
The limiter ran pkill -f game_scarlett_master.exe, which closes any
title on the Mac, including the next worker's run when a limiter fired
late. It now kills its own wine process and stops its own prefix's
wineserver, while it still holds the lock.
Resident size misses most of what the title holds under Wine; footprint(1)
does not. It takes over a second, so a background thread samples it every
5 s and the 0.1 s redraw is unaffected.
The checkpoint series now applies to VIctory-macOS bf99e72. Patch 0001
carries the earlier 0001-0005 (picker marker, GameInput timeline, mesh
limit and GPU wait, product name, copy written pages) rebased onto it,
plus the DirectStorage held-read release. 0002-0003 add a copied-bytes
counter and VICTORY_SKIP_SUPPORT_ALERT. 0004-0015 are the shader work
that lets the world's lighting passes run on a 32-lane GPU: Belobug's
wave32 cascade shadows and LDS flag regions, and VICTORY_WAVE64_REDUCE,
which translates wave reductions, first-lane and cross-half lane reads
where both host waves run together. Distinct compute shaders dropped in
world frames: 50 -> 28; the opening's night street now renders shaded.

build.sh --checkpoint --prepare reproduces exactly the tested tree
(tree 920af342). agent-worktree.sh now bases trees on the pinned
revision.
A short section under the breakthroughs with three captures from the
same opening: black geometry before the wave64 translation, then the
shaded car and the third-person street view after it, and the frame
times as they are (2-30 s on 18 GB, swapping).
The confirm file's Windows path comes from the checkout's location
instead of a fixed home directory, and the runbook's toolchain path is
relative to the checkout. The HUD counts only real launcher processes
in the queue.
SCARLETT_CONSOLE=series-s passes --console series-s to the runtime, so
the title runs as an Xbox Series S: 7.8 GB of title memory instead of
13.5 GB, and its Series S assets and render sizes. Unset keeps Series X.
github manually merged commit 6cf29604f9 into main 2026-11-27 01:31:12 +00:00
This discussion has been locked. Commenting is limited to contributors.
No description provided.