Shaders: lower unclamped 24-bit multiply-add through DXIL MAD #3731
Loading…
Reference in a new issue
No description provided.
Delete branch "upstream-pr/3731"
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 andrewpozdnakov7-jpg on 2026-11-28T12:41:57Z.
Use DXIL
IMadandUMadfor the unclampedv_mad_i32_i24andv_mad_u32_u24forms. The two multiplicands still read their low 24 bits with the original signed or unsigned extension, and the entire 32-bit addend contributes to the wrapping result.DXC disassembly of generated compute shaders showed:
The operation takes one fewer DXIL instruction per MAD. The intrinsic declaration adds bytes in these modules. These are emitted instruction and file sizes. GPU execution time and game performance were unmeasured.
On Microsoft WARP 1.0.22 with Agility 1.620.2, the new reference test matched all 726 inputs for each opcode on both main and this change. The full semantics group passed 35 tests with one existing ignored test, including the existing 5,780-input probes per MAD opcode. Strict all-feature shader Clippy and the asset policy passed.
The unsigned operand mask in #3632 and saturating clamped forms in #2926 cover different parts of these operations.
Please retain the Git author on cherry-pick or rebase, or add
Co-authored-by: andrewpozdnakov7-jpg <[email protected]>if folding the change into another commit.AI-assisted with OpenAI Codex.
Imported from Marvisak/VIctory. Originally posted by andrewpozdnakov7-jpg on 2026-11-28T12:46:08Z.
Windows CI passed on
7c6f908, including the workspace tests and both Clippy configurations. The independent combined check with the unsigned operand mask and clamped forms is recorded in #3632.The next step is maintainer review. Please retain the Git author on cherry-pick or rebase, or add
Co-authored-by: andrewpozdnakov7-jpg <[email protected]>if folding the change into another commit.AI-assisted with OpenAI Codex.
Imported from Marvisak/VIctory. Originally posted by cloph-dsp on 2026-11-28T12:55:35Z.
Independent local verification (Windows, Rust 1.100.0/MSVC, no game data):
7c6f9081c93bb1f65429fa62a4d765af186ae53d, base/parent63bcca43c6a00a758510398fa43096ce7e4f7df0.cargo test --locked -p victory-shader --lib -- emit::semantics_tests::mad24_wraps_with_a_full_width_addend --exact --test-threads=1 --quiet→ 1 passed, 0 failed, 305 filtered, exit 0.git grep -Ffor the test name on the base returned no match (test is new on this PR);git diff --check 63bcca4 HEADclean (2 files, +42/-10).CARGO_TARGET_DIR(never shared) withCARGO_BUILD_JOBS=2.AI-assisted (Hy4 flash).
Imported from Marvisak/VIctory. Originally posted by ColorMeBoom on 2026-11-28T15:51:55Z.
Hardware run: RX 5700 XT (Navi 10, RDNA1, 32–64 lanes, driver 32.0.21045.29003, Windows 11 26200), head
7c6f908on63bcca4.mad24_wraps_with_a_full_width_addendpasses:v_mad_i32_i24/v_mad_u32_u24, 726 inputs, zero mismatches on the card and on WARP.victory-shader --lib --features host: 303 passed, 0 failed, 3 ignored.AI use: Claude Code (Claude Opus 5.5).
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.