Copy counters: the bank size follows the counter enum #3920

Open
101Leafy wants to merge 1 commit from upstream-pr/3920 into main
101Leafy commented 2026-12-01 01:23:59 +00:00 (Migrated from github.com)

Imported from Marvisak/VIctory. Originally posted by 101Leafy on 2026-12-01T01:23:59Z.


COUNTERS in copystat.rs is a hand-kept 61, and C has exactly 61 variants. The next counter added without raising the number indexes past COUNT and panics the thread that counts it.

The size is now C::MirrorWaitUs as usize + 1, so a new counter always gets its slot as long as it goes before the end or the line follows the new last variant. A comment says so.

cargo check -p victory-gpu is clean.

<!-- greyfinch-sync:Marvisak/VIctory:issue:5576990960 --> Imported from [Marvisak/VIctory](https://github.com/Marvisak/VIctory/pull/3920). Originally posted by [101Leafy](https://github.com/101Leafy) on 2026-12-01T01:23:59Z. --- `COUNTERS` in `copystat.rs` is a hand-kept 61, and `C` has exactly 61 variants. The next counter added without raising the number indexes past `COUNT` and panics the thread that counts it. The size is now `C::MirrorWaitUs as usize + 1`, so a new counter always gets its slot as long as it goes before the end or the line follows the new last variant. A comment says so. `cargo check -p victory-gpu` is clean.
passerbyyhx commented 2026-12-01 14:04:30 +00:00 (Migrated from github.com)

Imported from Marvisak/VIctory. Originally posted by passerbyyhx on 2026-12-01T14:04:30Z.


I compiled the counter enum, COUNT bank, and add function from 3d2298c4 as a standalone regression. On the unmodified parent and PR all 61 counters kept their own values, including 800 concurrent increments to the last slot. Inserting one test counter immediately before MirrorWaitUs left the parent bank at 61 for 62 variants and failed at the final slot; the PR expanded to 62 and retained the expected value 862. This exercises the documented last-variant convention.

<!-- greyfinch-sync:Marvisak/VIctory:comment:7313651299 --> Imported from [Marvisak/VIctory](https://github.com/Marvisak/VIctory/pull/3920#issuecomment-7313651299). Originally posted by [passerbyyhx](https://github.com/passerbyyhx) on 2026-12-01T14:04:30Z. --- I compiled the counter enum, COUNT bank, and add function from 3d2298c4 as a standalone regression. On the unmodified parent and PR all 61 counters kept their own values, including 800 concurrent increments to the last slot. Inserting one test counter immediately before MirrorWaitUs left the parent bank at 61 for 62 variants and failed at the final slot; the PR expanded to 62 and retained the expected value 862. This exercises the documented last-variant convention.
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/3920:upstream-pr/3920'
git switch 'upstream-pr/3920'

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/3920'
git switch 'upstream-pr/3920'
git rebase 'main'
git switch 'main'
git merge --ff-only 'upstream-pr/3920'
git switch 'upstream-pr/3920'
git rebase 'main'
git switch 'main'
git merge --no-ff 'upstream-pr/3920'
git switch 'main'
git merge --squash 'upstream-pr/3920'
git switch 'main'
git merge --ff-only 'upstream-pr/3920'
git switch 'main'
git merge 'upstream-pr/3920'
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
Marvisak/VIctory!3920
No description provided.