Tests: avoid poisoning SYNC_GRAPH with an unmapped fake fence in queue_tests (#1978) #2002
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!2002
Loading…
Reference in a new issue
No description provided.
Delete branch "gh-pr/2002/head"
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?
@zondy1i on GitHub · 2026-11-25 00:37 UTC · original
zondy1i:d3d12x/fix-parallel-test-race→main· +52 −3 · 3 files · 1 commits · merged 2026-11-25 18:14 UTCFixes #1978.
hle::d3d12x::real::queue_tests::queue_slot_18_before_the_layout_is_known_writes_8_bytespushed an unmapped sentinel address (0x5EED_0000) intoreal::FENCESand invokedqueue_dispatch(14, this, fence, 1, 0, 0)with a mocksignalreturning0(S_OK). Becausehr >= 0,queue_dispatchregistered that bogus pointer infence_x::FENCES(note_queue_signal) andlist_x::SYNC_GRAPH.title_fences(note_title_queue_signal), while the test only removed it fromreal::FENCES.Under
--test-threads=1,hle::d3d12x::list_x::tests::*ran alphabetically beforehle::d3d12x::real::queue_tests, hiding the bug. Under parallelcargo test,queue_testsfinished first and left0x5EED_0000inSYNC_GRAPH.title_fences; as soon as any concurrentlist_xtest ranwould_signal_close_cycle,prune_title_fence(0x5EED_0000, tf)calledID3D12Fence::GetCompletedValue()through the unmapped address and killed the test runner with0xc0000005 STATUS_ACCESS_VIOLATION.What is in it
0x5EED_0000sentinel inqueue_tests(crates/xcl/src/hle/d3d12x/real.rs) with a valid minimal stackID3D12FenceCOM vtable whoseGetCompletedValuereturnsu64::MAX, so any concurrentprune_title_fencecall during the test executes safely without UB.#[cfg(test)]cleanup helpersfence_x::forget_fence_for_test(crates/xcl/src/hle/d3d12x/fence_x.rs) andlist_x::forget_title_fence_for_test(crates/xcl/src/hle/d3d12x/list_x.rs), invoked from aDropguard inqueue_testsunder the respective locks before the stack mock objects go out of scope.#[cfg(test)]); no runtime code paths modified.Tested
rustc 1.100.0 (0ef1bc386 2026-11-09), debug tests + release smoke.cargo test -p xcl --lib -- hle::d3d12x::real::queue_tests hle::d3d12x::list_xcrashed 3/3 runs with0xc0000005 STATUS_ACCESS_VIOLATION.ea088a5ata18f4ab):cargo test -p xcl --lib -- --test-threads=4 hle::d3d12x::device_x::tests::pc_resource_desc_strips_uav_on_unsupported_formats_and_msaa hle::d3d12x::real::queue_tests hle::d3d12x::list_x::tests::cross_queue_passed (5/5), plus 5/5--test-threads=32runs on1d85dd1and 10/10 runs on4197910.Regression run
main:
PR:
Not tested
AI use
0x5EED_0000leak intoSYNC_GRAPH.title_fences, implemented the test-only fix, rebased onto latestmain, ran parallel verification and smoke runs, and drafted this description.@raylitebull on GitHub · 2026-11-25 01:13 UTC · original
Review note on
4197910:CIworkflow approved (currently running).@upipibi,#1523targets the same fake-fenceSYNC_GRAPHissue inqueue_slot_18_before_the_layout_is_known_writes_8_bytes. Depending on which approach is preferred,#2002will still needBuild and testgreen plus an AMD verification pass before merge.@JoaoPauluu on GitHub · 2026-11-25 02:56 UTC · original
A run under Wine on Linux, with vkd3d-proton as the host D3D12. The
0xc0000005from #1978 does not reproduce here, so this cannot confirm the fix. Another abort shows up in the same test pair, onmainand on this PR alike.Tested
x86_64-pc-windows-gnu:4197910as it is (based on6567c5f) andmaincbc296a, no uncommitted changes. Each run is one Wine process with--test-threads=4, 10 runs of each, main and this PR alternating.hle::d3d12x::real::queue_tests hle::d3d12x::list_x(the pair from #1978):main: 8 of 10 runsok. 30 passed. In 2, the process died.ok. 28 passed. In 3, the process died.double free or corruption (!prev)right after vkd3d-proton/DXVK reportFound device: NVIDIA GeForce RTX 3060, i.e. while a device is being made. The last test reported before it waslist_x::tests::a_mirrored_buffer_binds_its_mirror_without_asking_readable ... okeach time. No0xc0000005in any run.hle::d3d12xas a whole:main: 10 of 10 runs end175 passed; 2 failed; 2 ignored.158 passed; 2 failed; 2 ignored. In 2, the samedouble freeabort came afterbind::tests::reset_and_clear_state_track_initial_pso_and_clear_root_args ... ok.bind::tests::execute_indirect_reads_the_arguments_written_before_it(bind.rs:1086) anddevice_x::tests::gpu_depth_buffer_created_for_unordered_access_is_placed(device_x.rs:1126). They are unrelated to this PR.The abort is in the host's C heap (Wine / vkd3d-proton / the Vulkan driver) while devices are made in parallel. It may be a vkd3d-proton or driver problem rather than XCL's, and I have not narrowed it down. It occurs with and without this PR at about the same rate.
Not tested
AI use
@DavidM1911 on GitHub · 2026-11-25 03:51 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!
@luckyteagirl on GitHub · 2026-11-25 04:08 UTC · original
AMD Windows verification for PR #2002 at
4197910e7706d722ecbeac7701d345453dc6340aThe maintainer requested an AMD pass on the parallel queue-test crash in #1978. I tested this PR's clean exact head against current
maincbc296ab65a2661a61e3e2da109134bcd5319f60on Windows 11 build 26200, Radeon RX 6800M (driver30.0.13002.13003), Ryzen 9 5980HX, Rust1.99.0MSVC, withXCL_ADAPTER=6800Mand 32 test threads.Each invocation used
cargo test -p xcl --lib --locked -j 2 -- --exact --test-threads=32 --show-output <queue_slot_18...> <list_x...>. The first exact test washle::d3d12x::real::queue_tests::queue_slot_18_before_the_layout_is_known_writes_8_bytes; I paired it separately with:hle::d3d12x::list_x::tests::cross_queue_cycle_and_same_queue_fifo_do_not_deadlockhle::d3d12x::list_x::tests::cross_queue_wait64_before_signal_does_not_deadlock_submit_thread0xc0000005 STATUS_ACCESS_VIOLATIONbefore a test total0xc0000005 STATUS_ACCESS_VIOLATIONbefore a test totalcargo build --locked --workspace -j 2also passed on the PR head. These runs exercise the reported test interaction and support the test-only crash fix on AMD. They do not establish that PR #2002 is preferable to the overlapping #1523, nor that the full workspace suite is green.Not tested: Full library/workspace suite, retail title smoke, Intel/NVIDIA GPUs, or a merge of this older PR base with current main. No game data was used.
AI assistance: OpenAI Codex (GPT-6) ran the comparison and drafted this report.
@raylitebull on GitHub · 2026-11-25 10:42 UTC · original
Update: #1523 was closed in favour of this PR and #2002 now passes both NVIDIA (RTX 3060 Ti) and AMD (RX 6800M 5/5) verification on 4197910. Recent merges on main created a merge conflict (DIRTY) — @zondy1i, please rebase onto latest main so CI runs and we can merge!
@raylitebull on GitHub · 2026-11-25 11:00 UTC · original
Checked CI run
45598579825on1d85dd1:1154 passed; 1 failed.hle::d3d12x::device_x::tests::pc_resource_desc_strips_uav_on_unsupported_formats_and_msaa(crates/xcl/src/hle/d3d12x/device_x.rs:1376), which is a pre-existing failure onorigin/mainunrelated to#2002; allqueue_testsandlist_xtests passed.Remaining before merge: Re-run CI once the
maindevice_xtest fix lands (or rebase), plus independent AMD GPU verification on1d85dd1.@throny on GitHub · 2026-11-25 15:07 UTC · original
Two contributors checked independently and found that #2206 solves the same problem (for #1978) in a different way: #1607, group D77. You may want to compare them with the other author and agree on one, or say in the PR why both are needed.
This is a hint from the community triage in #1607, not a maintainer decision.
AI use: Claude Code (Claude Opus 5.5), posted by a script from the #1607 table.
@zondy1i on GitHub · 2026-11-25 15:32 UTC · original · edited 2026-11-25 15:39 UTC
Comparison for #1607 (group D77: #2002 vs #2206):
#[cfg(test)]): replaces the unmapped0x5EED_0000sentinel inqueue_testswith a valid minimal COM vtable and cleans upfence_x::FENCES/list_x::SYNC_GRAPHvia aDropguard, without serializing parallel D3D12 tests. Both CI checks are green ona18f4ab, it isMERGEABLE, verified on NVIDIA and AMD (RX 6800M 5/5), and #1523 was already closed in its favour.TEST_LOCKinstead of removing the unmapped pointer UB, has merge conflicts, and failsPR description.Only one fix is needed for #1978; #2002 is self-contained and ready to merge.
@zondy1i on GitHub · 2026-11-25 10:53 UTC · original · edited 2026-11-25 15:40 UTC
@raylitebull Rebased onto latest
main(13c2a40) at1d85dd1(resolved the adjacent insertion conflict inlist_x.rsnext topublish_cpu_cycle_break), re-verified 5/5 parallelqueue_tests+list_x::cross_queue_runs (--test-threads=32), and updated the regression smoke block for1d85dd1.@thiagocalile on GitHub · 2026-11-25 16:45 UTC · original
Independent test report for head
a18f4abdcd96de28414fb2826bab73ef42d9a4b2on an AMD Radeon RX 6600 (8 GB VRAM, RDNA2, native wave64).Tested
32.0.21045.29003,XCL_ADAPTER=radeon), AMD Ryzen 7 5700X3D, 47.9 GB RAM, Windows 11 (10.0.26200.0), Rust1.100.0(stable-x86_64-pc-windows-msvc), DXC1.8.2502.11.XCL_ADAPTER=radeon cargo test --no-fail-fast -p xcl --lib -- queue_tests --test-threads=4: 2 passed, 0 failed, 0 ignored (0skipped).Not tested: full workspace test suite on this head, NVIDIA/Intel GPUs, or Linux/Wine (test-only PR, no smoke run needed).
AI use: Antigravity (Gemini 4 Neon) ran the builds, tests, and smoke runs and drafted this report; the account owner reviewed and approved posting.
@upipibi on GitHub · 2026-11-25 00:41 UTC · original · edited 2026-11-25 17:50 UTC
Overlap note: #1523 (mine, opened earlier for #1487, mergeable, CI green) fixes the same crash. It replaces the
0x5EED_0000integer inqueue_slot_18_before_the_layout_is_known_writes_8_byteswith a static fakeID3D12FencewhoseGetCompletedValuereturns a completed value, soprune_title_fenceno longer calls through an unmapped address. JJAutoCompare linked #1978 to it as well.This PR goes a step further by also removing the test's entries from
fence_x::FENCESandSYNC_GRAPHafterwards, which keeps the shared state clean for later tests. If the maintainers prefer that, I'm happy to close #1523 in its favour. Only one of the two should go in.Separately confirmed here (RTX 3070, Windows 11): the parallel
cargo test -p xcl --lib -- cpu_writes q_release queuerun died with0xc0000005whilelist_x's cross-queue tests were running. Single-threaded, it passes on bothmainand another PR's head.Added 17:50Z: NVIDIA test report for
a18f4ab(head as is, baseea088a5), as asked in #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: 1236 passed, 0 failed, 46 ignored. The end-to-end title tests pass.main0829441on 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, 3 f16/f32 forms the per-lane path refuses, 1 no heap windows, and 1 PSO measurement that needs Developer Mode to turn the driver cache off.AI-assisted (Claude Code, Claude Opus 5.5). Synthetic tests only; no title run.
@oni-swr on GitHub · 2026-11-25 18:05 UTC · original
AMD RX 7800 XT run of
a18f4abdcd96de28414fb2826bab73ef42d9a4b2(PR head, as-is).Tested
#[cfg(test)]helpers and changes thequeue_testsmodule (checked in the diff).cargo test --workspace --no-fail-fast -- --test-threads=4: lib 1175 passed, 1 failed, 26 ignored; every other test binary passed.queue_tests::queue_slot_18_before_the_layout_is_known_writes_8_bytesandnewer_layout_maps_dispatch_mesh_to_slot_129_not_128passed, with no crash from the parallel run.gpu::dxil::fuzz_tests::fuzz_validate_and_gpu_1fails (seed 722:res[30] = 0x1, CPU 0x7fffffff); it fails the same way onmainin my run, so it is not caused by this PR.main(origin/main68a284a596bd558b6bd9db6eedda6d6aa178c360) in the same setup: 1218 passed, 2 failed (the fuzz test andlower_dxil::tests::a_bridged_mask_write_where_one_half_is_elsewhere_meets_no_barrier).Not tested
scripts/smoke.ps1: not run, as the diff is test-only (a maintainer'stest-onlylabel covers it).AI use
github-bot referenced this pull request2026-11-26 06:18:31 +00:00
@DavidM1911 on GitHub · 2026-11-26 07:05 UTC · original
Re-verification on RTX 3060 Ti (Windows 11), new head merged with current
main:cargo test -p xcl --lib: all passed, 0 failed, 27 ignored. The earlier merge conflict is resolved.Thanks!
— Devin