gpu/shadow: O(dirty) CopiedPages bitmask, lock-free mirrors & AVX2 merge/diff (2/4 of #51) #57
No reviewers
Labels
No labels
accessibility
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!57
Loading…
Reference in a new issue
No description provided.
Delete branch "github-bot/gh-57"
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?
@Vladimir-Human on GitHub · 2026-11-26 00:39 UTC · original
Vladimir-Human:perf/split-copied-pages-avx2→beta· +1342 −307 · 1 files · 1 commits · openSplit 2/4 of #51 cleanly on top of
beta(independent of #56, Part 3 ReBAR, and Part 4 Lazy Copy-Back).Summary of Changes (
crates/victory-gpu/src/shadow.rs)CopiedPagesbitmask +SmallRunsinline coalescer: pairs per-page copied stamps with a 64-page-per-worduncopied_bitsbitmask and inline 8-entrySmallRunssoShadow::copy_staleskips clean spans 64 pages at a time, plans coalesced copy runs underself.copied, and releases the mutex before issuing memory copies.Shadow::has_pending(AtomicBool) andCard::{has_dirty, has_sent}(AtomicBools with Release/Acquire ordering incard_dirtyandcard_merge_relay) to avoid mutex traffic on read-only windows and clean carded copies.has_avx2()runtime dispatch forfirst_difference,last_difference,changed_runs,merge_piece,merge_sync_card, andmerge_back_piece, eliminatingback_piece's per-piecemaskallocation.WideDoneworker completion, panic propagation, and TLS scratch reuse: movescopy_wideandShadow::differingonto the kept worker pool withWideDone, adaptiveWIDE_MIN_SPLITbatching, nestedIN_WIDEreentrancy guard, andSCRATCH_TITLE/parts+restbuffer reuse.copied_and_simd_tests::{plan_stale_matches_oracle_across_boundaries_and_partial_init, simd_diff_and_merge_helpers_match_scalar_oracles, nested_wide_runs_without_deadlock, wide_propagates_worker_panic_without_deadlocking_pool}and#[ignore] bench_copied_and_simd.Verification (
VICTORY_D3D12_DEBUG=1)cargo test -p victory-gpu-> passedcargo test -p victory-gpu --all-features-> passedcargo run -p xtask -- policy --staged->asset policy: 1 files ok(shadow.rs= 222,729 B)Related: #51, #56
@HandshakeHackin on GitHub · 2026-11-26 02:53 UTC · original
I tested
ea3f336on a Windows x64 runner that confirmed AVX2 was available. Across 22,380 placements of a changed byte range (including empty spans) in 31–97 byte buffers, the first/last differences and exact changed runs matched the expected values. With CPU edits at bytes 30, 31, 32, 63 and 64 where present, the copy-back merge also preserved those edits, returned the expected disjoint ranges, and left the host and title buffers byte-identical to the oracle. This exercises all-changed 32-byte blocks, ends of vectors and scalar tails using synthetic bytes. Test and logView 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.