perf: take the copies in the card's memory that changed from a list of their own #291
No reviewers
Labels
No labels
accessibility
bloqué : binaire console
bug
chargeur
console-dll
cpu
documentation
duplicate
enhancement
good first issue
gpu
help wanted
invalid
performance
question
runtime-gdk
wontfix
No milestone
No assignees
1 participant
Notifications
Due date
No due date set.
Dependencies
No dependencies set
Reference
github/LooperSalty--AnyXboxX!291
Loading…
Reference in a new issue
No description provided.
Delete branch "github-bot/gh-291"
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?
@Skyfrye on GitHub · 2026-11-26 01:28 UTC · original
Skyfrye:nep/card-dirty-queue→main· +133 −18 · 1 files · 1 commits · merged 2026-11-26 14:21 UTCDraft: the in-game A/B is pending (the change, its test and the profile it comes from are done).
Change
shadow::card_dirty(crates/victory-gpu/src/shadow.rs), called byHost::card_beforeat every submission, went through every copy in the card's memory (CARDED) to find those whoseCard::flaggedwas up. Nearly all were not: the pass took no lock of theirs, but upgraded and dropped aWeakand swapped an atomic for each of the thousands of copies, about 59 times a frame in the world.Now a copy goes into a list of its own (
FLAGGED) when its flag goes up (Card::flag, fromcard_changed,card_changed_runsandcopy_to_chunk), and when it is made flagged (note_carded).card_dirtytakes that list; what it does with each copy is unchanged (transient windows' chunks,dirtyranges joined, the relay'ssentnotes). A copy flagged again whilecard_dirtyruns is in the next call's list, as it was picked up by the next pass before.CARDEDstill lists every copy for the memory line; copies that are gone are taken off it innote_carded, each time its length reaches a power of two (64 and up), instead of incard_dirty.Where this comes from: a 30 s Nsight Systems capture of the world (release build of
mainat3e258c8, launcher fast set, 263 frames). On the title's submitting thread,card_dirtywas 2.5 % of the time on the CPU (theVec::retainoverCARDED), with no waits.Linked issue: none.
Verification
Windows 11 26300, Rust 1.98.1 (MSVC), on upstream
mainat578098b(merges cleanly onc4c93bd), fromthird_party/victory:The 3 failures are the same on
mainwithout this change (183 passed, 3 failed):descriptor::host::tests::spans_say_the_next_start_and_the_lowest_level_viewed,indirect::tests::warp_card_fetch_copies_flagged_pieces_to_their_slots,indirect::tests::warp_card_patch_writes_the_masked_bytes_and_no_others.New test
card_dirty_takes_only_the_copies_flagged_since(copies on the software adapter): a copy made flagged is taken by the first call; a changed copy is taken once with its ranges; nothing is taken when nothing changed; a copy changed twice is taken once with both ranges; a copy let go is passed over; and a copy whose flag and range were set without going through the list is not looked at. Revert check: withcard_dirtygoing through all ofCARDEDagain it fails (it takes that last copy too:left: [(b, [(0, 16)]), (c, [(0, 8)])]).Pending: an A/B in the world. The frame rate of the world moved 10-15 % between runs of the same build in my A/B of #278 and #279 (where the player is, and whether the driver is still recompiling shaders in the background), more than a 2.5 % share of one thread; a profile of the submitting thread is the better check.
Oracle and test data
No game file. The profile numbers come from my own capture of my copy of the game; no game code, address or dump is in this PR.
Checklist
E_NOTIMPL), never a fake success. (Nothing unimplemented here.)AI assistance: written with Claude Code. Claude Opus 5.5 read the Nsight Systems capture, wrote the change and its test, and wrote this description.
🤖 Generated with Claude Code
@KainanP on GitHub · 2026-11-26 10:32 UTC · original
Test report for #291 on three adapters.
Merges cleanly onto current main. Setup: current
origin/main(c4c93bd) merged with this PR, Windows 11,cargo test --lockedinthird_party/victory. Adapters: RTX 4060 Laptop (DXGI 0), Intel UHD 8086:a78b (16-lane waves, no FP64), WARP. The hardware adapter is picked by name through a local, uncommitted test hook and confirmed in its log; WARP for victory-gpu is--features diagnostics+VICTORY_D3D12_WARP=1. victory-gpu runs with--test-threads=1.victory-gpu --lib"main's 3" =
descriptor::host::tests::spans_say_the_next_start_and_the_lowest_level_viewed,indirect::tests::warp_card_fetch_copies_flagged_pieces_to_their_slots,indirect::tests::warp_card_patch_writes_the_masked_bytes_and_no_others. They fail on all three adapters on main too.card_dirty_takes_only_the_copies_flagged_sincepasses everywhere. No new failure. These are the same counts you give.Notes from reading the diff:
cardis set afternote_carded(or code that setsflaggedwithoutCard::flag) is never taken. The test pins that on purpose. Adebug_assert!incard_dirtyor a grep-able comment atflaggedwould keep later code from doingflagged.store(true)directly.CARDEDis now pruned only when its length hits a power of two ≥ 64. After a big drop it can hold many deadWeaks until the next doubling. That only affects the memory line, not correctness.AI use: Claude Code (Claude Opus 5.5) ran the tests and wrote this.