Fix bitmap mark clearing in copy_back_marks #2267

Closed
github-bot wants to merge 1 commit from gh-pr/2267/head into gh-pr/2267/base
Owner

@⁠Kholoso on GitHub · 2026-11-25 09:24 UTC · original
Kholoso:fix-last-bitmap-sentinel → main · +1 −1 · 1 files · 1 commits · closed without merging

## Problem

In copy_back_marks, the last bitmap word is currently cleared entirely:

bits[words - 1] = 0;

However, the last bit is reserved as an overflow sentinel, while the preceding 31 bits may still contain valid marks.

Clearing the entire word could discard valid GPU write marks, preventing the corresponding memory from being copied back.

## Proposed fix

Clear only the overflow sentinel bit while preserving the remaining bits:

bits[words - 1] &= !(1u32 << 31);

## Testing

Not tested yet. This change is based on code inspection and should be validated with a test covering valid marks in the last bitmap word.

**@⁠Kholoso** on GitHub · 2026-11-25 09:24 UTC · [original](https://github.com/Marvisak/VIctory/pull/2267) `Kholoso:fix-last-bitmap-sentinel` → `main` · +1 −1 · 1 files · 1 commits · closed without merging **## Problem** In `copy_back_marks`, the last bitmap word is currently cleared entirely: ```rust bits[words - 1] = 0; ``` However, the last bit is reserved as an overflow sentinel, while the preceding 31 bits may still contain valid marks. Clearing the entire word could discard valid GPU write marks, preventing the corresponding memory from being copied back. **## Proposed fix** Clear only the overflow sentinel bit while preserving the remaining bits: ```rust bits[words - 1] &= !(1u32 << 31); ``` **## Testing** Not tested yet. This change is based on code inspection and should be validated with a test covering valid marks in the last bitmap word.
Preserve valid marks in the last bitmap word while clearing the overflow sentinel bit.
github-bot locked as GitHub sync and limited conversation to collaborators 2026-11-26 05:00:25 +00:00
github-bot closed this pull request 2026-11-26 05:00:25 +00:00
Author
Owner

@⁠welisonzika14-jpg on GitHub · 2026-11-25 12:00 UTC · original

First run on NVIDIA hardware here, as far as I can see (the reviews above are static or WARP). RTX 5070 (Blackwell, driver 621.24), Ryzen 7 5700X, Windows 11, Rust 1.98.1 MSVC, no game files. Head 9ad90fa merged onto main 940d32f, cargo test -p victory-gpu -p victory-shader --lib --no-fail-fast.

The PR adds no test, so this only shows it breaks nothing here. The rest is the same as main on this card: the 5 known NVIDIA failures from #1744 (2 view heap cap tests in victory-gpu, 3 in victory-shader), nothing new.

One run, unit tests only, title not run.

Written with AI help (Claude/Kiro); the numbers are from runs on my machine.

**@⁠welisonzika14-jpg** on GitHub · 2026-11-25 12:00 UTC · [original](https://github.com/Marvisak/VIctory/pull/2267#issuecomment-7161787203) First run on NVIDIA hardware here, as far as I can see (the reviews above are static or WARP). RTX 5070 (Blackwell, driver 621.24), Ryzen 7 5700X, Windows 11, Rust 1.98.1 MSVC, no game files. Head `9ad90fa` merged onto `main` `940d32f`, `cargo test -p victory-gpu -p victory-shader --lib --no-fail-fast`. The PR adds no test, so this only shows it breaks nothing here. The rest is the same as `main` on this card: the 5 known NVIDIA failures from #1744 (2 view heap cap tests in `victory-gpu`, 3 in `victory-shader`), nothing new. One run, unit tests only, title not run. Written with AI help (Claude/Kiro); the numbers are from runs on my machine.
Author
Owner

@⁠Marvisak on GitHub · 2026-11-25 12:42 UTC · original

Automated triage for the maintainers.

Proposed close: duplicate of #2269. Both PRs make the same fix in copy_back_marks (crates/victory-gpu/src/shadow.rs): clear only the sink bit 31 of the bitmap's last dword, not the whole dword. The fix is right. #2269 also factors the drain into drain_marks and adds a test for the last-dword case (marks_in_the_last_dword_are_read_but_the_sink_bit_is_not). Both merge cleanly. #2269 is marked as a merge candidate.

This PR will be closed in 48 hours unless you push a change or a maintainer removes the triage: proposed close label. Thanks for finding it.


Generated by Claude Code

**@⁠Marvisak** on GitHub · 2026-11-25 12:42 UTC · [original](https://github.com/Marvisak/VIctory/pull/2267#issuecomment-7162743384) <!-- victory-triage v1 head=9ad90fac80f786e6eba9e7bddd2fd4e7e0d80522 verdict=proposed-close at=2026-11-25T12:44:00Z --> Automated triage for the maintainers. **Proposed close: duplicate of #2269.** Both PRs make the same fix in `copy_back_marks` (`crates/victory-gpu/src/shadow.rs`): clear only the sink bit 31 of the bitmap's last dword, not the whole dword. The fix is right. #2269 also factors the drain into `drain_marks` and adds a test for the last-dword case (`marks_in_the_last_dword_are_read_but_the_sink_bit_is_not`). Both merge cleanly. #2269 is marked as a merge candidate. This PR will be closed in 48 hours unless you push a change or a maintainer removes the `triage: proposed close` label. Thanks for finding it. --- _Generated by [Claude Code](https://claude.ai/code)_
Author
Owner

@⁠Kholoso on GitHub · 2026-11-25 13:16 UTC · original

Thanks for the review! I agree that #2269 supersedes this PR. Closing this one to avoid duplicate work.
Glad the fix was useful!

**@⁠Kholoso** on GitHub · 2026-11-25 13:16 UTC · [original](https://github.com/Marvisak/VIctory/pull/2267#issuecomment-7163540258) Thanks for the review! I agree that #2269 supersedes this PR. Closing this one to avoid duplicate work. Glad the fix was useful!

Pull request closed

This discussion has been locked. Commenting is limited to contributors.
No reviewers
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.

Dependencies

No dependencies set

Reference
github/Marvisak--VIctory!2267
No description provided.