gpu(land): batch each copy's landing pieces and open guard runs #195
Loading…
Reference in a new issue
No description provided.
Delete branch "upstream-pr/195"
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 Androtim/MiniVI. Originally posted by Androtim on 2026-11-30T03:48:51Z.
Summary
Shadow::land_cardbatch (land::jobsover(copy, title_address, bytes), keeping big copies distributed up tothreads()).land::pieceintopiece_scan(identifying differing pages / guard range) andpiece_put(merging into title memory / held snapshot), and addsland::runs+land::open_guardso contiguous guard ranges are coalesced and opened once per run instead of per piece (withVICTORY_LAND_BATCH=0opt-out for A/B comparison).Shadow::land_cardwithoutside_sorted_intoover joined skip ranges, and replaces theHashSetseen lookup inHost::relay_card_backwith sortedVecbinary search / insertion.land::runsand batchedland::jobspartitioning.Verification
cargo +1.98.1-x86_64-pc-windows-gnu run -p xtask -- policy:311 files okcargo +1.98.1-x86_64-pc-windows-gnu test -p victory-gpu --lib land:: -- --test-threads=1:10 passed; 0 failed; 1 ignoredcargo +1.98.1-x86_64-pc-windows-gnu test -p victory-gpu --lib shadow:: -- --test-threads=1:43 passed; 0 failed; 2 ignoredcargo +1.98.1-x86_64-pc-windows-gnu test -p victory-gpu --lib host:: -- --test-threads=1:146 passed; 0 failed; 17 ignoredcargo +1.98.1-x86_64-pc-windows-gnu clippy --workspace --all-targets -- -D warnings: passcargo +1.98.1-x86_64-pc-windows-gnu clippy --workspace --all-targets --features diagnostics -- -D warnings: pass-PlayParity): all 6 gates PASS (12.6 fps,copyback 12.5 ms,used_max=6437/6869 MB,over=0 MB,final_waiting=1644,mapped_rate=8.21 ms/s,lit=17/24,magenta=0.0%,0crashes, guard open/note1.24–1.57 ms/frame, late frames crisp)-PlayParity):10.9 fps,used_max=6615/6872 MB,over=0 MB,room_false=88.9%,lit=18/24,magenta=0.0%,0crashes, guard open/note1.89–2.04 ms/frame, late frames crispImported from Androtim/MiniVI. Originally posted by Androtim on 2026-11-30T05:03:43Z.
Automated triage for the maintainers (not an approval).
Verdict:
needs-work· CI (check):passingReview Summary
Good direction on reducing per-piece lock and guard-open overhead in
Shadow::land_card(piece_scan/piece_put/land::runs/outside_sorted_intolook clean), but grouping jobs by(copy, block)breaks the 64 KiB block exclusivity invariant inland.rswhen two copies overlap the same 64 KiB title memory block.Findings
Data race & ordering bug when two
Shadowcopies share a 64 KiB title block (crates/victory-gpu/src/host.rs,crates/victory-gpu/src/land.rs)crates/victory-gpu/src/land.rs:19-21documents the concurrency invariant: pieces in the same 64 KiB block of title memory must stay in one job in the order given, because two copies may hold the same title memory (see alsoland::orderedcheckingaloneper 64 KiB block).Host::relay_card_back(re-sortingpiecesby(shadow.id(), block)afterland::ordered) andRelayBack::merge(sorting by(copy_idx, block)) now separate pieces from different copies that touch the same 64 KiB block, andland::jobsputs each copy into separate jobs run concurrently byland::each.safecopy::mergein non-deterministic order, violating flight order and introducing a data race.land::Notes::flush(VICTORY_LAND_TAKEN) checksthrough.all(|other| other == copy)assuming all writes to ablockin the landing are recorded in the same job'sNotes. Splitting two copies that touch the same block across different jobs causes each job to believe it was the sole writer toblockand potentially callcopy.landed(block, before, now)concurrently with the other copy's write.batch_tests::jobs_keep_copies_apart_and_fill_the_threadsexplicitly exercises overlapping blocks(0..16)for copy7and copy9being placed in separate jobs.VICTORY_LAND_BATCH=0opt-out still re-sorts by copy (crates/victory-gpu/src/host.rs)Host::relay_card_backandRelayBack::merge,order.sort_by_key(...)unconditionally sorts by(copy, block)even when!land::batch_on(), soVICTORY_LAND_BATCH=0does not restore the previous block-grouped job layout for overlapping copies.Minor nit (
crates/victory-gpu/src/host.rs)Host::relay_card_back,seen.binary_search(&(copy, lo, hi))already returnsErr(pos)with the sorted insertion index, so the subsequentseen.partition_point(...)lookup is redundant.To change the verdict:
(copy, block)re-sorting inHost::relay_card_backandRelayBack::mergebehindland::batch_on()soVICTORY_LAND_BATCH=0is a clean A/B fallback.Generated with Antigravity CLI (
agy).Imported from Androtim/MiniVI. Originally posted by Androtim on 2026-12-01T01:39:06Z.
Closing stale/conflicted backlog PR per #276. Superseded by the active root-architecture replacement pillars with isolated plain --release A/B verification.
Pull request closed