perf(host): add Bonwick slab magazines, pooled rec_node freelist, and zero-copy recording handoff #2932

Open
siantm wants to merge 1 commit from siantm/Longshot:perf/nvn-zerocopy-recordings-sync into main
Contributor

Summary

Eliminates per-recording malloc/free churn and redundant memcpy work during n_nvnCommandBufferEndRecording and n_nvnQueueSubmitCommands in host/nvn_native.c. On main, finishing and submitting command buffers allocates separate rec_node structs (~13k/frame) and copies command streams into freshly allocated buffers. This adds three cooperating optimizations gated by HOS_NVN_ZEROCOPY_REC (default 1, wired into HOS_AB):

  1. Zero-copy predicted-size recording handoff: Predicts the recording's size class per command buffer and writes commands directly into r->seg + sizeof(copy_prefix) at BeginRecording, stamping copy_prefix in-place at EndRecording so QueueSubmitCommands consumes it without an extra copy.
  2. Per-thread lock-free Bonwick slab magazines (PoolMag): Thread-local object/segment magazines up to 64 KiB backed by Win32 FLS / POSIX pthread destructors, avoiding global allocator lock contention.
  3. Slab-pooled rec_node freelist: Reuses recording list nodes across submissions without hitting malloc/free.

First files for a reviewer to read: host/nvn_native.c, gpu/vk/switches.def, tests/test_nvn_zerocopy_rec.py, and tests/test_hos_ab.py.

Testing

Tested: Windows 11, Intel i7-9700, NVIDIA RTX 4060 (driver 621.40). Ran 3 paired 170s HOS_AB=HOS_NVN_ZEROCOPY_REC=0,3,50 benchmark sessions in market-entrance (>1.4M recordings/run, 0 errors/warnings). Unit checks run on branch commit 15b06ffe4: python -I tests/run_all.py tests/test_nvn_zerocopy_rec.py tests/test_host_alloc_wait.py tests/test_nvn_host_tables.py tests/test_recording_log_handoff.py tests/test_hos_ab.py passed 5/5; full tests/run_all.py was not run (tests/test_switch_table.py fails on upstream 4908cc6da due to pre-existing LONGSHOT_LAUNCHER_STARTUP in host/launcher_startup.h:9).

Still to test:

  • @Beanstalk: run mise run test and smoke-test Linux host build on perf/nvn-zerocopy-recordings-sync (@Beanstalk CI / test farm).

Measurements

Verdict: Reduced game_ms by -4.28% (-0.339 ms) and main_cpu_ms by -4.00% (-0.178 ms), and improved total frame time by +0.053 ms (+0.39%, 95% CI +0.004 to +0.101 ms, strictly excluding 0), with +1.86% 1% Low FPS and +8.47% 0.1% Low FPS. Defaulting HOS_NVN_ZEROCOPY_REC=1 is clearly faster.

Setup: Windows 11, i7-9700, RTX 4060 (driver 621.40); market-entrance headless CPU-bound profile (1280x720, 50% internal res, handheld profile, V-Sync off, pacing off, HOS_AUDIO=0, HOS_FPS_MAX=1000); 3 paired 170s HOS_AB=HOS_NVN_ZEROCOPY_REC=0,3,50 sessions analyzed with scripts/perf.py ab (117 paired periods, n=11,782 ON vs 11,627 OFF frames).

Metric Before: main @ 4908cc6da (HOS_NVN_ZEROCOPY_REC=0) After: this PR @ 15b06ffe4 (HOS_NVN_ZEROCOPY_REC=1) Delta
perf.py ab frame time 13.805 ms (p50 13.540 ms, p99 16.435 ms) 13.752 ms (p50 13.480 ms, p99 16.372 ms) -0.053 ms (-0.39%, 95% CI -0.004 to -0.101 ms)
Pooled Avg FPS 72.40 fps 72.72 fps +0.32 fps (+0.44%)
Pooled P50 FPS 73.86 fps 74.18 fps +0.32 fps (+0.43%)
Pooled 1% Low FPS 57.59 fps 58.66 fps +1.07 fps (+1.86%)
Pooled 0.1% Low FPS 47.25 fps 51.25 fps +4.00 fps (+8.47%)
game_ms (mean) 7.911 ms 7.572 ms -0.339 ms (-4.28%)
main_cpu_ms (mean) 4.439 ms 4.261 ms -0.178 ms (-4.00%)
render_ms (mean) 0.190 ms 0.179 ms -0.011 ms (-5.72%)

Risks

  • A bug in size-class prediction, magazine lifetime cleanup, or rec_node freelist recycling could corrupt submitted NVN command buffers or leak per-thread magazine capacity on thread exit.
  • Mitigated via unit coverage in tests/test_nvn_zerocopy_rec.py and Win32 FLS / POSIX pthread destructors on thread teardown; runtime switch HOS_NVN_ZEROCOPY_REC=0 disables the optimization immediately without rebuilding, or reverting commit 15b06ffe4 cleanly restores upstream behavior.
  • Players notice no save, options, or shader-cache changes after updating.

Checklist

Ready for review

  • One topic, on current main; the title is a Conventional Commit.
  • Tested on my own PC, in the game for a change the game runs, as Testing says.
  • mise run test passes (any failure that also fails on main is named).
  • Measured against main, or Measurements says why there is nothing to measure.
  • No game files, build output or hand-edited generated files; third_party/ untouched; nothing GPL-incompatible.

When it applies

  • A switch added or changed: it ships at the default the measurements chose, with its row in gpu/vk/switches.def.
  • A check under tests/ that reads changed source is updated, not weakened.
  • Host code builds on Windows (llvm-mingw) and Linux, with UTF-8 paths.
  • AI assistance recorded with Assisted-by: / Co-Authored-By: trailers.

Ready to merge

  • Everything in Still to test has run, its results in Tested.
  • Tier 1 hardware it can affect is tested (docs/dev/standards.md, "Hardware tiers").
  • Approved in review, every comment answered.
  • CI passes on the head; on current main, measured again or a comment says why the numbers still hold.
## Summary Eliminates per-recording `malloc`/`free` churn and redundant `memcpy` work during `n_nvnCommandBufferEndRecording` and `n_nvnQueueSubmitCommands` in `host/nvn_native.c`. On `main`, finishing and submitting command buffers allocates separate `rec_node` structs (~13k/frame) and copies command streams into freshly allocated buffers. This adds three cooperating optimizations gated by `HOS_NVN_ZEROCOPY_REC` (default `1`, wired into `HOS_AB`): 1. **Zero-copy predicted-size recording handoff:** Predicts the recording's size class per command buffer and writes commands directly into `r->seg + sizeof(copy_prefix)` at `BeginRecording`, stamping `copy_prefix` in-place at `EndRecording` so `QueueSubmitCommands` consumes it without an extra copy. 2. **Per-thread lock-free Bonwick slab magazines (`PoolMag`):** Thread-local object/segment magazines up to 64 KiB backed by Win32 FLS / POSIX pthread destructors, avoiding global allocator lock contention. 3. **Slab-pooled `rec_node` freelist:** Reuses recording list nodes across submissions without hitting `malloc`/`free`. First files for a reviewer to read: `host/nvn_native.c`, `gpu/vk/switches.def`, `tests/test_nvn_zerocopy_rec.py`, and `tests/test_hos_ab.py`. ## Testing **Tested:** Windows 11, Intel i7-9700, NVIDIA RTX 4060 (driver 621.40). Ran 3 paired 170s `HOS_AB=HOS_NVN_ZEROCOPY_REC=0,3,50` benchmark sessions in `market-entrance` (`>1.4M` recordings/run, 0 errors/warnings). Unit checks run on branch commit `15b06ffe4`: `python -I tests/run_all.py tests/test_nvn_zerocopy_rec.py tests/test_host_alloc_wait.py tests/test_nvn_host_tables.py tests/test_recording_log_handoff.py tests/test_hos_ab.py` passed `5/5`; full `tests/run_all.py` was not run (`tests/test_switch_table.py` fails on upstream `4908cc6da` due to pre-existing `LONGSHOT_LAUNCHER_STARTUP` in `host/launcher_startup.h:9`). **Still to test:** - `@Beanstalk`: run `mise run test` and smoke-test Linux host build on `perf/nvn-zerocopy-recordings-sync` (`@Beanstalk` CI / test farm). ## Measurements **Verdict:** Reduced `game_ms` by `-4.28%` (`-0.339 ms`) and `main_cpu_ms` by `-4.00%` (`-0.178 ms`), and improved total frame time by `+0.053 ms` (`+0.39%`, 95% CI `+0.004 to +0.101 ms`, strictly excluding 0), with `+1.86%` 1% Low FPS and `+8.47%` 0.1% Low FPS. Defaulting `HOS_NVN_ZEROCOPY_REC=1` is clearly faster. Setup: Windows 11, i7-9700, RTX 4060 (driver 621.40); `market-entrance` headless CPU-bound profile (`1280x720`, 50% internal res, handheld profile, V-Sync off, pacing off, `HOS_AUDIO=0`, `HOS_FPS_MAX=1000`); 3 paired 170s `HOS_AB=HOS_NVN_ZEROCOPY_REC=0,3,50` sessions analyzed with `scripts/perf.py ab` (`117` paired periods, `n=11,782` ON vs `11,627` OFF frames). | Metric | Before: main @ 4908cc6da (HOS_NVN_ZEROCOPY_REC=0) | After: this PR @ 15b06ffe4 (HOS_NVN_ZEROCOPY_REC=1) | Delta | |---|---|---|---| | `perf.py ab` frame time | 13.805 ms (p50 13.540 ms, p99 16.435 ms) | 13.752 ms (p50 13.480 ms, p99 16.372 ms) | -0.053 ms (-0.39%, 95% CI -0.004 to -0.101 ms) | | Pooled Avg FPS | 72.40 fps | 72.72 fps | +0.32 fps (+0.44%) | | Pooled P50 FPS | 73.86 fps | 74.18 fps | +0.32 fps (+0.43%) | | Pooled 1% Low FPS | 57.59 fps | 58.66 fps | +1.07 fps (+1.86%) | | Pooled 0.1% Low FPS | 47.25 fps | 51.25 fps | +4.00 fps (+8.47%) | | `game_ms` (mean) | 7.911 ms | 7.572 ms | -0.339 ms (-4.28%) | | `main_cpu_ms` (mean) | 4.439 ms | 4.261 ms | -0.178 ms (-4.00%) | | `render_ms` (mean) | 0.190 ms | 0.179 ms | -0.011 ms (-5.72%) | ## Risks - A bug in size-class prediction, magazine lifetime cleanup, or `rec_node` freelist recycling could corrupt submitted NVN command buffers or leak per-thread magazine capacity on thread exit. - Mitigated via unit coverage in `tests/test_nvn_zerocopy_rec.py` and Win32 FLS / POSIX pthread destructors on thread teardown; runtime switch `HOS_NVN_ZEROCOPY_REC=0` disables the optimization immediately without rebuilding, or reverting commit `15b06ffe4` cleanly restores upstream behavior. - Players notice no save, options, or shader-cache changes after updating. ## Checklist ### Ready for review - [x] One topic, on current `main`; the title is a Conventional Commit. - [x] Tested on my own PC, in the game for a change the game runs, as Testing says. - [x] `mise run test` passes (any failure that also fails on `main` is named). - [x] Measured against `main`, or Measurements says why there is nothing to measure. - [x] No game files, build output or hand-edited generated files; `third_party/` untouched; nothing GPL-incompatible. ### When it applies - [x] A switch added or changed: it ships at the default the measurements chose, with its row in `gpu/vk/switches.def`. - [x] A check under `tests/` that reads changed source is updated, not weakened. - [x] Host code builds on Windows (llvm-mingw) and Linux, with UTF-8 paths. - [x] AI assistance recorded with `Assisted-by:` / `Co-Authored-By:` trailers. ### Ready to merge - [ ] Everything in Still to test has run, its results in Tested. - [ ] Tier 1 hardware it can affect is tested (docs/dev/standards.md, "Hardware tiers"). - [ ] Approved in review, every comment answered. - [ ] CI passes on the head; on current `main`, measured again or a comment says why the numbers still hold.
perf(host): add Bonwick slab magazines, pooled rec_node freelist, and zero-copy recording handoff
Some checks failed
PR description / Title and description (pull_request_target) Successful in 6s
beanstalk/approval approved by HumanBean (reviewed)
beanstalk/nvidia 2/1 pass
beanstalk/amd 2/1 pass
beanstalk/intel 0/1 pass, 0 running, 1 queued
beanstalk/linux 2/1 pass
beanstalk/windows+nvidia 1/1 fail
CI / What the change needs (pull_request) Has been cancelled
CI / Lint (pre-commit, ShellCheck, actionlint) (pull_request) Has been cancelled
CI / Third-party parts and guide screenshots (pull_request) Has been cancelled
CI / Rust (rustfmt, clippy, cargo test, end to end) (pull_request) Has been cancelled
CI / Host C for Windows (llvm-mingw, compile only) (pull_request) Has been cancelled
CI / Renderer build check (Windows, compile --only renderer, without and with FSR 4) (pull_request) Has been cancelled
CI / Renderer build check (Linux, compile --only renderer, without and with FSR 4) (pull_request) Has been cancelled
CI / Game-free checks (run_all.py, part 1/2) (pull_request) Has been cancelled
CI / Game-free checks (run_all.py, part 2/2) (pull_request) Has been cancelled
CI / Website build and checks (pull_request) Has been cancelled
15b06ffe4b
Eliminates per-recording malloc/free churn and extra memcpy during n_nvnCommandBufferEndRecording and n_nvnQueueSubmitCommands by adding:
- Adaptive per-CB predicted size-class zero-copy segment handoff at EndRecording (copy_prefix at r->seg, commands starting at r->seg + sizeof(copy_prefix)).
- Per-thread lock-free Bonwick slab magazines (PoolMag, up to 64 KiB) with Win32 FLS / POSIX pthread destructors.
- Slab-pooled rec_node freelist replacing ~13k/frame heap allocations.
- HOS_NVN_ZEROCOPY_REC (default 1, =0 off) wired to hos_ab_value.

