texture tests: hold the title lock and skip the probe deadline in the hot-texture tests #308

Closed
m0rff wants to merge 1 commit from upstream-pr/308 into main
m0rff commented 2026-11-27 10:51:41 +00:00 (Migrated from github.com)

Imported from LakshanSivakumar/Native-Victory-macOS. Originally posted by m0rff on 2026-11-27T10:51:41Z.


Refs #307

Two hot-texture tests in native::texture_tests sometimes failed their "at once" and "at the next submission" asserts:

  • a_texture_rewritten_whole_is_read_whole_only_now_and_then
  • a_texture_uploaded_blank_is_probed_at_each_submission

Both had two causes, and both come from the Title the texture tests share. Traces in probe_round and sync_apply showed both. Details are in #307.

  1. Leftover hot textures and the probe deadline. Other tests' textures stay hot after those tests end. The 200 from a_hot_texture_is_probed_at_each_submission_among_hundreds stay hot for HOT submissions after it releases AGING. Under load, PROBE_BUDGET cut a round short after 61 of about 215 hot textures, and the test's texture was one of the 154 not visited. The tests now sync with sync_dirty_without_probe_deadline, as the 200-texture test already does.
  2. Other tests' submissions in between. Another test's sync ran between the test's own with_title calls and uploaded the write the samples missed. The test's next sync then spent the follow-up whole read on it and found nothing new, so the texture went back to a whole read every WHOLE_EVERY probes. The next write then waited. The tests now hold the title lock from their first write to their last assert.

The asserts are unchanged, and so is the production probe code. The deadline behaves as its doc comment says (a documented shortcut). Serialising the tests the way c1f930b did would not help: the textures stay hot after AGING is released, and the tests that submit in between don't take that lock. A note is added to docs/native-host.md.

Overlap. #252 keeps the deadline and doesn't make the tests hold the title lock, so it doesn't fix this. #301 touches the same file, but not these tests.

Reproduction. Native arm64, victory-gpu lib test binary with --test-threads=8, with a looping cargo build -j6 of other crates alongside:

Run ..._rewritten_whole_... ..._uploaded_blank_...
Test alone, 300 runs 0 –
Full suite on c1b9587, 200 runs 16 3
Full suite on ce2b786, 200 runs 20 6
Full suite with only the deadline change 0 2 (stopped early)
Full suite with this PR, 500 runs 0 0

In the 500-run loop, native::textures::tests::a_known_partial_chunk_skips_the_whole_read_until_every_page_is_readable failed once. It is a page-protection test that doesn't use the shared Title or anything changed here. It didn't fail in the 400 baseline runs. I haven't looked into it.

Checks: cargo test -p victory-hle -p victory -p victory-gpu -p xtask (native arm64), cargo clippy --workspace --all-targets --target x86_64-pc-windows-gnullvm -- -D warnings, cargo xtask policy.

