GPU: reject non-power-of-two alignments in allocate_upload #2106
No reviewers
Labels
No labels
accessibility
area: build
area: formats
area: gpu
area: loader
area: runtime
area: shader
bug
documentation
duplicate
enhancement
good first issue
gpu: amd
gpu: intel
gpu: nvidia
help wanted
host: wine
invalid
out of scope
question
request
run report
triage: confirmed
triage: has patch
triage: merge candidate
triage: needs info
triage: needs rebase
triage: needs work
triage: proposed close
wontfix
No milestone
No assignees
1 participant
Notifications
Due date
No due date set.
Dependencies
No dependencies set
Reference
github/Marvisak--VIctory!2106
Loading…
Reference in a new issue
No description provided.
Delete branch "github-bot/gh-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?
@fuzeofficlal on GitHub · 2026-11-25 05:05 UTC · original
fuzeofficlal:fix/gpu-allocate-upload-validation-837→main· +80 −4 · 1 files · 1 commits · openCloses #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.@Marvisak on GitHub · 2026-11-25 10:40 UTC · original · edited 2026-11-25 11:23 UTC
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
@fuzeofficlal on GitHub · 2026-11-25 10:49 UTC · original
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.