Tests: a title-queue upload waits for at least the mappings made before it #3278
Loading…
Reference in a new issue
No description provided.
Delete branch "upstream-pr/3278"
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?
Imported from ivall/xcl. Originally posted by Foniass on 2026-11-29T03:26:53Z.
Fixes the flaky
Build and test (Windows, no GPU)failures that show up on many PRs that never touch D3D12.X (e.g. #3250, #3266): 8title_texturestests red in one run, green in the next.There is one flaky test,
gpu_a_title_queue_upload_waits_for_the_page_mappings_before_it. It asserted that the upload waited for exactly the page-mapping value the test had just made. That value is device-wide: every mapping and unmapping on the device raises it (vram.rs,self.value += 1in map / unmap), including late releases of earlier tests and tests that do not holdVRAM_TEST_LOCK. When one lands between the test's mapping and its upload, the upload rightly waits for the newer value and the test fails. CI logs:left: 28, right: 26. Its panic then poisonsTEST_LOCK, so the next 7title_texturestests fail onPoisonErrorin the same run.The test now asserts what its doc comment says: the upload waits for at least the mapping made before it, and for no more than the device has reached. An upload that does not wait still fails it, so the check keeps what it tests; it no longer requires that nothing else maps pages meanwhile.
What is in it
crates/xcl/src/hle/d3d12x/title_textures.rs: the assertion, with the three values in its messagecrates/xcl/src/hle/d3d12x/vram.rs:mapping_value_for_test(test-only)Test-only: both changes are in
#[cfg(test)]code. It touches files undercrates/xcl/src, so it needs thetest-onlylabel instead of smoke runs.Tested
cargo test -p xcl --lib title_textures -- --test-threads=4: 63 passed, 0 failed, 1 ignoredcargo test -p xcl --lib -- --test-threads=4: 2465 passed, 4 failed, 29 ignored. The 4 aregpu::dxil::fuzz_tests::fuzz_validate_and_gpu_0..3with a driverE_OUTOFMEMORYthat this machine also has on main (they pass on other 5070 Tis).Not tested
uma_driver::tests::mixed_window_keeps_its_bytes_and_the_gpu_sees_every_segment(its watched regions sometimes include the 128 MiB GPU_UPLOAD segment). It has a different cause, and #3187 already addresses those mixed-window tests, so it is not touched here.AI use
🤖 Generated with Claude Code
Imported from ivall/xcl. Originally posted by Kalmarv on 2026-11-29T03:42:19Z.
merge-check
base:
fa204595a4head:
51ca7b0d41merge: clean onto main.
build: cargo test -p xcl --lib title_textures::tests -> ok (test-only change:
#[cfg(test)]helper invram.rs+ test assertion intitle_textures.rs).tests:
cargo test -p xcl --lib title_textures::tests -- --test-threads=4(DXC 1.9.2609.5) -> 63 passed, 0 failed, 1 ignored (includinggpu_a_title_queue_upload_waits_for_the_page_mappings_before_it); failing: none.review: none (whole 12-line diff read:
vram::mapping_value_for_testis#[cfg(test)]-only and readsPAGESunder its mutex; changingassert_eq!(waited, mapped)tomapped <= waited && waited <= nowfixes the parallel-test device-wide fence increment race while still failing if an upload does not wait).performance: zero runtime impact (
#[cfg(test)]only).verdict: safe to merge
hardware / tool and model: NVIDIA GeForce RTX 5070 Ti 16 GB, Windows 11, DXC 1.9.2609.5 via XCL_DXC_DIR; Antigravity (Gemini 3.5 Pro) ran the merge, tests, diff review, and drafted this check.
Imported from ivall/xcl. Originally posted by tiagonleal on 2026-11-29T12:02:51Z.
merge-check
base:
d8bd9a3820head:
51ca7b0d41merge: clean (trial merge 722f5631, local, not pushed;
git diff --checkclean).mainmoved tod2ec83dewhile this ran; the trial merge onto it is clean too. Build and tests below are on thed8bd9a38merge.build: cargo build --workspace -> ok
tests: cargo test --workspace --no-fail-fast -j 8 -- --test-threads=4 -> 2614 passed, 4 failed, 49 ignored; SKIPPED: 26 (21 "no wave64" on this GPU, 3 per-lane f16 forms refused, 2 "no heap windows"); failing:
gpu::dxil::fuzz_tests::fuzz_validate_and_gpu_0to_3, which fail on the base too. Then the lib test binary with the filtertitle_texturesand--test-threads=16, 20 times: 63 passed, 0 failed, 1 ignored every time,gpu_a_title_queue_upload_waits_for_the_page_mappings_before_itamong them. I did not loop the base, so these 20 runs show no regression; they do not show the flake going away, which I have not seen fail on this PC.review: whole diff read (+15/-4; the test in
title_textures.rsand a#[cfg(test)]reader invram.rs). The old assert wanted the upload to have waited for exactly the mapping value the test had just made. That value is one counter per device and every map or unmap raises it, so a parallel test can move it between the test's mapping and its upload. The new assert ismapped <= waited && waited <= now, withnowread afterwaited: an upload that does not wait still fails it (waitedstays belowmapped), and a wait for a value the device never reached fails it too.mapping_value_for_testonly readsPAGESunder its lock. No runtime code changes. The failure is real on CI today: two runs on PRs of mine that do not touch this code went red on this group (46257774766, 46260503226), each with this test first (left: 28, right: 26in the first run) and the other seven onPoisonError.performance: none, test code only.
verdict: safe to merge
hardware / tool and model: NVIDIA GeForce RTX 5070 Ti 16 GB (617.42), AMD Ryzen 7 9800X3D, Windows 11 Pro 26300, rustc 1.100.0, debug / Claude Code: Claude Fable 5.2 ran the merge, build, suite and loop and read the diff.
Note for @Foniass: the
PR descriptioncheck is red because the body has noxcl-smokeblocks (title_textures.rscounts as a runtime file). Both blocks, fromscripts/smoke.ps1on this head and onmain, are in my next comment for you to paste, if that helps.Imported from ivall/xcl. Originally posted by tiagonleal on 2026-11-29T13:08:57Z.
@Foniass here are the two
xcl-smokeblocks thePR descriptioncheck asks for, in case you have no retail title at hand.scripts/smoke.ps1 -Seconds 60 -Title 9cc6a39e(Newer Retail Game), release builds in clean trees, one run each,XCL_PREPARE=0, same DXIL cache, RTX 5070 Ti. The PR block is on your head51ca7b0das it is, not on a merge withmain. Paste them under Regression run if you want to use them; they stop matching if you push again.main(d2ec83de):This PR (
51ca7b0d):AI use: Claude Code (Claude Fable 5.2) ran the two builds and the smoke script.