GPU: reject overflowing and non-buffer descriptor spans before shadow… #1859

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

@⁠VlREX on GitHub · 2026-11-24 23:37 UTC · original
VlREX:fix/checked-buffer-view-spans → main · +71 −15 · 1 files · 1 commits · open

Unify checked GPU buffer descriptor span arithmetic across SRV/UAV materialization, bindless address discovery and host bounds validation. Reject arithmetic overflow, empty ranges and incompatible buffer dimensions before shadow lookup. Independent BigInt reference verification: 10,368 cases, zero disagreements. Three Rust regression tests included. Native compilation and GPU validation pending. Complementary to #635 and #402. AI-assisted (ChatGPT).

**@⁠VlREX** on GitHub · 2026-11-24 23:37 UTC · [original](https://github.com/Marvisak/VIctory/pull/1859) `VlREX:fix/checked-buffer-view-spans` → `main` · +71 −15 · 1 files · 1 commits · open Unify checked GPU buffer descriptor span arithmetic across SRV/UAV materialization, bindless address discovery and host bounds validation. Reject arithmetic overflow, empty ranges and incompatible buffer dimensions before shadow lookup. Independent BigInt reference verification: 10,368 cases, zero disagreements. Three Rust regression tests included. Native compilation and GPU validation pending. Complementary to #635 and #402. AI-assisted (ChatGPT).
github-bot locked as GitHub sync and limited conversation to collaborators 2026-11-26 04:46:45 +00:00
Author
Owner

@⁠upipibi on GitHub · 2026-11-25 00:10 UTC · original

Ran on Windows 11 with an RTX 3070 (Ampere, driver 616.56), debug build, at 8c77217: cargo test -p victory-gpu --locked gives 79 passed, 2 failed, 1 ignored. The two failures are the NVIDIA heap-cap ones main also has (descriptor::host::tests::dynamic_slots_are_held_until_released and memory::tests::lists_share_a_table_and_copies_keep_their_views, #1744), so there is nothing new on this hardware. Not run: a title.

AI-assisted (Claude Code).

**@⁠upipibi** on GitHub · 2026-11-25 00:10 UTC · [original](https://github.com/Marvisak/VIctory/pull/1859#issuecomment-7148236506) Ran on Windows 11 with an RTX 3070 (Ampere, driver 616.56), debug build, at `8c77217`: `cargo test -p victory-gpu --locked` gives 79 passed, 2 failed, 1 ignored. The two failures are the NVIDIA heap-cap ones `main` also has (`descriptor::host::tests::dynamic_slots_are_held_until_released` and `memory::tests::lists_share_a_table_and_copies_keep_their_views`, #1744), so there is nothing new on this hardware. Not run: a title. AI-assisted (Claude Code).
Author
Owner

@⁠Marvisak on GitHub · 2026-11-25 07:26 UTC · original · edited 2026-11-25 19:21 UTC

Automated triage for the maintainers.

Merge candidate. This is a recommendation to look, not an approval. It now merges cleanly into main. CI: check passing.

The PR adds checked_view_span in crates/victory-gpu/src/descriptor/host.rs and uses it in buffer_range, unordered_range, buffer_srv, buffer_uav and within. They now refuse spans whose base + FirstElement*element or length overflows. In main that panics in debug builds and wraps to unrelated title memory in release. They also refuse SRV/UAV descriptions whose dimension is not BUFFER before reading the Buffer union member. Placed descriptors come from title memory, so a non-buffer dimension would otherwise be read as FirstElement/NumElements. The existing within assertions still hold, and the new tests build their placed views correctly. #2541 makes nearly the same change but covers less (not buffer_srv/buffer_uav or within), so this one is the better of the two.


Generated by Claude Code

**@⁠Marvisak** on GitHub · 2026-11-25 07:26 UTC · [original](https://github.com/Marvisak/VIctory/pull/1859#issuecomment-7155856036) · edited 2026-11-25 19:21 UTC <!-- victory-triage v1 head=1cc3da34af5bc61d16f48d3c6d9ac280a782c235 verdict=merge-candidate at=2026-11-25T19:32:00Z --> Automated triage for the maintainers. **Merge candidate.** This is a recommendation to look, not an approval. It now merges cleanly into `main`. CI: `check` passing. The PR adds `checked_view_span` in `crates/victory-gpu/src/descriptor/host.rs` and uses it in `buffer_range`, `unordered_range`, `buffer_srv`, `buffer_uav` and `within`. They now refuse spans whose `base + FirstElement*element` or length overflows. In `main` that panics in debug builds and wraps to unrelated title memory in release. They also refuse SRV/UAV descriptions whose dimension is not BUFFER before reading the `Buffer` union member. Placed descriptors come from title memory, so a non-buffer dimension would otherwise be read as FirstElement/NumElements. The existing `within` assertions still hold, and the new tests build their placed views correctly. #2541 makes nearly the same change but covers less (not `buffer_srv`/`buffer_uav` or `within`), so this one is the better of the two. --- _Generated by [Claude Code](https://claude.ai/code)_
This pull request can be merged automatically.
This branch is out-of-date with the base branch
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/1859/head:github-bot/gh-1859'
git switch 'github-bot/gh-1859'

Merge

Merge the changes and update on Forgejo.
git switch 'main'
git merge --no-ff 'github-bot/gh-1859'
git switch 'github-bot/gh-1859'
git rebase 'main'
git switch 'main'
git merge --ff-only 'github-bot/gh-1859'
git switch 'github-bot/gh-1859'
git rebase 'main'
git switch 'main'
git merge --no-ff 'github-bot/gh-1859'
git switch 'main'
git merge --squash 'github-bot/gh-1859'
git switch 'main'
git merge --ff-only 'github-bot/gh-1859'
git switch 'main'
git merge 'github-bot/gh-1859'
git push origin 'main'
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!1859
No description provided.