perf: the card compare's result area is a ring, not drained when half taken #255
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!255
Loading…
Reference in a new issue
No description provided.
Delete branch "github-bot/gh-255"
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-25 21:57 UTC · original
Skyfrye:nep/compare-result-ring→main· +281 −28 · 3 files · 2 commits · merged 2026-11-26 14:21 UTCDraft: the in-game check on this base is pending (the test machine's GPU is in use for a few hours). Everything below the game run is done.
Change
Each submission that has host copies in the card's memory records a compare whose results take one dword per piece in a 1 MiB area (
CardWork::differs). The area was reused from its start only when no plan was in the air (Host::card_done:if !relay() || work.out == 0 { work.taken = 0 }). With the relay a plan is nearly always in the air, so the area only filled up, and every time it was half taken the submitting thread drained every flight — a wait for the card and the copy-back of all of them — before it could go on (card_results_low→settle(WHY_MOST), counted as "lists in the air").Plans land in the order they were made, and their results are read before
card_done(relay_card_back, thencard_done). So the area is now a ring (resultring.rs):card_done; the space comes back in landing order, so the next plans keep going without the area ever being empty;No range of a plan in the air is ever handed to another plan, so a compare never overwrites results not yet read. The compare shader writes every dword of its range (0 or 1), so a reused stretch needs no clearing.
VICTORY_RESULT_RING=0restores the previous rule (reused only when empty, drained at half).Linked issue: none.
Verification
Windows 11 26300, Rust 1.98.1 (MSVC), RTX 5080, on upstream
mainataffaf15, fromthird_party/victory:With
givemade to keep every stretch (as if no plan ever landed), 3 of the first 4 tests fail; the fourth checks the former rule and passes either way. Withshort_for_nextmade to answerfalse,free_dwords_split_between_the_end_and_the_start_call_for_a_landingfails.Pending: a game run (GTA VI 1.0.2.1, my own copy, launcher settings) with the diagnostics frame lines ("settled for: ... lists in the air", "of the waiting for the card in settles"), against
mainand withVICTORY_RESULT_RING=0. I will add the numbers here before marking the PR ready.Oracle and test data
None involved. Failure cases (
resultring.rstests): 300 plans through an area of 100 dwords with three always in the air, each compared in full and never overlapping; a full area grants only what is free; a plan that lands early frees its stretch once older ones are back; the former rule without wrapping; free dwords split between the end and the start call for a landing.Checklist
E_NOTIMPL), never a fake success. (Not concerned.)AI assistance: written with Claude Code (Claude Opus 5.5): the reading of the base, the change, its tests, the checks on my machine and this description.
🤖 Generated with Claude Code
@LooperSalty on GitHub · 2026-11-26 00:07 UTC · original
Reviewed: this looks good to merge (tests pass, only the 3 known victory-gpu failures from main). Please mark it ready for review when you are happy with it and we will merge it.
@KainanP on GitHub · 2026-11-26 10:32 UTC · original
Test report for #255 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. The 5resultringtests pass everywhere. No new failure.Notes from reading the diff:
takeusestaken.front()as the lowest taken start. That holds only while stretches come back in order. After an out-of-ordergive(thea_plan_that_lands_early...case), the hole stays unused until the older stretch is back. That is safe, just wasted space, as the doc comment says.ResultRing. Nothing drivescard_results_low/card_donewith the relay on, wheregivemust receive exactly the(start, granted)thattakereturned. A WARP test with two or three plans in the air would pin that link.AI use: Claude Code (Claude Opus 5.5) ran the tests and wrote this.