Shaders: lower v_mov_b32 abs/neg modifiers bitwise #2546
Loading…
Reference in a new issue
No description provided.
Delete branch "upstream-pr/2548"
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 Marvisak/VIctory. Originally posted by fuzeofficlal on 2026-11-25T15:38:06Z.
Refs #883
Summary
Ports the remaining
v_mov_b32half of #883 (AscilCH'scacf6ad, withCo-authored-bypreserved) onto currentmain(v_cndmask_b32already landed there):absandnegmodifiers onv_mov_b32clear or flip bit 31 bitwise without flushing subnormal values or quietingsNaNpayloads unless a floating-point output modifier (clamporomod) is active.Lower::src_bitsincrates/victory-shader/src/emit/lower.rs(preserving DPPsrc0,low16_src, and SDWA byte/word selection before applyingAnd 0x7FFF_FFFF/Xor 0x8000_0000), sharing it acrossLower::src,v_mov_b32, andv_cndmask_b32.v_mov_b32throughas_float+write_fonly whenv.clamp || v.omod != 0.Verification
emit::valu_tests::v_mov_b32_modifiers_are_bitwise(crates/victory-shader/src/emit/valu_tests.rs) coveringv_mov_b32_e64(-v1,|v1|,-|v1|),v_mov_b32_sdwa(-v1,-v1.w0,|sext(v1.b0)|) across normals,±0.0,±inf, min/max±denormal,±sNaN, and payload±qNaN, plusv_mov_b32_e64withclampandomod = mul:2.lower.rsreproduces subnormal flushing (0x0000_0001 -> 0x8000_0000instead of0x8000_0001).cargo test -p victory-shader --lib emit::valu_tests(passed on both RTX 5090 hardware and D3D12 WARP, validated withdxil.dll)cargo clippy -p victory-shader --all-targets -- -D warnings(default and--no-default-features)cargo xtask policyImported from Marvisak/VIctory. Originally posted by fyernald on 2026-11-25T17:33:22Z.
Review: APPROVED
Verified on RTX 3080 (617.42), Windows 10 (19045) plus WARP,
main67e8ae1+ #486 + #2596 (the suite crashes on NVIDIA without #2596, #2571).cargo test -p victory-shader --lib --locked -- --test-threads=1: 268 passed, 3 failed (the #1835 ones, also on the base).v_mov_b32_modifiers_are_bitwisepasses on both adapters.Making
abs/negsign-bit operations (AND0x7FFFFFFF, XOR0x80000000) in onesrc_bitsis cleaner than the select-only special case it replaces, and it keeps denormals and NaN payloads, which a hostfabs/fnegmay not.srcstill refuses modifiers for its integer users, so nothing else changes.Imported from Marvisak/VIctory. Originally posted by Marvisak on 2026-11-25T18:35:51Z.
Automated triage for the maintainers.
Verdict: merge candidate (unchanged). The new head is a rebase onto current
main, and it merges cleanly. I reread the whole diff.Lower::src_bits(crates/victory-shader/src/emit/lower.rs) appliesabs/negto the bits after the DPP,low16and SDWA selection.Lower::srcstill refuses modifiers on other integer operations.v_mov_b32goes through the float path only withclamp/omod.v_cndmask_b32now uses the shared helper in place of its own copy of the same loop. The test invalu_tests.rsis unchanged in what it covers.As noted before, #1275 makes the same change on an old base, and only one of the two should land.
CI: passing (
check).Generated by Claude Code
Imported from Marvisak/VIctory. Originally posted by brainbudt on 2026-11-25T21:10:55Z.
APPROVE — independently verified
cc7e263merged ontomain(13f91ca).-0.0, subnormals, signaling and quiet NaNs, and combinedabs/neg. Negative control withmain's lowering confirmed negating0x00000001returned0x80000000instead of0x80000001; this PR preserves the payload.1.9.2609.5): accepted 8/8 containers (all 7 regression shaders plus an additional DPP shader whose disassembly showsWaveReadLaneAt -> and i32 -> xor i32).cargo check -p victory-shader --target x86_64-pc-windows-msvc --tests --lockedpassed.Imported from Marvisak/VIctory. Originally posted by andrewpozdnakov7-jpg on 2026-11-27T13:51:09Z.
Lyrnc measured an extra case that affects the current PR's test expectation. On the gfx1036 hardware,
v_mov_b32ignoresclampand all three output multipliers while still applying the source sign modifier. For example,-(-0.25) clamp mul:2gives 0.25. Hardware report in #883I ran the reporter's existing regression on
40ede2b(this change applied to current main63bcca4) and on Lyrnc's follow-up a9cc700. The control changes0xbf800000to zero withclamp. The follow-up passes all 63 modifier/input combinations on app-local WARP 1.0.22, and the corrected existing source-modifier test passes too. All 37 VALU tests, strict shader Clippy and the asset check passed with SDK DXIL validation enabled.@fuzeofficlal the follow-up is ready to review with this PR, with Lyrnc's test and authorship already in the commit.
AI-assisted with Codex. Synthetic shaders only.
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.