GPU: a command-list 64-bit memory wait lets the consumer read before its producer writes #700
Labels
No labels
accessibility
area: build
area: formats
area: gpu
area: loader
area: runtime
area: shader
bug
documentation
duplicate
enhancement
good first issue
gpu: amd
gpu: intel
gpu: nvidia
help wanted
host: wine
invalid
out of scope
question
request
run report
triage: confirmed
triage: has patch
triage: merge candidate
triage: needs info
triage: needs rebase
triage: needs work
triage: proposed close
wontfix
No milestone
No assignees
1 participant
Notifications
Due date
No due date set.
Dependencies
No dependencies set
Reference
github/Marvisak--VIctory#700
Loading…
Reference in a new issue
No description provided.
Delete branch "%!s()"
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?
@ifBars on GitHub · 2026-11-24 07:02 UTC · original
On main
d2a4bae1, I reproduced a stale read through the guest command-list and queue tables with the diagnostics build on Microsoft WARP. The list's 64-bit memory wait currently returns immediately. PR #32 implements queue fence waits and explicitly leaves this separate command-list method open.Synthetic reproduction
Create two guest direct queues, one closed list on each, and three live 64-bit words initially zero. Keep the lists, queues, and words alive throughout.
0x5a55a11cinto the payload and2into the counter, in that order.1, then copies eight bytes from the payload to the result.Once the producer completes and releases the consumer, the expected result is
0x5a55a11cin both cases. Blocking the submitting CPU thread at the first Execute would deadlock the consumer-first case. A wait in the middle of a list also needs to preserve work before it.ABI evidence
On retail build 1.0.2.1, I found two call sites on the newer list layout that pass comparison 7 and a full-width reference. They supply a 32-bit trailing argument of 0 and 1 respectively. This agrees with the XCL 64-bit implementation, which compares the full word. The 32-bit command has a distinct signature.
This establishes a command-ordering regression with synthetic data. Its contribution to the black frame or device removal in #71 is unmeasured. No title run or game data was needed for the reproduction. AI-assisted investigation and verification with Codex.
@ifBars on GitHub · 2026-11-24 07:24 UTC · original
Microsoft has a public Xbox sample for this exact pair. The graphics list draws its independent geometry, calls
Wait64BitValueX(address, comparison, value, flags), then starts the color pass. The compute list publishes the matching counter withWrite64BitValueBottomOfPipeX. This gives us a mid-list test case as well as the leading-wait case above. The sample uses equality. The synthetic reproduction above uses greater-than-or-equal.Graphics consumer · Compute producer
@LAKSHYA-cmd-tech on GitHub · 2026-11-24 07:33 UTC · original
Verified the reproduction and ABI analysis on Windows 11 MSVC:
@fuzeofficlal on GitHub · 2026-11-24 07:34 UTC · original
I extended the synthetic reproduction on
d2a4baeusing the same guest list and queue paths, on both RTX 5090 and WARP. The consumer list writes a bottom-of-pipe prefix marker, does the 64-bit wait, then copies the payload and writes a suffix marker. A second list in the sameExecuteCommandListscall writes a separate marker. The producer uses a different guest queue. I tested equality with matching low bits but different high bits initially, and greater-or-equal with a reference above the 32-bit range.Both producer-first controls copied the expected payload on each backend. With the consumer first, its submit returned with the prefix, suffix and following-list markers already written. The copy had replaced its sentinel with zero. The producer then wrote the payload and full-width counter, but the result stayed zero.
The useful acceptance check is to see the prefix marker and the original result sentinel before the producer submits, with neither later marker set. After the producer releases the wait, the result and both later markers should be visible. On main the memory copy runs during host preparation, so the wait needs to hold the suffix and following list before that stage, while leaving the producer queue free to submit.
@cj5k9dnkfd-afk on GitHub · 2026-11-24 07:40 UTC · original
Hi anyone have the gameLink it something
@NuraadGit on GitHub · 2026-11-24 07:52 UTC · original
In-title measurement: the world hits this case continuously. About 29% of list 64-bit waits are still unmet when VIctory submits the list, and none of them is satisfied by a write earlier in the same list.
Setup: RTX 2080, Windows 11, Xbox Series 1.0.2.1, diag build of
d2a4bae+ #493 + #189 + #206 (the set that keeps the world up here; see #71),VICTORY_SHADER_LOOP_LIMIT=32, Enter-only input to the world, a ~4.5-min run. Thewait_valuestub inlist.rsgot a temporary probe:host::read_into.defer_hoststep re-reads the value whenrun_deferredreaches the wait.defer_writeaddresses since its lastresetare kept, so a wait can be split into two cases. Either an earlier write in the same list produces the value (in order on the GPU, harmless), or another list does (this issue).Results (counts over the whole run; menus and loading have none unmet):
0xdd2b00000: unmet at record time but always met by submit, so its producer is submitted first.0xd0417fe00–0xd04180080(8-byte stride, not contiguous): these are the unmet ones. Each waits forreference = now + 1(rarely +2), a per-frame counter that another list has not yet written when the consumer runs. The first ones in the world wait on counters that are still0(e.g.reference=0x633 now=0x0).wait_valuea no-op, those consumer lists run with the producer's previous-frame data, or zeros the first time. I haven't yet shown how much of the black scene this explains. That needs a scheduler that holds the consumer until the producer list's writes land. As you note, blocking at Execute deadlocks the consumer-first case, so it has to be queue-level.Probe patch (diagnostics only, not for merging) on request.
AI-assisted (Claude Code): the probe, runs and log summary were automated. The hardware, title copy and runs are the user's.
@AlanQiang0418 on GitHub · 2026-11-24 07:59 UTC · original
A fix is ready, but I can't open a PR while PR creation is limited to collaborators (#712): branch AlanQiang0418:claude/list-memory-waits, commit
8dc74b6, onmaind2a4bae.Wait32BitValueX/Wait64BitValueXwaits. A wait is over once(value & mask) <comparison> reference, the comparison aD3D12_COMPARISON_FUNC; the 64-bit form compares the whole word, the argument after the value being flags.Your reproduction is ported as
a_list_waiting_for_a_value_runs_once_it_is_written: consumer first, producer first, and both in one submission, with a fence signalled after the consumer. Each gives0x5a55a11c, with the fence at 1 only after the consumer ran. It fails on the old code.cargo test -p victory-gpupasses on an RTX 5080 (46) and on WARP withdiagnostics(48). No game data.I'll open the PR when PR creation reopens. AI-assisted (Claude Code).
@NuraadGit on GitHub · 2026-11-24 08:28 UTC · original
@AlanQiang0418 I tested
8dc74b6(merged cleanly) on the RTX 2080 stack from my measurement above. On this card it makes the world lose the device almost immediately.d2a4bae+ #493 + #189 + #206,VICTORY_SHADER_LOOP_LIMIT=32, DRED, Enter-only input)8dc74b68dc74b60x887A00063 s after the first world frame. No breadcrumbs. Computeebf622dcaeae13dbwas in the in-flight set.a submission of 1 lists … list 0 of 1, of its 131: dispatch 7x1x1 [compute 3cf39f4495b908d0]. That is the compute program @matheushagedorn found most dispatched in the hung Linux list above.Two readings:
I haven't told the two apart. A run with your change and
VICTORY_SKIP_PIPELINES=3cf39f4495b908d0,ebf622dcaeae13dbwould separate them. I can do that if useful.AI-assisted (Claude Code): the builds, runs and summary were automated. The hardware, title copy and runs are the user's.
@NuraadGit on GitHub · 2026-11-24 08:29 UTC · original
Follow-up to my last comment: I skipped those two compute programs (
VICTORY_SKIP_PIPELINES=3cf39f4495b908d0,ebf622dcaeae13db) on the same8dc74b6build, and the device is still removed at world entry. This time the stop is an ordinary draw:list 0 of 3, of its 288: indexed 36x1 [vertex 861bd1a467a31f9b, pixel e63bdd53a9b47da8], with no breadcrumbs.So on this card the failure follows whatever runs first after lists start being held. It does not follow particular programs. That points at the holding and release path (reading 2) rather than at shaders hanging on real data. Without
8dc74b6the same stack runs 21 min in the world.AI-assisted (Claude Code).
@AndyLatimer on GitHub · 2026-11-24 08:44 UTC · original
A fix for this is on a branch, because new pull requests are closed right now (#717):
AndyLatimer:fix/gpu-list-wait-value, commita9a7985. It is stacked on #32 because it uses that PR's queue timeline. Only the last commit is new. I'll open the PR once creation is allowed again.What it does:
ExecuteCommandListsruns each part as its own host submission. Between two parts it holds the queue on its timeline until the word compares true. The submitting thread never blocks, so submitting the consumer first does not deadlock, and work before the wait runs at once.D3D12_COMPARISON_FUNCon the full 64-bit word, as in the call sites above (7 with a full-width reference).ALWAYS,NEVERand unknown values are not held. The trailing flags argument is ignored.Test: the reproduction above with the consumer first, plus the markers before and after the wait from @fuzeofficlal's acceptance check. Before the producer runs, the marker before the wait is set, the result still holds its sentinel, and the marker after the wait is not set. Once the producer's list runs, the result is
0x5a55a11cand the marker after the wait is set. Without the change the result is 0, as in the table.cargo test -p victory-gpu --libpasses (56 passed, 1 ignored, 0 failures in 30 runs) on Windows 11 with the hardware adapter, and thediagnosticsbuild compiles.Not run with the title, so the effect on #71 and the device removals is not measured. AI-assisted.
@LAKSHYA-cmd-tech on GitHub · 2026-11-24 09:03 UTC · original
Verified \AndyLatimer:fix/gpu-list-wait-value\ merged cleanly onto latest upstream main (\
8e79c80):@andrewpozdnakov7-jpg on GitHub · 2026-11-24 08:58 UTC · original · edited 2026-11-24 09:23 UTC
AlanQiang0418 at
8dc74b6. A held submission retains the guest list and later reads its current host recording. GuestResetclears the uploads and resets that recording in place, so recording B can replace the already submitted A. A synthetic test can submit A with a pending wait and a marker, reset with a second allocator, then close B without submitting it. When the producer releases the wait, only A should run. #32 has the relevant ownership pattern of retaining the submitted host recording and detaching it on reset. The CPU model reproduces the recording substitution. Its connection to the reported device removal remains unconfirmed. Queue retention and retry · Guest resetWindows D3D12 WARP follow-up. I ran the reset-while-held regression 10 times on each pinned revision. Both recordings used the same pending wait and wrote separate markers. A was submitted, then the guest list was reset with a second allocator and B was closed without being submitted. The test waited for the consumer fence after the producer released the wait.
8dc74b6wrote B's marker and left A's marker untouched in 10/10 runs.50ebfa1wrote A's marker and left B's marker untouched in 10/10 runs.The test on
8dc74b6paused retries only while the guest reset and re-recorded B, then let the normal queue path resume. This isolates which recording the queue picked. The test used synthetic input on the software adapter. The cause of the reported in-title device removal remains unconfirmed.AI-assisted source review and CPU/WARP checks.
@NuraadGit on GitHub · 2026-11-24 09:48 UTC · original
@AlanQiang0418 I found why
8dc74b6removes the device here, and the fix is on a branch: NuraadGit:gpu/held-list-reset, commit8168962on top of yours, +27 lines plus a test.Reseta list as soon as it has submitted it. Held work names the title's lists andrunexecutes whateverhost_list(l)holds when the wait ends. If the title has reset the list and is recording it again, the host executes an open or different list. Our removal reason was "the application made a call that is invalid", not a hang.held::list_reset(list), called at the top oflist::reset. It runs the held work that names the list first, up to and including it and whole, in queue order.a_held_list_the_title_resets_runs_firstholds a list on a counter nothing writes, resets it, and checks the queue no longer holds it and that its copy ran with the submitted commands. It fails without the change. Your two tests still pass, all three on the RTX 2080.Two more things the run showed:
0xd0417fe00–0xd04180080from my measurement above often aren't satisfied by any write the branch models. So those counters are probably written on a path you don't see, likely by shaders through UAVs, or copied back. Frames got slower: 2.9–4.1 s, with copy-back up to 40–52 MB.The reset path is logged with your "not over after 2 s" warning (a
shortcut:in the commit); tell me if you'd rather it had its own message.AI-assisted (Claude Code): the fix, test and runs were automated. The hardware, title copy and runs are the user's.
@KLeek5 on GitHub · 2026-11-24 09:06 UTC · original · edited 2026-11-24 10:01 UTC
An updated fix is available on
[KLeek5:fix/gpu-wait64-v3](https://github.com/KLeek5/VIctory/tree/fix/gpu-wait64-v3), commit[836490b](https://github.com/KLeek5/VIctory/commit/836490b9690c0215a66914f47269783bc12aa86e). It integrates main8e79c80and the source tree of #32 at9c5328d. I'll open a PR once creation is allowed again (#717).What it does:
D3D12_COMPARISON_FUNCmodes.Tests: 14/14 shared scenarios, 79/79 GPU tests (including ignored), and 400/400 stress runs passed on each of WARP and RTX 3050. Short equality tests passed 16/16 for each Signal path on both adapters.
Nonzero flags, transient external writes, and end-to-end UAV/copy-back behavior remain unverified. Full workspace CI was blocked by a missing dependency. Not tested with the title; independent testing is welcome.
@NuraadGit on GitHub · 2026-11-24 10:11 UTC · original
Image result for
8dc74b6+8168962on the RTX 2080 (#493 + #189 + #206, loop limit 32, ~4 min in the world): the presented world frame doesn't change.8dc74b6+8168962Both stay near black: faint noise, no image. So honouring the list waits, on its own, isn't what's missing for the black scene here, though it may be one of several things. The title-card and transition frames before the world look the same with or without it.
AI-assisted (Claude Code).
@KLeek5 on GitHub · 2026-11-24 07:50 UTC · original · edited 2026-11-24 12:55 UTC
An updated fix is available on [KLeek5:fix/gpu-wait64-v3](https://github.com/KLeek5/VIctory/tree/fix/gpu-wait64-v3), commit [836490b](
github.com/KLeek5/VIctory@836490b969). It integrates main8e79c80and the source tree of #32 at9c5328d. I'll open a PR once creation is allowed again (#717).What it does:
Recording. Splits host lists at wait boundaries, avoiding empty native segments for consecutive waits.
Submission. Runs the prefix immediately and holds subsequent work until the predicate is satisfied, without blocking the submitting thread. Preserves submitted recordings across guest resets.
Waking. Bottom-of-pipe writes and CPU/queue Signal capture satisfied predicates before subsequent writes. Other writes are polled. No forced timeout.
Comparison. Supports masked 32-bit and full-width 64-bit waits with all eight D3D12_COMPARISON_FUNC modes.
Memory. Uses checked guest-memory reads and releases resources for impossible predicates.
Tests: 14/14 shared scenarios, 79/79 GPU tests (including ignored), and 400/400 stress runs passed on each of WARP and RTX 3050. Short equality tests passed 16/16 for each Signal path on both adapters.
Nonzero flags, transient external writes, and end-to-end UAV/copy-back behavior remain unverified. Full workspace CI was blocked by a missing dependency. Not tested with the title; independent testing is welcome.
@AgneyaK on GitHub · 2026-11-24 19:01 UTC · original
How often this happens in the title itself, measured with a local probe on
mainffe310eplus the stack in #1232 (RTX 3050 6 GB Laptop, diag build, title 1.0.2.1, Series X profile, story load).Probe: the list's 32-bit and 64-bit wait methods (newer layout
0x248and0x250) record the condition. At submission, a host step reads the word and checks the comparison, taking 7 as>=as in this issue. Each bottom-of-pipeWritten::Valuewrite is checked against the unmet ones. Local only, not a PR.Result, 300 s:
met=2866 unmet=1024near the end. In the first minute nearly all are met (one word at0xdd2b00000, waiting for 1, which is already 1).0xd0417fe00–0xd0417fff8. The value is a frame-like counter and the word holds one less (reference=0x6f7 now=0x6f6) or still 0.So on this title the consumer-first case from the synthetic test above happens all the time during the world load, not as an edge case. I haven't checked which queues the producer and consumer are on, or what the consumers read.
AI use: Claude Code (Claude Opus 5.5) wrote the probe, ran the title on my machine and drafted this; results are from the runs described.
@KLeek5 on GitHub · 2026-11-24 19:20 UTC · original
@AgneyaK Thanks for the detailed measurements!
The fact that all 1,024 initially unmet waits were eventually satisfied, with delays of up to 4.1 seconds, is particularly interesting.
Would you be willing to test my implementation in #1023 using the same integration stack and diagnostic probe?
It would be valuable to compare:
The implementation does not use a forced timeout, so your findings could help validate its behavior under real workloads.
Thanks for your work!
@AgneyaK on GitHub · 2026-11-24 20:55 UTC · original
@KLeek5 here are the results for #1023, with #1388 measured the same way.
Setup:
VICTORY_SKIP_WAVE64=mesh, the story load. This laptop doesn't reach the world, so this covers the load only.mainffe310e+ #208 + #223/#233/#320/#439 + #452 + #579 + #431. Each PR was merged onto that base (both clean). Runs of up to 600 s.GPU queue still waiting for memorywarning, which fires after 5 s.+0x5149aec(#1232)0x887A0007)VICTORY_D3D12_DRED=1#1023:
still waiting for memorywarning in 8.5 minutes. My earlier probe saw waits met 184 ms–4.1 s after submission on the base, so none reached the 5 s line.no new host list, no failure. It ended at the same title stop as the base, a bit later.host GPU failure: wait segment: Not enough memory resources … (0x8007000E), after threeno new host list: a list to run is reset. The machine was at its commit limit (22.7 GB private + 6.9 GB GPU memory in RAM, 34.5 GB limit), andacquire_listfailing goes throughhost::fail. On low-memory machines it might be worth falling back, e.g. recording on in the same list and treating that wait as met with a warning, as #1388 does, rather than ending the process.#1388: about twice the base frame time, and the device was removed in 2 of 2 runs without DRED (at 2:46 and 3:29, after submissions of 29 and 3 lists). The DRED run didn't reproduce it, so it looks timing-dependent. #1388 makes a new
HostList(two allocators, two lists) for every wait. On this title that's thousands per load, which may explain the frame time. I'll post this on #1388 too.One run per row except where noted; spread between runs here is about ±15%.
AI use: Claude Code (Claude Opus 5.5) built the trees, ran the title on my machine and drafted this; results are from the runs described.
@Marvisak on GitHub · 2026-11-25 01:48 UTC · original · edited 2026-11-25 15:46 UTC
Automated triage for the maintainers.
Fixed in
mainby9cc37c5("GPU: lists wait on memory values; queues hold work until its waits hold").wait_valueis no longer an empty function: incrates/victory-gpu/src/list.rs,wait32/wait64(method slots0x238/0x240, newer0x248/0x250) record ahold::ValueWait. A wait recorded after commands cuts the title list into a new host list (wait,next_segment).crates/victory-gpu/src/hold.rsthen keeps each queue as a FIFO of list segments, Signals and fence Waits, and runs a queue's head once its waits hold, without blocking the submitting thread. The comparison is anyD3D12_COMPARISON_FUNCon the masked 32-bit or full 64-bit word. Work held across a titleResetkeeps its own host list. The commit addshold::testsand the GPU testresource::tests::a_list_waiting_for_another_queues_write_reads_what_it_wrote(a consumer cut at its wait, reset while held, reads what the other queue wrote).That covers the synthetic consumer-first reproduction above and the reset-while-held problem found on the fork branches. Open PRs #1023 and #1388 implement the same method on an older
mainand are superseded by this commit.Proposed close as fixed in
main(9cc37c5). This issue will be closed in 48 hours unless the reporter replies or a maintainer removes thetriage: proposed closelabel.Generated by Claude Code