Skip to content

Tests: placed_title_textures_share_vram_and_preserve_pixels fails now and then at its cubemap reuse check (main 9ce2070) #718

Backlog

Description

@futurepro62

hle::d3d12x::title_textures::tests::placed_title_textures_share_vram_and_preserve_pixels sometimes fails at its cubemap reuse check on trees based on main 9ce2070. When it does, its panic poisons the lock it holds, and two more tests fail on that lock.

Seen

thread 'hle::d3d12x::title_textures::tests::placed_title_textures_share_vram_and_preserve_pixels' panicked at crates\xcl\src\hle\d3d12x\title_textures.rs:1782:21:
assertion `left == right` failed: cubemap extra_pages must be reused at same va
  left: 2359296
 right: 2555904

then, on the poisoned lock (PoisonError):

  • hle::d3d12x::title_textures::tests::transitions_apply_when_their_list_is_submitted (title_textures.rs:1368)
  • hle::d3d12x::vram::tests::d32s8_targets_take_their_own_size_of_video_memory (vram.rs:778)
tree (PR head on 9ce2070) right (pages after placing the second cube) difference
#606 62d31c5 (changes only kbm.rs, README.md) 2555904 +196608 (3 × 64 KiB)
#608 2a3c7f4 (kernelx.rs) 17170432 +14811136
#604 a452faa (present.rs, window_mode.rs, …) 2555904 +196608

left was 2359296 every time. None of these PRs changes title_textures.rs or vram.rs, and #606 changes nothing on this path, so I don't think a PR caused it.

How often

A guess, not checked
dev_pages() is vram::page_bytes_for(dev_key), the page total for the shared device. The test holds VRAM_TEST_LOCK and TEST_LOCK, but a parallel test that places textures on the same device without those locks could add pages between p0 and the second read. That would make this two tests sharing one device, like #343, rather than reuse failing. +196608 is three 64 KiB tiles.

Machine
NVIDIA GeForce RTX 5070 Ti 16 GB (32-lane waves), driver 616.64, Ryzen 7 9800X3D, Windows 11 Home 26300, Rust 1.100.0 MSVC, debug, D3D12 debug layer installed, XCL_REQUIRE_GPU=mesh. The machine also has an AMD iGPU; the tests ran on the NVIDIA card.

Not tested

  • Whether it happens with --test-threads=1, which test ran beside it, a stack or page dump at the failure, AMD.

AI use

  • Claude Code (Claude Opus 5.5) ran the tests, read the test and wrote this issue. I checked it before posting.

