D3D12.X: a same-list write drops a later wait only when its value meets it #2506
No reviewers
Labels
No labels
accessibility
bug
documentation
duplicate
enhancement
goal:world-load
good first issue
help wanted
invalid
keep-open
off-goal
question
stale
test-only
wontfix
No milestone
No assignees
1 participant
Notifications
Due date
No due date set.
Dependencies
No dependencies set
Reference
github/xcl-dev--xcl!2506
Loading…
Reference in a new issue
No description provided.
Delete branch "github-bot/gh-2506"
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?
@tiagonleal on GitHub · 2026-11-25 21:03 UTC · original
tiagonleal:wait-memory-self-write-value→main· +116 −4 · 1 files · 1 commits · openwait_memorydrops aWait32/64BitValueXwhenever the same open list already wrote an overlapping address (has_prior_write, there since3dfbcfbd). The comment gives the reason: the write is earlier in the same list, and polling the address before that list is submitted would only wait on our own unsubmitted list. That holds only when the value the list wrote meets the wait. A list that resets a counter (Write64BitValue…X(X, 0)) and then waitsX >= 1for another queue to raise it lost the wait, so it ran without waiting for the producer. With this change such a wait is recorded like any other wait. A wait that the list's own last write meets is still dropped, also after a mid-listsplit. Part of #1452.What is in it
crates/xcl/src/hle/d3d12x/list_x.rs:ListStatekeeps the value of the list's last immediate write (write:Write32/64BitValue…X) per address, cleared whereverwritten_rangesis cleared. A later write over it of unknown value (fill,CopyMemoryToMemoryX, timestamp) forgets it.wait_memorydrops the wait when that value, masked, meets the comparison (compare_u64), or when there is no known value for exactly that address and width (fill, copy, partial write), as before.splitcarries the written values to the next segment together with the written ranges (writes_for_split), so a wait after a split is judged the same way.a_wait_after_an_own_write_is_dropped_only_when_the_written_value_meets_it: the eightD3D12_COMPARISON_FUNCs for 32 and 64 bit, a 64-bit value above 32 bits, theWait32BitValueXmask, the last of two writes, a write to another address, and a fill over the value.a_split_segment_keeps_the_written_value_for_a_later_wait: a list writesX = 0and then waitsX >= 1; after the split the wait is kept. It exercises whatsplitcarries to the next segment (thewrites_for_splitpair), notsplititself.A title that writes an address and then waits on it in the same list for a value its own write does not meet now gets that wait (before, it was dropped). If nothing else ever produces the value, the wait behaves like any other wait without a producer: the CPU fallback blocks the submitting thread for up to 2 s, or the GPU bridge waits until the watchdog releases it at 5 s. Before, the list just ran.
Tested
a4b66e81onmain6d12f58a.main6d12f58a, with only the drop condition ofmainrestored, fails on its first case:64-bit: wrote 0x0, wait op 7 0x1,left: 0, right: 1(the wait is dropped). The split test fails withwrites_for_splitreturning no values:the wait after the split was dropped,left: 0, right: 1.a4b66e81:cargo test -p xcl --lib -- a_wait_after_an_own_write a_split_segment_keeps: 2 passed, 3 of 3 runs.cargo test -p xcl --lib -- hle::d3d12x, 6 runs (earlier head46456f0d, not repeated ona4b66e81): 254 passed, 0 failed, 2 ignored in 5 runs. In 1 runa_dispatch_with_a_pipeline_still_building_waits_at_the_submitfailed (segment count 389, expected 421). The same test failed 1 time in 6 runs onmain6d12f58a(252/253 passed), so it depends on timing and fails without this change too.cargo test --workspace --no-fail-fast -- --test-threads=4, run twice ona4b66e81: 1421 passed, 4 failed, 46 ignored both times. The 4 failures aregpu::dxil::fuzz_tests::fuzz_validate_and_gpu_0..3(CreateComputePipelineState: E_OUTOFMEMORY). They failed onmain6d12f58ain earlier runs; I did not run them onmainagain today.SKIPPEDlines on this adapter: 24 GPU tests that need wave32/wave64 forms this adapter does not have ("no wave64"), andheap_window_out_of_memory_falls_back_to_the_switch_form("no heap windows").Regression run
60 s each, the same retail title, release builds, one after the other.
main:This PR:
Earlier diagnostic runs (a build with a log line in
wait_memory, 60 s and 100 s) were made on the previous head46456f0d. They logged no same-list wait, dropped or kept. This title does not reach the changed check in that time, so the smoke runs only show that nothing else regressed.Not tested
split; it checks only the valuessplitcarries over.Overlap: #1256 (records
cpu_writesranges for this drop) and #592 (range tracking) change the same check. Neither looks at the written value. With #1256, its title-memory writes would have no known value here and would still be dropped.AI use
🤖 Generated with Claude Code
@DavidM1911 on GitHub · 2026-11-25 21:14 UTC · original
Verification on RTX 3060 Ti (Windows 11), branch merged with current
main:cargo test -p xcl --lib: all passed, 0 failed, ~26 ignored. (Intermittent single-test flake / 0xc0000005 abort under parallel scheduling — tracked in #1978; clean on single-threaded rerun.)Thanks!
@SlopTart on GitHub · 2026-11-25 21:15 UTC · original
gpu_suite (cold cache): 164 passed / 3 failed, no crashes. The three are the known baseline on this lane (seed-1003 fuzz, mad/mac contraction, promoted-UAV-clear driver gap, PR #2490); none caused by this PR.Targeted run of
a_wait_after_an_own_write_is_dropped_only_when_the_written_value_meets_it: passed. Lane context: this fence/wait area is the same machinery behind the two redd11_*tests on #2439; this PR does not change them on this lane.@emirduran707 on GitHub · 2026-11-25 21:29 UTC · original
Independent AMD RDNA4 (native wave64) test report on exact head
46456f0d4e5e2cbc55ddc3d15efd8002cb1f0165(clean detached checkout, no local changes).Tested
stable-x86_64-pc-windows-msvc), DXC 1.9.2602.17; tests debug, smoke release.cargo build --workspace && cargo test --workspace --no-fail-fast -- --test-threads=4: 1422 passed, 2 failed, 46 ignored; 8 SKIPPED (6 inlower_dxil::tests::{f16,f32}_programs_on_the_gpurefused by per-lane form;heap_window_out_of_memory_falls_back_to_the_switch_form;pso_measurement_compiles_an_exact_synthetic_record). All native wave64 GPU tests ran and passed.hle::d3d12x::list_x::tests::a_wait_after_an_own_write_is_dropped_only_when_the_written_value_meets_it.gpu::dxil::fuzz_tests::fuzz_validate_and_gpu_1seed 722 andfuzz_validate_and_gpu_3seed 1599) are pre-existing on unmodifiedmainon this GPU.Regression run (60 s retail-title smoke,
XCL_NETWORK=0, release)(Matched
main68a284abaseline on the same machine today: 1573 frames, 14420 MB peak, 0 device removals, 0 crashes.)Not tested
AI use
@copilot-pull-request-reviewer[bot] on GitHub · 2026-11-25 21:04 UTC · original · reviewed
Copilot was unable to review this pull request because the user who requested the review has insufficient remaining quota. Try requesting a review at a lower effort level.
An organization owner can choose the repository organization as the billing source for reviews requested by members with a paid Copilot license. Learn about Copilot code review billing.
@luckyteagirl on GitHub · 2026-11-26 08:42 UTC · original · reviewed
At exact head
46456f0(base6d12f58, current mainb49be18), the new value-aware wait rule loses the written value across a mid-list split. This is a source-derived review; I did not run a split-enabled title fixture.splitcopieswritten_rangesfrom the oldListStateinto the next segment (list_x.rs:2789,2879) but leaveswritten_valuesat its default empty value.wait_memorythen treats an overlapping prior write with no matching known value as already ordered and returns (:3023–3025). One concrete path is: recordWrite64(A, 0), issue a wait on unrelated B sotry_split_for_waitcreates a second segment, then issueWait64(A, >=, 1)while another queue is expected to raise A. The second segment remembers A's written range but not 0, so it drops a wait that the PR's rule would retain before the split. This is an incomplete case of the bug the PR addresses, rather than a regression newly introduced against main.Could
splitcarrywritten_valueswithwritten_ranges(keeping the existing invalidation on later overlapping writes)? A split-enabled fixture can inspect the second segment's pending waits afterA >= 1, withA >= 0as the satisfied control.AI assistance: two GPT-6.2 Sol agents independently checked this path; GPT-6.2 Astra verified the exact-head source and wording.
46456f0d4etoa4b66e8115@tiagonleal on GitHub · 2026-11-26 11:53 UTC · original
Confirmed.
splitcopiedwritten_rangesinto the next segment but leftwritten_valuesempty, so after a split the wait on A was dropped as a write of unknown value.Fixed in
a4b66e81(squashed with the first commit):splitnow carries both through a smallwrites_for_splithelper. New testa_split_segment_keeps_the_written_value_for_a_later_waitrecordsWrite64(A, 0), moves the state to a new segment the waysplitdoes, then waitsA >= 1. It exercises whatsplitcarries over, notsplititself. With the values left out it fails (0 waits kept, 1 expected); with the fix it passes, 3 of 3 runs.Run on
a4b66e81:cargo test --workspace --no-fail-fast -- --test-threads=4, twice: 1421 passed, 4 failed, 46 ignored; the 4 failures aregpu::dxil::fuzz_tests::fuzz_validate_and_gpu_0..3(E_OUTOFMEMORY, known on this machine). 60 s smoke runs on6d12f58aanda4b66e81: both exit 0, no device removals, 1604 and 1616 frames shown. Not run: a split-enabled title fixture with the realsplit, and the four fuzz tests onmaintoday.View command line instructions
Checkout
From your project repository, check out a new branch and test the changes.Merge
Merge the changes and update on Forgejo.