Tests: wait for every quarantine mark before draining sparse tiles #2775

Open
github-bot wants to merge 1 commit from github-bot/gh-2775 into main AGit
Owner

@⁠sage-sage on GitHub · 2026-11-26 11:48 UTC · original
sage-sage:tests/sparse-quarantine-wait → main · +16 −0 · 1 files · 1 commits · open

Two sparse tests fail now and then in parallel runs of the lib tests:

  • a_tile_decommitted_and_committed_again_keeps_its_video_memory fails at assert!(s.drain_quarantined()).
  • flush_parked_does_not_free_or_reuse_tiles_while_unmap_is_in_flight fails with "completed unmap batch should drain after fence completion".

The tests wait for the sparse queue's fence and then expect the quarantined tiles to drain. But quarantine_tiles also puts a mark on every queue in present::known_queues, and that list keeps every queue that ever went through note_execute, including queues of other tests that can still have work in flight. So a batch can rightly stay quarantined after the sparse queue is done. The runtime is right to wait. Now the tests wait too, for every mark of the quarantined batches (at most 30 s), before they check. Test-only change.

What is in it

  • crates/xcl/src/hle/d3d12x/sparse.rs (tests only): a wait_for_quarantine helper, called after s.wait_for(s.value) in the three places that then expect the batches to drain.

Tested

  • Setup: RTX 4080 SUPER (driver 621.40), Ryzen 5 7600X, Windows 11 26H2 build 26300.10075, rustc 1.100.0, debug build, base b49be18.
  • cargo test --workspace -- --test-threads=4: 1435 passed, 0 failed, 47 ignored, 29 SKIPPED lines, the same as main on this machine (wave64, debug layer, Developer Mode, heap windows).
  • The whole lib test binary at --test-threads=12, main's sparse code (main, or main plus an unrelated test-only fix in another file):
    • 9 of 450 runs had one of these two tests fail.
    • With this change, 0 of 300 runs.
    • 150 of the runs on each side alternated, run for run, so both saw the same load.
    • The other failures with this change were the known a_dispatch_with_a_pipeline_still_building_waits_at_the_submit, placed_title_textures_share_vram_and_preserve_pixels and writes_land_after_the_queue flakes.

Regression run

  • None needed: test-only change (only #[cfg(test)] mod tests in sparse.rs changes).

Not tested

  • AMD / Intel.
  • #2638 rewrites the quarantine (quarantine_tiles_for). It still marks every queue from known_queues, so this helper should still apply there, but I have not tested the two together.

AI use

  • Claude Code, Claude Opus 5.5: found the cause in repeated parallel runs, wrote the change, ran the tests and wrote this description.

🤖 Generated with Claude Code

**@⁠sage-sage** on GitHub · 2026-11-26 11:48 UTC · [original](https://github.com/xcl-dev/xcl/pull/2775) `sage-sage:tests/sparse-quarantine-wait` → `main` · +16 −0 · 1 files · 1 commits · open Two sparse tests fail now and then in parallel runs of the lib tests: - `a_tile_decommitted_and_committed_again_keeps_its_video_memory` fails at `assert!(s.drain_quarantined())`. - `flush_parked_does_not_free_or_reuse_tiles_while_unmap_is_in_flight` fails with "completed unmap batch should drain after fence completion". The tests wait for the sparse queue's fence and then expect the quarantined tiles to drain. But `quarantine_tiles` also puts a mark on every queue in `present::known_queues`, and that list keeps every queue that ever went through `note_execute`, including queues of other tests that can still have work in flight. So a batch can rightly stay quarantined after the sparse queue is done. The runtime is right to wait. Now the tests wait too, for every mark of the quarantined batches (at most 30 s), before they check. Test-only change. **What is in it** - `crates/xcl/src/hle/d3d12x/sparse.rs` (tests only): a `wait_for_quarantine` helper, called after `s.wait_for(s.value)` in the three places that then expect the batches to drain. **Tested** - Setup: RTX 4080 SUPER (driver 621.40), Ryzen 5 7600X, Windows 11 26H2 build 26300.10075, rustc 1.100.0, debug build, base `b49be18`. - `cargo test --workspace -- --test-threads=4`: 1435 passed, 0 failed, 47 ignored, 29 SKIPPED lines, the same as `main` on this machine (wave64, debug layer, Developer Mode, heap windows). - The whole lib test binary at `--test-threads=12`, `main`'s sparse code (`main`, or `main` plus an unrelated test-only fix in another file): - 9 of 450 runs had one of these two tests fail. - With this change, 0 of 300 runs. - 150 of the runs on each side alternated, run for run, so both saw the same load. - The other failures with this change were the known `a_dispatch_with_a_pipeline_still_building_waits_at_the_submit`, `placed_title_textures_share_vram_and_preserve_pixels` and `writes_land_after_the_queue` flakes. **Regression run** - None needed: test-only change (only `#[cfg(test)] mod tests` in `sparse.rs` changes). **Not tested** - AMD / Intel. - #2638 rewrites the quarantine (`quarantine_tiles_for`). It still marks every queue from `known_queues`, so this helper should still apply there, but I have not tested the two together. **AI use** - Claude Code, Claude Opus 5.5: found the cause in repeated parallel runs, wrote the change, ran the tests and wrote this description. 🤖 Generated with [Claude Code](https://claude.com/claude-code)
Two sparse tests failed now and then in parallel runs of the lib tests
(a_tile_decommitted_and_committed_again_keeps_its_video_memory at
`assert!(s.drain_quarantined())`, and
flush_parked_does_not_free_or_reuse_tiles_while_unmap_is_in_flight at
"completed unmap batch should drain after fence completion").

The tests wait for the sparse queue's fence and then expect the
quarantined tiles to drain. But quarantine_tiles also signals a mark on
every queue in present::known_queues, which keeps every queue that ever
went through note_execute. In a parallel run those include other tests'
queues, which can still have work in flight, so a batch can stay
quarantined after the sparse queue is done. The runtime is right to
wait; the tests now wait for every mark of the quarantined batches too
(at most 30 s) before checking.

Measured on an RTX 4080 SUPER, whole lib test binary at
--test-threads=12: main 9 sparse failures in 450 runs, this change 0 in
300 (150 of them alternated with main runs).

Assisted-by: Claude Code (Claude Opus 5.5)
Co-Authored-By: Claude Opus 5.5 <[email protected]>
github-bot locked as GitHub sync and limited conversation to collaborators 2026-11-26 11:51:56 +00:00
This pull request can be merged automatically.
You are not authorized to merge this pull request.
View command line instructions

Checkout

From your project repository, check out a new branch and test the changes.
git fetch -u origin '+refs/pull/2775/head:github-bot/gh-2775'
git switch 'github-bot/gh-2775'

Merge

Merge the changes and update on Forgejo.
git switch 'main'
git merge --no-ff 'github-bot/gh-2775'
git switch 'github-bot/gh-2775'
git rebase 'main'
git switch 'main'
git merge --ff-only 'github-bot/gh-2775'
git switch 'github-bot/gh-2775'
git rebase 'main'
git switch 'main'
git merge --no-ff 'github-bot/gh-2775'
git switch 'main'
git merge --squash 'github-bot/gh-2775'
git switch 'main'
git merge --ff-only 'github-bot/gh-2775'
git switch 'main'
git merge 'github-bot/gh-2775'
git push origin 'main'
This discussion has been locked. Commenting is limited to contributors.
No description provided.