D3D12.X: preserve unwritten gaps when tracking same-list waits #592
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!592
Loading…
Reference in a new issue
No description provided.
Delete branch "github-bot/gh-592"
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?
@dervoxx on GitHub · 2026-11-24 02:12 UTC · original
dervoxx:fix/same-list-written-gaps→main· +24 −9 · 1 files · 1 commits · openThe command list used to stop tracking individual UMA write ranges after 256 entries. It expanded the last entry across later writes, so a wait targeting an unwritten gap could be treated as a same-list dependency and skipped. The tracker now coalesces overlapping or adjacent writes while preserving gaps.
What is in it
crates/xcl/src/hle/d3d12x/list_x.rstracks sorted, disjoint write ranges and uses binary search for overlap checks. The regression test records 300 scattered writes, checks an unwritten gap, then writes into that gap and verifies the neighboring gap stays unwritten.Tested
cargo test --workspace -- --test-threads=4): 752 passed, 0 failed, 41 ignored.gpu_geometry_wave32_prefix_count_over_a_maskandgpu_wave32_program_in_wave64_hardware.9ce2070reproduced the false overlap on the first unwritten gap. On 905b90d it passed.Regression run
Release builds, fresh XCL data and DXIL directories, same title and duration. Rebased onto
930e8b4with the upstream GPU wait watchdog preserved.Not tested
AI use
@MesshM on GitHub · 2026-11-24 02:46 UTC · original
Test run of
905b90d5d93877d19da142b24bdf88788212a47don AMD RDNA4; the PR was tested on NVIDIA only. I merged it onto currentmain3db536elocally (clean merge) and tested that tree.Tested
stable-x86_64-pc-windows-msvc, debugcargo build --workspace+cargo test --workspace -- --test-threads=4on the merge: 687 passed, 0 failed, 41 ignored, exit code 0;xcllib tests 647 passed, 0 failed, 21 ignoredSKIPPED;scattered_writes_preserve_unwritten_gapspasses.Review:
note_writekeeps the ranges sorted and disjoint:partition_point(stop < va)finds the first range that overlaps or touchesva, the secondpartition_point(start <= end)counts those it reaches, and they are merged into one (touching ranges included) or the new range is inserted.has_prior_writethen needs one lookup, and an exact-boundary read (stop <= va) does not count as overlap, matching the half-open ranges. One thing to consider: with the 256-entry cap gone the list has no bound, and each insert into the middle shifts the tail, so a list with many scattered small writes costs O(n) per write untilReset/KickoffX. A cap that falls back to the old merge-everything behaviour only past, say, a few thousand entries would keep the gap tracking for normal lists. Not a blocker.Not tested: no retail title or regression run (I have no unpacked game), no
XCL_SAMPLE_*tests, release build; the PR's head on its old base was not run, only its merge ontomain.Run and review by Claude Code (Claude Opus 5.5) on this machine; the review points were checked against the code.
@brainhay5 on GitHub · 2026-11-24 03:32 UTC · original
Retail result on Blackwell, since your "Not tested" names exactly this: whether a retail frame waits on an unwritten gap after 256 scattered writes.
Setup:
main91f9a5ewith this PR merged on top (merge11ccb8a, clean, 1 file), release build. RTX 5070 Ti (15997 MiB, driver 32.0.16.1088), Ryzen 7 5800X3D, Windows 11 22631, rustc 1.100.0, DXC 1.9.2602.17 from Windows SDK 10.0.26100. Interactive desktop session,XCL_NETWORK=0, full launch (notsmoke.ps1), noXCL_SAMPLE_*.It moves the title off the fault it was dying on. Same hardware,
mainat63cdc25without the PR, dies after ~80 s atVCRUNTIME140.dll+0x1dafb(read at0x285e28f9fc0, stack insidexcl.exe). With this PR the same run gets togame_scarlett_master.exe+0x23cf683(write at0x0), which is the known remaining fault in #616, with that issue's exact stack:Counts from
report.json, same ~80 s window:63cdc2591f9a5e+ #592failed_pipelinespresentsxapu_packets_decodedxapu_nonzero_samplesSo the range tracker change is what removed the CRT fault; the run now reaches the loading-screen/cutscene wall described in #616 instead.
One observation, not a blocker: presents held 29.9 fps for the first 1200 frames, then dropped to 8.9 fps over the last 300 as the pipeline count climbed toward 73. Consistent with compile stalls, but it happens after the point where the unpatched tree died.
Not tested: AMD hardware, other GPUs,
XCL_SAMPLE_*, longer runs past the #616 fault.AI use: OpenCode, DeepSeek V4.1 Flash 1017.
@brainhay5 on GitHub · 2026-11-24 03:45 UTC · original
Important for this PR's justification: on pure
mainf4ce27c(no PRs merged, no switches) the fault I used to motivate this is gone.Before (
63cdc25, no PR):VCRUNTIME140.dll+0x1dafb, read of an uncommitted page, ~80 s.Now (
f4ce27c, no PR):game_scarlett_master.exe+0x23cf683(write at0x0), the known #616 fault, 120 s,presents: 1573,translated_pipelines: 140,failed_pipelines: 0,xapu_packets_decoded: 16,957.So something in the last batch (#347 write-watch-resume, #484 title-textures-safe-read-committed — both about reading pages that were not committed) removed the CRT fault without this PR. The gap-tracking bug this PR fixes may still be real on its own merits, but the crash evidence I posted earlier no longer reproduces on current
main, and you should not merge on that basis alone.Same hardware and setup as before: RTX 5070 Ti, driver 32.0.16.1088, Windows 11 22631, interactive session,
XCL_NETWORK=0, release build.AI use: OpenCode, DeepSeek V4.1 Flash 1017.
@CryingLaughing on GitHub · 2026-11-24 03:48 UTC · original
Tested
905b90d5d93877d19da142b24bdf88788212a47d, its exact parent9ce2070eccf436d7bd38601c90407da447df34f3, and updatedmainf4ce27ceb6d1b0576d0c659b713b674778bf1968, each with the same scratch-only test inlist_x.rs. NVIDIA GeForce RTX 4080, driver 621.01, Intel Core i5-13600K, Windows 11 25H2 build 26200.9974, Rust 1.100.0 MSVC x64, debug.XCL_ADAPTER=4080,XCL_REQUIRE_GPU=1, allXCL_SAMPLE_*variables unset.cargo test -p xcl --lib --locked -j 4 --no-run --message-format=json, then ran the executable withhle::d3d12x::list_x::tests::gpu_gap_wait_splits_batch_after_scattered_writes --exact --test-threads=1 --nocapture.Wait64BitValueXon the unwritten gap after write 260. A preceding native DIRECT list writes42to that gap. The test runs the realexecute_with_waitssplitting path and records the gap value immediately before each native queue submission. The callback waits on a queue fence after each submission, and the fixture checks all 300 GPU-written values.main, the wrapper failed 0/1. Each submitted both lists while the gap still held0. On the PR head it passed 1/1 with zero skips. The producer was submitted alone with the gap at0, then the waiting list was submitted alone after the gap reached42. The GPU writes read back correctly on all three revisions.The synthetic gap still reaches the old batching behavior on the same
mainrevision where the reported retail fault disappeared. Retail follow-upNot tested
AI use
@relativespace2K on GitHub · 2026-11-24 04:09 UTC · original · edited 2026-11-25 04:09 UTC
Tested -
189f9dbonmain3da2abb, retail GTA6 1.0.2.1Tool: OpenCode with DeepSeek V4.1 Flash 1017
0xc0000409; the XCL log up to that point is clean (40 refusals, 0 failed pipelines,0 shader errors, peak 31,837 MB).
905b90donb8b1f49crashed atgame_scarlett_master.exe+0x23cf683;that no longer happens on
3da2abb.a re-run with more headroom is needed to tell whether it is memory-related.
Tested - native Windows, AMD RDNA2
905b90d5d93877d19da142b24bdf88788212a47d(based on9ce2070), applied as acherry-pick without committing onto current
mainf4ce27c(clean).Windows 11 IoT Enterprise LTSC 26100; Rust 1.100.0 MSVC; DXC 1.9.2602.17; debug;
no
XCL_SAMPLE_*.cargo build --workspace && cargo test --workspace --no-fail-fast -- --test-threads=4:mainf4ce27cmain+ this PRtwo
PoisonErrorfollow-ons); this PR does not touch them. The parallel run'stitle-texture assertion was its known
cubemap extra_pagesvariant.scattered_writes_preserve_unwritten_gaps: 1 passed, 0 failed.SKIPPEDGPU tests on this adapter.Not tested: whether a retail title still waits on an unwritten gap (the thread reports
the original fault is gone on
f4ce27cwithout this PR), release build, NVIDIA / Intel.AI use: OpenCode with DeepSeek V4.1 Flash 1017 ran the tests and drafted this report.
@JJAutoCompare on GitHub · 2026-11-25 06:43 UTC · original
Empirical test report (
189f9db1)Hardware / environment
189f9db18c0304714ca17ce600770aacc2bf3287, tested from a clean detached checkout.10.0.26200.9974, AMD Ryzen 7 3800X 8-Core Processor. The focused runs usedXCL_ADAPTER=NONE_CPU_ONLY.1.100.0 (0ef1bc386 2026-11-09), targetx86_64-pc-windows-msvc. DXC1.9.2609.5 (01b62ad47). Cargo's unoptimized test profile ran with incremental compilation and debug info disabled.Commands and results
cargo test --workspace --no-runexited 0 and built 18 test executables. This was a compilation check.$unitTestExewas the built library test binaryxcl-77aca8ccb20e299f.exe. Both commands ran outside the Arc test wrapper.cmd /d /c "$unitTestExe hle::d3d12x::list_x::tests::scattered_writes_preserve_unwritten_gaps --exact --test-threads=1 > $focusedLog 2>&1"exited 0. Counts were 1 passed, 0 failed, 0 ignored, 0 skipped.cmd /d /c "$unitTestExe hle::d3d12x::list_x::tests::written_ranges_detect_same_list_overlap --exact --test-threads=1 >> $focusedLog 2>&1"exited 0. Counts were 1 passed, 0 failed, 0 ignored, 0 skipped.^SKIPPEDlines.Observed behavior
After 300 scattered writes, the new regression test found the selected gap unwritten. Filling that gap made it detectable as a prior write and preserved the preceding gap. The existing overlap test also passed its partial-overlap and boundary checks.
Not tested
The full GPU workspace suite and game smoke runs were omitted. The PR changes no GPU tests.
AI use
Verified with T3 Code / Codex (gpt-6.2-sol, reasoningEffort: high). Coordinator #2 (T3 Code / Antigravity, gemini-4-neon) verified counts against pr592-focused.log and published.
@DavidM1911 on GitHub · 2026-11-25 13:06 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!
@upipibi on GitHub · 2026-11-25 18:28 UTC · original
NVIDIA test report for
189f9db(head as is, base930e8b4), for #1607's NVIDIA list. RTX 3070 8 GB (Ampere, 32-lane waves), driver 616.56, Windows 11, debug, aftercargo build --workspace:cargo test --workspace --no-fail-fast -- --test-threads=4 --skip hle::xaudio2: 743 passed, 0 failed, 41 ignored. The end-to-end title tests pass.mainat0829441(not currentmain) on the same machine, same command: 1263 passed, 0 failed, 46 ignored (the PR's base is older, so it has fewer tests).hle::xaudio2, because its tests fail or hang on this machine onmaintoo. The PR doesn't touch it.no wave64on this card.AI-assisted (Claude Code, Claude Opus 5.5). Synthetic tests only; no title run.
@Royalflamejlh on GitHub · 2026-11-25 19:52 UTC · original
Linux (Wine + vkd3d-proton) + NVIDIA, the title, 3 runs with #592 and 3 of the same base with a counter: in the 3 base runs XCL never skipped a wait on an address the same list had written earlier, so the case this fixes did not occur here. The counter, at the
has_prior_writereturn inlist_x.rs, logs from the first skipped wait, and it logged nothing in 3 of 3 runs. No run crashed or lost its device; in both trees the title stopped presenting between 72 and 90 s and stayed stopped until XCL ended it at 120 s.Setup:
mainc56e7448+ #684e56dbc3+ #592189f9db(local mergeb4ab8fe0), against the same base + one counter commit (local9875adc1). RTX 4070 12 GB (615.71.09), Fedora 44, Wine 11.21 Staging, vkd3d-proton v3.1-90-g30b0eb9b with the relaxed-vtable patch from #175 and a local dxil-spirv patch,VKD3D_CONFIG=ignore_shared_fence, release, Series X profile, the first-run screens completed once and no story progress, 120 s,XCL_NETWORK=0,XCL_PSO_PRELOAD=0,WINEDEBUG=err+all,fixme-all. A was pressed once the title presented steadily, once at 16.2 to 18.3 s; in115051-bthe title presented steadily from 8 s, so a press at 10.0 s did not start loading and a second followed at 20.3 s.has_prior_writehas one caller,wait_memoryinlist_x.rs, which serves bothWait32BitValueXandWait64BitValueX. By our reading of the diff, the new tracker reports a prior write only where the old one did (it drops only the old merging past 256 ranges), so with no skip in the base tree #592 had nothing to change in these runs.Not tested: the test suite, including the PR's new test; Windows; AMD and Intel; runs past 120 s; how many lists passed 256 written ranges (the counter counts skipped waits only).
AI use: Claude Code (Claude Opus 5.5) wrote the counter, ran the title and wrote this comment.
Posted without review by a person: the account owner was away and reads replies later.
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.