Textures: hash big texture memory on several threads (same hash, up to 6x faster) #28
Loading…
Reference in a new issue
No description provided.
Delete branch "upstream-pr/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?
Imported from PastiiJay/klbf-lab. Originally posted by spy0eye-beep on 2026-11-25T17:32:08Z.
What
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
Imported from PastiiJay/klbf-lab. Originally posted by PastiiJay on 2026-11-25T18:38:14Z.
Thanks a lot @spy0eye-beep! Noted. It goes into tonight's RX 9070 XT test queue and I'll report the result here.
Imported from PastiiJay/klbf-lab. Originally posted by HandshakeHackin on 2026-11-26T03:11:38Z.
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
Imported from PastiiJay/klbf-lab. Originally posted by PastiiJay on 2026-11-26T10:42:30Z.
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.Warning: The "Autodetect manual merge" setting is not enabled for this repository, you will have to mark this pull request as manually merged afterwards.