Skip to content

GPU: VICTORY_COLD_SKIP=1: refreshes pass over 2 MiB chunks with no write since (off by default) - #1358

Open
TG0000 wants to merge 1 commit into
fxceless:mainfrom
TG0000:pr/cold-skip
Open

TG0000 wants to merge 1 commit into
fxceless:mainfrom
TG0000:pr/cold-skip

Conversation

@TG0000

@TG0000 TG0000 commented Nov 26, 2026

Copy link
Copy Markdown
Contributor

AI-assisted (Claude). Off by default. This branch has not been run in the game: the numbers below come from an earlier version of the change on a local stack. Reports from other GPUs and CPUs are very welcome.

What

A refresh of a host copy walks every 64 KiB page of its range and compares the page's last copy with its last noted write (Shadow::copy_stale). A large copy that many submissions refresh is walked whole each time, mostly to find nothing.

With VICTORY_COLD_SKIP=1:

  • the write journal numbers every page it notes and keeps, per 2 MiB chunk, the number of the last one (its mark);
  • a copy remembers, per chunk, the mark it saw when a walk last left every page of the chunk fresh;
  • while the mark has not moved, the chunk is passed over.

Marks are read under the same lock as the written pages. A page still stale after its copy (taken in part, or numbered after a standing asking) keeps its chunk walked, so the same pages are copied as without the switch.

VICTORY_COLD_SKIP=alt turns it on and off every 20 s. A log line with the frame-rate line says how many pages were passed over. With the switch unset no marks are kept and every page is looked at as before.

Measured

AMD Radeon RX 6800 16 GB (RDNA2), Adrenalin 26.11.2, Ryzen 9 5900X, Windows 11, 1440p internal. One 240 s launch alternating the switch, 43 paired blocks, on a local stack with many other switches on (older base than this branch).

paired median change with the switch 95 % interval
frame time (base median 107.4 ms) -3.95 ms (30 of 43 blocks) -8.4 to -2.2
preparing -2.35 ms -6.9 to +1.1 (not distinguishable from zero)
GPU time +0.85 ms -1.3 to +3.0 (no change)
  • Pages passed over in the world: about 78 % (70 to 80).
  • A separate 180 s launch with VICTORY_REFRESH_CHECK=1: no "stale after its refresh" line. That check samples the first 256 bytes of each 64 KiB block, so it is evidence, not proof.
  • One machine, one launch each. Please do not read the 3.95 ms as a promise.

Difference from the measured version: while porting I found that it could remember a chunk holding a page that was still stale (written after a standing asking), and so not take that page again as the walk without the switch does. This PR keeps such a chunk walked; there is a test for it. The fixed version has not been measured.

Checks (on this branch, rebased on 52ac4ec0)

Built on macOS (Apple M3 Pro), cross-targeting Windows where noted:

  • cargo clippy --workspace --all-targets --locked -- -D warnings, with and without --all-features, target x86_64-pc-windows-msvc: clean.
  • The victory-gpu and victory-shader Windows test binaries build. They were not run.
  • Native cargo test for victory-core, victory-formats, victory-pipeline, victory-shader: pass.
  • cold_skip.rs (standard library only): 9 of 9 tests pass with rustc --test, including a randomized comparison of the copied runs with and without the skip, with standing askings and partly held pages. These tests model the walk; they do not drive Shadow::copy_stale itself.
  • cargo xtask policy reports two files over the size limit (host.rs, lower.rs). Both already are on main, and this PR touches neither.

Related

To try it

VICTORY_COLD_SKIP=alt and compare the two phases; once, VICTORY_COLD_SKIP=1 VICTORY_REFRESH_CHECK=1 and look for "stale after its refresh". Please report GPU, CPU, driver, the "passed over" percentage and both phases' preparing and frame times.

🤖 Generated with Claude Code

…ite since (off by default)

A refresh of a host copy walks every 64 KiB page of its range, comparing the
page's last copy with its last noted write. A large copy refreshed by many
submissions is walked whole each time, mostly to find nothing.

