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

Open
oxybes wants to merge 1 commit from upstream-pr/592 into main
oxybes commented 2026-12-04 08:48:48 +00:00 (Migrated from github.com)

Imported from readmet3xt-lab/foxhound. Originally posted by oxybes on 2026-12-04T08:48:48Z.


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.

<!-- greyfinch-sync:readmet3xt-lab/foxhound:issue:5643335371 --> Imported from [readmet3xt-lab/foxhound](https://github.com/readmet3xt-lab/foxhound/pull/592). Originally posted by [oxybes](https://github.com/oxybes) on 2026-12-04T08:48:48Z. --- `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.
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/592:upstream-pr/592'
git switch 'upstream-pr/592'

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/592'
git switch 'upstream-pr/592'
git rebase 'main'
git switch 'main'
git merge --ff-only 'upstream-pr/592'
git switch 'upstream-pr/592'
git rebase 'main'
git switch 'main'
git merge --no-ff 'upstream-pr/592'
git switch 'main'
git merge --squash 'upstream-pr/592'
git switch 'main'
git merge --ff-only 'upstream-pr/592'
git switch 'main'
git merge 'upstream-pr/592'
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
readmet3xt-lab/foxhound!592
No description provided.