[pr-performance] play: keep the card buffers' 64 KiB floor under 24 GB of RAM #483

Open
Indy2l wants to merge 1 commit from upstream-pr/483 into main
Indy2l commented 2026-11-30 22:40:03 +00:00 (Migrated from github.com)

Imported from TaynanGT/Vice-Tay. Originally posted by Indy2l on 2026-11-30T22:40:03Z.


Related: #474 (settings sized to the PC), 6265cec2

What it changes

Under 24 GB of RAM, machine_settings in apps/vice-tay/src/play.rs unsets VICE_TAY_CARD_BUFFERS_MIN_KB. The engine then uses its own 512 KiB floor (the log says card_buffers_min_kb=512), so every title buffer of 64 to 512 KiB stays in RAM, and the card reads it across the bus each frame. On a 16 GB PC this made the card the limit.

This keeps play's 64 KiB floor under 24 GB, like the small-memory profile already does since 6265cec2 (measured there on an RTX 4090: 6.2 fps with the floor, 2.2 without). docs/small-memory.md already says play keeps it, so this makes the code match the doc. The other 16 GB settings (VICE_TAY_INPLACE=2, VICE_TAY_WINDOW_KB=64, VICE_TAY_WINDOW_TAILS=1) stay as they are. On a small card, what bounds the copies is still their total (VICE_TAY_CARD_BUFFERS_MB, 256 MB under 8 GB).

