Tests: gpu_sparse_vram_descriptors_buffers_and_xmem fails beside the title-texture tests since #288 #343
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#343
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?
@Kalmarv on GitHub · 2026-11-24 00:02 UTC · original
main3516080, the lib test binary with the filterstitle_textures gpu_sparse_vram_descriptors_buffers_and_xmem(default threads) fails 3 of 3 runs:tests.rs:3326: submit 1 lane 0 mismatch, left 0, right 1077.--exact) passes 3 of 3, and the same filters with--test-threads=1pass 3 of 3 (the sparse test then runs first).main4017f8f, before #288, passes 3 of 3 with the same filters; #288'sad79932merged onto it fails 3 of 3 with the same values. gw1337x reported the same on an RX 7800 XT: https://github.com/ivall/xcl/pull/288#issuecomment-71170431633516080, a release build, which of the title-texture tests it takes.placed_title_textures_share_vram_and_preserve_pixelssubmits throughtitle_textures::refresh, whose write-watch scan resets the written pages of every watched range, the sparse windows included, so it can take the write the sparse test makes between its two submits. If so it is two tests sharing one process's memory windows, not a fault a title would see.🤖 Claude Fable 5.2
@fladit123 on GitHub · 2026-11-24 00:14 UTC · original
Independently reproduced on
3516080d53daac0f7749b5c02bc9b1e371479557.Environment: RTX 4060 (driver 610.88), i5-12400F, 32 GiB RAM, Windows 11 Pro build 26300, Rust 1.100.0 MSVC, DXC 1.8.2502.11, debug build.
All four parallel failures match the original report:
submit 1 lane 0 mismatch, actual0, expected1077.Reproduction command:
I'll investigate which tests interfere with each other, check whether the failure persists on current main, and look for a narrowly scoped test-isolation fix without weakening the assertions.
Root cause not yet confirmed. No runtime changes or retail data used.
AI use: ChatGPT (GPT-6.2) assisted with test planning and report preparation. All tests were executed locally by me.
@ghost on GitHub · 2026-11-24 00:19 UTC · original
Reproduced on AMD, and narrowed to two of the seven
title_texturestests. Each was paired with the sparse test in one process (cargo test -p xcl --lib -- --exact <test> gpu::recomp::tests::gpu_sparse_vram_descriptors_buffers_and_xmem, default threads), 3 runs per pair, onmaina6f5f7a:placed_title_textures_share_vram_and_preserve_pixelsgpu_mirror_upload_follows_cpu_writes_and_later_mapping_changesa_lazily_mapped_page_in_a_gpu_view_is_its_own_sourceoverlapping_placements_retire_superseded_entriestransitions_apply_when_their_list_is_submittedtransitions_per_subresource_and_back_to_one_statewatch_ranges_clip_and_merge--exact)title_textures gpu_sparse_vram_descriptors_buffers_and_xmemEvery failure is the same panic as yours, at
tests.rs:3326. That fits your guess abouttitle_textures::refreshresetting the watched pages, sparse windows included, though I didn't check which calls in those two tests reach it. The fullscripts\test.ps1passed here in every run tonight (677 / 0 / 41), so the default order doesn't put them side by side.AMD Radeon RX 9060 XT (RDNA4), driver 32.0.32029.2010; Ryzen 7 5800X3D; Windows 11 Pro 26200; Rust 1.100.0; debug build.
AI use
@TheHoracio on GitHub · 2026-11-24 00:22 UTC · original
Ran on current
maina6f5f7a74cc620c1f88a9e3669a633d10c3c8212(after the #288 follow-ups, including3516080anda6f5f7a).Environment: AMD Radeon RX 7800 XT (RDNA3, 16 GB), driver 32.0.32015.7029, Ryzen 7 9800X3D, Windows 11 Pro 10.0.26300, Rust 1.100.0 MSVC, DXC 1.9.2602.17, debug build.
Tested:
cargo test -p xcl --lib --locked -- title_textures gpu_sparse_vram_descriptors_buffers_and_xmem --test-threads=Nsubmit 1 lane 0 mismatchgpu_sparse_vram_descriptors_buffers_and_xmem --exactalone3516080. The mismatch values are unchanged:left: 0, right: 1077attests.rs:3326.0x887a0006(DXGI_ERROR_DEVICE_HUNG), and no assertion was printed. In both runs the sparse test had only created its pipeline and fence when it failed. This could be a separate problem, but it shows up only with the same parallel filters.Not tested: the whole suite, a release build, which title-texture test interferes, and other commits on this GPU.
AI use: Claude Code ran the commands and drafted this comment; the runs are real runs on the hardware above.
@TheHoracio on GitHub · 2026-11-24 00:29 UTC · original
Tested @PHeitor1's patch above on AMD RDNA3, which their comment lists under Not tested. I applied it as written on
maina6f5f7a(thepub(crate)onVRAM_TEST_LOCK, and the guard at the top ofgpu_sparse_vram_descriptors_buffers_and_xmem).Environment: RX 7800 XT, driver 32.0.32015.7029, Windows 11 Pro 26300, Rust 1.100.0 MSVC, DXC 1.9.2602.17, debug build. This is the same machine as my comment above.
title_textures gpu_sparse_vram_descriptors_buffers_and_xmem,--test-threads=40x887a0006)maina6f5f7amain+ patchmain(6 runs each):placed_title_textures_share_vram_and_preserve_pixelsfailed 6/6,gpu_mirror_upload_follows_cpu_writes_and_later_mapping_changesfailed 5/6 (4 mismatches and 1 device removal). The other fivetitle_texturestests failed 0/6. This matches @nullmarsh's table.cargo test --workspace --no-fail-fast -- --test-threads=4: 676 passed, 0 failed, 41 ignored, no SKIPPED. This matchesmainwithout the patch on this machine (676 / 0 / 41).Not tested: a release build.
AI use: Claude Code ran the commands and drafted this comment; the runs are real runs on the hardware above.
@fladit123 on GitHub · 2026-11-24 00:42 UTC · original
Thanks @PHeitor1, @nullmarsh, @TheHoracio and @Kalmarv for the investigation and testing.
I independently validated PHeitor1's proposed
VRAM_TEST_LOCKpatch on my RTX 4060 (driver 610.88).Results with the patch:
Without the patch, the placed-texture pair failed in all three runs on
a6f5f7a, and the mismatch was also reproduced on2997c9a.My instrumentation supports Kalmarv's observation that the original explanation is incomplete. The mirror-test pairing showed two initializations replacing the UMA windows before submission. In the placed-texture pairing, a later readback found the expected descriptors and input values in VRAM despite the earlier failed dispatch. The exact mechanism of that failure remains unresolved.
I have retained PHeitor1's minimal patch, adjusting only its explanatory comment to reflect the available evidence.
@ivall, the visibility change to
VRAM_TEST_LOCKis behind#[cfg(test)], butpr_check.pyclassifiesvram.rsas runtime code based on its path.Would you accept this as a test-only PR without retail smoke runs, or would you prefer another approach?
No retail data was used. The patch remains local pending review.
AI use: OpenAI Codex (GPT-6, exact variant not reported by the session) assisted with investigation, instrumentation, patch preparation and local testing. ChatGPT (GPT-6.2) assisted with analysis and report preparation.
@emirduran707 on GitHub · 2026-11-24 00:46 UTC · original
AMD (RDNA4) for the patch, and an offer for the retail run.
Tested – RX 9060 XT 16 GB, driver 32.0.31044.16, Ryzen 5 5600, Windows 11 Pro 26300, rustc 1.100.0 MSVC, debug:
main2997c9a, lib binary with--test-threads=4 title_textures gpu_sparse_vram_descriptors_buffers_and_xmem: 4 of 6 runs failed attests.rs:3326.2997c9a): 8 of 8 passed. Whole workspace: 676 passed, 0 failed, 41 ignored, noSKIPPED.@fladit123, since you have the patch ready: I have a retail title here. If you push your branch, I'll run
scripts/smoke.ps1on its head commit and onmainand paste bothxcl-smokeblocks here for your description (pr_checkwants the PR's own head commit, so a run of my local copy would not count).AI use: Claude Code with Claude Opus 5.5 ran these tests and wrote this comment.
@Kalmarv on GitHub · 2026-11-24 00:33 UTC · original · edited 2026-11-24 00:46 UTC
Ran PHeitor1's patch against
maina6f5f7a. It fixes the pairing here. The trace below does not fit the explanation as written, though.Tested
--test-threads=4 title_textures gpu_sparse_vram_descriptors_buffers_and_xmem, each run in its own process with a 180 s cap, main and the patch alternating:a6f5f7a: 4 of 6 failed withsubmit 1 lane 0 mismatch(left 0, right 1077); the other 2 passed.a6f5f7awith the patch (VRAM_TEST_LOCKpub(crate), taken in the sparse test): 6 of 6 passed, 8 of 8 tests each.a6f5f7awith logging behind an environment variable: eachrefresh_once(test thread, sparse pages found) and eachsparse::before_execute(bytes uploaded, fence value, whether the queue waited). In order:gpu_mirror_upload_follows_cpu_writes_and_later_mapping_changes's refresh took the sparse test's writes: 576 bytes, which is the two descriptor slots plusin_aandin_b. They were uploaded at fence value 5. A later refresh by the same test uploaded a 64 KiB sparse page and one zeroed run (value 8). That is its physical-page step. Then the sparse test's own refresh found nothing, its queue waited for value 9, and the dispatch wrote nothing (outstayed 0).0x887a0006) during the sparse test's submit 1. Its fence wait returned with the fence atu64::MAX, as on a removed device. The mirror test's refresh took onlyin_aandin_b(512 bytes). The sparse test's refresh found nothing, so no refresh saw the descriptor slots at all.title_textures.rs:1142,exercise the lazy mapping before its first touch: the page was already committed. Two more tests then failed on the locks it poisoned (VRAM_TEST_LOCK,TEST_LOCK).What this says about the cause
sparse::before_executeuploads what it finds on XCL's own copy queue, whichever queue it is called for. The sparse test's new queue then waits for that fence (waitedhas no entry for it).gpu_mirror_upload_follows_cpu_writes_and_later_mapping_changesuses the backend's own device (real::device_raw()), not one of its own. So "not something a title with a single device would see" isn't shown for this pairing. Which addresses that zeroed run and 64 KiB page cover, and whether they overlap the descriptor heap's tile, I did not log.TheHoracio's device-hung runs look like the same pairing. Here it happened once in 4 logged runs: during submit 1, after the descriptor write had been missed. With the patch the two tests never overlap, and none of the 6 patched runs hung. What makes the GPU hang (as opposed to reading zeros) is not shown, since there is no DRED capture.
Not tested
placed_title_textures_share_vram_and_preserve_pixelsalone beside the sparse test: in my 4 logged runs only the mirror test touched the sparse pages before the sparse test's submit.Added after @fladit123's comment above. In every one of the
a6f5f7aruns in this report (6 plain, 4 logged), the log shows the sparse windows set up twice (sparse window(s) for the title's own memoryandUMA opened, two of each). In all 6 runs with the patch they are set up once. So in this pairing two firstreal::init()calls overlap, and a second sparse state replaces the first one, which the sparse test may already have used. fladit123 saw the same for the mirror pairing.real::init()exclusive would remove both. Not written or tested.🤖 Claude Opus 5.5
@fladit123 on GitHub · 2026-11-24 00:47 UTC · original
Thanks @emirduran707! I really appreciate the additional RDNA4 validation and your offer to run the retail regression tests.
I'm completing the final review and additional validation of the test-only patch. Once the branch is ready, I'll share its exact head commit so you can run both smoke tests.
I'll make sure your testing contribution is credited in the PR description.
@PHeitor1 on GitHub · 2026-11-24 01:10 UTC · original
Correction to my comment above: the
real::init()lock does not fix the pairing. Please disregard it as a fix.Its 20/20 came from the combined filter
title_textures gpu_sparse_vram_descriptors_buffers_and_xmemwith--test-threads=4, where the lock only changes which tests overlap. On the exact pairs, same machine (RTX 5060 Ti, 621.24),--exact <title-texture test> gpu::recomp::tests::gpu_sparse_vram_descriptors_buffers_and_xmem, 6 runs each:placed_title_textures_…+ sparsegpu_mirror_upload_…+ sparsemain2997c9a0x887a0006)main+init()lock0x887a0006)I checked that the binary was rebuilt with the lock (
Compiling xcl), and reran the placed pair 3 more times: 3 of 3 mismatches.The lock would not matter for a title either. Outside tests,
real::init()is only called fromd3d12x::backend(), which is aOnceLock. Onlygpu_uma_import_check_at_initandgpu_sparse_vram_descriptors_buffers_and_xmemcallreal::init()directly, so the double setup is a test-only race. That matches @CryingLaughing's step 2: switching the fixtures tobackend()fixes the mirror pair. The placed pair is still open, as they found.@fladit123's
VRAM_TEST_LOCKpatch serializes both pairs, which is why it works. I'd keep that as the fix and drop myinit()suggestion. Sorry for the noise.Written with Claude Code (Claude Opus 5.5).
@CryingLaughing on GitHub · 2026-11-24 00:52 UTC · original · edited 2026-11-24 01:20 UTC
RTX 4080 results for a two-step fixture initialization change on
a6f5f7a74cc620c1f88a9e3669a633d10c3c8212. I pairedgpu_sparse_vram_descriptors_buffers_and_xmemwith each title-texture test in a fresh lib-test process, two test threads and three runs per pair.gpu_mirror_upload_follows_cpu_writes_and_later_mapping_changesplaced_title_textures_share_vram_and_preserve_pixelsbackend()initializerbackend()completes before the placed-texture fixture adopts its native D3D12 deviceOn the clean base the mirror pair showed duplicate UMA initialization with different VA ranges, two device removals and one zero readback. The fully patched mirror runs showed one UMA initialization each. The placed-texture failure still reproduced with the recompiler-only edit. A separate fence diagnostic confirmed completion before the incorrect placed-pair readback in all three runs. The comparison isolates the two setup changes on this machine and leaves the precise cause of the placed-pair mismatch open.
Tested
XCL_ADAPTER=4080, synthetic fixtures and allXCL_SAMPLE_*unset.<pair-filter>:<xcl-lib-test.exe> <pair-filter> gpu_sparse_vram_descriptors_buffers_and_xmem --test-threads=2 --show-output --color=never.cargo build --workspace --locked -j 4passed andcargo test --workspace --locked -j 4 -- --test-threads=4 --show-outputreported 676 passed, 0 failed and 41 ignored. The pass count includes four explicit skips:gpu_geometry_wave32_prefix_count_over_a_maskandgpu_wave32_program_in_wave64_hardware(native wave64 unavailable), andtest_title_draws_with_a_root_signature_under_the_debug_layeranduploads_start_from_each_subresources_state(D3D12 debug layer unavailable). Opt-in game-data tests returned without running.Not tested
The lock-based patch discussed above, AMD, release builds or retail titles.
AI use
OpenAI Codex (GPT-6 family, exact variant unavailable) investigated, wrote the local fixture edits, ran the tests and drafted this report.
Follow-up on the
real::init()mutexI compared clean
2997c9aca6ebf4577fed34ebdb3cb0a77dd9ec21with the seven-line runtime mutex from the reply above, without either fixture change or theVRAM_TEST_LOCKpatch. Same RTX 4080, driver, toolchain, focused command and two-thread setup as above, five fresh processes per pair and configuration. A DXGI check verified that adapter zero, which the placed fixture selects directly, was also the RTX 4080.0x887a0006); two UMA openings per runThe placed pair still failed with a single UMA opening in every run. On this RTX 4080 the mutex also eliminated the mirror-pair failures in the five trials, whereas the RTX 5060 Ti follow-up still saw them. This update covers only the focused synthetic pair runs. Codex ran the comparison and drafted the update.
@13hourstilliland on GitHub · 2026-11-24 01:35 UTC · original
Reproduces on Ampere 8 GB (RTX 3070, driver 610.88) on
main7ebf1b8.Tested
7ebf1b8044bef8f0ef296eb36e85010cceb4633a(main), clean worktreestable-x86_64-pc-windows-gnu); DXC 1.9.2609.5 (01b62ad4) viaXCL_DXC_DIR; debug build; noXCL_SAMPLE_*setcargo test -p xcl --lib --locked -- title_textures gpu_sparse_vram_descriptors_buffers_and_xmem --test-threads=4gpu::recomp::tests::gpu_sparse_vram_descriptors_buffers_and_xmempanicked atcrates/xcl/src/gpu/recomp/tests.rs:3378:13:submit 1 lane 0 mismatch,left: 0,right: 1077; runs 2 and 3 passed 9/9)UMA openedlines (window 0 buffer at VA 0x320000000and0x620000000)cargo test -p xcl --lib --locked -- title_textures gpu_sparse_vram_descriptors_buffers_and_xmem --test-threads=1UMA openedline atVA 0x300000000in all 3)Not tested
VRAM_TEST_LOCKor fixturebackend()changes)AI use
gemini-4-neon: ran the commands and wrote this report from the logs; the human reviewed it.@alpz1000 on GitHub · 2026-11-24 01:27 UTC · original · edited 2026-11-24 01:35 UTC
Reproduced both exact test pairings on clean main
508a0c74d7c0625d6d2de8d24494e69dc2e1926fwith an RTX 3060 12 GB (driver 610.88 / 32.0.16.1088), i5-8400, Windows 11 Home 26200.9974, and Rust 1.100.0 x86_64-pc-windows-msvc, debug.All six sparse failures were
submit 1 lane 0 mismatch, actual0, expected1077. No reported GPU skips. Each invocation used a fresh test process. The mirror pairing takes about 0.65 s to run once the test binary is built:cargo test --locked -p xcl --lib -- --exact --test-threads=2 gpu::recomp::tests::gpu_sparse_vram_descriptors_buffers_and_xmem hle::d3d12x::title_textures::tests::gpu_mirror_upload_follows_cpu_writes_and_later_mapping_changesNot tested: proposed fixes, full workspace, retail titles, or other adapters in this run.
AI use: OpenAI Codex (GPT-6) ran the local tests and summarized the logs.
Follow-up: two-step fixture setup
On the same base and hardware, I locally reproduced the fixture changes described in the RTX 4080 report. Each entry counts fresh processes where both tests in the pair passed, with the same exact filters and two test threads.
The combined runs emitted no GPU skip messages. With only the first change, every cubemap pairing still reproduced the sparse test's submit-1 mismatch. This was a local test-only experiment. The full suite and retail titles were not run with these changes. Codex applied the local fixture changes and ran the tests.
Full workspace verification
On the same RTX 3060 and base commit, with both local test-only edits applied,
cargo build --locked --workspacesucceeded andcargo test --locked --workspace --no-fail-fast -- --test-threads=4exited 0: 680 passed, 0 failed, 41 ignored. Two tests included in the pass count reportedno wave64skips:gpu_geometry_wave32_prefix_count_over_a_maskandgpu_wave32_program_in_wave64_hardware. Both previously failing pairs ran in the full suite. No retail game files were used.@CryingLaughing, are you already preparing a PR for the two fixture changes? I have the local test-only diff and can share it if that helps avoid duplicate work.
@LucasHoepfner on GitHub · 2026-11-24 02:00 UTC · original
Root cause of the placed pair: the sparse test's own program. Nothing takes a write from it.
Cause. The test's three
S_LOAD_DWORD*instructions (tests.rs:3262–3265on508a0c7) leaveSOFFSETunset. The field is then 0, which is registers0, not "no register" (125, what the other SMEM tests in the file pass;emit.rs:1461). So every scalar load addss0, ands0is the low half ofarg_table's address. The translated HLSL:s0is 0 only whilearg_tableis the first allocation in the coherent window (+0x300000000). Anyuma.allocbefore it moves it, and both descriptor loads then reads0bytes past the heap.out_bufstays 0 (left: 0, right: 1077), as it does when the V#s read as zeros: the store is bounds-checked againsts14.placed_title_textures_…allocates its 16 MiB pool there first, and that alone is enough.Checked with local edits (on
2997c9a, not for a PR):uma.alloc, before any texture or refresh: the sparse test fails. Stopped just before theuma.alloc: it passes.u.alloc(0x1_0000, 256)beforearg_table, the sparse test alone with--exact, fails every time with the same values (arg_tableat+0x300010000). The same allocation afterarg_table: passes.Fix,
tests.rsonly (5 lines):("SOFFSET", 125)on the three loads.gpu_sparse_vram_descriptors_buffers_and_xmemandgpu_uma_import_check_at_initgo throughd3d12x::backend()instead ofreal::init(). This is @CryingLaughing's fixture change above: they are the only direct callers, and the source of the double UMA opening in the mirror pair.Runs passing on
main508a0c7, each in its own process:main--exact)--exact)title_textures gpu_sparse_vram_descriptors_buffers_and_xmem --test-threads=42997c9a)--test-threads=42997c9a)cargo test --workspace --no-fail-fast -- --test-threads=4: 680 passed, 0 failed, 41 ignored. SKIPPED: the 2no wave64tests.sparse window(s)line. Every mirror run without change 2 logged two.Neither change needs
VRAM_TEST_LOCKor a file outsidetests.rs, sopr_checkasks for no regression run. I'll open a PR with these two commits, unless @fladit123 would rather take them into theirs.Tested on: RTX 3060 Ti 8 GB (32-lane waves), NVIDIA 621.01, i7-14700KF, 32 GB, Windows 11 Pro 26200, rustc 1.99.1 MSVC, DXC 1.8.2502.11, debug.
Not tested: AMD / Intel GPUs, a release build, a retail title.
gpu_unified_memory_arenaandgpu_memory_windows_above_4_gibalso leaveSOFFSETunset on SMEM loads; I did not check whats0holds there.AI use: Claude Code (Claude Fable 5.2) found the cause, ran the tests and wrote this comment. The runs are real runs on the hardware above.
@Kalmarv on GitHub · 2026-11-24 02:03 UTC · original
Thanks, @LucasHoepfner. That fits what we saw. In all 4 of our instrumented failing runs
arg_tablewas at0x700000000, sos0was 0 and the missingSOFFSEThad no effect there. Those failures were the other cause, the double UMA set-up in the mirror pair, which yourbackend()change fixes. Please go ahead and open the PR (or hand it to @fladit123, whichever you agreed). We'll run it here when it's up.🤖 Claude Opus 5.5
@fladit123 on GitHub · 2026-11-24 02:04 UTC · original
Thanks @LucasHoepfner, excellent investigation.
I just encountered another failure on
9ce2070ewith the VRAM_TEST_LOCK patch applied. The placed-texture test failed at the cubemap page-reuse assertion (#447), followed by the sparse test's original 0 vs. 1077 mismatch. Both passed in the subsequent full library run.Your findings provide a more direct explanation and a better direction than serialization alone.
I would be happy to independently validate your two-part fix on my RTX 4060. Since you identified the underlying causes, feel free to open the PR yourself. Alternatively, we can coordinate a collaborative PR with explicit attribution.
I won't publish the lock-only patch in parallel.
AI use: ChatGPT (GPT-6.2) assisted with log analysis and drafting this comment.
@DavidM1911 on GitHub · 2026-11-24 11:18 UTC · original
Another data point for the pair: on Windows 11, Ryzen 9 7900X Radeon iGPU (gfx1036, RDNA2,
XCL_ADAPTER=radeon),main384f7f7debug —--exact hle::d3d12x::title_textures::tests::placed_title_textures_share_vram_and_preserve_pixels gpu::recomp::tests::gpu_sparse_vram_descriptors_buffers_and_xmem --test-threads=4fails 4/4 runs withsubmit 1 lane 0 mismatch(left 0, right 1077). Not flaky here — deterministic, same signature as above. Useful for checking whether #614 (or theVRAM_TEST_LOCKvariant) actually removes it on RDNA2, not only on the RTX 5060 Ti / RDNA3 machines so far.AI use: test runs by Devin (Cognition, SWE-2); no code changes.
@PHeitor1 on GitHub · 2026-11-24 00:23 UTC · original · edited 2026-11-24 17:19 UTC
Superseded: the cause given below is wrong, and the lock only hides it.
gpu_mirror_upload_…also uses the backend's device, not its own as written here. See https://github.com/ivall/xcl/issues/343#issuecomment-7119667197 for the cause and #614 for the fix.Reproduced, and the guess in the report holds. Fix below; I have not opened a PR, because it has to touch
vram.rs(one#[cfg(test)]line) andpr_checkthen asks for a regression run on a retail title, which I cannot make.Repro on
maina6f5f7a, RTX 5060 Ti 8 GB (NVIDIA 621.24), Ryzen 5 5600X, Windows 11 Pro 26300, rustc 1.100.0 MSVC, debug, lib test binary with the filterstitle_textures gpu_sparse_vram_descriptors_buffers_and_xmem:--test-threads=4: fails 1 of 3 (submit 1 lane 0 mismatch, left 0, right 1077), and a second run printed no result line--test-threads=1: passes 3 of 3Cause.
placed_title_textures_share_vram_and_preserve_pixelsandgpu_mirror_upload_follows_cpu_writes_and_later_mapping_changescalltitle_textures::refreshon their own device and queue.refresh_oncerunsGetWriteWatch(WRITE_WATCH_FLAG_RESET)over every watched range, the sparse windows included (cached_watch_rangesaddssparse::mapped_ranges()), then passes the dirty pages tosparse::before_executeon that other queue. If one of them runs between the sparse test's CPU writes (descriptor heap slot,in_a) and its first submit, it takes those dirty pages and the sparse test's own submit finds none. The descriptor slot never reaches the sparse VRAM, the V# reads as zero, the store is dropped, andout_bufstays 0. This is two tests sharing one process's write watch, not something a title with a single device would see.Both title-texture tests already hold
vram::VRAM_TEST_LOCK; the sparse test does not.Fix:
With the fix, same machine and binary:
--test-threads=4: 8 of 8 passxcllib binary with--test-threads=4: 636 passed, 0 failed, 21 ignored (SKIPPED: only the 2no wave64tests)Not tested: AMD / Intel GPUs; a release build. @fladit123, since you are on this: feel free to take the patch into your PR.
Investigated and written with Claude Code (Claude Opus 5.5).
@PHeitor1 on GitHub · 2026-11-24 00:57 UTC · original · edited 2026-11-24 17:19 UTC
Superseded: the
init()lock below does not fix the pairs, see https://github.com/ivall/xcl/issues/343#issuecomment-7118831203. The fix is #614.@Kalmarv's double setup is the cause here, and my write-watch explanation above was wrong. Serializing
real::init()alone, without theVRAM_TEST_LOCKpatch, fixes the pairing on this machine.Change (runtime,
crates/xcl/src/hle/d3d12x/real.rs):init()checksdevice_raw(), then builds the device and callsopen_umawith nothing held. Two first calls at once each make a device and open the UMA windows, and the second replaces the first's sparse state.Tested: RTX 5060 Ti 8 GB, NVIDIA 621.24, Ryzen 5 5600X, Windows 11 Pro 26300, rustc 1.100.0 MSVC, debug. Lib test binary,
title_textures gpu_sparse_vram_descriptors_buffers_and_xmem --test-threads=4, each run its own process:submit 1 lane 0 mismatch0x887a0006)main2997c9amain+ theinit()lock only (noVRAM_TEST_LOCKchange)2997c9a.xcllib binary with--test-threads=4gives 636 passed, 0 failed, 21 ignored. SKIPPED: only the 2no wave64tests.So the write-watch steal alone does not fail the test, which matches Kalmarv's runs 3 and 4. The
VRAM_TEST_LOCKpatch worked only because it also keeps the two firstinit()calls apart.Which fix:
VRAM_TEST_LOCK(test-only) hides the race in the test suite.init()lock removes it, but it is a runtime change and needs the twoxcl-smokeruns. I can't make those (no title here). @emirduran707 offered to run them for a PR.Not tested:
init()calls at once. I did not trace the callers.Investigated and written with Claude Code (Claude Opus 5.5).
@PHeitor1 on GitHub · 2026-11-24 17:22 UTC · original
Thanks @LucasHoepfner, the missing
SOFFSETis what I missed. Both pairs pass 10 of 10 here with #614, against 0/10 (placed) and 7/10 (mirror) onmain9e3831e: see the report on #614.In my last comment I said I would keep the
VRAM_TEST_LOCKpatch as the fix. Please disregard that too: it only keeps the tests apart. I have marked my two earlier comments here as superseded.Written with Claude Code (Claude Opus 5.5).
@Aniseto on GitHub · 2026-11-24 19:09 UTC · original
Confirms the pair on
mainc160d86, and it does not need the wholegpu::recompgroup.Machine: RTX 5070 Ti (Blackwell, 32-lane waves), driver 32.0.16.2124, Windows 11 build 26200, rustc 1.100.0, debug build,
XCL_ADAPTER=nvidia, noXCL_SAMPLE_*set.cargo test --workspace -- --test-threads=4: fails on 7 of 7 runs (5 measured earlier, 2 now), always the same three tests: the cubemap assertion inplaced_title_textures_share_vram_and_preserve_pixels, thentransitions_apply_when_their_list_is_submittedandvram::d32s8_targets_take_their_own_size_of_video_memoryon the poisoned lock. 672 passed, 3 failed, 21 ignored.--test-threads=1: 675 passed, 0 failed.hle::d3d12x::title_textures+gpu::recomp::tests::gpu_sparse_vram_descriptors_buffers_and_xmem, 4 threads: 10 of 10 runs fail. (One earlier run in the same session passed 3 times in a row before that, so it is not a fixed clock/order constant, but failing is the dominant outcome here.)gpu_uma_import_check_at_init,gpu_unified_memory_arena,gpu_memory_windows_above_4_giborgpu_bench_really_runsin place of the sparse test: 14 passed, 0 failed each.hle::d3d12xalone: 115 passed.gpu::alone: 283 passed. Both together: fails.So on this tree it is exactly this sparse test beside the title-texture tests, as the guess above says;
gpu::recompas a group reproduces it only because it contains this test.Not tested: AMD, release build, which of the two tests takes the other's memory windows first.
AI-assisted (OpenCode), model: DeepSeek V4.1 Flash 1017 - ran the commands above on this machine; no game data was used.