Repository navigation
victory-gpu: 64-thread CARD_COMPARE with per-plan VRAM staging and COPY queue readback - #688
Claudinhomerq wants to merge 1 commit into
Conversation
|
Independent RTX 5080 comparison. Windows 11 Pro 26200, driver 617.14, Ryzen 9 5900X, 32 GB RAM, Series X profile, SATA SSD and DRED. I compared
The PR run had visible missing wall and ceiling surfaces at a similar interior angle after retreating. The base capture showed those surfaces. This comparison is the full PR versus its base. It does not isolate staging from the other changes. The title responded to input and ended deliberately after the capture. DRED did not report device removal. All 13 selected relay/card/compare tests passed, including a rerun that required WARP initialization in both card-compare tests. Method, GPU busy and sample counts. Testing and reporting assisted by OpenAI Codex. Same-binary follow-up on
The same wall and ceiling gaps appeared in both modes at the post-retreat interior angle. Both runs logged the same |
|
Another RTX 5080 series, on a different CPU from @iGoldenNinja's, with this PR's two settings and the base alternated in one sitting. Setup. RTX 5080 16 GB (driver 610.88), Ryzen 7 7800X3D, 32 GB, Windows 11 Pro 22631, diag build, rustc 1.98.1. PR head 7e7bb18 as it is (it sits on 310c6eb; it also merges onto today's 8dd30ab without conflicts, not run there yet). The base binary is 310c6eb with #154's two commits and
So here staging takes the fetch wait from about 100 ms to about 30 and halves copying back, as in the PR's and @iGoldenNinja's numbers, but the frame gains only 7-10 ms of 162-163 (about 5%). The relay thread now spends most of its time waiting for the card with nothing to land (71-78 ms), and the card is 73-75% busy against 78% on the base, so on this machine the frame is held by the card and the submitting thread rather than by the fetches. With staging off, the other parts of the PR (wide compare, parallel merge) are worth about 6-7 ms on their own. Picture. Screenshots at 300 and 350 s, checking the chain-link mesh in the window, the print on the back of the shirt and the cell wall left of the window:
On the wall and ceiling gaps: the cell wall left of the window is missing in most runs of every build I have run in this scene since On the hazard raised on #71 (a fetch beside later flights): as I read (Runs, measurements and this note by Claude Code with Claude Opus 5.5 on the hardware above, at the account owner's request.) |
The 9e6137f run spent 54 ms a frame copying back on the thread that lands flights, merging the pushed runs one after another. The runs of a landing are now noted first and merged once every plan's are, before the slots are given back: with VICTORY_WIDE_MERGE=1 each copy's runs go to one thread in their order (a copy's merges take its own lock anyway), the copies spread over up to eight jobs by their bytes. Without the switch the runs merge in the same order as before. The push line now says how many copies the runs were of and how long the merges took, so a run shows whether the copy-back is spread over enough copies to gain from the threads. This takes the parallel-merge part of fxceless fxceless#665 and fxceless#688 for the push path. Their copy-queue fetch and VRAM staging do not apply with VICTORY_CARD_PUSH on, where nothing is fetched. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_017V7WBB9Mgcxkr8YRW4LAzi
|
@Claudinhomerq, I checked the per-plan staging boundary on 7e7bb18. Two tracked flights write 17 and then 29 to the same 64 KiB pieces. Both finish on DIRECT before the relay lands the first one. With 256 changed pieces, the first landing returns 256 producer words. With 257, the flags show 256 staged and one overflow. That first landing returns 256 words of 17 and one of 29. The second landing returns 29 for all 257. This repeated twice each on WARP and an RTX 2060 SUPER with staging enabled. Only the overflow piece took the live DIRECT fallback. Is that piece intended to retain the producing flight's value at its first landing? Exact test and transcripts. Prepared with the help of Codex 6.2 Astra Max. |
…M via COPY queue + READBACK, and parallelize relay merge - Parallelize CARD_COMPARE from 1 thread per 64 KiB piece (4,096 serial loads) to one 64-thread group per piece (64 coalesced loads + deterministic groupshared tree reduction). - Under VICTORY_RELAY (when VICTORY_INFLIGHT_FETCH is off), inline-stage differing pieces inside CARD_COMPARE into an exclusive per-plan DEFAULT-heap VRAM StageBuf (256-byte-aligned 65,792 B stride) with an explicit UAV -> COMMON barrier at the end of check, avoiding any simultaneous DIRECT-write / COPY-read hazard on the same ID3D12Resource (escape hatch: VICTORY_CARD_INLINE_STAGE=0). - Pull staged pieces on a dedicated D3D12_COMMAND_LIST_TYPE_COPY queue into a canonical D3D12_HEAP_TYPE_READBACK buffer so relay_card_back no longer stalls behind newer graphics flights queued on the DIRECT queue. - Enable VICTORY_WIDE_MERGE parallel merging in relay_card_back across byte-disjoint chunks (keeping overlapping sub-ranges in chronological order) using an RwLock on Shadow::before. - Extend WARP D3D12 unit tests to cover skewed 65,552 B pieces, ring overflow fallback, and COPY-queue readback into D3D12_HEAP_TYPE_READBACK. Co-authored-by: OpenBot <335604065+openbotgit[bot]@users.noreply.github.com>
7e7bb18 to
7b91f86
Compare
|
Thanks for the thorough overflow test on both WARP and the 2060 SUPER, @Pin0d1! Yes — that behavior on the 257th (overflow) piece is intentional and matches
I also just rebased this branch cleanly onto |
Summary
Reduces GPU-to-CPU card-memory readback latency and eliminates
DIRECTqueue fetch stalls underVICTORY_RELAY=1:64-thread workgroup
CARD_COMPAREcompute shader (crates/victory-gpu/src/host.rs)[numthreads(64, 1, 1)]) per piece using coalesced 16-byte loads and deterministic groupshared reduction.Per-plan exclusive VRAM staging + dedicated
COPYqueue readback (crates/victory-gpu/src/host.rs)VICTORY_RELAY=1and inline staging is enabled (default; disable withVICTORY_CARD_INLINE_STAGE=0), differing pieces are written inline to a per-plan exclusiveDEFAULT-heapStageBuf(65792B stride, 256 slots/plan, explicitUAV -> COMMONbarrier) and pulled over a dedicatedD3D12_COMMAND_LIST_TYPE_COPYqueue into a canonicalD3D12_HEAP_TYPE_READBACKbuffer (Host::readback_buffer).CARD_DIFF_OVERFLOW_BITand cleanly falls back to the existingDIRECTqueueCopyBufferRegionfetch path.Byte-disjoint parallel relay merge (
crates/victory-gpu/src/host.rs,crates/victory-gpu/src/shadow.rs)partition_disjoint_merge_chunks) for parallelwide_runmerging while keeping overlapping ranges ordered by submission sequence and preservingshadow.walls_merged(...).Shadow::beforefromMutextoRwLockso parallel readers do not serialize.Tests (
crates/victory-gpu/src/indirect.rs,crates/victory-gpu/src/host.rs)CARD_COMPAREtest for the 8-constant / 4-UAV root signature.warp_card_compare_inline_stages_and_handles_ring_overflow(verifying skewed 65,552 B pieces, ring overflow, tail reclamation, andCOPYqueue ->READBACKtransfer on WARP) andrelay_tests::disjoint_merge_chunks_keep_overlaps_together.Measured Impact (RTX 5070 Ti,
VICTORY_RELAY=1, 395s sustained run, 0 crashes/TDRs)286-324 ms(3.1-3.5 FPS) ->221-237 ms(4.2-4.5 FPS)fetches:148 ms->41 ms(-67%)128 lists in the airstalls:76 ms->0.0 ms(-100%)copying back:-52%;on the GPU:-65%Verification
cargo xtask policy—asset policy: 169 files okcargo test -p victory-gpu --lib -- warp_card_compare relay_tests card_tests—13 passed; 0 failed