How it was tested

  • Graphics card, RAM, and profile: RTX 3060 12 GB (driver 621.40, Resizable BAR on), 16 GB RAM, i5-12400F. Series X, --res 1080to1440 --dlss off (1920x1080 scene, 2560x1440 output), no frame generation, ray tracing off (--set VICE_TAY_BVH_BUILDER=). Diagnostics build of main at 206e07b4, the same warm shader and pipeline cache for both runs, no F1-menu settings, the prison prologue from the same save to the crowded room, recorded with OBS.
  • Before (main as it is, so card_buffers_min_kb=512): median 3.7 fps over 96 five-second windows in the world (92 under 5 fps). Card time a frame from the layer's card meter: median 250 ms; the submitting thread waited for the card a median 156 ms a frame. Card memory 8.4 GB own + 4.1 GB shared (median), peak system commit 46.3 GB, page-ins a median 4,400/s.
  • After (only --set VICE_TAY_CARD_BUFFERS_MIN_KB=64, the value this PR keeps; the layer's switches line differs from the run before in that one switch): median 6.7 fps over 52 windows (18 under 5 fps). Card time a frame: median 81 ms; the submitting thread waited a median 14 ms. Card memory 8.7 GB own + 4.3 GB shared, peak commit 46.6 GB, page-ins a median 12,000/s. The game closed normally.
  • The routes weren't identical (a shorter stand at the first window in the run after), so on the same stretch, the last 90 s of each run (the corridor and the crowded room): card time 265 ms a frame against 98, frame time 273 ms against 104.
  • Recordings, whole run each, reviewed at one frame every 10 s: no new artifacts. In the run after, the opening cutscene started before its scene had loaded (blocky untextured shapes for its first seconds, then the right scene). The run before passed through that cutscene at about 2 fps, so it had more time to load. This looks like the existing late loading on 16 GB showing up once the frames are faster, together with the higher page-in rate, but it is not proven.
  • cargo test --locked -p vice-tay, with and without --all-features --test-threads=1: all pass (default: 93 unit tests and 11 more in the integration tests; --all-features: 94 and 11). The two tests on the 16 GB settings (each_pc_gets_its_tier, sixteen_gb_or_less_stays_on_series_x) now check that the floor is kept.
  • cargo clippy --locked -p vice-tay --all-targets -- -D warnings, with and without --all-features: clean. cargo run --locked -p xtask -- policy: 676 files ok. git diff --check: clean.

Not measured: Series S (it now runs its own build), other cards or RAM sizes, or ray tracing on. One run each way; the difference in card time (about 3x on the same stretch) is far outside what these runs vary by.

The cost is RAM traffic: page-ins went up from about 4,400 to 12,000 a second. With every 16 GB setting turned off as well (INPLACE, WINDOW_KB, WINDOW_TAILS unset), the card filled up (10.5 GB) and closing the game made system commit jump by about 26 GB to the limit and froze the PC, so those settings matter on a 16 GB PC; this PR leaves them on.

Has this been tried here before?

The floor's effect was measured in 6265cec2 (kept in the small-memory profile); this is the same floor for play's own 16 GB settings, which still dropped it. Two open pull requests touch play.rs (#479, #428), neither of them machine_settings or this switch.

  • I searched the open pull requests for the same issue and for the files this touches. Related: #474

AI-assisted: yes

🤖 Generated with Claude Code

<!-- greyfinch-sync:TaynanGT/Vice-Tay:issue:5575073854 --> Imported from [TaynanGT/Vice-Tay](https://github.com/TaynanGT/Vice-Tay/pull/483). Originally posted by [Indy2l](https://github.com/Indy2l) on 2026-11-30T22:40:03Z. --- Related: #474 (settings sized to the PC), 6265cec2 ## What it changes Under 24 GB of RAM, `machine_settings` in `apps/vice-tay/src/play.rs` unsets `VICE_TAY_CARD_BUFFERS_MIN_KB`. The engine then uses its own 512 KiB floor (the log says `card_buffers_min_kb=512`), so every title buffer of 64 to 512 KiB stays in RAM, and the card reads it across the bus each frame. On a 16 GB PC this made the card the limit. This keeps `play`'s 64 KiB floor under 24 GB, like the small-memory profile already does since 6265cec2 (measured there on an RTX 4090: 6.2 fps with the floor, 2.2 without). `docs/small-memory.md` already says `play` keeps it, so this makes the code match the doc. The other 16 GB settings (`VICE_TAY_INPLACE=2`, `VICE_TAY_WINDOW_KB=64`, `VICE_TAY_WINDOW_TAILS=1`) stay as they are. On a small card, what bounds the copies is still their total (`VICE_TAY_CARD_BUFFERS_MB`, 256 MB under 8 GB). ## How it was tested - Graphics card, RAM, and profile: RTX 3060 12 GB (driver 621.40, Resizable BAR on), 16 GB RAM, i5-12400F. Series X, `--res 1080to1440 --dlss off` (1920x1080 scene, 2560x1440 output), no frame generation, ray tracing off (`--set VICE_TAY_BVH_BUILDER=`). Diagnostics build of `main` at 206e07b4, the same warm shader and pipeline cache for both runs, no F1-menu settings, the prison prologue from the same save to the crowded room, recorded with OBS. - Before (`main` as it is, so `card_buffers_min_kb=512`): median 3.7 fps over 96 five-second windows in the world (92 under 5 fps). Card time a frame from the layer's card meter: median 250 ms; the submitting thread waited for the card a median 156 ms a frame. Card memory 8.4 GB own + 4.1 GB shared (median), peak system commit 46.3 GB, page-ins a median 4,400/s. - After (only `--set VICE_TAY_CARD_BUFFERS_MIN_KB=64`, the value this PR keeps; the layer's switches line differs from the run before in that one switch): median 6.7 fps over 52 windows (18 under 5 fps). Card time a frame: median 81 ms; the submitting thread waited a median 14 ms. Card memory 8.7 GB own + 4.3 GB shared, peak commit 46.6 GB, page-ins a median 12,000/s. The game closed normally. - The routes weren't identical (a shorter stand at the first window in the run after), so on the same stretch, the last 90 s of each run (the corridor and the crowded room): card time 265 ms a frame against 98, frame time 273 ms against 104. - Recordings, whole run each, reviewed at one frame every 10 s: no new artifacts. In the run after, the opening cutscene started before its scene had loaded (blocky untextured shapes for its first seconds, then the right scene). The run before passed through that cutscene at about 2 fps, so it had more time to load. This looks like the existing late loading on 16 GB showing up once the frames are faster, together with the higher page-in rate, but it is not proven. - `cargo test --locked -p vice-tay`, with and without `--all-features --test-threads=1`: all pass (default: 93 unit tests and 11 more in the integration tests; `--all-features`: 94 and 11). The two tests on the 16 GB settings (`each_pc_gets_its_tier`, `sixteen_gb_or_less_stays_on_series_x`) now check that the floor is kept. - `cargo clippy --locked -p vice-tay --all-targets -- -D warnings`, with and without `--all-features`: clean. `cargo run --locked -p xtask -- policy`: 676 files ok. `git diff --check`: clean. Not measured: Series S (it now runs its own build), other cards or RAM sizes, or ray tracing on. One run each way; the difference in card time (about 3x on the same stretch) is far outside what these runs vary by. The cost is RAM traffic: page-ins went up from about 4,400 to 12,000 a second. With every 16 GB setting turned off as well (`INPLACE`, `WINDOW_KB`, `WINDOW_TAILS` unset), the card filled up (10.5 GB) and closing the game made system commit jump by about 26 GB to the limit and froze the PC, so those settings matter on a 16 GB PC; this PR leaves them on. ## Has this been tried here before? The floor's effect was measured in 6265cec2 (kept in the small-memory profile); this is the same floor for `play`'s own 16 GB settings, which still dropped it. Two open pull requests touch `play.rs` (#479, #428), neither of them `machine_settings` or this switch. - [x] I searched the open pull requests for the same issue and for the files this touches. Related: #474 AI-assisted: yes 🤖 Generated with [Claude Code](https://claude.com/claude-code)
This pull request cannot be merged automatically due to conflicts.
Merge manually to resolve the conflicts.
View command line instructions

Checkout

From your project repository, check out a new branch and test the changes.
git fetch -u origin 'upstream-pr/483:upstream-pr/483'
git switch 'upstream-pr/483'

Merge

Merge the changes and update on Forgejo.

Warning: The "Autodetect manual merge" setting is not enabled for this repository, you will have to mark this pull request as manually merged afterwards.

git switch 'main'
git merge --no-ff 'upstream-pr/483'
git switch 'upstream-pr/483'
git rebase 'main'
git switch 'main'
git merge --ff-only 'upstream-pr/483'
git switch 'upstream-pr/483'
git rebase 'main'
git switch 'main'
git merge --no-ff 'upstream-pr/483'
git switch 'main'
git merge --squash 'upstream-pr/483'
git switch 'main'
git merge --ff-only 'upstream-pr/483'
git switch 'main'
git merge 'upstream-pr/483'
git push origin 'main'
Sign in to join this conversation.
No reviewers
No labels
No milestone
No assignees
1 participant
Notifications
Due date
The due date is invalid or out of range. Please use the format "yyyy-mm-dd".

No due date set.

Reference
TaynanGT/Vice-Tay!483
No description provided.