Repository navigation
Shaders: honor clamp on unsigned VOP3 add and subtract - #1398
EatCodeSleep2 wants to merge 1 commit into
Conversation
catminou4
left a comment
There was a problem hiding this comment.
Clamp on unsigned VOP3 add/sub: carry/borrow now saturates to u32::MAX/0 via select instead of rejecting the modifier. The dedicated arm covers v_add_nc/v_sub_nc/v_subrev_nc/v_add3 (overflow = OR of both carries for add3), the _co family reuses add_sub_carry with its carry-out, and every other integer op still errors on clamp through the int closure — conservative. resource.rs adds f.clamp to the plain-move bail-out so clamped ops aren't mistaken for moves. The 10-op x clamp x carry-in matrix is a solid hardware test. Local verification: macOS arm64, rustc 1.98.1, PR head merged into main ffe310e, cargo test -p victory-shader --locked. Shader execution tests (valu_tests/host/diff_tests) are #[cfg(all(test, windows))], so macOS covers lowering/decode/unit tests only. 96 passed, 0 failed on macOS; valu test Windows-gated.
|
Ran on an RTX 5070 (desktop, driver 621.40, the only adapter), Windows 11 26300, Rust 1.98.1 at The saturation reads right to me:
|
Offline measurement on a retail dump, and the shader tests on AdaResult: no count change against Offline. I merged head 38ddebf onto No program changes its failure reason either. That is the expected result for a fix whose instructions sit behind the earlier failures on Tests: with the same merge, No shader names or data are included, per the asset policy. AI-assisted (Claude Code). |
|
Automated triage for the maintainers. Needs rebase. This pull request conflicts with Generated by Claude Code |
Addresses 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.