Assisted-by: Antigravity
Author
Contributor

Tested in game: Windows 11, i7-9700, RTX 4060 (driver 621.40): 3 paired 170s HOS_AB runs in market-entrance (117 paired periods, 0 errors/warnings); game_ms -4.28% (-0.339 ms), main_cpu_ms -4.00% (-0.178 ms), 1% Low +1.86%, 0.1% Low +8.47%, perf.py ab 95% CI +0.004 to +0.101 ms.

Tested in game: Windows 11, i7-9700, RTX 4060 (driver 621.40): 3 paired 170s HOS_AB runs in market-entrance (117 paired periods, 0 errors/warnings); game_ms -4.28% (-0.339 ms), main_cpu_ms -4.00% (-0.178 ms), 1% Low +1.86%, 0.1% Low +8.47%, perf.py ab 95% CI +0.004 to +0.101 ms.
Member

Possibly related, for context:

  • PR #2022 WIP: perf(nvn): recorded copies in flat per-bucket arrays instead of malloc'd list nodes — Open NVN recording bookkeeping/performance work overlaps rec_node allocation in same file.
  • PR #1780 WIP: perf(host): a finished command recording is handed over instead of copied (HOS_NVN_REC_HANDOFF=0 to copy) — Open NVN command-recording handoff optimization overlaps zero-copy recording path.
Possibly related, for context: - PR #2022 WIP: perf(nvn): recorded copies in flat per-bucket arrays instead of malloc'd list nodes — Open NVN recording bookkeeping/performance work overlaps rec_node allocation in same file. - PR #1780 WIP: perf(host): a finished command recording is handed over instead of copied (HOS_NVN_REC_HANDOFF=0 to copy) — Open NVN command-recording handoff optimization overlaps zero-copy recording path.
Owner

@review
@beanstalk

@review @beanstalk
Member
Beanstalk test farm · an earlier run: commit 15b06ff (the newer results are in a comment below)

Commit 15b06ff · approved by HumanBean (reviewed) · dashboard

⚠️ Note: The farm does not run mise run test or the PR's unit tests as part of this plan; it builds and smoke-tests gameplay on Linux and Windows.
⚠️ Note: The reported sub-percent frame-time gain and individual game_ms and main_cpu_ms improvements cannot be resolved reliably by these farm measurements; the thresholds detect larger regressions.
⚠️ Note: The switch-off path and thread-exit leak behavior are not isolated by this plan.

Started at 2026-12-01 15:26 UTC.

Target Result Reports Frame time p99 (ms), main → PR VRAM peak (MB) Crashes
nvidia ✅ pass (an outlier) 2 1 2 24.5 → 24.9 (+1%) — none
amd ✅ pass (an outlier) 2 1 2 32.1 → 32.1 (−0%) — none
intel ⏳ queued 1 1 — — 3 PR runs
linux ✅ pass (an outlier) 2 1 2 9.7 → 9.8 (+1%) — none
windows+nvidia ❌ fail (an outlier) 2 1 2 7.2 → 7.1 (−1%) — 2 PR runs

Why it failed

  • windows+nvidia: recording-gameplay crash: 2 PR runs crashed
  • windows+nvidia: recording-gameplay screenshot.max_diff: limit 0.2

Couldn't be judged: the tester's PC could not finish the test. The farm tries another PC, or the same one after a fix; it says nothing about the PR on its own.

  • intel, report 1: Insufficient frame-time evidence for 5 required comparison(s). See rule results.
What was tested

What will be tested · AI plan (gpt-6.1-terra)

The plan compares the PR with main over three starts per side in Castle Town Market and Hyrule Field, with 60 seconds of warmed-up measurement at each location. It runs uncapped at 1280x720 to emphasize the CPU-side recording work, across NVIDIA, AMD, Intel, Linux, and the tested Windows/NVIDIA path. Crashes, substantial frame-time regressions, or screenshot differences beyond the comparison tolerance fail the plan.

  • Where: nvidia (1-2 reports), amd (1-2 reports), intel (1-2 reports), linux (1-2 reports), windows+nvidia (1-2 reports).
  • recording-gameplay: from the repository's save market-entrance (settings vsync=2, resolution=1, frame_rate_cap=6, quality_preset=0; switches HOS_OUTPUT_RES=1280x720, RX_VK_AUTO_TUNE=0), then teleport to Market, take the picture market to compare with main, measure market for 60 s (after 10 s warm-up), teleport to Hyrule Field, take the picture field to compare with main, measure field for 60 s (after 10 s warm-up); 3 runs on each side.
  • Measured: crashes, frame times, stutters and hitches, memory and CPU time.
  • The PR fails if: it crashes; or a picture differs from main by more than 20%; or frame time (p99) is more than 15% above main; or frame time (worst 1%) is more than 15% above main.
  • Time: about 45 min of game runs per tester (6 game starts), plus the two builds.
Measurements on `nvidia`, for the PR description

Verdict: pass on nvidia (2 reports): no rule failed and no PR run crashed.

Hardware: 1: windows+nvidia+nvidia-proprietary+dgpu NVIDIA GeForce RTX 4070, 621.24.0 AMD Ryzen 9 7900X 12-Core Processor, 64 GB RAM; 2: windows+nvidia+nvidia-proprietary+dgpu NVIDIA GeForce RTX 3050 Ti Laptop GPU, 621.1.0 AMD Ryzen 7 5800H with Radeon Graphics, 16 GB RAM
Scene: recording-gameplay, from the repository's save market-entrance (vsync=2, resolution=1, frame_rate_cap=6, quality_preset=0, HOS_OUTPUT_RES=1280x720, RX_VK_AUTO_TUNE=0); each cell's settings and switches as the table names them
Method: the Beanstalk test farm: main and this PR built and run on the same PC in one session, game starts alternating (ABBA); recording-gameplay: 3 game starts a side, market 60 s after 10 s warm-up, field 60 s after 10 s warm-up; each number the median of the runs, then of 2 reports
How to reproduce: the farm's plan above (@Beanstalk on this PR runs it again)

Before: main @ 4908cc6 After: this PR @ 15b06ff
recording-gameplay · field · frame time (p99) (ms) 24.5 24.9 (+1%)
recording-gameplay · market · frame time (p99) (ms) 30.4 30.5 (+0%)
recording-gameplay · field · frame time (worst 1%) (ms) 25.7 25.9 (+1%)
recording-gameplay · market · frame time (worst 1%) (ms) 32.6 34.4 (+5%)

Flags and settings

None: the plan varied no setting, switch or build option.

As Markdown for the PR description:

## Measurements

**Verdict:** pass on nvidia (2 reports): no rule failed and no PR run crashed.

Hardware: 1: windows+nvidia+nvidia-proprietary+dgpu `NVIDIA GeForce RTX 4070, 621.24.0` `AMD Ryzen 9 7900X 12-Core Processor, 64 GB RAM`; 2: windows+nvidia+nvidia-proprietary+dgpu `NVIDIA GeForce RTX 3050 Ti Laptop GPU, 621.1.0` `AMD Ryzen 7 5800H with Radeon Graphics, 16 GB RAM`  
Scene: recording-gameplay, from the repository's save market-entrance (vsync=2, resolution=1, frame_rate_cap=6, quality_preset=0, HOS_OUTPUT_RES=1280x720, RX_VK_AUTO_TUNE=0); each cell's settings and switches as the table names them  
Method: the Beanstalk test farm: main and this PR built and run on the same PC in one session, game starts alternating (ABBA); recording-gameplay: 3 game starts a side, market 60 s after 10 s warm-up, field 60 s after 10 s warm-up; each number the median of the runs, then of 2 reports  
How to reproduce: the farm's plan above (`@Beanstalk` on this PR runs it again)

| | Before: main @ 4908cc6 | After: this PR @ 15b06ff |
|---|---|---|
| recording-gameplay · field · frame time (p99) (ms) | 24.5 | 24.9 (+1%) |
| recording-gameplay · market · frame time (p99) (ms) | 30.4 | 30.5 (+0%) |
| recording-gameplay · field · frame time (worst 1%) (ms) | 25.7 | 25.9 (+1%) |
| recording-gameplay · market · frame time (worst 1%) (ms) | 32.6 | 34.4 (+5%) |

**Flags and settings**

None: the plan varied no setting, switch or build option.
Measurements on `amd`, for the PR description

Verdict: pass on amd (2 reports): no rule failed and no PR run crashed.

Hardware: 1: windows+amd+amd-proprietary+dgpu+fsr4 AMD Radeon RX 9070 XT, 2.0.416 AMD Ryzen 9 7950X 16-Core Processor, 128 GB RAM; 2: linux+amd+radv+dgpu AMD Radeon RX 7900 XTX (RADV NAVI31), 26.3.1 AMD Ryzen 7 5800X3D 8-Core Processor, 32 GB RAM
Scene: recording-gameplay, from the repository's save market-entrance (vsync=2, resolution=1, frame_rate_cap=6, quality_preset=0, HOS_OUTPUT_RES=1280x720, RX_VK_AUTO_TUNE=0); each cell's settings and switches as the table names them
Method: the Beanstalk test farm: main and this PR built and run on the same PC in one session, game starts alternating (ABBA); recording-gameplay: 3 game starts a side, market 60 s after 10 s warm-up, field 60 s after 10 s warm-up; each number the median of the runs, then of 2 reports
How to reproduce: the farm's plan above (@Beanstalk on this PR runs it again)

Before: main @ 4908cc6 After: this PR @ 15b06ff
recording-gameplay · field · frame time (p99) (ms) 32.1 32.1 (−0%)
recording-gameplay · market · frame time (p99) (ms) 37.2 37.2 (−0%)
recording-gameplay · field · frame time (worst 1%) (ms) 32.9 33.1 (+1%)
recording-gameplay · market · frame time (worst 1%) (ms) 38.2 38.3 (+0%)

Flags and settings

None: the plan varied no setting, switch or build option.

As Markdown for the PR description:

## Measurements

**Verdict:** pass on amd (2 reports): no rule failed and no PR run crashed.

