fix(gpu): keep deferred copy bytes ordered across submissions and lists #874
Loading…
Reference in a new issue
No description provided.
Delete branch "upstream-pr/874"
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 makmatvey on 2026-11-28T08:24:02Z.
Step::Copy mutated title memory during prepare, so later refreshes and a shared staging upload could expose a newer payload to an earlier GPU read. Place large host-copy destinations when scratch exists, snapshot one-sided ranges into submission-owned uploads before the lists, and fall back to an unpooled Own buffer when the spare pool cannot supply one. Land #844's ordering regression probes.
Imported from trustno1-coder/VIctory-NVIDIA. Originally posted by thegonsalez1 on 2026-11-28T08:55:12Z.
Thanks for the #844 fixes. I compared
63b902fe1720with512feed26916using synthetic workloads on Windows 11, Core Ultra 5 225F, RTX 5060 8 GB, 32 GB RAM and NVIDIA driver 621.40.Deferred copies within one command list remain unordered. With placement forced off, both GPU reads began with
0x51in 3/3 runs per layout. The first should begin with0x21. Both deferred writes happen during submission preparation. Restoring one snapshot before the list cannot supply the first value at the intervening GPU read.The fallback is reachable with default settings. A fresh destination starts without a GPU shadow, and
place_copyrequires an existing one. Failure to allocate list scratch takes the same branch. The normal-placement probe creates the shadow before recording. Reachability follows from the code, while the incorrect bytes were measured with placement forced off. Buffer registration · Placement checks · Public copy pathTo reproduce at this head with the PowerShell helper and relay settings from #844, run
I also checked the linked fork commit
4c73241. Its two new tests passed. The same public probe passed 3/3 with normal placement and still failed 3/3 when deferred. Fork commitOn this PR, median refresh time was 15.23 → 14.97 ms across five runs per build, within observed variability. The corrected large-copy case increased median peak process working set by 38.73 MiB (133.39 → 172.12 MiB). Actual memory exhaustion and gameplay behavior remain unverified.
OpenAI Codex assisted with hardware testing, source review and this write-up.
Imported from trustno1-coder/VIctory-NVIDIA. Originally posted by jptorres96 on 2026-11-28T09:47:50Z.
Ran the PR head (
512feed) on RTX 4080 SUPER (driver 621.01), Windows build 26300, release.1. Fresh destination case (from the review above): added
a_fresh_destination_keeps_the_first_copy_for_its_read. The destination has no host copy at the first copy, so that copy is deferred; the GPU read creates the host copy; the second copy is placed. 9/9 runs correct (256 B and 8 MiB + 256, default /VICTORY_LATE_WAIT=0/2):deferred=1 placed=1 first=0x21 second=0x51. So the case argued from the code holds on hardware.2. The ordering probes can pass by timing: without
VICTORY_LATE_WAIT/VICTORY_RELAY,settle_nowreturns immediately (late() == false). Polling the readback buffer right after it, the bytes were still changing 4–197 µs later (secondprinted0x00, then the full-range check passed because by then the copy had landed). With late waits on, nothing changed after the settle. The #844 recipe setsVICTORY_RELAY=2, so the earlier measurements are valid; it's the probes run without it that can pass or fail depending on timing.Suggested test-only fix: a
card_idle(host)helper (fence signalled on the host queue and waited) aftersettle_nowin the probes. With it: 6/6 correct with and without late waits, for bothtwo_public_copies_in_the_same_listand the new test. Patch below (applies on512feed).Test patch (crates/victory-gpu/src/host/upcheck.rs, +78)
Imported from trustno1-coder/VIctory-NVIDIA. Originally posted by thegonsalez1 on 2026-11-29T21:21:51Z.
The #844 copy-ordering defect reproduces on v2026.11.29.04 (
f72cec7714aa6d6e274b761fb6fa40bfcf44243b). Thank you for the fix in #874 and for the RTX 4080 SUPER fence suggestion. On a desktop RTX 5060 8 GB, driver 621.40, Core Ultra 5 225F, 32 GB RAM and Windows 11, I compared the release with unchanged PR head512feed269169f222478269dba97b2122b59e62a. Every GPU readback below waited on an explicit direct-queue fence.Three submissions returned while the GPU was gated in each of six rounds per process, repeated in three fresh processes. Without injection the two-sided control was correct on both builds. The refusal hook fired 57 times on the release and 9 times on the PR in the two-sided case. On the release the one-sided path skipped that allocator entirely. Physical memory exhaustion was not tested.
Fresh destination, normal placement. With two 8 MiB + 256-byte copies, the release recorded two deferred steps and read
0x51, 0x51. The PR deferred the first copy, placed the second and read the expected0x21, 0x51. This held 3/3 per wait setting (default, late wait 0 and 2). The 256-byte control passed on both. A fresh destination alone therefore preserved both values on the PR under normal placement.With
VICTORY_COPIES_IN_PLACE=0, the PR still returned the second payload for both reads. Both writes are prepared before the list, so a single pre-list snapshot cannot supply the first value at the intervening GPU read. The tested normal paths pass. A normal gameplay occurrence of the both-deferred failure has not been demonstrated.The archive contains the test-only diffs for both pins, the 120-invocation matrix, sanitized readbacks and PowerShell reproduction steps. Download the synthetic ordering evidence
OpenAI Codex assisted with the testing, analysis and write-up.
Pull request closed