Shaders: honor clamp on unsigned VOP3 add and subtract #1398
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!1398
Loading…
Reference in a new issue
No description provided.
Delete branch "github-bot/gh-1398"
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?
@EatCodeSleep2 on GitHub · 2026-11-24 17:45 UTC · original
EatCodeSleep2:fix/clamp-valu-carry-1242→main· +109 −4 · 3 files · 1 commits · openAddresses VIC-BT-010 in #1242. Clamped unsigned addition saturates at UINT32_MAX on overflow, and clamped unsigned subtraction saturates at zero on borrow. The carry and borrow outputs retain their original values. This covers the carry, carry-in, no-carry and add3 forms. Descriptor tracing declines to treat a saturating addition as a plain address addition.
The synthetic Windows shader regression reads back the result and the carry/borrow independently, with and without clamp. It fails on main with "integer output modifiers." The updated regression passes alongside 119 other shader tests. The full suite still reproduces the existing host v_med3_f32 NaN failure tracked in #726. Shader Clippy with warnings as errors passes.
AI use: Codex wrote and tested the change.
@marquezinii on GitHub · 2026-11-24 18:10 UTC · original
Ran on an RTX 5070 (desktop, driver 621.40, the only adapter), Windows 11 26300, Rust 1.98.1 at
38ddebf.cargo test -p victory-shader --lib -- --test-threads=1gives 121 passed, 0 failed, 1 ignored.vop3_unsigned_add_sub_clamppasses on the hardware adapter and WARP.The saturation reads right to me:
v_add3_u32ORs the carries of both adds, so overflow in either step saturates.@marquezinii on GitHub · 2026-11-24 18:48 UTC · original
Cross-checked this against #1478, which covers the same VIC-BT-010 item: details in #1478. On an RTX 5070 the two give identical results on the 9 ops they share. This PR adds clamped
v_add3_u32, and #1478 adds signedv_add/sub_nc_i32with clamp.@sinan-cmyk on GitHub · 2026-11-24 20:44 UTC · original
Offline measurement on a retail dump, and the shader tests on Ada
Result: no count change against
main.Offline. I merged head
38ddebfontomainffe310e(clean merge) and ranvictory translate --validate --listonshaders.rpf(1.0.2.1), with dxil.dll 1.8.2502.11. I compared the result withmainprogram by program (25,889 programs). Validated: 21,724 onmain, 21,724 with this PR.No program changes its failure reason either. That is the expected result for a fix whose instructions sit behind the earlier failures on
main. The count shows that the change rejects nothing. It does not show whether the output is right.Tests: with the same merge,
cargo test --locked -p victory-shader --libpassed 121, failed 0. The bitcode benchmark is ignored, as onmain, where 120 pass. The run was on an RTX 4070 SUPER (Ada, 32-lane waves, driver 32.0.16.1088), the default adapter, withVICTORY_WARPunset.No shader names or data are included, per the asset policy. AI-assisted (Claude Code).
@Marvisak on GitHub · 2026-11-25 01:25 UTC · original
Automated triage for the maintainers.
Needs rebase. This pull request conflicts with
main(conflicting:crates/victory-shader/src/emit/lower.rs). It will be reviewed once it is rebased onto the currentmain.Generated by Claude Code
View command line instructions
Manual merge helper
Use this merge commit message when completing the merge manually.
Checkout
From your project repository, check out a new branch and test the changes.Merge
Merge the changes and update on Forgejo.