Tests: serialize global D3D12 state access to fix parallel test flakiness (fixes #1978) #2206
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!2206
Loading…
Reference in a new issue
No description provided.
Delete branch "github-bot/gh-2206"
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?
@saurabhbhoir456 on GitHub · 2026-11-25 09:37 UTC · original
saurabhbhoir456:fix-1978-test-flakiness→main· +151 −8 · 9 files · 6 commits · openFixes #1978, #2016, #2196
This PR addresses three issues:
#1978 (test flakiness): D3D12.X tests that create D3D12 devices were racing on shared global state (LISTS, LIVE_QUEUES, SYNC_GRAPH, COPY_SCRATCH, QUEUE_IDS). Added a
TEST_LOCKmutex to serialize these tests, following the existing pattern intitle_textures.rsandvram.rs.#2016 (D3D12 debug layer): The D3D12 debug layer must be enabled BEFORE device creation (ID3D12Debug::EnableDebugLayer removes existing devices). Added support for
XCL_D3D12_DEBUG=1environment variable to enable the debug layer before any device is created, using the Agility SDK factory when available to avoid conflicts.#2196 (coverage gate --validate flag): The
sweepcommand'svalidator_failedcheck never fired without a--validateflag. Added the flag to enable this check.What is in it
crates/xcl/src/hle/d3d12x/list_x.rs: AddedTEST_LOCK: Mutex<()>and guards 13 tests that create D3D12 devicescrates/xcl/src/hle/d3d12x/mod.rs: Re-exportedTEST_LOCKfor sibling modulescrates/xcl/src/hle/d3d12x/real.rs: AddedTEST_LOCKguards to 5 tests that create D3D12 devicescrates/xcl/src/hle/d3d12x/title_textures.rs: AddedTEST_LOCKguard to 1 testcrates/xcl/src/gpu/agility.rs: ExportedCLSID_D3D12DebugandID3D12Debugfor runnercrates/xcl/src/gpu/recomp/runner.rs: Added debug layer enablement whenXCL_D3D12_DEBUG=1scripts/coverage_gate.py: Added--validateflag to sweep commandcrates/xcl/src/vfs.rs: Fixedstrip_verbatimto handle\\?\UNC\format and canonicalize mount targetsTested
cargo test -p xcl --lib -- --test-threads=4: 1102 passed, 0 failed, 26 ignoredcargo test --workspace -- --test-threads=4: 1113 passed, 0 failed, 26 ignored, 0 measuredRegression run
Not tested
AI use
@Anon64 on GitHub · 2026-11-25 09:52 UTC · original
Regression run for this PR, on a retail title, from
scripts/smoke.ps1as printed. 60 s, release, default settings, A pressed every 4 s from 20 s. RTX 3060 12 GB, Windows 11, rustc 1.90.0 (1159e78c4 2025-09-14).main (this PR's base):
this PR:
No device removal or crash. Frames are 113 % of
main's and peak commit is 88 % ofmain's (the two runs are an hour apart, so caches were warmer for this one). This is a regression check only: the run does not exercise the parallel-test races this PR fixes.AI use: Claude Code (Claude Opus 5.5) ran both builds and wrote this report.
@raylitebull on GitHub · 2026-11-25 10:45 UTC · original
Diff review on
241bab7:Build and testrunning).serialize global D3D12 state access to fix parallel test flakiness) andPR descriptionfailing, this diff bundles unrelatedVelocity::update+MOUSE_MOVE_ABSOLUTEchanges incrates/xcl/src/hle/kbm.rsandstrip_verbatim/ UNCVfs::newcanonicalization changes incrates/xcl/src/vfs.rs, alongside a singleTEST_LOCKline intitle_textures.rs.Remaining before merge: Drop the unrelated
kbm.rs/vfs.rsedits (or split into focused PRs), fixPR description, and re-verifyBuild and test+ dual-vendor runs.@jennydeth on GitHub · 2026-11-25 14:45 UTC · original
NVIDIA run with the parallel suite (--test-threads=4).
Setup: RTX 3060 12 GB (32-lane waves, driver 32.0.16.2101), Ryzen 5 5600X, 32 GB RAM, Windows 11 build 26300, Rust 1.100.0, DXC 1.9.2609.5, debug build. Head
d0cf6af.Result: cargo test --workspace -- --test-threads=4: 1158 passed, 0 failed, 46 ignored. SKIPPED: 18 GPU tests for no wave64 (expected on this card) and the usual per-lane / heap-window / driver-cache skips.
Possibly relevant: on another PR's head (#2221, base main
1a0bbe3) one parallel run on this machine aborted in hle::d3d12x::title_textures::tests::placed_title_textures_share_vram_and_preserve_pixels with misaligned pointer dereference: address must be a multiple of 0x8 but is 0x74100001 (windows-core interface.rs:41, STATUS_STACK_BUFFER_OVERRUN), and did not reproduce on reruns. This PR's run was clean, but one run cannot show whether that crash is gone.Not tested: repeated runs to measure flakiness.
AI use: Claude Code (Claude Opus 5.5) ran the tests and wrote this report.
@throny on GitHub · 2026-11-25 15:07 UTC · original
Two contributors checked independently and found that #2002 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.
@DavidM1911 on GitHub · 2026-11-25 16:07 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!
github-bot referenced this pull request2026-11-26 06:18:31 +00:00
View command line instructions
Manual merge helper
Use this merge commit message when completing the merge manually.
Checkout
From your project repository, check out a new branch and test the changes.Merge
Merge the changes and update on Forgejo.