<!-- greyfinch-sync:LakshanSivakumar/Native-Victory-macOS:issue:5525381214 --> Imported from [LakshanSivakumar/Native-Victory-macOS](https://github.com/LakshanSivakumar/Native-Victory-macOS/pull/308). Originally posted by [m0rff](https://github.com/m0rff) on 2026-11-27T10:51:41Z. --- Refs #307 Two hot-texture tests in `native::texture_tests` sometimes failed their "at once" and "at the next submission" asserts: - `a_texture_rewritten_whole_is_read_whole_only_now_and_then` - `a_texture_uploaded_blank_is_probed_at_each_submission` Both had two causes, and both come from the `Title` the texture tests share. Traces in `probe_round` and `sync_apply` showed both. Details are in #307. 1. **Leftover hot textures and the probe deadline.** Other tests' textures stay hot after those tests end. The 200 from `a_hot_texture_is_probed_at_each_submission_among_hundreds` stay hot for `HOT` submissions after it releases `AGING`. Under load, `PROBE_BUDGET` cut a round short after 61 of about 215 hot textures, and the test's texture was one of the 154 not visited. The tests now sync with `sync_dirty_without_probe_deadline`, as the 200-texture test already does. 2. **Other tests' submissions in between.** Another test's sync ran between the test's own `with_title` calls and uploaded the write the samples missed. The test's next sync then spent the follow-up whole read on it and found nothing new, so the texture went back to a whole read every `WHOLE_EVERY` probes. The next write then waited. The tests now hold the title lock from their first write to their last assert. The asserts are unchanged, and so is the production probe code. The deadline behaves as its doc comment says (a documented shortcut). Serialising the tests the way c1f930b did would not help: the textures stay hot after `AGING` is released, and the tests that submit in between don't take that lock. A note is added to `docs/native-host.md`. **Overlap.** #252 keeps the deadline and doesn't make the tests hold the title lock, so it doesn't fix this. #301 touches the same file, but not these tests. **Reproduction.** Native arm64, victory-gpu lib test binary with `--test-threads=8`, with a looping `cargo build -j6` of other crates alongside: | Run | `..._rewritten_whole_...` | `..._uploaded_blank_...` | |---|---|---| | Test alone, 300 runs | 0 | – | | Full suite on c1b9587, 200 runs | 16 | 3 | | Full suite on ce2b786, 200 runs | 20 | 6 | | Full suite with only the deadline change | 0 | 2 (stopped early) | | **Full suite with this PR, 500 runs** | **0** | **0** | In the 500-run loop, `native::textures::tests::a_known_partial_chunk_skips_the_whole_read_until_every_page_is_readable` failed once. It is a page-protection test that doesn't use the shared `Title` or anything changed here. It didn't fail in the 400 baseline runs. I haven't looked into it. Checks: `cargo test -p victory-hle -p victory -p victory-gpu -p xtask` (native arm64), `cargo clippy --workspace --all-targets --target x86_64-pc-windows-gnullvm -- -D warnings`, `cargo xtask policy`.
LakshanSivakumar commented 2026-11-27 11:54:09 +00:00 (Migrated from github.com)

Imported from LakshanSivakumar/Native-Victory-macOS. Originally posted by LakshanSivakumar on 2026-11-27T11:54:09Z.


Thank you for tracing this to the other tests' hot textures and for holding the title lock in the two tests.

I will wait for the loop result on the current head before this leaves draft. Please post the number of failures and runs for both tests when it finishes, with the same load as in #307. The deadline itself is no longer covered by these two tests; please say in the description which test still covers it.

<!-- greyfinch-sync:LakshanSivakumar/Native-Victory-macOS:comment:7217606837 --> Imported from [LakshanSivakumar/Native-Victory-macOS](https://github.com/LakshanSivakumar/Native-Victory-macOS/pull/308#issuecomment-7217606837). Originally posted by [LakshanSivakumar](https://github.com/LakshanSivakumar) on 2026-11-27T11:54:09Z. --- Thank you for tracing this to the other tests' hot textures and for holding the title lock in the two tests. I will wait for the loop result on the current head before this leaves draft. Please post the number of failures and runs for both tests when it finishes, with the same load as in #307. The deadline itself is no longer covered by these two tests; please say in the description which test still covers it.
LakshanSivakumar commented 2026-11-27 13:06:51 +00:00 (Migrated from github.com)

Imported from LakshanSivakumar/Native-Victory-macOS. Originally posted by LakshanSivakumar on 2026-11-27T13:06:51Z.


Merged into main as of d35ba927 (bb1a6ddf), from the head before your latest commit 92795938, so GitHub still shows this open with one commit left.

Loop result on the merged head, texture_tests module, 8 threads, 4 CPU burners alongside: 500 runs, 0 failures of the two tests this fixes. Main under the same load, 300 runs: rewritten_whole failed 11 times and uploaded_blank 2. A third test, a_texture_blank_for_thousands_of_submissions_is_still_probed, fails on both (5 of 500 here, 2 of 300 on main); it is an older flaky test this PR does not touch.

If 92795938 is still needed, rebase it on main and I will take it; otherwise please close this. Thank you.

<!-- greyfinch-sync:LakshanSivakumar/Native-Victory-macOS:comment:7219073010 --> Imported from [LakshanSivakumar/Native-Victory-macOS](https://github.com/LakshanSivakumar/Native-Victory-macOS/pull/308#issuecomment-7219073010). Originally posted by [LakshanSivakumar](https://github.com/LakshanSivakumar) on 2026-11-27T13:06:51Z. --- Merged into main as of d35ba927 (bb1a6ddf), from the head before your latest commit 92795938, so GitHub still shows this open with one commit left. Loop result on the merged head, `texture_tests` module, 8 threads, 4 CPU burners alongside: 500 runs, 0 failures of the two tests this fixes. Main under the same load, 300 runs: `rewritten_whole` failed 11 times and `uploaded_blank` 2. A third test, `a_texture_blank_for_thousands_of_submissions_is_still_probed`, fails on both (5 of 500 here, 2 of 300 on main); it is an older flaky test this PR does not touch. If 92795938 is still needed, rebase it on main and I will take it; otherwise please close this. Thank you.
m0rff commented 2026-11-27 13:23:53 +00:00 (Migrated from github.com)

Imported from LakshanSivakumar/Native-Victory-macOS. Originally posted by m0rff on 2026-11-27T13:23:53Z.


Merged in bb1a6ddf. The remaining commit only updates the measured figures in docs/native-host.md, so closing.

<!-- greyfinch-sync:LakshanSivakumar/Native-Victory-macOS:comment:7219427424 --> Imported from [LakshanSivakumar/Native-Victory-macOS](https://github.com/LakshanSivakumar/Native-Victory-macOS/pull/308#issuecomment-7219427424). Originally posted by [m0rff](https://github.com/m0rff) on 2026-11-27T13:23:53Z. --- Merged in bb1a6ddf. The remaining commit only updates the measured figures in docs/native-host.md, so closing.

Pull request closed

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
LakshanSivakumar/Native-Victory-macOS!308
No description provided.