Repository navigation
Conversation
…_sub_i32 (port of upstream VIctory fxceless#1095)
|
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
… s_add_i32, s_addk_i32, and s_) head 5c83bc1
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#1095 (
ESAT586).Problem
In
crates/victory-shader/src/emit/lower.rs(Lower::salu),s_add_i32,s_addk_i32, ands_sub_i32compute the 32-bit sum/differencerand returncarry = None, falling through to:Meanwhile
ir.rs::writes_sccalready marks all three instructions as writingReg::Scc. Any shader that readsSCCafterwards (e.g.s_cselect_b32,s_cselect_b64, ors_cbranch_scc0/1) fails lowering withUnsupported { what: "the carry of a scalar operation" }.What changed
crates/victory-shader/src/emit/lower.rs(Lower::salu):SCCfors_add_i32,s_addk_i32, ands_sub_i32per the AMD RDNA2 ISA (pure 32-bit DXIL integer ops without needingflags::INT64):s_add_i32/s_addk_i32:((a ^ r) & (b ^ r)) <s 0(aandbshare a sign bit thatrflips).s_sub_i32:((a ^ b) & (a ^ r)) <s 0(aandbhave opposite signs andrflipsa's sign).crates/victory-shader/src/emit/valu_tests.rs(signed_scalar_add_sub_scc_matches_rdna2):sopkand an end-to-end synthetic compute shader test coverings_add_i32,s_sub_i32,s_addk_i32 +1, ands_addk_i32 -32768across 30 signed-overflow edge cases (i32::MAX + 1,i32::MIN - 1,0 - i32::MIN,-1 + 1, etc.), readingSCCback vias_cselect_b32.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::signed_scalar_add_sub_scc_matches_rdna2 ... 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