shader(fold): sign-extend negative inline constants in upper mask9 half #2983
Loading…
Reference in a new issue
No description provided.
Delete branch "upstream-pr/2983"
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?
Imported from trustno1-coder/VIctory-NVIDIA. Originally posted by RanoGames on 2026-11-29T19:12:58Z.
What it changes
Fixes
mask9incrates/victory-shader/src/fold.rswhen folding 64-lane VALU instructions (such asv_cndmask_b32and*_co_ci_u32carry-in) into lower/upper 32-lane halves:129..=192and 32-bit literals255already mapped to128(0) inupper(half)(Half::B/Half::BSwap).193..=208(-1..=-16) sign-extend to-1(0xFFFF_FFFF, code193) in bits32..63(matchinghalves()), butmask9previously returnedOk(code)unchanged for194..=208, clearing bits in lanes32..35on the upper half.193..=208 if upper(half) => Ok(193)and unit testfold::tests::mask9_sign_extends_negative_inline_constants_in_upper_half.How it was tested
folded_testsinvictory-shader)mask9(194..=208, Half::B | Half::BSwap, ...)returned194..=208(-2..=-16) instead of193(-1, all 32 upper lanes set).mask9(193..=208, Half::B | Half::BSwap, ...)returns193.emit::folded_tests+fold::tests)cargo testpassed for the crates it touches: yes (cargo test --locked -p victory-shader --lib -- fold::tests emit::folded_tests: 18 passed, 0 failed;cargo xtask policy --stagedpassed)Checked for overlap
View command line instructions
Checkout
From your project repository, check out a new branch and test the changes.Merge
Merge the changes and update on Forgejo.Warning: The "Autodetect manual merge" setting is not enabled for this repository, you will have to mark this pull request as manually merged afterwards.