GPU: reject non-power-of-two alignments in allocate_upload #2104
Loading…
Reference in a new issue
No description provided.
Delete branch "upstream-pr/2106"
Deleting a branch is permanent. Although the deleted branch may continue to exist for a short time before it actually gets removed, it CANNOT be undone in most cases. Continue?
Imported from Marvisak/VIctory. Originally posted by fuzeofficlal on 2026-11-25T05:05:54Z.
Closes #837.
Summary
alignment != 0 && !alignment.is_power_of_two()inlist::allocate_upload(crates/victory-gpu/src/list.rs) before clamping.max(16), so sub-16 non-power-of-two alignments (3,5..=7,9..=15, etc.) are rejected instead of being silently rounded up to 16 while0and powers of two continue to allocate memory aligned tomax(alignment, 16).Verification
list::tests::allocate_upload_validates_alignment_and_size_overflow: verifies non-zero non-power-of-two alignments and overflowing sizes return null without recording an upload block, while0and valid power-of-two alignments return zeroed memory aligned tomax(alignment, 16).cargo clippy -p victory-gpu --tests --locked -- -D warningsandcargo xtask policy: passed.Imported from Marvisak/VIctory. Originally posted by DenRakEiw on 2026-11-25T05:18:18Z.
Review: APPROVED
Verified locally merged onto
origin/main(940d32f, Windows 11 x64, NVIDIA GeForce RTX 5090, Rust 1.98.1 MSVC):cargo test -p victory-gpu --lib allocate_upload— passed (allocate_upload_rejects_bad_alignments_and_oversized_requests)cargo clippy -p victory-gpu --all-targets— 0 warningscargo xtask policy— ok (183 files ok)Clean validation of sub-16 alignments and oversized allocation requests in
allocate_upload. Looks good.AI-assisted (Gemini 4 Neon).
[PR #2106] GPU: validate sub-16 alignments and guard oversized requests in allocate_uploadto [PR #2106] GPU: reject non-power-of-two alignments in allocate_uploadImported from Marvisak/VIctory. Originally posted by Marvisak on 2026-11-25T10:40:41Z.
Automated triage for the maintainers.
Merge candidate.
list::allocate_uploadincrates/victory-gpu/src/list.rsnow rejects a non-zero, non-power-of-twoalignmentbefore clamping it to 16, so values like3or12no longer get silently rounded up.0and powers of two still allocate atmax(alignment, 16). The new testallocate_upload_validates_alignment_and_size_overflowchecks bad alignments and overflowing sizes return null with no upload block recorded, and valid alignments return zeroed, correctly aligned memory. It uses the existing helpers (create_allocator,create_list,close,reset,uploads) the same way the other tests in that module do. CI is passing.On your reply: thanks, the head changed to
1be45cbfand it does what you said. The unreachableoffset >= aligncheck and the non-WindowsUpload::newchanges are gone, and the test no longer has the info-queue andshadowsetup.Generated by Claude Code
Imported from Marvisak/VIctory. Originally posted by fuzeofficlal on 2026-11-25T10:49:42Z.
Updated in
1be45cbfper triage feedback:offset >= aligncheck and reverted the non-WindowsUpload::new(isize::MAX/try_reserve_exact) changes back tomain.allocate_uploadalignment and overflow cases (allocate_upload_validates_alignment_and_size_overflow), removing the info-queue andshadowGPU readback setup.View command line instructions
Checkout
From your project repository, check out a new branch and test the changes.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.