With the switch the write journal numbers every page it notes and keeps, per
2 MiB chunk, the number of the last one (its mark). A copy remembers per chunk
the mark it saw when a walk last left every page of the chunk fresh; while the
mark has not moved, the chunk is passed over. Marks are read under the same
lock as the written pages. A page still stale after its copy (taken in part, or
numbered after a standing asking) keeps its chunk walked, so the same pages are
copied as without the switch. VICTORY_COLD_SKIP=alt takes it in turns of 20 s.

Off by default: no marks are kept and every page is looked at as before.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Co-Authored-By: Claude Sonnet 5.5 <noreply@anthropic.com>
KomanderDG88 pushed a commit to KomanderDG88/VIniVIdiVIci that referenced this pull request Nov 26, 2026
…ite since (off by default)

A refresh of a host copy walks every 64 KiB page of its range, comparing the
page's last copy with its last noted write. A large copy refreshed by many
submissions is walked whole each time, mostly to find nothing.

With the switch the write journal numbers every page it notes and keeps, per
2 MiB chunk, the number of the last one (its mark). A copy remembers per chunk
the mark it saw when a walk last left every page of the chunk fresh; while the
mark has not moved, the chunk is passed over. Marks are read under the same
lock as the written pages. A page still stale after its copy (taken in part, or
numbered after a standing asking) keeps its chunk walked, so the same pages are
copied as without the switch. VICTORY_COLD_SKIP=alt takes it in turns of 20 s.

Off by default: no marks are kept and every page is looked at as before.

Port (upstream fxceless/victory-fork fxceless#1358 on our pile, which has no
VICTORY_DIRTY_4K): the 4 KiB sub-page parts of the pull request
(`Journal::sub`, `subpages`, the narrow copy in `copy_stale`) left out;
the marks threaded through our `writes_in` (VICTORY_GUARD_RUNS) as a sixth
argument instead of the pull request's `writes_marking`, and the answer
still read under the journal's lock before our GUARD_OUTSIDE arming is
finished. Every note of the journal (kernel write watch, guards, guard
runs, light refresh, `wrote`/`wrote_own`) goes through `Written::insert`,
and no path of our pile lowers a copy's `copied` stamps, so a chunk is
passed over only where the walk would have copied nothing.

(cherry picked from commit 6be3efb)

Co-Authored-By: Claude Sonnet 5.5 <noreply@anthropic.com>
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
KomanderDG88 added a commit to KomanderDG88/VIniVIdiVIci that referenced this pull request Nov 26, 2026
…ure fixes), cascade shadows, render-target snapshots, and switches for rays, memory and input

Twenty-two commits, tested as fe2ede8 (cargo check of the workspace with
diagnostics clean; victory-gpu --lib 356 passed, 0 failed) and built by
Codex as fe2ede8-diagnostics.