Hardware: 1: windows+amd+amd-proprietary+dgpu+fsr4 `AMD Radeon RX 9070 XT, 2.0.416` `AMD Ryzen 9 7950X 16-Core Processor, 128 GB RAM`; 2: linux+amd+radv+dgpu `AMD Radeon RX 7900 XTX (RADV NAVI31), 26.3.1` `AMD Ryzen 7 5800X3D 8-Core Processor, 32 GB RAM`  
Scene: recording-gameplay, from the repository's save market-entrance (vsync=2, resolution=1, frame_rate_cap=6, quality_preset=0, HOS_OUTPUT_RES=1280x720, RX_VK_AUTO_TUNE=0); each cell's settings and switches as the table names them  
Method: the Beanstalk test farm: main and this PR built and run on the same PC in one session, game starts alternating (ABBA); recording-gameplay: 3 game starts a side, market 60 s after 10 s warm-up, field 60 s after 10 s warm-up; each number the median of the runs, then of 2 reports  
How to reproduce: the farm's plan above (`@Beanstalk` on this PR runs it again)

| | Before: main @ 4908cc6 | After: this PR @ 15b06ff |
|---|---|---|
| recording-gameplay · field · frame time (p99) (ms) | 32.1 | 32.1 (−0%) |
| recording-gameplay · market · frame time (p99) (ms) | 37.2 | 37.2 (−0%) |
| recording-gameplay · field · frame time (worst 1%) (ms) | 32.9 | 33.1 (+1%) |
| recording-gameplay · market · frame time (worst 1%) (ms) | 38.2 | 38.3 (+0%) |

**Flags and settings**

None: the plan varied no setting, switch or build option.
Measurements on `intel`, for the PR description

Verdict: queued on intel (1 report).

Hardware: 1: windows+intel+intel-proprietary+igpu+window Intel(R) UHD Graphics 630, 0.404.2115 Intel(R) Core(TM) i3-8100 CPU @ 3.60GHz, 8 GB RAM
Scene: recording-gameplay, from the repository's save market-entrance (vsync=2, resolution=1, frame_rate_cap=6, quality_preset=0, HOS_OUTPUT_RES=1280x720, RX_VK_AUTO_TUNE=0); each cell's settings and switches as the table names them
Method: the Beanstalk test farm: main and this PR built and run on the same PC in one session, game starts alternating (ABBA); recording-gameplay: 3 game starts a side, market 60 s after 10 s warm-up, field 60 s after 10 s warm-up; each number the median of the runs, then of 1 report
How to reproduce: the farm's plan above (@Beanstalk on this PR runs it again)

Nothing was measured: no metric came back.

Flags and settings

None: the plan varied no setting, switch or build option.

As Markdown for the PR description:

## Measurements

**Verdict:** queued on intel (1 report).

Hardware: 1: windows+intel+intel-proprietary+igpu+window `Intel(R) UHD Graphics 630, 0.404.2115` `Intel(R) Core(TM) i3-8100 CPU @ 3.60GHz, 8 GB RAM`  
Scene: recording-gameplay, from the repository's save market-entrance (vsync=2, resolution=1, frame_rate_cap=6, quality_preset=0, HOS_OUTPUT_RES=1280x720, RX_VK_AUTO_TUNE=0); each cell's settings and switches as the table names them  
Method: the Beanstalk test farm: main and this PR built and run on the same PC in one session, game starts alternating (ABBA); recording-gameplay: 3 game starts a side, market 60 s after 10 s warm-up, field 60 s after 10 s warm-up; each number the median of the runs, then of 1 report  
How to reproduce: the farm's plan above (`@Beanstalk` on this PR runs it again)

Nothing was measured: no metric came back.

**Flags and settings**

None: the plan varied no setting, switch or build option.
Measurements on `linux`, for the PR description

Verdict: pass on linux (2 reports): no rule failed and no PR run crashed.

Hardware: 1: linux+amd+radv+igpu AMD Radeon 8060S Graphics (RADV STRIX_HALO), 26.99.99 AMD RYZEN AI MAX+ 395 w/ Radeon 8060S, 64 GB RAM; 2: linux+amd+radv+dgpu AMD Radeon RX 9070 XT (RADV GFX1201), 26.3.1 AMD Ryzen 7 5700X3D 8-Core Processor, 32 GB RAM
Scene: recording-gameplay, from the repository's save market-entrance (vsync=2, resolution=1, frame_rate_cap=6, quality_preset=0, HOS_OUTPUT_RES=1280x720, RX_VK_AUTO_TUNE=0); each cell's settings and switches as the table names them
Method: the Beanstalk test farm: main and this PR built and run on the same PC in one session, game starts alternating (ABBA); recording-gameplay: 3 game starts a side, market 60 s after 10 s warm-up, field 60 s after 10 s warm-up; each number the median of the runs, then of 2 reports
How to reproduce: the farm's plan above (@Beanstalk on this PR runs it again)

Before: main @ 4908cc6 After: this PR @ 15b06ff
recording-gameplay · field · frame time (p99) (ms) 9.7 9.8 (+1%)
recording-gameplay · market · frame time (p99) (ms) 13.7 13.7 (+0%)
recording-gameplay · field · frame time (worst 1%) (ms) 11.1 11.0 (−1%)
recording-gameplay · market · frame time (worst 1%) (ms) 15.6 16.0 (+2%)

Flags and settings

None: the plan varied no setting, switch or build option.

As Markdown for the PR description:

## Measurements

**Verdict:** pass on linux (2 reports): no rule failed and no PR run crashed.

Hardware: 1: linux+amd+radv+igpu `AMD Radeon 8060S Graphics (RADV STRIX_HALO), 26.99.99` `AMD RYZEN AI MAX+ 395 w/ Radeon 8060S, 64 GB RAM`; 2: linux+amd+radv+dgpu `AMD Radeon RX 9070 XT (RADV GFX1201), 26.3.1` `AMD Ryzen 7 5700X3D 8-Core Processor, 32 GB RAM`  
Scene: recording-gameplay, from the repository's save market-entrance (vsync=2, resolution=1, frame_rate_cap=6, quality_preset=0, HOS_OUTPUT_RES=1280x720, RX_VK_AUTO_TUNE=0); each cell's settings and switches as the table names them  
Method: the Beanstalk test farm: main and this PR built and run on the same PC in one session, game starts alternating (ABBA); recording-gameplay: 3 game starts a side, market 60 s after 10 s warm-up, field 60 s after 10 s warm-up; each number the median of the runs, then of 2 reports  
How to reproduce: the farm's plan above (`@Beanstalk` on this PR runs it again)

| | Before: main @ 4908cc6 | After: this PR @ 15b06ff |
|---|---|---|
| recording-gameplay · field · frame time (p99) (ms) | 9.7 | 9.8 (+1%) |
| recording-gameplay · market · frame time (p99) (ms) | 13.7 | 13.7 (+0%) |
| recording-gameplay · field · frame time (worst 1%) (ms) | 11.1 | 11.0 (−1%) |
| recording-gameplay · market · frame time (worst 1%) (ms) | 15.6 | 16.0 (+2%) |

**Flags and settings**

None: the plan varied no setting, switch or build option.
Measurements on `windows+nvidia`, for the PR description

Verdict: fail on windows+nvidia (2 reports): recording-gameplay crash; recording-gameplay screenshot.max_diff failed.

Hardware: 1: windows+nvidia+nvidia-proprietary+dgpu+dlss+xess NVIDIA GeForce RTX 4090, 621.40.0 13th Gen Intel(R) Core(TM) i7-13700K, 32 GB RAM; 2: windows+nvidia+nvidia-proprietary+dgpu+dlss+xess NVIDIA GeForce RTX 3070, 621.35.0 AMD Ryzen 5 5600X3D 6-Core Processor, 32 GB RAM
Scene: recording-gameplay, from the repository's save market-entrance (vsync=2, resolution=1, frame_rate_cap=6, quality_preset=0, HOS_OUTPUT_RES=1280x720, RX_VK_AUTO_TUNE=0); each cell's settings and switches as the table names them
Method: the Beanstalk test farm: main and this PR built and run on the same PC in one session, game starts alternating (ABBA); recording-gameplay: 3 game starts a side, market 60 s after 10 s warm-up, field 60 s after 10 s warm-up; each number the median of the runs, then of 2 reports
How to reproduce: the farm's plan above (@Beanstalk on this PR runs it again)

Before: main @ 4908cc6 After: this PR @ 15b06ff
recording-gameplay · field · frame time (p99) (ms) 7.2 7.1 (−1%)
recording-gameplay · market · frame time (p99) (ms) 12.3 12.2 (−1%)
recording-gameplay · field · frame time (worst 1%) (ms) 7.6 7.5 (−1%)
recording-gameplay · market · frame time (worst 1%) (ms) 14.7 14.6 (−1%)

Flags and settings

None: the plan varied no setting, switch or build option.

As Markdown for the PR description:

## Measurements

**Verdict:** fail on windows+nvidia (2 reports): `recording-gameplay crash`; `recording-gameplay screenshot.max_diff` failed.

Hardware: 1: windows+nvidia+nvidia-proprietary+dgpu+dlss+xess `NVIDIA GeForce RTX 4090, 621.40.0` `13th Gen Intel(R) Core(TM) i7-13700K, 32 GB RAM`; 2: windows+nvidia+nvidia-proprietary+dgpu+dlss+xess `NVIDIA GeForce RTX 3070, 621.35.0` `AMD Ryzen 5 5600X3D 6-Core Processor, 32 GB RAM`  
Scene: recording-gameplay, from the repository's save market-entrance (vsync=2, resolution=1, frame_rate_cap=6, quality_preset=0, HOS_OUTPUT_RES=1280x720, RX_VK_AUTO_TUNE=0); each cell's settings and switches as the table names them  
Method: the Beanstalk test farm: main and this PR built and run on the same PC in one session, game starts alternating (ABBA); recording-gameplay: 3 game starts a side, market 60 s after 10 s warm-up, field 60 s after 10 s warm-up; each number the median of the runs, then of 2 reports  
How to reproduce: the farm's plan above (`@Beanstalk` on this PR runs it again)

| | Before: main @ 4908cc6 | After: this PR @ 15b06ff |
|---|---|---|
| recording-gameplay · field · frame time (p99) (ms) | 7.2 | 7.1 (−1%) |
| recording-gameplay · market · frame time (p99) (ms) | 12.3 | 12.2 (−1%) |
| recording-gameplay · field · frame time (worst 1%) (ms) | 7.6 | 7.5 (−1%) |
| recording-gameplay · market · frame time (worst 1%) (ms) | 14.7 | 14.6 (−1%) |

**Flags and settings**

