Textures: hash big texture memory on several threads (same hash, up to 6x faster) #28
No reviewers
Labels
No labels
accessibility
bench-bm-v1
bug
documentation
duplicate
enhancement
good first issue
help wanted
invalid
question
wontfix
No milestone
No assignees
1 participant
Notifications
Due date
No due date set.
Dependencies
No dependencies set
Reference
github/PastiiJay--klbf-lab!28
Loading…
Reference in a new issue
No description provided.
Delete branch "github-bot/gh-28"
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?
@spy0eye-beep on GitHub · 2026-11-25 17:32 UTC · original
spy0eye-beep:klbf-fast-hash→beta· +115 −5 · 3 files · 1 commits · openWhat
Texture memory is hashed with BLAKE3 at a check to tell whether it changed (partly mapped textures,
through_copy, view memory taken by turn, the unlocked read). That ran on one thread: about 4.5 GB/s here, 3.7 ms for a 16 MB texture.From 1 MiB on, the hash now runs on several threads (
blake3with itsrayonfeature,Hasher::update_rayon). The hash is the same: BLAKE3 hashes a fixed tree of 1 KiB chunks, whichever thread hashes which part. So what is detected as changed, uploaded and drawn is unchanged.cargo test --release -p victory-gpu --lib content_hash_speed -- --ignored --nocapture, i7-13620H (6 P + 4 E cores):content_hashBelow 1 MiB it stays on one thread (
blake3::hash), where threads cost more than they save.Same output
the_wide_hash_is_the_hash:content_hashequalsblake3::hashat 0, 1, 1024, 1025 bytes, at the 1 MiB switch ±1, past it by a chunk, and at 3, 8 and 9 MiB plus odd tails.blake3::hash(read|tiled)calls intexture.rsare the only ones changed; pipeline and shader-cache hashes are left alone.Cost
blake3/rayon:rayon-core,crossbeam-deque,crossbeam-epoch,crossbeam-utils(Cargo.lock +36 lines). Rayon's pool starts on the first big hash, one thread per logical CPU.Testing
cargo test -p victory-gpu --all-featureson the RTX 4060 Laptop: 163 passed, 0 failed.cargo build --release -p victory: OK. Clippy: onlybeta's existing two errors. rustfmt: no new differences.cargo xtask policyreports the same 4 findings asbeta(lower.rssize,logo.svg, two.pyfiles), none new.AI-assisted (Claude).
🤖 Generated with Claude Code
@PastiiJay on GitHub · 2026-11-25 18:38 UTC · original
Thanks a lot @spy0eye-beep! Noted. It goes into tonight's RX 9070 XT test queue and I'll report the result here.
@HandshakeHackin on GitHub · 2026-11-26 03:11 UTC · original
I reran the unmodified release benchmark at
39ad849on a smaller Windows VM (AMD EPYC 7763, 2 cores / 4 logical processors). The eleven byte-for-byte hash fixtures passed withRAYON_NUM_THREADS=1,2, and the unset default. The table gives median milliseconds per hash over six interleaved runs of each configuration.The serial column is the paired serial reference from the default-pool runs. On this VM the default paid off at the 1 MiB threshold, while a single-worker Rayon pool had a small overhead. These are isolated texture-hash timings. Runner, per-round results, and medians
@PastiiJay on GitHub · 2026-11-26 10:42 UTC · original
Thanks for the small-VM rerun; good to know it holds on fewer cores. We'll check it in game.
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.