Tests: count the placed-texture test's own pages, not the device's #2581

Open
sage-sage wants to merge 1 commit from upstream-pr/2591 into main
sage-sage commented 2026-11-26 00:48:17 +00:00 (Migrated from github.com)

Imported from ivall/xcl. Originally posted by sage-sage on 2026-11-26T00:48:17Z.


placed_title_textures_share_vram_and_preserve_pixels fails now and then when tests run with more threads:
its first part reads the device-wide page bytes (vram::page_bytes_for), but every test in the process
gets the same ID3D12Device for an adapter, and tests that do not hold VRAM_TEST_LOCK add and expire
targets on it at the same time. Seen as:

assertion `left == right` failed: pages must equal covered 16 MiB, not 512 MiB
  left: 11141120
 right: 16777216

The test now counts the distinct pages its own 512 textures map (vram::tile_mappings_for, whose comment
already says device-wide counts can shrink when unrelated idle targets expire), with the same two
assertions: 16 MiB of pages after the first 16 placements, and no page added by the other 496.

What is in it

  • crates/xcl/src/hle/d3d12x/title_textures.rs: the first part of the test counts the union of its
    textures' (pool, tile) pages instead of page_bytes_for(device). Test code only; the later
    dev_pages() checks in the same test are unchanged.

Tested

  • RTX 4080 SUPER (driver 621.40), Ryzen 5 7600X, Windows 11 26H2 build 26300.10075, rustc 1.100.0,
    DXC 1.9.2602.17 (Windows SDK 10.0.26100), debug build, base 08db802, head 52fedb7
  • cargo test --workspace -- --test-threads=4: 1429 passed, 0 failed, 47 ignored
  • cargo test -p xcl --lib -- --test-threads=12: before the change the test failed in 1 of 34 runs;
    with it, 0 failures of this test in 40 runs. (One of those 40 runs failed in
    list_x::tests::a_dispatch_with_a_pipeline_still_building_waits_at_the_submit, an unrelated flaky test
    I will report separately.)
  • SKIPPED on this adapter: the wave64 tests (NVIDIA, wave32 only), the tests that need the D3D12 debug
    layer (d3d12SDKLayers.dll not installed), and pso_measurement_compiles_an_exact_synthetic_record
    (Developer Mode off)

Regression run

  • None: the diff is inside #[cfg(test)] mod tests of title_textures.rs only, so this asks for the
    test-only label.

Not tested

  • AMD and Intel GPUs. 40 clean runs against a failure rate of about 1 in 34 is evidence, not proof.
  • The same test's later check pages_after_cover < pages_before_reuse still reads the device-wide count
    and could in principle be hit the same way; I have not seen it fail and left it alone.

AI use

  • Claude Code, Claude Opus 5.5: found the flaky test by repeated runs, diagnosed it, wrote the change,
    ran the tests and wrote this description. I read and checked the diff.

🤖 Generated with Claude Code