On by default, each with a way back:
- the original's fifth merge up to e4245f3 with 93db653: VICTORY_PAGE_WRITES
  now also sends back to pending the textures written by slots and by
  plain reads (1|2|8; =guards is the default of before), textures without
  room on the card are asked for again (VIctory #3198), a released view
  heap forgets its run of title memory (fxceless#589), shader fixes (fxceless#1112, fxceless#702,
  mesh corners, samplers behind a uniform branch, sampleLevel);
- fxceless#1002: exact cascade shadows on cards of 32 lanes
  (VICTORY_SHADER_CASCADE_EXACT=0 goes back);
- fxceless#1371: render targets replayed from a copy taken at SetRenderTargets
  (VICTORY_RT_SNAPSHOT=0 goes back).

Off by default: VICTORY_RT_SKIN_SKIP, VICTORY_RT_RESOLVE_SKIP,
VICTORY_ACTIVATE_RAYS_SKIP, VICTORY_HAIR_VB_SKIP (with a census of such
programs), VICTORY_ALT_FLIP (fxceless#1341), VICTORY_RAM_TRIM, VICTORY_WINDOW_REUSE
(fxceless#1362), VICTORY_COLD_SKIP (fxceless#1358), the worker chain of fxceless#1290,
VICTORY_KEYS_FILE, VICTORY_NULL_SAMPLES, and the merge's CARD_HASH_WIDE=alt,
GATHER_SEGMENTS, GATHER_DISPATCHES, DIRTY_4K, MERGE_RUNS_ALT,
HEAP_RECHECK_EVERY and WAVE_WIDE_ONLY. The profiler test walks only modules
that never unload.

Left out: diagnostics/translate-water-5dc3-6f22-2026-11-26.txt, a
translation diagnostic of the original's run that lists offsets and
instructions of two of the title's shaders.

Measured by Codex on fe2ede8, the ten switches of Status, screenshots
every second, one pair of sessions of 480 s, the same binary: in the
opening's cafeteria two faces were drawn with their features with the new
default, and one of them came out without features and the background
washed out with VICTORY_PAGE_WRITES=guards, at different moments and
poses; in the reverse pair a face came out almost all black with the new
default (the guards session was stopped by the memory guard at 391 s), so
these fixes are not the whole answer to black faces. Not measured for
frame rate yet. Neither session crashed; frames of a second
or more between 150 and 450 s: 49 (longest 5.7 s) with guards, 52 (6.8 s)
with the default. A first session with a cold shader cache was ended at
388 s by the title itself after a frame of 21.5 s spent waiting for the
runtime's remapping.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
grosterr added a commit to grosterr/victory-fork that referenced this pull request Nov 26, 2026
…x3060-n

Kept j.written.noted(first, last, marks) with guard_outside drop(held) + arming.finish ordering in watch.rs.

Co-Authored-By: Antigravity <noreply@anthropic.com>
grosterr added a commit to grosterr/victory-fork that referenced this pull request Nov 26, 2026
…o exp/rtx3060-n

Kept j.written.noted (from fxceless#1358) inside reservation::covered, combined title_memory_committed with ask_once_end(), and updated reservation test Journal to Written::new().

Co-Authored-By: Antigravity <noreply@anthropic.com>
@Filip722

Copy link
Copy Markdown
Contributor

Tested 6be3efbd integrated on main 4c604661 on Bazzite, GE-Proton11-14, vkd3d-proton 3.2.0 and an RTX 5060 Laptop 8 GB. I made two independent copies of the same Series S checkpoint, prefix and cache seed. Both replays used the same executable, indexed Wine server and 50% internal scale. Only VICTORY_COLD_SKIP changed.

Mode Unique DXGI Presents in 54 s FPS Median / p95 interval Minimum free VRAM
0 285 5.28 173 / 251 ms 1,422 MiB
1 304 5.63 167 / 236 ms 1,583 MiB

Both reached the matched cell camera at about 209 s. The enabled arm skipped a median 76.6% of page checks over 50 samples in the scoring window. Forward-copy timing moved from 58.0 to 55.8 ms/frame at the median, and reported forward bytes were 164.3 and 159.3 MB/frame. This is one replay per mode. Streaming activity varied, and an earlier 50% run without the PR gave 5.86 FPS, so the test does not establish a net gain over main.

The nine cold-skip regressions passed on the Windows-target binary under Proton with the feature off and on. The stale-page regression passed. The wider watch filter matched the control exactly at 17 passes, two inherited Wine capability failures and one ignored. The two failures were the Event Log subscription stub and the missing placeholder query.

Assisted by Codex (GPT-6.2-Sol High).

@TG0000

TG0000 commented Nov 27, 2026

Copy link
Copy Markdown
Contributor Author

CI status: the only failing check is repository_passes_policy. It fails on two upstream files over the 512 KiB limit, crates/victory-gpu/src/host.rs (534,239 bytes) and crates/victory-shader/src/emit/lower.rs (546,915 bytes). This PR changes neither file, and main fails the same check.

#1357 fixes this by moving those test modules into their own files.

Depends on: #1357

I'll re-run CI (or rebase) once #1357 lands.

(AI-assisted comment.)

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants