Skip to content

GPU: each list takes every copy of title memory by address, whichever list numbered it - #370

Open
joroyt wants to merge 1 commit into
fxceless:mainfrom
joroyt:memory-copies-per-list
Open

joroyt wants to merge 1 commit into
fxceless:mainfrom
joroyt:memory-copies-per-list

Conversation

@joroyt

@joroyt joroyt commented Nov 25, 2026

Copy link
Copy Markdown

What

memory::ready brought the numbered copies up to date, and declared them written, once per list: at the list's first dispatch of a shader that reads title memory by address (first_read), at its first one that can store (first_write), and for the copies that very call numbered. A copy numbered in between by another list was left out of both. The module said so as a shortcut for the read side ("a copy another list numbers meanwhile is brought up to date by that list's submission, which may run after this one's").

The title records its lists on several threads, and a shader finds a copy through the directory whichever list numbered it. So a list could:

  • read a copy it had never refreshed (a new copy is all zeros until its first refresh);
  • store into a copy it had not declared written: no snapshot, no compare, and the stores never go back to title memory;
  • declare a copy written at its first storing dispatch without ever having refreshed it (the two conditions were separate), so the snapshot and the shaders both start from stale bytes.

Change (crates/victory-gpu/src/memory.rs, +24/-12)

Each list takes each copy once, for reading and for writing, kept per list with the keys first_use already has. Copies are only ever added, so a list walks them from the last one down and stops at the first it has taken: the cost per dispatch is one lookup plus the new copies, as before.

Measured

RTX 5070 12 GB (32-lane waves, driver 32.0.16.2124), i9-14900KF, Windows 11, diag build, Series X profile.

With VICTORY_BVH_BUILDER=1 (on 2119b0e + #156, which the builder needs on a 32-lane card, + #115), a local counter of the copies the old conditions would have skipped: 16 dispatches in the first two seconds of the structure builder found copies another list had numbered: 210 copies not brought up to date and 210 not declared written in all (1 to 9 a dispatch, and one dispatch with 146); in 13 of the 16 the list stores. One run; the counter is not part of this change.

Without the builder (this branch as it is, 423 s, into the world): no exception, 376-395 ms per frame at the end with 4,860 draws, against about 392 ms (2119b0e) and 357 ms (2119b0e + #156) in the same scene in two runs earlier the same evening. The runs are not a clean A/B (different lengths, the shader cache refilled after each rebuild), so read that as "no visible cost", not as a number.

Checks: cargo clippy --workspace --all-targets --locked -- -D warnings, the same with --all-features, and cargo test --workspace --locked (496 passed, 0 failed, 7 ignored), all on this branch.

What this does not do

Not tested

  • AMD and Intel GPUs, Windows 10, VICTORY_RELAY, VICTORY_LATE_WAIT.
  • Frame time with the builder on (it is dominated by the snapshots of every numbered window, 12 GB a frame here, which this does not touch).

AI use: found, written and measured with Claude (Anthropic) running in OpenCode on my machine, with my own copy of the title. No game data attached; counts and log lines only.

…e and declares it written, whichever list numbered it
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.

Ray-tracing builder runs on an RTX 5070 (32-lane) - then the title crashes on f16 box bounds

1 participant