Repository navigation
shader: lower v_add_nc_i16, v_sub_nc_i16, v_mad_i16, and v_mad_u16 with clamp - #1699
geiyiliyabumo wants to merge 1 commit into
Conversation
DenRakEiw
left a comment
There was a problem hiding this comment.
Verified locally merged onto origin/main (Windows 11 x64, NVIDIA GeForce RTX 5090 + WARP, Rust 1.98.1 MSVC, with dxil.dll validator):
cargo test -p victory-shader --lib vop3_16bit_int_add_sub_mad_and_triads_match_rdna2— passed on RTX 5090 hardware and underVICTORY_D3D12_WARP=1cargo clippy -p victory-shader --all-targets— 0 warningscargo xtask policy— ok
Clean lowering of the 10 RDNA2 16-bit integer VOP3 ops (add/sub/mad/min3/max3/med3) with end-to-end GPU+WARP verification. Looks good.
AI-assisted (Gemini 4 Neon).
8512978 to
6fd640a
Compare
|
Reviewed head 6fd640a locally (isolated worktree, fresh CARGO_TARGET_DIR, real GPU dispatch). What it does: lowers Verified locally:
Findings, ranked:
LGTM, with the #1668 note above. |
catminou4
left a comment
There was a problem hiding this comment.
Tested locally on macOS arm64 (rustc 1.98.1): PR head merged cleanly into current main (ffe310e), cargo test -p victory-shader --locked → 96 passed, 0 failed. Hardware/valu/waterfall execution tests are #[cfg(all(test, windows))] and run only on Windows; macOS covers lowering/structure unit tests.
v_add_nc_i16/v_sub_nc_i16/v_mad_i16/v_mad_u16 lowered with clamp support (computed on selected 16-bit halves, low 16 bits kept); clamp_ok gate rejects clamp/omod/abs/neg for the rest. Hardware tests on RDNA2/WARP.
|
Measurement-backed extensions to the clamp list, from reading the diff (not run). AnyPS5 measured the VOP3 clamp bit on 16-bit integer ops on RDNA2 hardware: gfx1036, wave32 and wave64; boykopovar/AnyPS5's
AI-assisted (Claude Code). No game files. |
|
Automated triage for the maintainers. Closing because another open pull request covers the same change. See #1211. v_mad_u16/v_mad_i16 with clamp (the same code as #1211) plus v_add_nc_i16/v_sub_nc_i16 (also in #92). None is used by the title. If this is mistaken, reply here with what was missed (or push a change and say so) and it will be looked at again. Thank you for the contribution. |
|
Automated triage for the maintainers. Needs rebase. This pull request conflicts with Generated by Claude Code |
Summary
crates/victory-shader/src/emit/lower.rs(valu16_op), honoringop_sel[0..3]and preserving the untouched VGPR half viawrite_halfwith pure 32-bit DXIL arithmetic:v_add_nc_i16(0x30d),v_sub_nc_i16(0x30e),v_mad_i16(0x35e), andv_mad_u16(0x340), with both wraparound andCLAMPsaturation ([-32768, 32767]signed /[0, 65535]unsigned).v_{min3,max3,med3}_{i16,u16}), Shaders: lower v_mad_u32_u16, v_mad_i32_i16, and v_lerp_u8 #1688 (v_mad_{u32_u16,i32_i16}), and Shaders: read inline floats as f32 bits in 16-bit integer ops #1668 (half_srcinline float handling).Verification
cargo test -p victory-shader --lib valu_tests: PASS on both AMD Radeon RX 9060 XT (D3D12 hardware) and Microsoft Basic Render Driver (WARP), includingvop3_16bit_int_add_sub_mad_and_triads_match_rdna2testing all 4 instructions across wrap vsCLAMPsaturation,op_selhigh/low half selection, and untouched VGPR half preservation.cargo clippy -p victory-shader --all-targets -- -D warnings: clean.cargo xtask policy: pass (154 files).AI-assisted; synthetic tests only, no game files.