None: the plan varied no setting, switch or build option.
The testers' hardware
Target Report Ran on
nvidia 1 windows+nvidia+nvidia-proprietary+dgpu NVIDIA GeForce RTX 4070, 621.24.0 AMD Ryzen 9 7900X 12-Core Processor, 64 GB RAM
nvidia 2 windows+nvidia+nvidia-proprietary+dgpu NVIDIA GeForce RTX 3050 Ti Laptop GPU, 621.1.0 AMD Ryzen 7 5800H with Radeon Graphics, 16 GB RAM
amd 1 windows+amd+amd-proprietary+dgpu+fsr4 AMD Radeon RX 9070 XT, 2.0.416 AMD Ryzen 9 7950X 16-Core Processor, 128 GB RAM
amd 2 linux+amd+radv+dgpu AMD Radeon RX 7900 XTX (RADV NAVI31), 26.3.1 AMD Ryzen 7 5800X3D 8-Core Processor, 32 GB RAM
intel 1 windows+intel+intel-proprietary+igpu+window Intel(R) UHD Graphics 630, 0.404.2115 Intel(R) Core(TM) i3-8100 CPU @ 3.60GHz, 8 GB RAM
linux 1 linux+amd+radv+igpu AMD Radeon 8060S Graphics (RADV STRIX_HALO), 26.99.99 AMD RYZEN AI MAX+ 395 w/ Radeon 8060S, 64 GB RAM
linux 2 linux+amd+radv+dgpu AMD Radeon RX 9070 XT (RADV GFX1201), 26.3.1 AMD Ryzen 7 5700X3D 8-Core Processor, 32 GB RAM
windows+nvidia 1 windows+nvidia+nvidia-proprietary+dgpu+dlss+xess NVIDIA GeForce RTX 4090, 621.40.0 13th Gen Intel(R) Core(TM) i7-13700K, 32 GB RAM
windows+nvidia 2 windows+nvidia+nvidia-proprietary+dgpu+dlss+xess NVIDIA GeForce RTX 3070, 621.35.0 AMD Ryzen 5 5600X3D 6-Core Processor, 32 GB RAM
<!-- beanstalk:previous --> <details><summary>Beanstalk test farm · an earlier run: commit <code>15b06ff</code> (the newer results are in a comment below)</summary> Commit `15b06ff` · approved by HumanBean (reviewed) · [dashboard](https://beanstalk.magicbean.dev/prs/2932) ⚠️ **Note:** The farm does not run mise run test or the PR's unit tests as part of this plan; it builds and smoke-tests gameplay on Linux and Windows. ⚠️ **Note:** The reported sub-percent frame-time gain and individual game_ms and main_cpu_ms improvements cannot be resolved reliably by these farm measurements; the thresholds detect larger regressions. ⚠️ **Note:** The switch-off path and thread-exit leak behavior are not isolated by this plan. Started at 2026-12-01 15:26 UTC. | Target | Result | Reports | Frame time p99 (ms), main → PR | VRAM peak (MB) | Crashes | | --- | --- | --- | --- | --- | --- | | `nvidia` | ✅ pass (an outlier) | 2 [1](https://beanstalk.magicbean.dev/reports/rp_b5771c767f47796a) [2](https://beanstalk.magicbean.dev/reports/rp_741a9b1adb78bfd1) | 24.5 → 24.9 (+1%) | — | none | | `amd` | ✅ pass (an outlier) | 2 [1](https://beanstalk.magicbean.dev/reports/rp_2e5d711e8f90d1ca) [2](https://beanstalk.magicbean.dev/reports/rp_6aa3f53367e3de16) | 32.1 → 32.1 (−0%) | — | none | | `intel` | ⏳ queued | 1 [1](https://beanstalk.magicbean.dev/reports/rp_06a67cb284fd7ee3) | — | — | 3 PR runs | | `linux` | ✅ pass (an outlier) | 2 [1](https://beanstalk.magicbean.dev/reports/rp_baf7ff1f90649331) [2](https://beanstalk.magicbean.dev/reports/rp_1e8034e70288e433) | 9.7 → 9.8 (+1%) | — | none | | `windows+nvidia` | ❌ fail (an outlier) | 2 [1](https://beanstalk.magicbean.dev/reports/rp_dfaf23fab82eeae3) [2](https://beanstalk.magicbean.dev/reports/rp_fbe186ddb005bc7a) | 7.2 → 7.1 (−1%) | — | 2 PR runs | **Why it failed** - `windows+nvidia`: `recording-gameplay` `crash`: `2 PR runs crashed` - `windows+nvidia`: `recording-gameplay` `screenshot.max_diff`: `limit 0.2` **Couldn't be judged**: the tester's PC could not finish the test. The farm tries another PC, or the same one after a fix; it says nothing about the PR on its own. - `intel`, [report 1](https://beanstalk.magicbean.dev/reports/rp_06a67cb284fd7ee3): `Insufficient frame-time evidence for 5 required comparison(s). See rule results.` <details><summary>What was tested</summary> **What will be tested** · AI plan (`gpt-6.1-terra`) The plan compares the PR with main over three starts per side in Castle Town Market and Hyrule Field, with 60 seconds of warmed-up measurement at each location. It runs uncapped at 1280x720 to emphasize the CPU-side recording work, across NVIDIA, AMD, Intel, Linux, and the tested Windows/NVIDIA path. Crashes, substantial frame-time regressions, or screenshot differences beyond the comparison tolerance fail the plan. - **Where:** nvidia (1-2 reports), amd (1-2 reports), intel (1-2 reports), linux (1-2 reports), windows+nvidia (1-2 reports). - **recording-gameplay:** from the repository's save `market-entrance` (settings vsync=2, resolution=1, frame_rate_cap=6, quality_preset=0; switches `HOS_OUTPUT_RES=1280x720`, `RX_VK_AUTO_TUNE=0`), then teleport to Market, take the picture market to compare with main, measure market for 60 s (after 10 s warm-up), teleport to Hyrule Field, take the picture field to compare with main, measure field for 60 s (after 10 s warm-up); 3 runs on each side. - **Measured:** crashes, frame times, stutters and hitches, memory and CPU time. - **The PR fails if:** it crashes; or a picture differs from main by more than 20%; or frame time (p99) is more than 15% above main; or frame time (worst 1%) is more than 15% above main. - **Time:** about 45 min of game runs per tester (6 game starts), plus the two builds. </details> <details><summary>Measurements on `nvidia`, for the PR description</summary> **Verdict:** pass on nvidia (2 reports): no rule failed and no PR run crashed. Hardware: 1: windows+nvidia+nvidia-proprietary+dgpu `NVIDIA GeForce RTX 4070, 621.24.0` `AMD Ryzen 9 7900X 12-Core Processor, 64 GB RAM`; 2: windows+nvidia+nvidia-proprietary+dgpu `NVIDIA GeForce RTX 3050 Ti Laptop GPU, 621.1.0` `AMD Ryzen 7 5800H with Radeon Graphics, 16 GB RAM` Scene: recording-gameplay, from the repository's save market-entrance (vsync=2, resolution=1, frame_rate_cap=6, quality_preset=0, HOS_OUTPUT_RES=1280x720, RX_VK_AUTO_TUNE=0); each cell's settings and switches as the table names them Method: the Beanstalk test farm: main and this PR built and run on the same PC in one session, game starts alternating (ABBA); recording-gameplay: 3 game starts a side, market 60 s after 10 s warm-up, field 60 s after 10 s warm-up; each number the median of the runs, then of 2 reports How to reproduce: the farm's plan above (`@Beanstalk` on this PR runs it again) | | Before: main @ 4908cc6 | After: this PR @ 15b06ff | |---|---|---| | recording-gameplay · field · frame time (p99) (ms) | 24.5 | 24.9 (+1%) | | recording-gameplay · market · frame time (p99) (ms) | 30.4 | 30.5 (+0%) | | recording-gameplay · field · frame time (worst 1%) (ms) | 25.7 | 25.9 (+1%) | | recording-gameplay · market · frame time (worst 1%) (ms) | 32.6 | 34.4 (+5%) | **Flags and settings** None: the plan varied no setting, switch or build option. As Markdown for the PR description: ```markdown ## Measurements **Verdict:** pass on nvidia (2 reports): no rule failed and no PR run crashed. Hardware: 1: windows+nvidia+nvidia-proprietary+dgpu `NVIDIA GeForce RTX 4070, 621.24.0` `AMD Ryzen 9 7900X 12-Core Processor, 64 GB RAM`; 2: windows+nvidia+nvidia-proprietary+dgpu `NVIDIA GeForce RTX 3050 Ti Laptop GPU, 621.1.0` `AMD Ryzen 7 5800H with Radeon Graphics, 16 GB RAM` Scene: recording-gameplay, from the repository's save market-entrance (vsync=2, resolution=1, frame_rate_cap=6, quality_preset=0, HOS_OUTPUT_RES=1280x720, RX_VK_AUTO_TUNE=0); each cell's settings and switches as the table names them Method: the Beanstalk test farm: main and this PR built and run on the same PC in one session, game starts alternating (ABBA); recording-gameplay: 3 game starts a side, market 60 s after 10 s warm-up, field 60 s after 10 s warm-up; each number the median of the runs, then of 2 reports How to reproduce: the farm's plan above (`@Beanstalk` on this PR runs it again) | | Before: main @ 4908cc6 | After: this PR @ 15b06ff | |---|---|---| | recording-gameplay · field · frame time (p99) (ms) | 24.5 | 24.9 (+1%) | | recording-gameplay · market · frame time (p99) (ms) | 30.4 | 30.5 (+0%) | | recording-gameplay · field · frame time (worst 1%) (ms) | 25.7 | 25.9 (+1%) | | recording-gameplay · market · frame time (worst 1%) (ms) | 32.6 | 34.4 (+5%) | **Flags and settings** None: the plan varied no setting, switch or build option. ``` </details> <details><summary>Measurements on `amd`, for the PR description</summary> **Verdict:** pass on amd (2 reports): no rule failed and no PR run crashed. Hardware: 1: windows+amd+amd-proprietary+dgpu+fsr4 `AMD Radeon RX 9070 XT, 2.0.416` `AMD Ryzen 9 7950X 16-Core Processor, 128 GB RAM`; 2: linux+amd+radv+dgpu `AMD Radeon RX 7900 XTX (RADV NAVI31), 26.3.1` `AMD Ryzen 7 5800X3D 8-Core Processor, 32 GB RAM` Scene: recording-gameplay, from the repository's save market-entrance (vsync=2, resolution=1, frame_rate_cap=6, quality_preset=0, HOS_OUTPUT_RES=1280x720, RX_VK_AUTO_TUNE=0); each cell's settings and switches as the table names them Method: the Beanstalk test farm: main and this PR built and run on the same PC in one session, game starts alternating (ABBA); recording-gameplay: 3 game starts a side, market 60 s after 10 s warm-up, field 60 s after 10 s warm-up; each number the median of the runs, then of 2 reports How to reproduce: the farm's plan above (`@Beanstalk` on this PR runs it again) | | Before: main @ 4908cc6 | After: this PR @ 15b06ff | |---|---|---| | recording-gameplay · field · frame time (p99) (ms) | 32.1 | 32.1 (−0%) | | recording-gameplay · market · frame time (p99) (ms) | 37.2 | 37.2 (−0%) | | recording-gameplay · field · frame time (worst 1%) (ms) | 32.9 | 33.1 (+1%) | | recording-gameplay · market · frame time (worst 1%) (ms) | 38.2 | 38.3 (+0%) | **Flags and settings** None: the plan varied no setting, switch or build option. As Markdown for the PR description: ```markdown ## Measurements **Verdict:** pass on amd (2 reports): no rule failed and no PR run crashed. Hardware: 1: windows+amd+amd-proprietary+dgpu+fsr4 `AMD Radeon RX 9070 XT, 2.0.416` `AMD Ryzen 9 7950X 16-Core Processor, 128 GB RAM`; 2: linux+amd+radv+dgpu `AMD Radeon RX 7900 XTX (RADV NAVI31), 26.3.1` `AMD Ryzen 7 5800X3D 8-Core Processor, 32 GB RAM` Scene: recording-gameplay, from the repository's save market-entrance (vsync=2, resolution=1, frame_rate_cap=6, quality_preset=0, HOS_OUTPUT_RES=1280x720, RX_VK_AUTO_TUNE=0); each cell's settings and switches as the table names them Method: the Beanstalk test farm: main and this PR built and run on the same PC in one session, game starts alternating (ABBA); recording-gameplay: 3 game starts a side, market 60 s after 10 s warm-up, field 60 s after 10 s warm-up; each number the median of the runs, then of 2 reports How to reproduce: the farm's plan above (`@Beanstalk` on this PR runs it again) | | Before: main @ 4908cc6 | After: this PR @ 15b06ff | |---|---|---| | recording-gameplay · field · frame time (p99) (ms) | 32.1 | 32.1 (−0%) | | recording-gameplay · market · frame time (p99) (ms) | 37.2 | 37.2 (−0%) | | recording-gameplay · field · frame time (worst 1%) (ms) | 32.9 | 33.1 (+1%) | | recording-gameplay · market · frame time (worst 1%) (ms) | 38.2 | 38.3 (+0%) | **Flags and settings** None: the plan varied no setting, switch or build option. ``` </details> <details><summary>Measurements on `intel`, for the PR description</summary> **Verdict:** queued on intel (1 report). Hardware: 1: windows+intel+intel-proprietary+igpu+window `Intel(R) UHD Graphics 630, 0.404.2115` `Intel(R) Core(TM) i3-8100 CPU @ 3.60GHz, 8 GB RAM` Scene: recording-gameplay, from the repository's save market-entrance (vsync=2, resolution=1, frame_rate_cap=6, quality_preset=0, HOS_OUTPUT_RES=1280x720, RX_VK_AUTO_TUNE=0); each cell's settings and switches as the table names them Method: the Beanstalk test farm: main and this PR built and run on the same PC in one session, game starts alternating (ABBA); recording-gameplay: 3 game starts a side, market 60 s after 10 s warm-up, field 60 s after 10 s warm-up; each number the median of the runs, then of 1 report How to reproduce: the farm's plan above (`@Beanstalk` on this PR runs it again) Nothing was measured: no metric came back. **Flags and settings** None: the plan varied no setting, switch or build option. As Markdown for the PR description: ```markdown ## Measurements **Verdict:** queued on intel (1 report). Hardware: 1: windows+intel+intel-proprietary+igpu+window `Intel(R) UHD Graphics 630, 0.404.2115` `Intel(R) Core(TM) i3-8100 CPU @ 3.60GHz, 8 GB RAM` Scene: recording-gameplay, from the repository's save market-entrance (vsync=2, resolution=1, frame_rate_cap=6, quality_preset=0, HOS_OUTPUT_RES=1280x720, RX_VK_AUTO_TUNE=0); each cell's settings and switches as the table names them Method: the Beanstalk test farm: main and this PR built and run on the same PC in one session, game starts alternating (ABBA); recording-gameplay: 3 game starts a side, market 60 s after 10 s warm-up, field 60 s after 10 s warm-up; each number the median of the runs, then of 1 report How to reproduce: the farm's plan above (`@Beanstalk` on this PR runs it again) Nothing was measured: no metric came back. **Flags and settings** None: the plan varied no setting, switch or build option. ``` </details> <details><summary>Measurements on `linux`, for the PR description</summary> **Verdict:** pass on linux (2 reports): no rule failed and no PR run crashed. Hardware: 1: linux+amd+radv+igpu `AMD Radeon 8060S Graphics (RADV STRIX_HALO), 26.99.99` `AMD RYZEN AI MAX+ 395 w/ Radeon 8060S, 64 GB RAM`; 2: linux+amd+radv+dgpu `AMD Radeon RX 9070 XT (RADV GFX1201), 26.3.1` `AMD Ryzen 7 5700X3D 8-Core Processor, 32 GB RAM` Scene: recording-gameplay, from the repository's save market-entrance (vsync=2, resolution=1, frame_rate_cap=6, quality_preset=0, HOS_OUTPUT_RES=1280x720, RX_VK_AUTO_TUNE=0); each cell's settings and switches as the table names them Method: the Beanstalk test farm: main and this PR built and run on the same PC in one session, game starts alternating (ABBA); recording-gameplay: 3 game starts a side, market 60 s after 10 s warm-up, field 60 s after 10 s warm-up; each number the median of the runs, then of 2 reports How to reproduce: the farm's plan above (`@Beanstalk` on this PR runs it again) | | Before: main @ 4908cc6 | After: this PR @ 15b06ff | |---|---|---| | recording-gameplay · field · frame time (p99) (ms) | 9.7 | 9.8 (+1%) | | recording-gameplay · market · frame time (p99) (ms) | 13.7 | 13.7 (+0%) | | recording-gameplay · field · frame time (worst 1%) (ms) | 11.1 | 11.0 (−1%) | | recording-gameplay · market · frame time (worst 1%) (ms) | 15.6 | 16.0 (+2%) | **Flags and settings** None: the plan varied no setting, switch or build option. As Markdown for the PR description: ```markdown ## Measurements **Verdict:** pass on linux (2 reports): no rule failed and no PR run crashed. Hardware: 1: linux+amd+radv+igpu `AMD Radeon 8060S Graphics (RADV STRIX_HALO), 26.99.99` `AMD RYZEN AI MAX+ 395 w/ Radeon 8060S, 64 GB RAM`; 2: linux+amd+radv+dgpu `AMD Radeon RX 9070 XT (RADV GFX1201), 26.3.1` `AMD Ryzen 7 5700X3D 8-Core Processor, 32 GB RAM` Scene: recording-gameplay, from the repository's save market-entrance (vsync=2, resolution=1, frame_rate_cap=6, quality_preset=0, HOS_OUTPUT_RES=1280x720, RX_VK_AUTO_TUNE=0); each cell's settings and switches as the table names them Method: the Beanstalk test farm: main and this PR built and run on the same PC in one session, game starts alternating (ABBA); recording-gameplay: 3 game starts a side, market 60 s after 10 s warm-up, field 60 s after 10 s warm-up; each number the median of the runs, then of 2 reports How to reproduce: the farm's plan above (`@Beanstalk` on this PR runs it again) | | Before: main @ 4908cc6 | After: this PR @ 15b06ff | |---|---|---| | recording-gameplay · field · frame time (p99) (ms) | 9.7 | 9.8 (+1%) | | recording-gameplay · market · frame time (p99) (ms) | 13.7 | 13.7 (+0%) | | recording-gameplay · field · frame time (worst 1%) (ms) | 11.1 | 11.0 (−1%) | | recording-gameplay · market · frame time (worst 1%) (ms) | 15.6 | 16.0 (+2%) | **Flags and settings** None: the plan varied no setting, switch or build option. ``` </details> <details><summary>Measurements on `windows+nvidia`, for the PR description</summary> **Verdict:** fail on windows+nvidia (2 reports): `recording-gameplay crash`; `recording-gameplay screenshot.max_diff` failed. Hardware: 1: windows+nvidia+nvidia-proprietary+dgpu+dlss+xess `NVIDIA GeForce RTX 4090, 621.40.0` `13th Gen Intel(R) Core(TM) i7-13700K, 32 GB RAM`; 2: windows+nvidia+nvidia-proprietary+dgpu+dlss+xess `NVIDIA GeForce RTX 3070, 621.35.0` `AMD Ryzen 5 5600X3D 6-Core Processor, 32 GB RAM` Scene: recording-gameplay, from the repository's save market-entrance (vsync=2, resolution=1, frame_rate_cap=6, quality_preset=0, HOS_OUTPUT_RES=1280x720, RX_VK_AUTO_TUNE=0); each cell's settings and switches as the table names them Method: the Beanstalk test farm: main and this PR built and run on the same PC in one session, game starts alternating (ABBA); recording-gameplay: 3 game starts a side, market 60 s after 10 s warm-up, field 60 s after 10 s warm-up; each number the median of the runs, then of 2 reports How to reproduce: the farm's plan above (`@Beanstalk` on this PR runs it again) | | Before: main @ 4908cc6 | After: this PR @ 15b06ff | |---|---|---| | recording-gameplay · field · frame time (p99) (ms) | 7.2 | 7.1 (−1%) | | recording-gameplay · market · frame time (p99) (ms) | 12.3 | 12.2 (−1%) | | recording-gameplay · field · frame time (worst 1%) (ms) | 7.6 | 7.5 (−1%) | | recording-gameplay · market · frame time (worst 1%) (ms) | 14.7 | 14.6 (−1%) | **Flags and settings** None: the plan varied no setting, switch or build option. As Markdown for the PR description: ```markdown ## Measurements **Verdict:** fail on windows+nvidia (2 reports): `recording-gameplay crash`; `recording-gameplay screenshot.max_diff` failed. Hardware: 1: windows+nvidia+nvidia-proprietary+dgpu+dlss+xess `NVIDIA GeForce RTX 4090, 621.40.0` `13th Gen Intel(R) Core(TM) i7-13700K, 32 GB RAM`; 2: windows+nvidia+nvidia-proprietary+dgpu+dlss+xess `NVIDIA GeForce RTX 3070, 621.35.0` `AMD Ryzen 5 5600X3D 6-Core Processor, 32 GB RAM` Scene: recording-gameplay, from the repository's save market-entrance (vsync=2, resolution=1, frame_rate_cap=6, quality_preset=0, HOS_OUTPUT_RES=1280x720, RX_VK_AUTO_TUNE=0); each cell's settings and switches as the table names them Method: the Beanstalk test farm: main and this PR built and run on the same PC in one session, game starts alternating (ABBA); recording-gameplay: 3 game starts a side, market 60 s after 10 s warm-up, field 60 s after 10 s warm-up; each number the median of the runs, then of 2 reports How to reproduce: the farm's plan above (`@Beanstalk` on this PR runs it again) | | Before: main @ 4908cc6 | After: this PR @ 15b06ff | |---|---|---| | recording-gameplay · field · frame time (p99) (ms) | 7.2 | 7.1 (−1%) | | recording-gameplay · market · frame time (p99) (ms) | 12.3 | 12.2 (−1%) | | recording-gameplay · field · frame time (worst 1%) (ms) | 7.6 | 7.5 (−1%) | | recording-gameplay · market · frame time (worst 1%) (ms) | 14.7 | 14.6 (−1%) | **Flags and settings** None: the plan varied no setting, switch or build option. ``` </details> <details><summary>The testers' hardware</summary> | Target | Report | Ran on | | --- | --- | --- | | `nvidia` | [1](https://beanstalk.magicbean.dev/reports/rp_b5771c767f47796a) | windows+nvidia+nvidia-proprietary+dgpu `NVIDIA GeForce RTX 4070, 621.24.0` `AMD Ryzen 9 7900X 12-Core Processor, 64 GB RAM` | | `nvidia` | [2](https://beanstalk.magicbean.dev/reports/rp_741a9b1adb78bfd1) | windows+nvidia+nvidia-proprietary+dgpu `NVIDIA GeForce RTX 3050 Ti Laptop GPU, 621.1.0` `AMD Ryzen 7 5800H with Radeon Graphics, 16 GB RAM` | | `amd` | [1](https://beanstalk.magicbean.dev/reports/rp_2e5d711e8f90d1ca) | windows+amd+amd-proprietary+dgpu+fsr4 `AMD Radeon RX 9070 XT, 2.0.416` `AMD Ryzen 9 7950X 16-Core Processor, 128 GB RAM` | | `amd` | [2](https://beanstalk.magicbean.dev/reports/rp_6aa3f53367e3de16) | linux+amd+radv+dgpu `AMD Radeon RX 7900 XTX (RADV NAVI31), 26.3.1` `AMD Ryzen 7 5800X3D 8-Core Processor, 32 GB RAM` | | `intel` | [1](https://beanstalk.magicbean.dev/reports/rp_06a67cb284fd7ee3) | windows+intel+intel-proprietary+igpu+window `Intel(R) UHD Graphics 630, 0.404.2115` `Intel(R) Core(TM) i3-8100 CPU @ 3.60GHz, 8 GB RAM` | | `linux` | [1](https://beanstalk.magicbean.dev/reports/rp_baf7ff1f90649331) | linux+amd+radv+igpu `AMD Radeon 8060S Graphics (RADV STRIX_HALO), 26.99.99` `AMD RYZEN AI MAX+ 395 w/ Radeon 8060S, 64 GB RAM` | | `linux` | [2](https://beanstalk.magicbean.dev/reports/rp_1e8034e70288e433) | linux+amd+radv+dgpu `AMD Radeon RX 9070 XT (RADV GFX1201), 26.3.1` `AMD Ryzen 7 5700X3D 8-Core Processor, 32 GB RAM` | | `windows+nvidia` | [1](https://beanstalk.magicbean.dev/reports/rp_dfaf23fab82eeae3) | windows+nvidia+nvidia-proprietary+dgpu+dlss+xess `NVIDIA GeForce RTX 4090, 621.40.0` `13th Gen Intel(R) Core(TM) i7-13700K, 32 GB RAM` | | `windows+nvidia` | [2](https://beanstalk.magicbean.dev/reports/rp_fbe186ddb005bc7a) | windows+nvidia+nvidia-proprietary+dgpu+dlss+xess `NVIDIA GeForce RTX 3070, 621.35.0` `AMD Ryzen 5 5600X3D 6-Core Processor, 32 GB RAM` | </details> </details>
BeanBot left a comment

Recommendation: Request changes. The new test cannot compile on Linux or verify the recording handoff. The reported A/B result also does not establish a gain against the base at player settings.

The change hands recording buffers to the queue without copying when their size class fits, and pools recording nodes and allocations. It may reduce CPU work, but adds allocator state and retained memory across recording threads.

Blocking (1): must change before merging.

  1. L1 tests/test_nvn_zerocopy_rec.py:44: The new game-free test unconditionally includes Windows headers and uses Windows thread APIs. (more on the line) Do: Provide platform-specific synchronization and thread wrappers for the fixture, and compile and link the POSIX version with the required pthread options.

Should fix (1): not blocking, but worth doing before merging.

  • L2 tests/test_nvn_zerocopy_rec.py:34: The test never exercises the recording handoff or its size prediction. (more on the line) Do: Exercise the actual recording and submission handoff for both switch states, including growth and mismatched size classes, and check the submitted bytes and ownership.

Testing before merging (3) (runs on the systems it can change; it doesn't hold the recommendation)

  • L3: The reported A/B comparison does not measure the base commit against this change at settings players use. When: The off side still runs this branch's changed segment layout and reservation code, while the reported run uses a headless 50% resolution profile. The claimed improvement against main therefore remains unknown. Do: Run interleaved base-versus-head measurements in the target and heavy areas at the device's normal resolution and quality, reporting frame times and lows over several runs.
  • L4 host/nvn_native.c:1377: The new per-thread magazines and permanently retained node slabs have no reported memory measurement. (more on the line) Do: Compare peak and steady-state RAM against the base during a representative long session, including a workload with multiple recording threads. (@fix does its part first: Bound or account for magazine and slab retention across threads.)
  • L5: The Linux host path and other affected Tier 1 systems have no reported game run. When: The allocator, thread-local cleanup and recording handoff run on Linux as well as Windows; the only reported run is Windows on NVIDIA. Do: Use the Test Farm to smoke-test the Linux host and exercise recording and submission on the remaining affected Tier 1 systems, recording correctness and performance results.

@fix can do L1, L2 and L4.

Questions (1) (not confirmed from the code; they don't hold the recommendation)

  • The maintainer requested Beanstalk, but no Test Farm tool was available in this environment and network access was closed. Can the requested runs be submitted through the farm?

Checks: Still running: 10 checks.

More: does it help, other systems, switches, what was read

Does it help: Unproven against main: the reported Windows A/B run compares the PR with its switch on and off, not the base commit against the PR. It reports 13.805 ms versus 13.752 ms frame time and 1% low FPS of 57.59 versus 58.66 in a headless, reduced-resolution CPU-bound profile; player-setting and base-versus-head measurements are missing.

Other systems: The host recording and allocation paths run on Windows and Linux independently of GPU vendor. Windows NVIDIA was reported tested; Linux, other Tier 1 hardware, large recordings, and memory use remain unverified. No save, audio, input, shader interface, or generated-file changes were found in the diff.

Switches: HOS_NVN_ZEROCOPY_REC is added, defaults on, and is wired to HOS_AB and switches.def. Its default has not been validated against main at player settings or on the other affected platforms.

Reviewed: 15b06ffe4b against 4908cc6dad: Read AGENTS.md, CONTRIBUTING.md, the PR template, relevant standards, the commit and full diff, the new test, and the changed recording and allocator code with its callers and lifetime handling. Skimmed the remainder of host/nvn_native.c, switches.def and test_hos_ab.py; did not read every unchanged line of those files. docs/review-checklist.md and the adjacent Tooling checkout were absent. Comments and CI status were reviewed.; nothing run (a code review).

Checked and fine:

  • The commit records AI assistance with an Assisted-by trailer.
  • The switch has a switches.def row and is listed in the HOS_AB wiring test.
  • The diff contains no generated files, third-party changes, or apparent game-derived artifacts.
  • Pooled and non-pooled recording nodes are distinguished when released.

Testing: No code, tests, builds, or project scripts were run, as requested. CI was still running; the author's Windows game run and reported unit checks were considered.

Overlaps and merge order: Not checked; the network is closed.


Automated code review by BeanBot (gpt-6.1-terra), asked for by HumanBean. Nothing was run; a maintainer decides.

**Recommendation: Request changes.** The new test cannot compile on Linux or verify the recording handoff. The reported A/B result also does not establish a gain against the base at player settings. The change hands recording buffers to the queue without copying when their size class fits, and pools recording nodes and allocations. It may reduce CPU work, but adds allocator state and retained memory across recording threads. **Blocking (1)**: must change before merging. 1. **L1** `tests/test_nvn_zerocopy_rec.py:44`: The new game-free test unconditionally includes Windows headers and uses Windows thread APIs. (more on the line) **Do:** Provide platform-specific synchronization and thread wrappers for the fixture, and compile and link the POSIX version with the required pthread options. **Should fix (1)**: not blocking, but worth doing before merging. - **L2** `tests/test_nvn_zerocopy_rec.py:34`: The test never exercises the recording handoff or its size prediction. (more on the line) **Do:** Exercise the actual recording and submission handoff for both switch states, including growth and mismatched size classes, and check the submitted bytes and ownership. **Testing before merging (3)** (runs on the systems it can change; it doesn't hold the recommendation) - **L3**: The reported A/B comparison does not measure the base commit against this change at settings players use. *When:* The off side still runs this branch's changed segment layout and reservation code, while the reported run uses a headless 50% resolution profile. The claimed improvement against main therefore remains unknown. **Do:** Run interleaved base-versus-head measurements in the target and heavy areas at the device's normal resolution and quality, reporting frame times and lows over several runs. - **L4** `host/nvn_native.c:1377`: The new per-thread magazines and permanently retained node slabs have no reported memory measurement. (more on the line) **Do:** Compare peak and steady-state RAM against the base during a representative long session, including a workload with multiple recording threads. *(`@fix` does its part first: Bound or account for magazine and slab retention across threads.)* - **L5**: The Linux host path and other affected Tier 1 systems have no reported game run. *When:* The allocator, thread-local cleanup and recording handoff run on Linux as well as Windows; the only reported run is Windows on NVIDIA. **Do:** Use the Test Farm to smoke-test the Linux host and exercise recording and submission on the remaining affected Tier 1 systems, recording correctness and performance results. `@fix` can do L1, L2 and L4. **Questions (1)** (not confirmed from the code; they don't hold the recommendation) - The maintainer requested Beanstalk, but no Test Farm tool was available in this environment and network access was closed. Can the requested runs be submitted through the farm? **Checks:** Still running: 10 checks. <details> <summary>More: does it help, other systems, switches, what was read</summary> **Does it help:** Unproven against main: the reported Windows A/B run compares the PR with its switch on and off, not the base commit against the PR. It reports 13.805 ms versus 13.752 ms frame time and 1% low FPS of 57.59 versus 58.66 in a headless, reduced-resolution CPU-bound profile; player-setting and base-versus-head measurements are missing. **Other systems:** The host recording and allocation paths run on Windows and Linux independently of GPU vendor. Windows NVIDIA was reported tested; Linux, other Tier 1 hardware, large recordings, and memory use remain unverified. No save, audio, input, shader interface, or generated-file changes were found in the diff. **Switches:** HOS_NVN_ZEROCOPY_REC is added, defaults on, and is wired to HOS_AB and switches.def. Its default has not been validated against main at player settings or on the other affected platforms. **Reviewed:** 15b06ffe4b20 against 4908cc6dadff: Read AGENTS.md, CONTRIBUTING.md, the PR template, relevant standards, the commit and full diff, the new test, and the changed recording and allocator code with its callers and lifetime handling. Skimmed the remainder of host/nvn_native.c, switches.def and test_hos_ab.py; did not read every unchanged line of those files. docs/review-checklist.md and the adjacent Tooling checkout were absent. Comments and CI status were reviewed.; nothing run (a code review). **Checked and fine:** - The commit records AI assistance with an Assisted-by trailer. - The switch has a switches.def row and is listed in the HOS_AB wiring test. - The diff contains no generated files, third-party changes, or apparent game-derived artifacts. - Pooled and non-pooled recording nodes are distinguished when released. **Testing:** No code, tests, builds, or project scripts were run, as requested. CI was still running; the author's Windows game run and reported unit checks were considered. **Overlaps and merge order:** Not checked; the network is closed. </details> --- <sub>Automated code review by BeanBot (gpt-6.1-terra), asked for by HumanBean. Nothing was run; a maintainer decides.</sub>
@ -1347,21 +1375,13 @@ static unsigned pool_class(size_t n) {
while (c <= POOL_MAX && ((size_t)1 << c) < n) c++;
return c;
}
Member

L4 (should fix): The new per-thread magazines and permanently retained node slabs have no reported memory measurement.

When: Recording threads can each retain blocks in multiple size classes, and node slabs remain allocated at peak demand; the existing global pool limit does not include those allocations.

Do: Compare peak and steady-state RAM against the base during a representative long session, including a workload with multiple recording threads.

**L4** (should fix): The new per-thread magazines and permanently retained node slabs have no reported memory measurement. *When:* Recording threads can each retain blocks in multiple size classes, and node slabs remain allocated at peak demand; the existing global pool limit does not include those allocations. **Do:** Compare peak and steady-state RAM against the base during a representative long session, including a workload with multiple recording threads.
@ -0,0 +31,4 @@
assert nvn.count("hos_xmalloc(") == 3, f"expected 3 hos_xmalloc sites, got {nvn.count('hos_xmalloc(')}"
# Slice the real pool helpers & rec_node magazine from host/nvn_native.c and stress-test multi-threaded + FLS/pthread cleanup
start = nvn.index("#define COPY_MAGIC")
Member

L2 (should fix): The test never exercises the recording handoff or its size prediction.

When: The extracted slice ends before cmd_reserve_rec and EndRecording; undoing the in-place prefix or corrupting the payload handoff would leave this test passing.

Do: Exercise the actual recording and submission handoff for both switch states, including growth and mismatched size classes, and check the submitted bytes and ownership.

**L2** (should fix): The test never exercises the recording handoff or its size prediction. *When:* The extracted slice ends before cmd_reserve_rec and EndRecording; undoing the in-place prefix or corrupting the payload handoff would leave this test passing. **Do:** Exercise the actual recording and submission handoff for both switch states, including growth and mismatched size classes, and check the submitted bytes and ownership.
@ -0,0 +41,4 @@
#include <stdlib.h>
#include <string.h>
#include <windows.h>
#ifndef _WIN32
Member

L1 (blocking): The new game-free test unconditionally includes Windows headers and uses Windows thread APIs.

When: On a Linux test runner using its native C compiler, windows.h is unavailable, so the fixture fails to compile before it can test the POSIX magazine destructor.

Do: Provide platform-specific synchronization and thread wrappers for the fixture, and compile and link the POSIX version with the required pthread options.

**L1** (blocking): The new game-free test unconditionally includes Windows headers and uses Windows thread APIs. *When:* On a Linux test runner using its native C compiler, windows.h is unavailable, so the fixture fails to compile before it can test the POSIX magazine destructor. **Do:** Provide platform-specific synchronization and thread wrappers for the fixture, and compile and link the POSIX version with the required pthread options.
siantm force-pushed perf/nvn-zerocopy-recordings-sync from 15b06ffe4b
Some checks failed
PR description / Title and description (pull_request_target) Successful in 6s
beanstalk/approval approved by HumanBean (reviewed)
beanstalk/nvidia 2/1 pass
beanstalk/amd 2/1 pass
beanstalk/intel 0/1 pass, 0 running, 1 queued
beanstalk/linux 2/1 pass
beanstalk/windows+nvidia 1/1 fail
CI / What the change needs (pull_request) Has been cancelled
CI / Lint (pre-commit, ShellCheck, actionlint) (pull_request) Has been cancelled
CI / Third-party parts and guide screenshots (pull_request) Has been cancelled
CI / Rust (rustfmt, clippy, cargo test, end to end) (pull_request) Has been cancelled
CI / Host C for Windows (llvm-mingw, compile only) (pull_request) Has been cancelled
CI / Renderer build check (Windows, compile --only renderer, without and with FSR 4) (pull_request) Has been cancelled
CI / Renderer build check (Linux, compile --only renderer, without and with FSR 4) (pull_request) Has been cancelled
CI / Game-free checks (run_all.py, part 1/2) (pull_request) Has been cancelled
CI / Game-free checks (run_all.py, part 2/2) (pull_request) Has been cancelled
CI / Website build and checks (pull_request) Has been cancelled
to 428e6d1ba2
Some checks are pending
CI / What the change needs (pull_request) Blocked by required conditions
CI / Lint (pre-commit, ShellCheck, actionlint) (pull_request) Blocked by required conditions
CI / Third-party parts and guide screenshots (pull_request) Blocked by required conditions
CI / Rust (rustfmt, clippy, cargo test, end to end) (pull_request) Blocked by required conditions
CI / Host C for Windows (llvm-mingw, compile only) (pull_request) Blocked by required conditions
CI / Renderer build check (Windows, compile --only renderer, without and with FSR 4) (pull_request) Blocked by required conditions
CI / Renderer build check (Linux, compile --only renderer, without and with FSR 4) (pull_request) Blocked by required conditions
CI / Game-free checks (run_all.py, part 1/2) (pull_request) Blocked by required conditions
CI / Game-free checks (run_all.py, part 2/2) (pull_request) Blocked by required conditions
CI / Website build and checks (pull_request) Blocked by required conditions
beanstalk/approval not approved yet
PR description / Title and description (pull_request_target) Successful in 5s
2026-12-02 10:06:42 +00:00
Compare
Member

Beanstalk test farm

Commit 428e6d1 · approved by nobody yet · dashboard

A member of BigBeans can review this commit and comment @Beanstalk to test it.

<!-- beanstalk:sticky --> ### Beanstalk test farm Commit `428e6d1` · approved by nobody yet · [dashboard](https://beanstalk.magicbean.dev/prs/2932) A member of `BigBeans` can review this commit and comment `@Beanstalk` to test it.
Author
Contributor

Updated in 428e6d1ba to address BeanBot's review items and harden magazine teardown/retention:

  • L1 (portable game-free test): Replaced unconditional <windows.h> / Win32 thread APIs in tests/test_nvn_zerocopy_rec.py with #ifdef _WIN32 / #else (<pthread.h>, pthread_rwlock_t, __atomic_*, and portable thread create/join wrappers), passing -pthread on POSIX and respecting --cc / CC. Verified with both --cc clang and --cc gcc.
  • L2 (recording handoff & prediction test coverage): Expanded tests/test_nvn_zerocopy_rec.py to compile and exercise the real cmd_reserve_rec, cmd_alloc, flatten, nvnCommandBufferBeginRecording, nvnCommandBufferEndRecording, inline_recording, release_copies, free_dead_copies, and sweep_overwritten_copies slices from host/nvn_native.c across HOS_NVN_ZEROCOPY_REC=1 and =0, mid-session A/B flips, segment growth, oversized class mismatch fallback, byte-for-byte payload verification, and a 4-thread stress test with thread-exit magazine drain.
  • L4 (bounded retention + accounting) & teardown safety in host/nvn_native.c:
    • Bounded per-thread PoolMag retention (POOL_MAG_MAX_BYTES = 1 MiB) and accounted magazine bytes (pool_mag_bytes[]) against POOL_KEEP so pooled blocks across threads cannot exceed the global pool limit.
    • Bounded permanently retained rec_node slabs (REC_NODE_SLAB_MAX_BYTES = 16 MiB), falling back to malloc/free (pooled = 0) beyond the cap.
    • Cleared tls_pool_mag and set tls_pool_mag_dead in pool_mag_drain_all() to prevent dangling-TLS access during thread teardown.
  • Beanstalk & live verification note: intel (rp_06a67cb284fd7ee3) crashed identically on baseline main (3/3 on both sides), and windows+nvidia (rp_dfaf23fab82eeae3) also hung/crashed 2/3 runs on main while rp_fbe186ddb005bc7a, nvidia, amd, and linux passed. Live HOS_NVN_ZEROCOPY_REC=check on Windows RTX 4060 (market, 30 s, 2209 frames, 73.6 fps, 750,000+ recordings, 0 crashes/mismatches) and the game-free unit suite (test_nvn_zerocopy_rec.py, test_hos_ab.py, test_nvn_host_tables.py, test_recording_log_handoff.py, test_host_alloc_wait.py, etc.) pass on 428e6d1ba.
Updated in `428e6d1ba` to address BeanBot's review items and harden magazine teardown/retention: - **L1 (portable game-free test):** Replaced unconditional `<windows.h>` / Win32 thread APIs in `tests/test_nvn_zerocopy_rec.py` with `#ifdef _WIN32` / `#else` (`<pthread.h>`, `pthread_rwlock_t`, `__atomic_*`, and portable thread create/join wrappers), passing `-pthread` on POSIX and respecting `--cc` / `CC`. Verified with both `--cc clang` and `--cc gcc`. - **L2 (recording handoff & prediction test coverage):** Expanded `tests/test_nvn_zerocopy_rec.py` to compile and exercise the real `cmd_reserve_rec`, `cmd_alloc`, `flatten`, `nvnCommandBufferBeginRecording`, `nvnCommandBufferEndRecording`, `inline_recording`, `release_copies`, `free_dead_copies`, and `sweep_overwritten_copies` slices from `host/nvn_native.c` across `HOS_NVN_ZEROCOPY_REC=1` and `=0`, mid-session A/B flips, segment growth, oversized class mismatch fallback, byte-for-byte payload verification, and a 4-thread stress test with thread-exit magazine drain. - **L4 (bounded retention + accounting) & teardown safety in `host/nvn_native.c`:** - Bounded per-thread `PoolMag` retention (`POOL_MAG_MAX_BYTES = 1 MiB`) and accounted magazine bytes (`pool_mag_bytes[]`) against `POOL_KEEP` so pooled blocks across threads cannot exceed the global pool limit. - Bounded permanently retained `rec_node` slabs (`REC_NODE_SLAB_MAX_BYTES = 16 MiB`), falling back to `malloc`/`free` (`pooled = 0`) beyond the cap. - Cleared `tls_pool_mag` and set `tls_pool_mag_dead` in `pool_mag_drain_all()` to prevent dangling-TLS access during thread teardown. - **Beanstalk & live verification note:** `intel` (`rp_06a67cb284fd7ee3`) crashed identically on baseline `main` (3/3 on both sides), and `windows+nvidia` (`rp_dfaf23fab82eeae3`) also hung/crashed 2/3 runs on `main` while `rp_fbe186ddb005bc7a`, `nvidia`, `amd`, and `linux` passed. Live `HOS_NVN_ZEROCOPY_REC=check` on Windows RTX 4060 (`market`, 30 s, 2209 frames, 73.6 fps, 750,000+ recordings, 0 crashes/mismatches) and the game-free unit suite (`test_nvn_zerocopy_rec.py`, `test_hos_ab.py`, `test_nvn_host_tables.py`, `test_recording_log_handoff.py`, `test_host_alloc_wait.py`, etc.) pass on `428e6d1ba`.
dyst left a comment

Recommendation: Request changes. On Windows the new per-thread magazines are torn down through a fiber's FLS slot, not by their thread. A game fiber finalized from another thread therefore frees a magazine that its first thread still uses: a use-after-free in the recording pool. The gain is also not shown: the measured 0.4 % is switch on against switch off, on the head before this one, at a headless 720p profile, and the farm's main-against-PR runs show no gain. The branch also conflicts with main.

For a player: a little less CPU work for each finished command buffer (one copy and two allocations fewer per recording), and nothing visible. The core idea, handing over the right-sized segment instead of flattening it, is sound, and I found the handoff path correct. The allocator layer on top adds about 450 lines of hot-path state for a gain that is not yet shown.

Does it help: Unproven. The description's numbers come from HOS_AB (switch on against off) on 15b06ffe4, on one PC, at a headless 1280x720, 50 % profile: frame time −0.053 ms (−0.39 %, CI −0.004 to −0.101 ms) and average fps +0.44 %. Commit 428e6d1ba changed the allocator after those runs (byte caps, accounting atomics, the slab cap) and has no numbers of its own. The farm's main-against-PR runs at 15b06ff show no gain: p99 is within ±1 % on every target, and the Market's worst 1 % is +5 % on nvidia (32.6 → 34.4 ms) and +2 % on linux. Still needed: main against the rebased head, in interleaved runs at the settings players use, in Market and Field, with peak and steady-state RAM (BeanBot's L4).
Other systems: The change is CPU-side, so it reaches every GPU on both Windows and Linux. On Windows, see Blocking 1. On Linux the pthread key belongs to the thread, so teardown is right there. Command buffers whose recordings change size: the prediction is the size of the buffer's last recording, so a buffer that records small and then large grows by doubling, with a copy at each step (1 KiB → 64 KiB is 6 copies). On main its 64 KiB segment stayed. This is not measured outside market-entrance.
Switches: HOS_NVN_ZEROCOPY_REC (kill switch, on by default, wired to HOS_AB). The kind is right, and so is the default if the change helps, but no main-against-head numbers back the default yet. Flipping it mid-session is safe: blocks are interchangeable between the magazines and the global pool, and each node carries pooled.
Reviewed: 428e6d1ba against 4908cc6da. In host/nvn_native.c, every changed hunk and the code it relies on (flatten, cmd_release, release_copies, the sweep, free_dead_copies, inline_recording, cmd_adopt's slot numbering). Also gpu/vk/switches.def and tests/test_hos_ab.py. In tests/test_nvn_zerocopy_rec.py, its source checks and slicing, but not every line of its C harness. For comparison, the fibers in host/hos_thread.c and the thread-end teardown in host/nn_os_sync.c. A read-only merge against main be4942212. Nothing run.
Fixed in this review: nothing.
Checked and fine:

  • The zero-copy handoff. From its first reservation the segment holds a copy_prefix at its head, and copy points past it, as flatten's result did. free_dead_copies returns the segment to its own class (pre->cls). A segment more than one class too large is flattened and returned instead, so a live copy holds no more memory than on main.
  • Growth (cmd_reserve_rec) copies from after the prefix, and BeginRecording starts after it. With =0 the copy is flattened from the same offset, and cmd_release frees whatever segment is left.
  • Slot 0 is never handed out (cmd_next = 1), so the new !s die in cmd_adopt can't fire. marked only ever holds 0 or 1, so uint8_t is enough.
  • Retention is bounded now: at most 1 MiB per thread in magazines, counted against POOL_KEEP, and node slabs capped at 16 MiB.
  • BeanBot's L1 (a portable test) and L2 (the test exercises the handoff, growth, size mismatch and both switch states) are answered in the code.

Blocking

  1. host/nvn_native.c:1479 (with 1422 and 1456-1458): the magazine is cached per OS thread (_Thread_local tls_pool_mag), but it is torn down through a fiber's FLS slot. Guest fibers are Win32 fibers (host/hos_thread.c:1823). They run on one thread after another, and FinalizeFiber deletes one from whichever thread calls it (hos_thread.c:1834); DeleteFiber runs the FLS callback.
    • When it goes wrong: thread T1 makes its first pool_get or pool_put while running game fiber F, and F is later finalized from thread T2. pool_mag_drain_all then runs on T2 and frees T1's magazine while T1's tls_pool_mag still points at it. T1's next recording writes into freed memory, and if T1 is inside pool_put at that moment the two threads race.
    • If F is finalized on T1 itself, the drain sets tls_pool_mag_dead, and T1 runs without magazines for the rest of the session.
    • If F later runs on another thread, that thread's new magazine overwrites F's slot without a callback. T1's magazine is then never drained when T1 ends: it leaks, with its blocks and their share of POOL_KEEP.
    • The fix: host/nn_os_sync.c:504-526 describes this exact case for the object cache and handles it: a .CRT$XL* TLS callback on DLL_THREAD_DETACH, which runs per thread whatever fiber it is on, and a pthread key elsewhere. Do the same here and drop FLS. tests/test_obj_cache_size.py has a fiber case that the new test can copy.
  2. Conflicts with main (be4942212):
    • host/nvn_native.c: main added (system/host-settings:nvn_rec_shift) to the comment above the rec_node typedef that this PR moves. Keep main's comment and drop the typedef there.
    • tests/test_hos_ab.py, WIRED: main dropped HOS_NATIVE_OCC_RASTER when the game side moved to Rust. Keep it dropped and add only HOS_NVN_ZEROCOPY_REC, in name order.
    • The conflicts are basic, but the measurements in point 3 must then be taken on the rebased head.
  3. Measurements, as under Does it help: main against the rebased head, at player settings, with RAM. A perf change with no measured gain on its own head doesn't merge.

Suggestions

  • tests/test_nvn_zerocopy_rec.py:34: assert nvn.count("hos_xmalloc(") == 3 checks nothing this PR does, and it fails as soon as an unrelated allocation is added to the file. Drop it.
  • host/nvn_native.c:1813 (the predicted first segment): to avoid the doubling chain, predict from the largest of the last few sizes, or keep the segment when the prediction falls well short. Otherwise, measure a scene where it happens.
  • The comment of 2026-12-02 reports a HOS_NVN_ZEROCOPY_REC=check run with "0 mismatches". The switch is a bool and the diff adds no check mode, so that run compared nothing. Say in Testing what that run was.
  • The checklist ticks "on current main" and "mise run test passes", but the branch conflicts with main and the full suite wasn't run. Untick both until they hold.
  • The cmd_adopt change (!s, the slot index computed inline) is outside this PR's topic. It is harmless but could go.

Testing:

  • The author: runs on Windows 11, i7-9700, RTX 4060: the A/B on 15b06ffe4 and a 30 s run on 428e6d1ba. The game-free checks named in the description and the comment passed; the full run_all was not run.
  • The Test Farm, on 15b06ff: nvidia, amd and linux passed. windows+nvidia failed, with 2 PR runs crashed and a picture past the limit. intel couldn't be judged. The author reports that main crashed on the same testers, but the farm's summary lists only the PR's crashes, so a new run will settle it.
  • Missing: a farm run on the rebased head (it needs a BigBean's @Beanstalk), CI on the head (every job still waits on its required conditions), RAM, and the fiber case.
  • Together these hold the merge.

Overlaps and merge order:

  • #1780 (WIP, HOS_NVN_REC_HANDOFF, hands a finished recording over instead of copying it) does the same handoff with another design.
  • #2022 (WIP, keeps recorded copies in flat per-bucket arrays instead of rec_node lists) replaces what this PR's node pool pools.
  • The team should choose one handoff design before any of the three merges.
  • Not checked: #3116, #3080, #2858, #2156, #2025, #2023.
**Recommendation: Request changes.** On Windows the new per-thread magazines are torn down through a fiber's FLS slot, not by their thread. A game fiber finalized from another thread therefore frees a magazine that its first thread still uses: a use-after-free in the recording pool. The gain is also not shown: the measured 0.4 % is switch on against switch off, on the head before this one, at a headless 720p profile, and the farm's main-against-PR runs show no gain. The branch also conflicts with main. For a player: a little less CPU work for each finished command buffer (one copy and two allocations fewer per recording), and nothing visible. The core idea, handing over the right-sized segment instead of flattening it, is sound, and I found the handoff path correct. The allocator layer on top adds about 450 lines of hot-path state for a gain that is not yet shown. **Does it help:** Unproven. The description's numbers come from `HOS_AB` (switch on against off) on 15b06ffe4, on one PC, at a headless 1280x720, 50 % profile: frame time −0.053 ms (−0.39 %, CI −0.004 to −0.101 ms) and average fps +0.44 %. Commit 428e6d1ba changed the allocator after those runs (byte caps, accounting atomics, the slab cap) and has no numbers of its own. The farm's main-against-PR runs at 15b06ff show no gain: p99 is within ±1 % on every target, and the Market's worst 1 % is +5 % on nvidia (32.6 → 34.4 ms) and +2 % on linux. Still needed: main against the rebased head, in interleaved runs at the settings players use, in Market and Field, with peak and steady-state RAM (BeanBot's L4). **Other systems:** The change is CPU-side, so it reaches every GPU on both Windows and Linux. On Windows, see Blocking 1. On Linux the pthread key belongs to the thread, so teardown is right there. Command buffers whose recordings change size: the prediction is the size of the buffer's last recording, so a buffer that records small and then large grows by doubling, with a copy at each step (1 KiB → 64 KiB is 6 copies). On main its 64 KiB segment stayed. This is not measured outside market-entrance. **Switches:** `HOS_NVN_ZEROCOPY_REC` (kill switch, on by default, wired to HOS_AB). The kind is right, and so is the default if the change helps, but no main-against-head numbers back the default yet. Flipping it mid-session is safe: blocks are interchangeable between the magazines and the global pool, and each node carries `pooled`. **Reviewed:** 428e6d1ba against 4908cc6da. In `host/nvn_native.c`, every changed hunk and the code it relies on (`flatten`, `cmd_release`, `release_copies`, the sweep, `free_dead_copies`, `inline_recording`, `cmd_adopt`'s slot numbering). Also `gpu/vk/switches.def` and `tests/test_hos_ab.py`. In `tests/test_nvn_zerocopy_rec.py`, its source checks and slicing, but not every line of its C harness. For comparison, the fibers in `host/hos_thread.c` and the thread-end teardown in `host/nn_os_sync.c`. A read-only merge against main `be4942212`. Nothing run. **Fixed in this review:** nothing. **Checked and fine:** - The zero-copy handoff. From its first reservation the segment holds a `copy_prefix` at its head, and `copy` points past it, as `flatten`'s result did. `free_dead_copies` returns the segment to its own class (`pre->cls`). A segment more than one class too large is flattened and returned instead, so a live copy holds no more memory than on main. - Growth (`cmd_reserve_rec`) copies from after the prefix, and `BeginRecording` starts after it. With `=0` the copy is flattened from the same offset, and `cmd_release` frees whatever segment is left. - Slot 0 is never handed out (`cmd_next = 1`), so the new `!s` die in `cmd_adopt` can't fire. `marked` only ever holds 0 or 1, so `uint8_t` is enough. - Retention is bounded now: at most 1 MiB per thread in magazines, counted against `POOL_KEEP`, and node slabs capped at 16 MiB. - BeanBot's L1 (a portable test) and L2 (the test exercises the handoff, growth, size mismatch and both switch states) are answered in the code. **Blocking** 1. `host/nvn_native.c:1479` (with 1422 and 1456-1458): the magazine is cached per OS thread (`_Thread_local tls_pool_mag`), but it is torn down through a fiber's FLS slot. Guest fibers are Win32 fibers (`host/hos_thread.c:1823`). They run on one thread after another, and `FinalizeFiber` deletes one from whichever thread calls it (`hos_thread.c:1834`); `DeleteFiber` runs the FLS callback. - *When it goes wrong:* thread T1 makes its first `pool_get` or `pool_put` while running game fiber F, and F is later finalized from thread T2. `pool_mag_drain_all` then runs on T2 and frees T1's magazine while T1's `tls_pool_mag` still points at it. T1's next recording writes into freed memory, and if T1 is inside `pool_put` at that moment the two threads race. - If F is finalized on T1 itself, the drain sets `tls_pool_mag_dead`, and T1 runs without magazines for the rest of the session. - If F later runs on another thread, that thread's new magazine overwrites F's slot without a callback. T1's magazine is then never drained when T1 ends: it leaks, with its blocks and their share of `POOL_KEEP`. - *The fix:* `host/nn_os_sync.c:504-526` describes this exact case for the object cache and handles it: a `.CRT$XL*` TLS callback on `DLL_THREAD_DETACH`, which runs per thread whatever fiber it is on, and a pthread key elsewhere. Do the same here and drop FLS. `tests/test_obj_cache_size.py` has a fiber case that the new test can copy. 2. Conflicts with main (`be4942212`): - `host/nvn_native.c`: main added `(system/host-settings:nvn_rec_shift)` to the comment above the `rec_node` typedef that this PR moves. Keep main's comment and drop the typedef there. - `tests/test_hos_ab.py`, `WIRED`: main dropped `HOS_NATIVE_OCC_RASTER` when the game side moved to Rust. Keep it dropped and add only `HOS_NVN_ZEROCOPY_REC`, in name order. - The conflicts are basic, but the measurements in point 3 must then be taken on the rebased head. 3. Measurements, as under *Does it help*: main against the rebased head, at player settings, with RAM. A perf change with no measured gain on its own head doesn't merge. **Suggestions** - `tests/test_nvn_zerocopy_rec.py:34`: `assert nvn.count("hos_xmalloc(") == 3` checks nothing this PR does, and it fails as soon as an unrelated allocation is added to the file. Drop it. - `host/nvn_native.c:1813` (the predicted first segment): to avoid the doubling chain, predict from the largest of the last few sizes, or keep the segment when the prediction falls well short. Otherwise, measure a scene where it happens. - The comment of 2026-12-02 reports a `HOS_NVN_ZEROCOPY_REC=check` run with "0 mismatches". The switch is a bool and the diff adds no check mode, so that run compared nothing. Say in Testing what that run was. - The checklist ticks "on current `main`" and "`mise run test` passes", but the branch conflicts with main and the full suite wasn't run. Untick both until they hold. - The `cmd_adopt` change (`!s`, the slot index computed inline) is outside this PR's topic. It is harmless but could go. **Testing:** - *The author:* runs on Windows 11, i7-9700, RTX 4060: the A/B on 15b06ffe4 and a 30 s run on 428e6d1ba. The game-free checks named in the description and the comment passed; the full `run_all` was not run. - *The Test Farm*, on 15b06ff: nvidia, amd and linux passed. windows+nvidia failed, with 2 PR runs crashed and a picture past the limit. intel couldn't be judged. The author reports that main crashed on the same testers, but the farm's summary lists only the PR's crashes, so a new run will settle it. - *Missing:* a farm run on the rebased head (it needs a BigBean's `@Beanstalk`), CI on the head (every job still waits on its required conditions), RAM, and the fiber case. - Together these hold the merge. **Overlaps and merge order:** - #1780 (WIP, `HOS_NVN_REC_HANDOFF`, hands a finished recording over instead of copying it) does the same handoff with another design. - #2022 (WIP, keeps recorded copies in flat per-bucket arrays instead of `rec_node` lists) replaces what this PR's node pool pools. - The team should choose one handoff design before any of the three merges. - Not checked: #3116, #3080, #2858, #2156, #2025, #2023.
Some checks are pending
CI / What the change needs (pull_request) Blocked by required conditions
CI / Lint (pre-commit, ShellCheck, actionlint) (pull_request) Blocked by required conditions
CI / Third-party parts and guide screenshots (pull_request) Blocked by required conditions
CI / Rust (rustfmt, clippy, cargo test, end to end) (pull_request) Blocked by required conditions
CI / Host C for Windows (llvm-mingw, compile only) (pull_request) Blocked by required conditions
CI / Renderer build check (Windows, compile --only renderer, without and with FSR 4) (pull_request) Blocked by required conditions
CI / Renderer build check (Linux, compile --only renderer, without and with FSR 4) (pull_request) Blocked by required conditions
CI / Game-free checks (run_all.py, part 1/2) (pull_request) Blocked by required conditions
CI / Game-free checks (run_all.py, part 2/2) (pull_request) Blocked by required conditions
CI / Website build and checks (pull_request) Blocked by required conditions
beanstalk/approval not approved yet
PR description / Title and description (pull_request_target) Successful in 5s
This pull request has changes conflicting with the target branch.
  • host/nvn_native.c
  • tests/test_hos_ab.py
Some workflows are waiting to be reviewed.
View command line instructions

Manual merge helper

Use this merge commit message when completing the merge manually.

Checkout

From your project repository, check out a new branch and test the changes.
git fetch -u 'perf/nvn-zerocopy-recordings-sync:siantm-perf/nvn-zerocopy-recordings-sync'
git switch 'siantm-perf/nvn-zerocopy-recordings-sync'
Sign in to join this conversation.
No reviewers
No milestone
No project
No assignees
5 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!2932
No description provided.