gpu: join copy_beside before placed_copy/publish in submit split and note batch writes on shader_writes #2433
Loading…
Reference in a new issue
No description provided.
Delete branch "upstream-pr/2433"
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 trustno1-coder/VIctory-NVIDIA. Originally posted by qlfu on 2026-11-29T13:00:01Z.
What it changes
Fixes two synchronization/tracking bugs in opt-in GPU submission and indirect-batching paths on
origin/main(829188e9):VICTORY_SEND_BESIDE=1beforeplaced_copy/ submission publish underVICTORY_SUBMIT_SPLIT=1(crates/victory-gpu/src/host.rs): Whenpublishis true,Host::submitcallsself.card_take(...)which spawns asynchronouscopy_besidereads ofShadow::data, then only joinedsnapped(&mut snapping)before mutatingShadow::dataviashadow.placed_copy(...)and releasing thesubmittedlock for the next submission's refreshes. Joiningown.copied()immediately aftersnapped(&mut snapping)preserves overlap with snapping while preventing tornShadow::datareads.HostList::note_batch_writeon early returns inShadow::gpu_writesandShadow::shader_writes(crates/victory-gpu/src/shadow.rs): UnderVICTORY_INDIRECT_BATCH=3,Shadow::shader_writesreturned early forself.place.is_some()(e.g.VICTORY_PORT_CONSTANTS=1) andwc_no_backbuffers without callinglist.note_batch_write, andShadow::gpu_writesomitted it on thewc_no_backearly return. Both paths now record the write inWriteLogso subsequent indirect batches do not reuse stale clamped arguments.How it was tested
cargo testpassed for the crates it touches: yes (cargo test -p victory-gpu --lib --locked indirect::batch -- --test-threads=1passed, exit 0;cargo clippy -p victory-gpu --lib --tests --locked: 0 new warnings;--all-featureshits pre-existingmainshadowing inhost.rs:8673tracked by #2208).Checked for overlap
SEND_BESIDE,SUBMIT_SPLIT,shader_writes, andnote_batch_write; no overlapping open PR found.Imported from trustno1-coder/VIctory-NVIDIA. Originally posted by Dukestar69 on 2026-11-29T13:04:38Z.
Review: APPROVED
Tested locally merged onto
main(829188e9).crates/victory-gpu/src/host.rsandshadow.rs.cargo test -p victory-gpu --lib shadow::passed (71 passed; 0 failed; 5 ignored).cargo test -p victory-gpu --lib host::written_spans_tests::passed (3 passed; 0 failed).Clean ordering fix joining
copy_besidebeforeplaced_copy/publishin submit split and recording batch writes onshader_writes. LGTM.Synthetic tests only (no game files used). AI-assisted (Gemini 4 Neon).
Imported from trustno1-coder/VIctory-NVIDIA. Originally posted by qlfu on 2026-11-29T14:53:56Z.
Updated with deferred
copy_besidejoin (send::CopyWait+Host::pending_copy_beside):Shadow::placed_copywhen!batch.placed.is_empty()and beforeShadow::update/refresh_front/refresh_ahead/run_deferredon the next submission (plus top ofHost::settle), keeping theCopyWaitmutex held acrosscopying.join().copy_besideand submission N+1'scard_steps/sweep/ask_once.0 WARNs / 0 ERRORs):card_copiesdropped2.10 -> 1.30 msmedian (2.53 -> 1.57 msmean, -0.96 ms/frame); allindirect::batch,host::send, and fullvictory-gpu(926 passed; 0 failed) tests pass with0new clippy warnings.Imported from trustno1-coder/VIctory-NVIDIA. Originally posted by qlfu on 2026-11-29T15:33:16Z.
Reverted the deferred
CopyWaitexperiment back to joiningown.copied()immediately beforeplaced_copy/publish(48099873):victory-relay(Shadow::card_merge_relayinshadow.rs:7188) mutatesShadow::dataconcurrently without holdingHost::submitted, so keepingcopy_besideactive pastpublishcan race with landed shader writes (and produced visual reflection artifacts in live testing).own.copied()immediately beforeplaced_copy/publishguarantees no backgroundcopy_besidereader remains alive onceHost::submitreleasessubmitted.Imported from trustno1-coder/VIctory-NVIDIA. Originally posted by Yoruiopz on 2026-11-30T11:22:48Z.
Independent Windows verification on .05 (
41adb551) with synthetic memory. The CPU-only fixture used the production submit, send, and shadow code. A pending 32 KiB upload captured 0xC7 from a later placed update instead of its original 0x39 in four controlled schedules: the update was in the same submission or after handoff, and the copy job was queued or already claimed by a worker. All four preserve 0x39 when the exact patch from48099873is applied on .05. The synchronous and already-completed controls pass on both revisions.The locked Windows diagnostics crate build passed eight relevant CPU unit tests, with one adapter-dependent case ignored. The reproduction used CPU memory and synthetic bytes. The current #3809 and #3881 patches also apply cleanly on this tree.