Repository navigation
fix: honor clamp on unsigned VOP3 add and subtract - #327
Open
mauroalvare wants to merge 4 commits into
Open
mauroalvare wants to merge 4 commits into
mauroalvare wants to merge 4 commits into
Conversation
Owner
|
This PR now conflicts with main in 🤖 Generated with Claude Code |
7 of 12 tasks
mauroalvare
force-pushed
the
codex/victory-u32-clamp
branch
from
November 26, 2026 18:00
7e79fce to
7a2c911
Compare
Use the carry or borrow to saturate unsigned VOP3 add and subtract results, including three-input addition. Preserve the carry or borrow written to SDST. Keep clamped additions out of plain address tracing and diagnose clamped PC-relative addresses before lowering. Source: Marvisak/VIctory #1398 (38ddebf954267e2ae46dce6f3f3dbfdb622219ee) Co-authored-by: EatCodeSleep2 <52021568+EatCodeSleep2@users.noreply.github.com> # Conflicts: # THIRD_PARTY.md
mauroalvare
force-pushed
the
codex/victory-u32-clamp
branch
from
November 26, 2026 18:08
7a2c911 to
ca0c86b
Compare
Contributor
Author
|
Rebased and pushed over #387, with the VOP3 clamp attribution in the current All four clamp tests passed, and the asset-policy check passed for the updated branch. |
This branch has not been deployed
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Change
Neptune rejected unsigned VOP3 and VOP3B add/subtract with
clampasinteger output modifiersbefore it emitted DXIL. The resource tracer also treated a clamped sum relative tos_getpc_b64as an ordinary code-table address.tools/lancer_victory.ps1builds and launches the runtime that usesvictory-gpuandvictory_shader::emit::translate. These regressions exercise that translator's lowering and resource tracing.Use carry or borrow to saturate the VGPR result and preserve the lane bit written to SDST. For
v_add3_u32, overflow in either addition saturates the result. Resource tracing refuses a saturated PC-relative address with an explicit diagnostic because the lowered PC is an offset into the shader.This adapts VIctory #1398 by EatCodeSleep2 from commit
38ddebf954267e2ae46dce6f3f3dbfdb622219eeand adds Neptune-specific tests. The commit andTHIRD_PARTY.mdcredit the source.Verification
Commit
7e79fcee0443a2fff09f5b296dcb021f93553a76is based onc4c93bdc413191a9dc909998d2d53080a3f0c880.Run this from
third_party/victorywith the Windows SDK validator and cached dependencies.c4c93bdc413191a9dc909998d2d53080a3f0c880with the regression tests, all four fail. The three arithmetic tests stop in lowering at byte 36. The fourth shows the tracer returningCODE + 4with a dynamic term for the saturated sum.Additional checks on the committed tree:
cargo test --locked --offline -j 2 -p victory-shader -- --nocapture --test-threads=1cargo test --locked --offline -j 2 -p victory-loader --test load_probecargo check --locked --offline -j 2 -p victorycargo xtask policycargo build --release --locked --offline -j 2 --manifest-path rust/Cargo.tomlcargo test --release --locked --offline -j 2 --manifest-path rust/Cargo.tomlpython -m pytest -rspython -m ruff check --select W605,F,E9 PrototypeScarlett tests toolsThe full shader run also reported four optional console-compiler skips, one WARP pipeline skip, and one hardware wave test whose pipeline the device did not accept. The focused regression ran all 16 containers on both backends. Pytest used Python 3.13.15,
ANYXBOXX_REQUIRE_RUNTIME=1, and the existing native runtime and TomBox builds.Oracle and test data
The regression assembles one-thread synthetic compute shaders using the repository's GFX10 encoders. It compares every readback to exact integer arithmetic, using the representable range from section 6.5 of the AMD RDNA 2 ISA guide. The expected carry and borrow are based on the exact unsaturated result, as in the independently implemented interpreter and HLSL tests for the nine two-input variants in AnyXboxX #235.
Checklist
THIRD_PARTY.mdand the commit.AI assistance by Codex for porting, regression tests, and Windows validation.
Rebase verification
Rebased on
58d2f53and merged the upstream credit into the currentTHIRD_PARTY.mdtable.cargo test --locked --offline -j 5 -p victory-shader clamped_u32 -- --nocapture --test-threads=1passed all 4 tests on the rebased code.The size check in CI found that
lower.rsexceeded the 512 KiB limit. The existing add/subtract carry helper now lives ininteger_carry.rs. After the move,cargo xtask policypassed for all 215 files and all 4 targeted tests passed again.