gpu(native): read big texture memory chunk-parallel on the rayon pool #609
No reviewers
Labels
No labels
accessibility
bug
claimed
documentation
duplicate
enhancement
good first issue
help wanted
invalid
question
tester report
urgent
wontfix
No milestone
No assignees
1 participant
Notifications
Due date
No due date set.
Dependencies
No dependencies set
Reference
github/LakshanSivakumar--Native-Victory-macOS!609
Loading…
Reference in a new issue
No description provided.
Delete branch "github-bot/gh-605"
Deleting a branch is permanent. Although the deleted branch may continue to exist for a short time before it actually gets removed, it CANNOT be undone in most cases. Continue?
@AnastasisKon on GitHub · 2026-11-28 11:59 UTC · original
AnastasisKon:vibe/read-par-1705ac→main· +96 −8 · 4 files · 1 commits · openRefs #179
What
The texture sync read each watched texture's memory on a single thread — the scanner's chunk loop,
Job::read, and the GPU-written copy-back all copied a 4K texture's 32 MiB serially while the other 11 cores idled. Memory copy is bandwidth-bound, so this was pure lost throughput on every changed big texture.read_intonow splits buffers larger than 1 MiB intopar_chunks_mut(1 MiB)and reads the chunks independently on the rayon pool (thePoolTablemutex is only taken to walk the maps; the copies run outside it, so chunks don't serialize on it). The unreadable flag is OR-ed across chunks. Buffers at or below 1 MiB keep the single serial call. Allread_intocallers get this:Job::read, the copy-back path,read_memory.In
scan_round, a texture over 1 MiB is now read whole in oneread_intocall (chunk-parallel inside) and hashed with oneblake3::hash; smaller textures still stream through the scanner's 1 MiB buffer chunk by chunk with incremental hashing, unchanged.Adds
rayonas a workspace dependency ofvictory-gpu.Correctness
Chunk boundaries: a unit test reads buffers of 1 MiB-1, 1 MiB, 1 MiB+1 and 3 MiB+123 (the last two take the parallel path) from a source pattern and asserts byte-for-byte equality and a clear unreadable flag.
Testing
cargo test -p victory-hle -p victory -p victory-gpu -p xtask(host arm64) — all pass, incl.read_into_parallel_chunks_match_the_source_byte_for_bytecargo test --target x86_64-apple-darwin -p victory-gpu --lib textures::— 19 pass, 0 failcargo clippy --workspace --all-targets --locked --target x86_64-pc-windows-gnullvm -- -D warnings— cleancargo xtask policy— 404 files okChecklist
vibe/read-par-1705acfromupstream/main, pushed to my fork only@AnastasisKon on GitHub · 2026-11-28 12:05 UTC · original
CI green (check + macos-scripts SUCCESS), marked ready for review.
@AnastasisKon on GitHub · 2026-11-28 12:49 UTC · original
Note for review: #607, #608, #609, #612, #614 and #613 were cherry-picked together onto a local integration branch off main; host 4-crate tests, x86_64-apple-darwin tests (victory-gpu/victory-loader/victory-hle), windows-target clippy --locked -D warnings and cargo xtask policy all pass on the composed result (the scan_round hunks of #607/#605/#608 resolve to: par_iter scan_one, big textures via read_into + hash_of). Happy to rebase any of these onto another once it merges.
View command line instructions
Checkout
From your project repository, check out a new branch and test the changes.Merge
Merge the changes and update on Forgejo.