gpu(native): scanner hands its reads to submissions; adaptive sync threads #599

Open
github-bot wants to merge 1 commit from github-bot/gh-595 into main AGit
Owner

@⁠AnastasisKon on GitHub · 2026-11-28 11:06 UTC · original
AnastasisKon:vibe/perf-m1-1705ac → main · +231 −9 · 2 files · 1 commits · open

What this changes

Step toward #179 (world frame rate): the texture scanner already read a changed texture's memory whole on its own thread, and the submission then read the same memory again to hash and detile it. Now the scanner keeps what it read (up to 64 MiB per texture, 512 MiB total, evicted oldest-first) in Watch::stashed, and the submission's Job detiles those bytes directly (Job::stashed) — a scanner-found change is no longer read twice. Also, the sync read threads were a fixed 6; sync_threads() now uses all the host's cores but two (6 on an 8-core base M1, 10 on a 12-core M1 Pro), matching the other thread pools' available_parallelism pattern. Refs #179

How it was tested

  • cargo test -p victory-gpu — 456 passed, 0 failed; 6 new tests: scanner stashes changed bytes+hash, cap eviction (5x1024 into a 4096 cap), per-texture cap, Job::read detiles stashed bytes without touching memory (bogus address proves no read), unreadable stash falls back to reading, blank stash needs no detile, sync_threads sizing
  • cargo test --target x86_64-apple-darwin -p victory-gpu --lib textures:: — 25 passed under Rosetta
  • cargo test -p victory-hle -p victory -p victory-gpu -p xtask — all ok
  • cargo clippy --workspace --all-targets --locked --target x86_64-pc-windows-gnullvm -- -D warnings — RC=0
  • cargo xtask policy — 404 files ok
  • Game run: not yet (game download still in progress; measure with VICTORY_TRACE_TEXTURE_SYNC=1 when it lands)

Checklist

  • No game files, game code, disassembly listings or SDK files are included
  • Guesses about undocumented console behaviour are marked in the code and in docs/native-host.md — torn-stash shortcut marked in code and docs ("Texture sync without the host's lock")
  • New diagnostics are behind a VICTORY_* variable and documented — n/a, no new switch
**@⁠AnastasisKon** on GitHub · 2026-11-28 11:06 UTC · [original](https://github.com/LakshanSivakumar/Native-Victory-macOS/pull/595) `AnastasisKon:vibe/perf-m1-1705ac` → `main` · +231 −9 · 2 files · 1 commits · open ## What this changes Step toward #179 (world frame rate): the texture scanner already read a changed texture's memory whole on its own thread, and the submission then read the same memory again to hash and detile it. Now the scanner keeps what it read (up to 64 MiB per texture, 512 MiB total, evicted oldest-first) in `Watch::stashed`, and the submission's `Job` detiles those bytes directly (`Job::stashed`) — a scanner-found change is no longer read twice. Also, the sync read threads were a fixed 6; `sync_threads()` now uses all the host's cores but two (6 on an 8-core base M1, 10 on a 12-core M1 Pro), matching the other thread pools' `available_parallelism` pattern. Refs #179 ## How it was tested - [x] `cargo test -p victory-gpu` — 456 passed, 0 failed; 6 new tests: scanner stashes changed bytes+hash, cap eviction (5x1024 into a 4096 cap), per-texture cap, `Job::read` detiles stashed bytes without touching memory (bogus address proves no read), unreadable stash falls back to reading, blank stash needs no detile, `sync_threads` sizing - [x] `cargo test --target x86_64-apple-darwin -p victory-gpu --lib textures::` — 25 passed under Rosetta - [x] `cargo test -p victory-hle -p victory -p victory-gpu -p xtask` — all ok - [x] `cargo clippy --workspace --all-targets --locked --target x86_64-pc-windows-gnullvm -- -D warnings` — RC=0 - [x] `cargo xtask policy` — 404 files ok - [ ] Game run: not yet (game download still in progress; measure with `VICTORY_TRACE_TEXTURE_SYNC=1` when it lands) ## Checklist - [x] No game files, game code, disassembly listings or SDK files are included - [x] Guesses about undocumented console behaviour are marked in the code and in docs/native-host.md — torn-stash shortcut marked in code and docs ("Texture sync without the host's lock") - [x] New diagnostics are behind a `VICTORY_*` variable and documented — n/a, no new switch
The texture scanner already read a changed texture whole on its own
thread; the submission then read the same memory again to detile it.
The scanner now keeps those bytes (up to 64 MiB per texture, 512 MiB
in all, evicted oldest-first) and the submission's Job detiles them
directly, halving the reads of scanner-found changes. Torn stashes
self-heal: the next round's hash differs and the texture is read whole.

The sync read threads were a fixed 6; they now use all the host's
cores but two (sync_threads), so an 8-core M1 uses 6 and a 12-core
M1 Pro 10.

Refs #179
github-bot locked as GitHub sync and limited conversation to collaborators 2026-11-28 11:18:42 +00:00
This pull request can be merged automatically.
You are not authorized to merge this pull request.
View command line instructions

Checkout

From your project repository, check out a new branch and test the changes.
git fetch -u origin '+refs/pull/599/head:github-bot/gh-595'
git switch 'github-bot/gh-595'

Merge

Merge the changes and update on Forgejo.
git switch 'main'
git merge --no-ff 'github-bot/gh-595'
git switch 'github-bot/gh-595'
git rebase 'main'
git switch 'main'
git merge --ff-only 'github-bot/gh-595'
git switch 'github-bot/gh-595'
git rebase 'main'
git switch 'main'
git merge --no-ff 'github-bot/gh-595'
git switch 'main'
git merge --squash 'github-bot/gh-595'
git switch 'main'
git merge --ff-only 'github-bot/gh-595'
git switch 'main'
git merge 'github-bot/gh-595'
git push origin 'main'
This discussion has been locked. Commenting is limited to contributors.
No description provided.