[pr-performance][memory] shadow: 32-byte AVX2 fast-skip in merge_piece #440
Loading…
Reference in a new issue
No description provided.
Delete branch "Paliton/Darner-fork:pr/avx2-merge-piece"
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?
Contributor role (optional)
What it changes
shadow::merge_piece(crates/darner-gpu/src/shadow.rs) compared and updatednow,held, andtitlebyte-by-byte, writing every byte oftitleandheldeven across unchanged stretches during GPU-to-CPU shadow read-back merges.Ports the 32-byte AVX2 fast-skip path for
merge_piecefromProjectLeonida/mandy653f60d37(PR #2699,bobcatchris, GPL-3.0), runtime-dispatched viais_x86_feature_detected!("avx2")with a scalar fallback (merge_piece_scalar). Refined so that when a 32-byte chunk has differences, only the differing byte positions (trailing_zerosover the negated equality mask) are stored intotitle— avoiding writing neighbouring unchanged bytes that a title thread may be updating concurrently. Adds unit testmerge_piece_avx2_matches_scalar_across_lengths_and_patterns.How it was tested
Tested revision:
545354f(based onf3840d7)Commands and results:
cargo xtask policy->asset policy: 555 files okcargo clippy --workspace --all-targets --locked -- -D warnings-> ok (0 warnings)cargo clippy --workspace --all-targets --all-features --locked -- -D warnings-> ok (0 warnings)cargo test -p darner-gpu --lib --locked merge_piece -- --test-threads=1->1 passed; 0 failed(merge_piece_avx2_matches_scalar_across_lengths_and_patterns)cargo test --workspace --locked-> all non-flaky tests pass (1773/1774indarner-gpu; the single failure is the pre-existingwatch::tests::ask_once_by_res_splits_reservations_without_refusalsflake fixed by #262)Changes a default: yes (automatic AVX2 dispatch on x86_64 CPUs that support AVX2; identical observable output, stricter non-overwriting writes to
title).A/B result:
Isolated CPU microbenchmark (
rustc -O, Intel Core i7-14700KF, 4 MiB buffer, 200 iterations, 2 runs):In-game A/B (2 runs each, 240 s automated opening sequence,
--profile diag --features diagnostics, pureplay-defaults, RTX 5070 12 GB + i7-14700KF, Series X, 1440p -> 4K, DLSS off, FG off, RT off). Note this rig is primarily GPU-bound at 1440p -> 4K (run-to-run GPU variance ~1 ms), so average FPS gain is partly within GPU noise, while p99 spikes dropped cleanly and read-backs were spotless:f3840d7)545354f)Gates run on that revision: all three
AGENTS.mdgates +cargo xtask policyon545354f.Gameplay, when relevant: RTX 5070 12 GB + i7-14700KF, Series X, 1440p -> 4K, DLSS off, FG off, RT off. Zero read-back corruption or regressions.
Hardware dependence: x86_64 CPUs with AVX2 (safe scalar fallback elsewhere).
Coverage gaps: in-game A/B was run on a GPU-bound system rather than a CPU-bound one; non-AVX2 fallback verified via direct
merge_piece_scalarequivalence in unit tests.Checklist
main.docs/asset-policy.md.Checked for overlap
crates/darner-gpu/src/shadow.rs, non-overlapping functions)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.