gpu: the heap test no longer races another test sync #592

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

@⁠oxybes on GitHub · 2026-12-04 08:48 UTC · original
oxybes:pr/heap-test-flake → main · +33 −11 · 1 files · 1 commits · draft

records_copied_as_bytes_are_made_at_the_next_sync failed about once per full parallel run, and passed when run alone.

SHADER_HEAPS is global, and sync_heaps walks every registered heap, consuming each heap's write-watch pages with written.take(...). Another test's sync_heaps() - or the background victory-heap-sync thread started by begin_sync_heaps - can take this test's page between the copy and the assert!(!host.made(5)), or take it and still be mirroring when the test's own sync and made check return.

The test now retries the same sequence on fresh slots (up to ten, 2 ms apart), the way the neighbouring cleared_before_made already does, and keeps the same two assertions: a cleared copy is not made before the sync, and it is made after it. No global lock, so the rest of the test binary stays parallel.

cargo test -p victory-gpu --lib: 649 passed, twice in a row and six more times before that.

**@⁠oxybes** on GitHub · 2026-12-04 08:48 UTC · [original](https://github.com/readmet3xt-lab/foxhound/pull/592) `oxybes:pr/heap-test-flake` → `main` · +33 −11 · 1 files · 1 commits · draft `records_copied_as_bytes_are_made_at_the_next_sync` failed about once per full parallel run, and passed when run alone. `SHADER_HEAPS` is global, and `sync_heaps` walks *every* registered heap, consuming each heap's write-watch pages with `written.take(...)`. Another test's `sync_heaps()` - or the background `victory-heap-sync` thread started by `begin_sync_heaps` - can take this test's page between the copy and the `assert!(!host.made(5))`, or take it and still be mirroring when the test's own sync and `made` check return. The test now retries the same sequence on fresh slots (up to ten, 2 ms apart), the way the neighbouring `cleared_before_made` already does, and keeps the same two assertions: a cleared copy is not made before the sync, and it is made after it. No global lock, so the rest of the test binary stays parallel. `cargo test -p victory-gpu --lib`: 649 passed, twice in a row and six more times before that.
SHADER_HEAPS is global, so any other test's sync_heaps (or the
victory-heap-sync thread) writes the same heaps this test uses, and one
round of theirs can take this heap's write-watch pages between the copy
and the look. The test therefore copies into the next slot of the heap and
retries on fresh slots (up to 10) when the slot was already made, the same
way cleared_before_made retries. No global lock: the pre-sync assertion
and the post-sync one both stay.
github-bot locked as GitHub sync and limited conversation to collaborators 2026-12-04 08:52:28 +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/592/head:github-bot/gh-592'
git switch 'github-bot/gh-592'

Merge

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