Activity

  1. LucasHoepfner commented on Nov 24, 2026

    @LucasHoepfner
    Contributor

    This flake is what #447 (@Prime1997) fixes: an open tests-only PR that checks the cube's tile reuse independently of idle page reclamation, with passing reports on several GPUs.

    AI use: Claude Code (Claude Opus 5.5) found the PR; I checked it before posting.

  2. futurepro62 commented on Nov 24, 2026

    @futurepro62
    Author

    Found the cause, and my guess above was wrong: no other test is involved. It is the idle sweep (IDLE = 2 s in vram.rs) inside the test itself.

    I also misread the numbers: assert_eq!(dev_pages(), p0) puts the count after the second placement on the left, so in every failure the page total went down (17170432 → 2359296 is 226 pages of 64 KiB, 2555904 → 2359296 is 3 pages).

    What happens
    Part 1 of the test (the 512 streamed 1 MiB textures) releases its textures, and their pages go idle. If more than 2 s pass between that release and the cubemap check, place_tex → Pages::bind → sweep gives those idle pages back, between p0 and the second dev_pages(). The cube's own pages are reused as intended; the total drops because of pages the test released earlier. Under --test-threads=4 the test is slow enough to cross 2 s now and then.

    How I checked (main f4ce27c, temporary local changes, reverted after)

    • A 2 s sleep between p0 and the second place_tex: the test fails 5 of 5 in the parallel lib run and 2 of 2 alone (--exact … --test-threads=1), always left: 2359296, right: 17170432.
    • A log line in bind for every page taken while that window was open: none. So no page was added, by this test or another one.
    • A log line in sweep_idle for every page it removed in the window: 226 pages, all on the test's own thread, which is exactly the 14811136 B difference.
    • Without the sleep, the test alone passes 3 of 3 (0.77 s each).

    So it is a test problem, not a fault a title would see: the check compares a device-wide total across a moment when pages from earlier in the test may expire. Two ways to fix it, both in the test only: take p0 and the second count only over the cube's own keys ((base, i) in extra_pages and its pages), or make sure the earlier idle pages are gone before p0 is taken.

    AI use

    • Claude Code (Claude Opus 5.5) added and removed the instrumentation, ran the tests and wrote this comment. I checked it before posting.
  3. fromthemoonx commented on Nov 24, 2026

    @fromthemoonx

    I'm taking this one. I reproduced it here (1 of 15 cargo test -p xcl --lib -- --test-threads=4 runs on main f4ce27c, RTX 3060) and found the cause. It is not a second test on the same device.

    Cause: in the assertion, left is the page total after the second cube and right the one before, so in every failure (yours and mine) the total went down. Pages::bind starts with self.sweep(now), which returns pages left idle for IDLE (2 s) to the pool. Earlier steps of the same test leave pages idle. When the machine is busy and the test reaches the cube more than 2 s later, the second placement sweeps them, and the device total (page_bytes_for, which counts idle pages too) drops. With temporary logging, no other thread placed anything on the device during that window, and the total went from 17170432 to 15138816. The same applies to the reusing unaligned va must share extra_pages tile check.

    Plan (test-only, vram.rs): page_bytes_for, used only by this test, counts the pages a texture still uses (users > 0), not idle ones. With a forced 2.1 s sleep before the placement, the cube check and the unaligned-reuse check fail every time on main and pass with the change. If extra pages are deliberately not shared, the test still fails. PR shortly; it only touches a #[cfg(test)] function, so it will ask for the test-only label.

    AI use: Claude Code (Claude Opus 5.5) did the runs, the logging and this write-up.

  4. fromthemoonx commented on Nov 24, 2026

    @fromthemoonx

    Withdrawing my claim above: I missed that #447 already fixes this, as @LucasHoepfner says. I won't open a PR.

    One measured result that #447 does not cover yet: the reusing unaligned va must share extra_pages tile check in the same test has the same cause. It also compares the device-wide dev_pages() before and after a place_tex, and that placement can sweep idle pages too.

    On main f4ce27c (RTX 3060, cargo test -p xcl --lib -- --exact hle::d3d12x::title_textures::tests::placed_title_textures_share_vram_and_preserve_pixels), with a temporary std::thread::sleep(2100 ms) just before let reused = place_tex(base + 0x4000, &d16);:

    assertion `left == right` failed: reusing unaligned va must share extra_pages tile
      left: 327680
    

    It fails every time this way, and the same sleep before the cube's second place_tex fails the cube check every time, like the flake. #447 might want the same tile-identity comparison for that check as well.

    AI use: Claude Code (Claude Opus 5.5) did the runs and wrote this; the sleep was a local change only.

  5. Prime1997 commented on Nov 24, 2026

    @Prime1997
    Contributor

    Withdrawing my claim above: I missed that #447 already fixes this, as @LucasHoepfner says. I won't open a PR.

    One measured result that #447 does not cover yet: the reusing unaligned va must share extra_pages tile check in the same test has the same cause. It also compares the device-wide dev_pages() before and after a place_tex, and that placement can sweep idle pages too.

    On main f4ce27c (RTX 3060, cargo test -p xcl --lib -- --exact hle::d3d12x::title_textures::tests::placed_title_textures_share_vram_and_preserve_pixels), with a temporary std::thread::sleep(2100 ms) just before let reused = place_tex(base + 0x4000, &d16);:

    assertion `left == right` failed: reusing unaligned va must share extra_pages tile
      left: 327680
    

    It fails every time this way, and the same sleep before the cube's second place_tex fails the cube check every time, like the flake. #447 might want the same tile-identity comparison for that check as well.

    AI use: Claude Code (Claude Opus 5.5) did the runs and wrote this; the sleep was a local change only.

    Working on this.

  6. SlopTart commented on Nov 24, 2026

    @SlopTart

    AMD + Wine datapoint: the flake reproduces here, and the threads=1 control you listed as not tested does not.

    Machine: RX 7900 XT (RADV NAVI31), Mesa 26.2.5, kernel 7.2 (Arch), Wine = Proton Experimental (wine-11.0), patched vkd3d-proton v3.1, Rust 1.100.0 cross x86_64-pc-windows-gnu, main d5442d2. (Same rig as my Linux row in #42; release profile, XCL_NETWORK=0.)

    cargo test -p xcl --lib -- --test-threads=4, 5 completed runs:

    • runs 1-3: clean at the flake site — 659 passed / 4 failed (the 4 are this rig's stable Wine-lane failures, listed in GPU test results: NVIDIA RTX 3080 (wave32) and AMD RDNA2 iGPU (no mesh shaders) #42; not yours)
    • run 4: 656/7 — exactly your trio: placed_title_textures_share_vram_and_preserve_pixels fails its cubemap reuse check, then transitions_apply_when_their_list_is_submitted and d32s8_targets_take_their_own_size_of_video_memory die on the poisoned lock
    • run 5: 655/8 — same trio plus gpu_mirror_upload_follows_cpu_writes_and_later_mapping_changes
      So 2 of 5 here, similar to your 3 of 9 full-suite rate. (Runs 6-8 were cut short by an unrelated desktop freeze on my machine, not a test crash.)

    --test-threads=1 control, 3 runs: 659/4 every time, zero hits on all three tests. Consistent with your page-count interference guess: the flake needs a concurrently running test that touches the shared device's pages; serial execution removes it.

    Second machine, NVIDIA: a GTX 1070 (Pascal, driver 550) under Linux/Wine (wine-10.0) at main e50836b ran the three test families filtered (title_textures transitions_apply d32s8, 14 tests) at --test-threads=4 five times: 14/14 every time, zero hits — while that box's unrelated gpu::recomp family fails en masse (my #42 note), so the device does work. Vendor split so far: AMD/RADV 2/5 at threads=4 and 0/3 at threads=1; NVIDIA/Pascal 0/5 at threads=4.

    Not tested: the left/right page numbers in my two hits (log truncated before I captured them — I can rerun until one breaks with full stdout), whether pinning each of the three tests to separate processes fixes it on this rig, Windows.
    Counts only, no game data.
    AI use: Hermes agent (local Qwen-class) ran the loops and drafted this; I checked it before posting.

  7. NathanTheophile commented on Nov 24, 2026

    @NathanTheophile

    Independent confirmation on a GeForce RTX 4060 Laptop GPU (driver 616.87), Windows 11 build 26200.9974, Rust 1.100.0 MSVC and DXC 1.8.2502.11. In placed_title_textures_share_vram_and_preserve_pixels, a 2.2 s delay between let p0 = dev_pages(); and the second cubemap placement reproduces the assertion in just over 3 seconds on both #818’s head (baf0639) and its base (e50836b). The isolated check passes on both revisions without the delay.

    A test-only probe compared the ordered heap/tile mappings for the two cubemaps. All 33 owned tiles and 3 extra tiles matched while the device-wide counter fell from 17,170,432 to 2,359,296 bytes. The four-thread lib suite on the instrumented head reproduced the same result without the delay. This independently confirms the idle-page diagnosis and supports the mapping-based assertion in #447.

    AI use — OpenAI Codex (GPT-6 family, exact variant unavailable) ran the tests, prepared the diagnostic probe, and drafted this comment.

  8. NathanTheophile commented on Nov 24, 2026

    @NathanTheophile

    I tested #447 (48e7434) and #770 (234a8e1) separately and together on the same base, main at beaa245. Windows 11 build 26200, RTX 4060 Laptop GPU (driver 616.87), Rust 1.100.0 MSVC and SDK DXC 1.8.2502.11.

    cargo test --workspace --no-fail-fast -- --test-threads=4 results:

    Each full run had two native-wave64 capability skips. The unaligned-placement failure did not reproduce spontaneously. I used the existing tests without timing instrumentation or game data. The results support taking both test fixes together.

    AI use

    • Codex (GPT-6) ran the tests and drafted this report.
  9. SlopTart commented on Nov 24, 2026

    @SlopTart

    New member of this flaky family from today's 28-PR sweep on my rig (mains beaa245 -> 1ec4c98, release, --test-threads=4):

    hle::d3d12x::title_textures::tests::gpu_mirror_upload_follows_cpu_writes_and_later_mapping_changes failed in 9 of 28 lanes, across merged PRs that have nothing to do with each other (872, 859, 854, 844, 843, 833, 812, 806, 805). Same signature pattern as your trio: PR-independent, only at threads=4, and six lanes in the same sweep ran fully clean (711-718 passed / 7 failed), so it is load/order sensitive rather than content dependent.

    Also for tracking: gpu_geometry_wave32_prefix_count_over_a_mask (#847) hit 0/28 in this batch on the same rig - consistent with the load-sensitive read there too.

    Counts only, no game data.

    Machine: RX 7900 XT (RADV NAVI31), Mesa 26.2.5, kernel 7.2 (Arch), Proton Experimental (wine-11.0), patched vkd3d-proton v3.1, Rust cross x86_64-pc-windows-gnu, XCL_NETWORK=0, release profile. My Linux rows: #42 / #718.

    AI use: Hermes agent (local Qwen-class) ran the suite and drafted this; I checked it before posting.

  10. fromthemoonx commented on Nov 24, 2026

    @fromthemoonx

    @SlopTart, gpu_mirror_upload_follows_cpu_writes_and_later_mapping_changes may be #913 rather than this flake. On an RTX 3060 12 GB, main a1672ef, it fails with HRESULT(0x8007000E) (E_OUTOFMEMORY) at title_textures.rs:1305 in most lib runs. The three tests from this issue then fail on the lock it poisons.

    The cause is #348's a_freed_block_is_decommitted_before_its_address_is_reused: it creates a new 64 MiB sparse pool almost every alloc/free cycle and holds up to ~284 of them at once. Video memory peaks at 12 GB with it and 1.65 GB with --skip a_freed_block_is_decommitted_before_its_address_is_reused. It is also load and order dependent, because the test only allocates when earlier tests in the process have set up the sparse windows.

    If your failing lanes show 0x8007000E in that test's panic, they are this. Numbers and bisect are in #913.

    AI use: Claude Code (Claude Opus 5.5) did the runs and wrote this.

  11. fladit123 commented on Nov 24, 2026

    @fladit123

    Independent reproduction on native Windows, without injected delays or source modifications.

    Environment

    • Main: f4ce27ceb6d1b0576d0c659b713b674778bf1968
    • NVIDIA GeForce RTX 4060 8 GB, driver 610.88
    • Intel Core i5-12400F, 32 GB RAM
    • Windows 11 Pro build 26300
    • Rust 1.100.0 MSVC, DXC 1.8.2502.11
    • Debug, XCL_ADAPTER=4060, sample variables unset.

    Built with cargo test --locked -p xcl --lib --no-run, then executed the same library test binary in separate processes with --test-threads=4 --show-output.

    Run Passed Failed Ignored Test duration
    1 660 0 21 37.75 s
    2 657 3 21 39.68 s

    The second run failed with exit code 101:

    title_textures.rs:1897:21
    assertion `left == right` failed:
    cubemap extra_pages must be reused at same va
      left: 2359296
     right: 9895936
    

    The subsequent failures were:

    • transitions_apply_when_their_list_is_submitted: PoisonError
    • d32s8_targets_take_their_own_size_of_video_memory: PoisonError

    Both runs selected the real RTX 4060 backend. Two explicit no-wave64 skips were included in the passed counts.

    This is consistent with the already reported #718 failure pattern and supports the relevance of #447 and #673. I did not independently instrument tile identity or idle reclamation in these runs.

    The soak harness stopped automatically on the first failing run.

    AI use: ChatGPT (GPT-6.2) assisted with the test harness, log analysis and reporting. All tests were executed locally by me.

  12. KENAJBBY commented on Nov 24, 2026

    @KENAJBBY

    Before / after #923 on an RTX 5070 Ti and a Ryzen 7 9800X3D iGPU: the trio is gone here

    On this PC the #718 trio failed in nearly every library run before #923 and in none after it.

    Machine: Windows 11 Pro 26200, Ryzen 7 9800X3D, 32 GB. NVIDIA GeForce RTX 5070 Ti 16 GB, driver 621.24. AMD Radeon(TM) Graphics (9800X3D iGPU, 485 MiB dedicated), driver 32.0.21030.2001. Rust 1.100.0 MSVC, DXC 1.9.2602.17. No XCL_SAMPLE_*. cargo test -p xcl --lib -- --test-threads=4, one test process at a time, each tree in its own target dir. Peak memory is device-wide (Windows GPU Adapter Memory counters, sampled every 0.5 s).

    before: main 077ce40 after: #923 head 71bda93 after: main 9aec53d
    iGPU (XCL_ADAPTER=radeon), debug trio in 6 of 6 runs; a 7th run lost the device (CreateHeap of a 64 MiB pool refused 0x887a0005, then 0x887a0007) 0 of 5 0 of 3
    iGPU peak shared memory (one sampled run) 12 616 MiB 648 MiB 651–656 MiB
    RTX 5070 Ti (XCL_ADAPTER=nvidia), release 5 of 7 runs bad: 4 × d32s8_targets_take_their_own_size_of_video_memory (D32S8 target at 0x4000000000), 1 × device removed after E_OUTOFMEMORY 0 of 3 0 of 2
    RTX peak dedicated memory 15 858 MiB of 16 GB 2 673–2 733 MiB 2 653–2 658 MiB

    So on these two GPUs #718 was #913. Whether it is fully fixed elsewhere (#447 / #673 point at idle reclamation) I can't tell from this PC.

    AI use: Claude Code (Claude Opus 5.5) ran the builds and tests, read the logs and drafted this comment. The numbers come from those runs.

  13. jmal423 commented on Nov 24, 2026

    @jmal423

    Native Windows / RX 9070 XT follow-up to the #872 run. I checked the ancestry: the #872 head tested there predates #923. Current main includes it.

    Revision Library runs (4 test threads, debug) Cubemap assertion
    #872 head 98d987a 1 run: 669 passed, 3 failed, 21 ignored Hit once (8847360 vs 17170432), followed by two poisoned-lock failures. The placed-texture test then passed 5/5 in isolation.
    main 6efdabc 3 fresh processes: 685 passed, 0 failed, 21 ignored each 0/3

    RX 9070 XT, driver 32.0.32029.2010, Windows 11 Pro build 26200, DXC 1.8.2502.11. The main binary was built in a fresh target directory; the three runs were sequential, with XCL_ADAPTER=9070 and XCL_REQUIRE_GPU=wave64,mesh. No retail inputs.

    This is a post-merge observation on discrete RDNA4. The two revisions include other changes, and three clean runs do not isolate #923 or establish a fix. AI use: Codex ran the tests and prepared this comment from the logs.

    Combined check on main 47efa2e with the diffs from #447 (48e7434) and #770 (234a8e1). I ran the focused placed-texture test twice, inserting a 2100 ms sleep immediately before each second placement and recording device page bytes on either side. Both runs passed both tile-identity checks. Device bytes dropped from 16973824 to 327680 for the unaligned placement and from 2555904 to 2359296 for the cubemap in each run. The cubemap reused 33 ordinary tiles and 3 extra tiles. The second run printed the DXGI adapter description from the adapter used to create the device: AMD Radeon RX 9070 XT. This exercises both fixes while the old byte-count equalities would have failed in the same run. Focused debug test only. Codex instrumented and ran the tests.

    Same-base library comparison (debug, four test threads, one run per configuration). Both builds used #770 at 234a8e1 plus the small cover-baseline test change documented in #770. Without #447: 657 passed, 3 failed, 21 ignored. The cubemap count fell from 17170432 to 2555904; the other two failures were poisoned locks. Adding only the #447 diff: 660 passed, 0 failed, 21 ignored. The combined tree also completed scripts/test.ps1 (Cargo totals: 701 passed, 0 failed, 41 ignored; external sample variables unset). The synthetic title completed with exit 0. This pair reproduces the cubemap assertion under normal library load without the artificial delays used above.

  14. fladit123 commented on Nov 24, 2026

    @fladit123

    Follow-up to my earlier reproduction of the three failures on f4ce27c.

    20 consecutive successful library test runs on main 9e3831e1f570d3646e53ab753b19ec07eb8f1485, which includes #923.

    Environment

    • NVIDIA GeForce RTX 4060 8 GB (wave32), driver 610.88
    • Intel Core i5-12400F, 32 GB RAM
    • Windows 11 Pro build 26300
    • Rust 1.100.0 MSVC, DXC 1.8.2502.11
    • Debug, XCL_ADAPTER=4060, sample variables unset.
    Revision Runs Successful Failed
    f4ce27c 2 1 1
    9e3831e 20 20 0

    Every new run reported 727 passed, 0 failed, 21 ignored, with exit code 0. Two explicit hardware skips were included in the passed count in every run:

    • gpu::recomp::tests::gpu_geometry_wave32_prefix_count_over_a_mask: no wave64
    • gpu::recomp::tests::gpu_wave32_program_in_wave64_hardware: no wave64

    The test executable was built once using cargo test --locked -p xcl --lib --no-run and executed in 20 separate processes with --test-threads=4 --show-output, a 20-second interval and a four-minute timeout per run.

    No timeouts occurred. The real RTX 4060 backend was confirmed in the first run's log. The checkout remains clean.

    Mean wall-clock duration per run decreased from 39.48 s to 19.13 s.

    The previously observed cubemap assertion and subsequent PoisonError failures did not recur.

    This is a post-merge stability observation, not an isolated A/B test of #923. Other changes between the revisions may contribute to the improvement. No retail title was tested.

    AI use: ChatGPT (GPT-6.2) assisted with the test harness, result analysis and reporting. All tests were executed locally on my hardware.

  15. Aniseto commented on Nov 24, 2026

    @Aniseto

    Reproduced on current main and narrowed the interference to the gpu::recomp group.

    • 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, no XCL_SAMPLE_* set.
    • main c160d86, cargo test --workspace -- --test-threads=4: 5 of 5 runs fail, always the same three tests (the cubemap assertion, then the two PoisonError ones). 672 passed, 3 failed, 21 ignored.
    • Same tree, --test-threads=1: 675 passed, 0 failed, 21 ignored.
    • Isolation, all with --test-threads=4:
      • hle::d3d12x alone: 115 passed, 0 failed (1 ignored)
      • gpu:: alone: 283 passed, 0 failed (18 ignored)
      • hle::d3d12x gpu:: together: fails, same three tests
      • hle::d3d12x gpu::recomp: fails (300 passed, 3 failed)
      • hle::d3d12x gpu::uma: 122 passed, 0 failed
      • hle::d3d12x gpu::texture: 127 passed, 0 failed

    So on this tree the interfering group is gpu::recomp, which contains gpu_sparse_vram_descriptors_buffers_and_xmem from #343. That matches the guess there about two tests sharing one process's memory windows.

    For context, this machine was green with the same command on 47efa2e and 930e8b4 (3 of 3 runs each), so it has not been fixed; it just does not always show.

    Not tested: which single test inside gpu::recomp triggers it, a release build, AMD.

    AI-assisted (OpenCode), model: DeepSeek V4.1 Flash 1017 - ran the commands above on this machine; no game data was used.

  16. added a commit that references this issue on Nov 25, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions