Repository navigation
Conversation
…eam VIctory #1398)
triippywhale
pushed a commit
to triippywhale/victory-fork
that referenced
this pull request
Nov 25, 2026
…and subtract Hand port of PalmVIDev 6bfa714f8 (in fxceless#239; fxceless#948, upstream VIctory #1398) onto this tree's unsplit lower.rs: a clamped v_add_co/sub_co/subrev_co(_ci)_u32, v_add/sub/subrev_nc_u32 and v_add3_u32 saturate at all ones or zero instead of being refused ("integer output modifiers"). Other integer results with clamp are still refused (write_i); only these go through write_i_clamped. The resource tracer and the wave-local check no longer take a clamped add for a plain one. PalmVIDev's GPU tests for it are not ported. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
|
A hardware run of this PR's new test: |
HAL9000RELOADED
added a commit
to HAL9000RELOADED/victory-fork
that referenced
this pull request
Nov 26, 2026
…d and subtract (port of upstre) head 0b78d4e
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.
Ports upstream Marvisak/VIctory#1398 (
EatCodeSleep2), plus additionalclampguards invictory-shader's descriptor tracer and wave-prefix analysis.Problem
On RDNA2 / Xbox Series X, VOP3 integer instructions can carry the
clampmodifier (bit 15) to perform unsigned saturating arithmetic (u32::MAXon unsigned add overflow,0on unsigned subtract borrow) while still writing the true unclamped carry/borrow mask tosdst/VCC.Previously,
Lower::write_irejected every integer VALU instruction withv.clamp(Err("integer output modifiers")).What changed
crates/victory-shader/src/emit/lower.rs(Lower::write_i&Lower::valu_op):v.clampinLower::valu_op'sinthelper by default so unsupported integer ops still fail translation loudly, while allowingv.clampthroughLower::write_i.v_add_co_u32,v_sub_co_u32,v_subrev_co_u32,v_add_co_ci_u32,v_sub_co_ci_u32, andv_subrev_co_ci_u32atu32::MAX/0whenv.clampis set, while preserving the unclampedcarry/ borrow mask written tolane_bits.v.clamponv_add_nc_u32,v_sub_nc_u32,v_subrev_nc_u32, andv_add3_u32(ORing both carry stages forv_add3_u32).v_add_nc_u32andv_sub_nc_u32in wave-prefix analysis so saturating operations are not treated as modular wave sums/prefixes.crates/victory-shader/src/resource.rs(Tracer::vadd&Tracer::carried):f.clampwhen matchingv_add_co_u32,v_add_nc_u32, andv_add_co_ci_u32during descriptor address tracing so saturating arithmetic is not mistaken for a linear base+offset or 64-bit high-dword carry chain.crates/victory-shader/src/emit/valu_tests.rs(vop3_unsigned_add_sub_clamp):clamp = falseandclamp = trueacross edge-case inputs, independently reading back the carry/borrow mask for the 6 carry-out ops.Verification
Verified on Windows (
windows-latest+dxil.dll+ D3D12 WARP) via a temporary scoped CI branch on the fork:cargo clippy -p victory-shader -p xtask --all-targets --locked -- -D warnings: passedcargo clippy -p victory-shader -p xtask --all-targets --all-features --locked -- -D warnings: passedcargo test -p victory-shader -p xtask --locked -- --nocapture:victory-shader216 passed; 0 failed; 3 ignored(test emit::valu_tests::vop3_unsigned_add_sub_clamp ... ok, validated viadxil.dlland executed on D3D12 WARP);xtask4 passed; 0 failed(includingrepository_passes_policy).Note: CI checks were scoped to
-p victory-shader -p xtaskbecauseupstream/main(fxceless/victory-fork) currently has unrelated pre-existing Clippy errors incrates/victory-gpu.— Neon