<!-- greyfinch-sync:ivall/xcl:issue:5501845386 --> Imported from [ivall/xcl](https://github.com/xcl-dev/xcl/pull/2591). Originally posted by [sage-sage](https://github.com/sage-sage) on 2026-11-26T00:48:17Z. --- `placed_title_textures_share_vram_and_preserve_pixels` fails now and then when tests run with more threads: its first part reads the device-wide page bytes (`vram::page_bytes_for`), but every test in the process gets the same `ID3D12Device` for an adapter, and tests that do not hold `VRAM_TEST_LOCK` add and expire targets on it at the same time. Seen as: ``` assertion `left == right` failed: pages must equal covered 16 MiB, not 512 MiB left: 11141120 right: 16777216 ``` The test now counts the distinct pages its own 512 textures map (`vram::tile_mappings_for`, whose comment already says device-wide counts can shrink when unrelated idle targets expire), with the same two assertions: 16 MiB of pages after the first 16 placements, and no page added by the other 496. **What is in it** - `crates/xcl/src/hle/d3d12x/title_textures.rs`: the first part of the test counts the union of its textures' `(pool, tile)` pages instead of `page_bytes_for(device)`. Test code only; the later `dev_pages()` checks in the same test are unchanged. **Tested** - RTX 4080 SUPER (driver 621.40), Ryzen 5 7600X, Windows 11 26H2 build 26300.10075, rustc 1.100.0, DXC 1.9.2602.17 (Windows SDK 10.0.26100), debug build, base `08db802`, head `52fedb7` - `cargo test --workspace -- --test-threads=4`: 1429 passed, 0 failed, 47 ignored - `cargo test -p xcl --lib -- --test-threads=12`: before the change the test failed in 1 of 34 runs; with it, 0 failures of this test in 40 runs. (One of those 40 runs failed in `list_x::tests::a_dispatch_with_a_pipeline_still_building_waits_at_the_submit`, an unrelated flaky test I will report separately.) - SKIPPED on this adapter: the wave64 tests (NVIDIA, wave32 only), the tests that need the D3D12 debug layer (`d3d12SDKLayers.dll` not installed), and `pso_measurement_compiles_an_exact_synthetic_record` (Developer Mode off) **Regression run** - None: the diff is inside `#[cfg(test)] mod tests` of `title_textures.rs` only, so this asks for the `test-only` label. **Not tested** - AMD and Intel GPUs. 40 clean runs against a failure rate of about 1 in 34 is evidence, not proof. - The same test's later check `pages_after_cover < pages_before_reuse` still reads the device-wide count and could in principle be hit the same way; I have not seen it fail and left it alone. **AI use** - Claude Code, Claude Opus 5.5: found the flaky test by repeated runs, diagnosed it, wrote the change, ran the tests and wrote this description. I read and checked the diff. 🤖 Generated with [Claude Code](https://claude.com/claude-code)
DavidM1911 commented 2026-11-26 02:08:16 +00:00 (Migrated from github.com)

Imported from ivall/xcl. Originally posted by DavidM1911 on 2026-11-26T01:09:49Z.


Verification on RTX 3060 Ti (Windows 11), branch merged with current main:

  • cargo test -p xcl --lib: all passed, 0 failed, 26 ignored.

Thanks!

— Devin

<!-- greyfinch-sync:ivall/xcl:comment:7179496354 --> Imported from [ivall/xcl](https://github.com/xcl-dev/xcl/pull/2591#issuecomment-7179496354). Originally posted by [DavidM1911](https://github.com/DavidM1911) on 2026-11-26T01:09:49Z. --- Verification on RTX 3060 Ti (Windows 11), branch merged with current `main`: - `cargo test -p xcl --lib`: all passed, 0 failed, 26 ignored. Thanks! — Devin
fromthemoonx commented 2026-11-26 02:08:23 +00:00 (Migrated from github.com)

Imported from ivall/xcl. Originally posted by fromthemoonx on 2026-11-26T01:41:14Z.


On NVIDIA the flake shows on main and not with this change: placed_title_textures_share_vram_and_preserve_pixels failed 1 of 85 runs on main (the same pages must equal covered 16 MiB assert, left: 11141120) and 0 of 135 with this PR. At that rate this only supports the fix; it does not prove it.

Tested: 52fedb7 merged onto main b49be18 (clean). RTX 3060 12 GB (driver 610.88), Ryzen 7 5700X (16 threads), Windows 11 Pro 26300, Rust 1.100.0 MSVC, debug.

result
cargo test --workspace --no-fail-fast -- --test-threads=4 1435 passed, 0 failed, 47 ignored; 25 SKIPPED lines
the test alone, 30 runs 30 of 30
lib test binary, hle::d3d12x:: --test-threads=12 (254 tests), main, 85 runs this test failed once; other failures: a_dispatch_with_a_pipeline_still_building_waits_at_the_submit 3×, rotating_queue_… 2×, cross_queue_wait64_… 1× (known parallel flakes, see #2118 / #2547)
same, this PR, 135 runs this test 0×; a_dispatch_with_a_pipeline_still_building_… 2×. Two other runs ended with a segmentation fault and no failing test named. I did not keep those two outputs, and 75 later runs had none, so I can't say which test it was or whether it is related.

Not tested: AMD / Intel, a release build.

AI use: Claude Code (Claude Opus 5.5) ran the suite and the repeat runs, and wrote this report.

<!-- greyfinch-sync:ivall/xcl:comment:7180024211 --> Imported from [ivall/xcl](https://github.com/xcl-dev/xcl/pull/2591#issuecomment-7180024211). Originally posted by [fromthemoonx](https://github.com/fromthemoonx) on 2026-11-26T01:41:14Z. --- **On NVIDIA the flake shows on `main` and not with this change: `placed_title_textures_share_vram_and_preserve_pixels` failed 1 of 85 runs on `main` (the same `pages must equal covered 16 MiB` assert, `left: 11141120`) and 0 of 135 with this PR.** At that rate this only supports the fix; it does not prove it. **Tested:** `52fedb7` merged onto `main` `b49be18` (clean). RTX 3060 12 GB (driver 610.88), Ryzen 7 5700X (16 threads), Windows 11 Pro 26300, Rust 1.100.0 MSVC, debug. | | result | |---|---| | `cargo test --workspace --no-fail-fast -- --test-threads=4` | 1435 passed, 0 failed, 47 ignored; 25 `SKIPPED` lines | | the test alone, 30 runs | 30 of 30 | | lib test binary, `hle::d3d12x:: --test-threads=12` (254 tests), `main`, 85 runs | this test failed once; other failures: `a_dispatch_with_a_pipeline_still_building_waits_at_the_submit` 3×, `rotating_queue_…` 2×, `cross_queue_wait64_…` 1× (known parallel flakes, see #2118 / #2547) | | same, this PR, 135 runs | this test 0×; `a_dispatch_with_a_pipeline_still_building_…` 2×. Two other runs ended with a segmentation fault and no failing test named. I did not keep those two outputs, and 75 later runs had none, so I can't say which test it was or whether it is related. | **Not tested:** AMD / Intel, a release build. **AI use:** Claude Code (Claude Opus 5.5) ran the suite and the repeat runs, and wrote this report.
github-actions[bot] commented 2026-11-30 08:40:55 +00:00 (Migrated from github.com)

Imported from ivall/xcl. Originally posted by github-actions[bot] on 2026-11-30T08:40:55Z.


Nothing has happened on this PR for 3 days, so it is marked stale and will be closed in 4 days. A push or a comment takes the mark off: rebase it onto main if it conflicts, and say in one line what it still fixes. If it only waits for a maintainer, a comment saying so is enough.

<!-- greyfinch-sync:ivall/xcl:comment:7273210701 --> Imported from [ivall/xcl](https://github.com/xcl-dev/xcl/pull/2591#issuecomment-7273210701). Originally posted by [github-actions[bot]](https://github.com/apps/github-actions) on 2026-11-30T08:40:55Z. --- Nothing has happened on this PR for 3 days, so it is marked `stale` and will be closed in 4 days. A push or a comment takes the mark off: rebase it onto `main` if it conflicts, and say in one line what it still fixes. If it only waits for a maintainer, a comment saying so is enough.
Foniass commented 2026-12-01 08:26:04 +00:00 (Migrated from github.com)

Imported from ivall/xcl. Originally posted by Foniass on 2026-12-01T08:26:04Z.


Triage (#1607) – head 52fedb7

No open or merged PR makes the same change. On main, the streaming part of the placed-texture test in title_textures.rs still compares device-wide page_bytes_for deltas. This PR counts the tile identities of the test's own 512 textures through vram::tile_mappings_for (already on main, cfg(test)). The two asserts still check 16 MiB of pages and no growth after the working set is covered. No problems found in the diff.
Recommendation: keep open.

AI review: Claude Code (Claude Opus 5.5), diffs read only, not built or run; not checked by a human.

<!-- greyfinch-sync:ivall/xcl:comment:7305311615 --> Imported from [ivall/xcl](https://github.com/xcl-dev/xcl/pull/2591#issuecomment-7305311615). Originally posted by [Foniass](https://github.com/Foniass) on 2026-12-01T08:26:04Z. --- **Triage (#1607)** – head 52fedb7 No open or merged PR makes the same change. On main, the streaming part of the placed-texture test in title_textures.rs still compares device-wide `page_bytes_for` deltas. This PR counts the tile identities of the test's own 512 textures through `vram::tile_mappings_for` (already on main, cfg(test)). The two asserts still check 16 MiB of pages and no growth after the working set is covered. No problems found in the diff. Recommendation: keep open. AI review: Claude Code (Claude Opus 5.5), diffs read only, not built or run; not checked by a human.
This pull request cannot be merged automatically due to conflicts.
Merge manually to resolve the conflicts.
View command line instructions

Checkout

From your project repository, check out a new branch and test the changes.
git fetch -u origin 'upstream-pr/2591:upstream-pr/2591'
git switch 'upstream-pr/2591'

Merge

Merge the changes and update on Forgejo.

Warning: The "Autodetect manual merge" setting is not enabled for this repository, you will have to mark this pull request as manually merged afterwards.

git switch 'main'
git merge --no-ff 'upstream-pr/2591'
git switch 'upstream-pr/2591'
git rebase 'main'
git switch 'main'
git merge --ff-only 'upstream-pr/2591'
git switch 'upstream-pr/2591'
git rebase 'main'
git switch 'main'
git merge --no-ff 'upstream-pr/2591'
git switch 'main'
git merge --squash 'upstream-pr/2591'
git switch 'main'
git merge --ff-only 'upstream-pr/2591'
git switch 'main'
git merge 'upstream-pr/2591'
git push origin 'main'
Sign in to join this conversation.
No reviewers
No labels
No milestone
No assignees
1 participant
Notifications
Due date
The due date is invalid or out of range. Please use the format "yyyy-mm-dd".

No due date set.

Reference
xcl-dev/xcl!2581
No description provided.