Shaders: allow abs/neg source modifiers on v_cvt_{u16,i16}_f16 #668
Loading…
Reference in a new issue
No description provided.
Delete branch "upstream-pr/668"
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 DenRakEiw on 2026-11-24T06:27:28Z.
Allow VOP3
abs/negsource modifiers onv_cvt_u16_f16andv_cvt_i16_f16invalu16_op(crates/victory-shader/src/emit/lower.rs).Motivation
v_cvt_u16_f16andv_cvt_i16_f16already read theirf16operand viahalf_fsrc, which applies VOP3abs/negmodifiers, and already saturate to 16-bit integer bounds onmain(commit2af66ff1). However, the guard right above the integermatchrejectedv.abs != 0 || v.neg != 0for all arms, including these two float-source conversions.Changes
crates/victory-shader/src/emit/lower.rs: exemptv_cvt_u16_f16andv_cvt_i16_f16from thev.abs != 0 || v.neg != 0rejection while keepingv.clamp || v.omod != 0rejected and keeping all integer-source 16-bit ops unchanged.crates/victory-shader/src/emit/valu_tests.rs: addcvt_16bit_int_from_f16_saturates_and_honors_modifierscoveringv_cvt_u16_f16(including|src0|) andv_cvt_i16_f16(including-src0), NaN, infinities, and out-of-range saturation.Verified locally on Windows 11 x64 (NVIDIA GeForce RTX 5090 + WARP, Rust 1.98.1 MSVC):
cargo test -p victory-shader --lib cvt_16bit_int_from_f16_saturates_and_honors_modifiers— passed on both RTX 5090 hardware andVICTORY_D3D12_WARP=1cargo clippy -p victory-shader --all-targets— 0 warningscargo xtask policy— ok (183 files ok)AI-assisted (Gemini 4 Neon).
Imported from Marvisak/VIctory. Originally posted by LAKSHYA-cmd-tech on 2026-11-24T06:37:51Z.
Review: APPROVED
LGTM! Tested on Windows 11 with MSVC Rust 1.98.1. All 71 tests in ictory-shader passed cleanly, including both synthetic tests in alu_tests. Ordering f16 .omod before clamp and saturating 16-bit integer conversions from f16 matches RDNA2 hardware semantics.
Imported from Marvisak/VIctory. Originally posted by catminou4 on 2026-11-24T06:42:13Z.
Review: APPROVED
Verified locally on macOS 26 arm64, rustc 1.98.1 (aarch64-apple-darwin, rust-toolchain.toml) at head
38a41cb:cargo test -p victory-shader --locked: 56 passed, 0 failed (includes the new v_cvt f16/omod/saturate tests)The new opcode coverage runs green. Approving.
Imported from Marvisak/VIctory. Originally posted by slint6614-dev on 2026-11-24T10:16:49Z.
AMD hardware check, Windows 11, Adrenalin driver: RX 9070 (RDNA4) and Ryzen 9600X iGPU (RDNA2, gfx1036), each picked as the hardware device of
run_cases(local adapter-selection patch, not part of this PR);cargo test -p victory-shader --release valu_testsat the PR head. Negative control: the PR's non-test files reverted to its merge base, its new tests kept.f16_omod_applies_before_clampandcvt_16bit_int_from_f16_saturates_and_honors_modifierspass on both AMD GPUs.Imported from Marvisak/VIctory. Originally posted by DenRakEiw on 2026-11-24T12:17:29Z.
Rebased onto latest \main\ (\fe310e): kept upstream's f32-clamped saturation for \cvt{u16,i16}_f16\ while retaining \16\ \.omod\ (before \clamp) and \bs/
eg\ source modifiers on \cvt{u16,i16}_f16. Re-verified with \cargo test -p victory-shader\ (122 passed, 0 failed on Windows 11 / RTX 5090 + WARP), \cargo clippy -p victory-shader --all-targets\ (0 warnings), and \cargo xtask policy. AI-assisted (Gemini 4 Neon).
Imported from Marvisak/VIctory. Originally posted by Marvisak on 2026-11-25T00:33:41Z.
Automated triage for the maintainers.
Needs rebase. This PR no longer merges cleanly into
main:mainhas moved since the last triage, and the branch now conflicts incrates/victory-shader/src/emit/valu_tests.rs. It will be reviewed again once it is rebased onto currentmain.Previous verdict for this head: merge candidate.
Generated by Claude Code
Imported from Marvisak/VIctory. Originally posted by DenRakEiw on 2026-11-25T02:54:45Z.
Rebased cleanly onto latest
origin/main(940d32f, headaca82f4) resolving the tail conflict incrates/victory-shader/src/emit/valu_tests.rs.Re-verified locally on Windows 11 x64 (NVIDIA GeForce RTX 5090 + WARP, Rust 1.98.1 MSVC):
f16_omod_applies_before_clampandv_cvt_u16_i16_f16_*— passed on both RTX 5090 hardware andVICTORY_D3D12_WARP=1cargo clippy -p victory-shader --all-targets— 0 warningscargo xtask policy— ok (183 files ok)Ready for review. AI-assisted (Gemini 4 Neon).
[PR #668] Shaders: support f16 omod and saturate/apply source modifiers in v_cvt_{u16,i16}_f16to [PR #668] Shaders: allow abs/neg source modifiers on v_cvt_{u16,i16}_f16Imported from Marvisak/VIctory. Originally posted by DenRakEiw on 2026-11-25T03:46:13Z.
Addressed the triage feedback:
f16omodchange (until RDNA2 f16 omod denormal behavior is measured on hardware) so this PR is now strictly scoped to allowingabs/negonv_cvt_{u16,i16}_f16.lower.rsdiff to a 4-line guard update (no moved integer match block).cvt_16bit_int_from_f16_saturates_and_honors_modifiers).Re-verified locally on RTX 5090 + WARP,
cargo clippy -p victory-shader --all-targets(0 warnings), andcargo xtask policy(ok).AI-assisted (Gemini 4 Neon).
Imported from Marvisak/VIctory. Originally posted by DenRakEiw on 2026-11-26T00:53:50Z.
Closing this PR — stepping back from code contributions on this account. Feel free to reuse the approach if helpful.
Pull request closed