Repository navigation
Conversation
v_pk_fmac_f16 is decoded as VOP2 (0x03C, supporting DPP16/SDWA) and VOP3 (0x13C, not VOP3P), where `v.neg_hi` is always 0 and `v.abs`/`v.opsel`/ `v.sdwa` may be set. Lower::packed16 previously never checked `v.sdwa`, `v.abs`, or `v_pk_fmac_f16`'s `v.neg`/`v.opsel`, so: - `v.neg != 0` on v_pk_fmac_f16 negated only the low f16 half (`neg_hi == 0`). - `v.abs`, `v.sdwa`, and `v.opsel` on v_pk_fmac_f16 were silently ignored. Fail closed on `v.sdwa.is_some() || v.abs != 0 || (op == "fmac_f16" && (v.neg != 0 || v.opsel != 0))` while keeping plain v_pk_fmac_f16 (and DPP without abs/neg) and all VOP3P modifiers (`v_pk_fma_f16` etc.) intact. Disjoint from Marvisak#2229 (DPP `self.src0` in `fmac_half`). Tests live in `emit/lower/packed_mod_tests.rs`. Assisted-by: T3 Code (Antigravity, gemini-4-neon)
fuzeofficlal
left a comment
There was a problem hiding this comment.
The new guards on v.omod, v.sdwa, v.abs, and VOP3 v_pk_fmac_f16 neg/opsel cleanly preserve VOP3P opsel/opsel_hi/neg/neg_hi (crates/victory-shader/src/emit/lower.rs also stays under the 512 KiB cap at 520,741 bytes), but one unmodeled v_pk_fmac_f16 encoding path is still silently miscompiled:
- Unmodeled DPP on
v_pk_fmac_f16(crates/victory-shader/src/emit/lower.rs:5818-5828,lower.rs:7275-7295,lower.rs:7313-7319):
v_pk_fmac_f16is a VOP2 opcode (0x3C) and supports DPP16/DPP8 (v.dpp.is_some()).Lower::valucomputes the shuffled lane value intoself.src0 = Some(x), then dispatches topacked16->fmac_half. However,fmac_halfcallsself.operand(inst, &op)(lower.rs:7285), which never readsself.src0, and the new guard checksv.sdwa.is_some()without checkingv.dpp.is_some(). As a result, a modifier-freev_pk_fmac_f16_dpp(e.g.,quad_perm:[1,0,3,2]) still lowers without error while silently reading the local lane'ssrc0instead of the shuffled lane. Either rejectv.dpp.is_some()here or consumeself.src0fork == 0infmac_half(note#2229also targets DPP handling forv_pk_fmac_f16). - Test assertions (
crates/victory-shader/src/emit/lower/packed_mod_tests.rs:96-134):- The negative cases only assert
.is_err(), which would also pass on an earlier decode/lowering failure; checking the returnedShaderErrormessage ensures the new modifier guard is what rejected them. - The positive VOP3P control tests
neg/neg_hiwithopsel = opsel_hi = 0; adding a case with non-zeroopsel/opsel_hiwould also cover VOP3P half selection.
- The negative cases only assert
kotekompotek
left a comment
There was a problem hiding this comment.
LGTM — fails closed on sdwa/abs/fmac-neg-opsel instead of silently mis-lowering (neg on v_pk_fmac_f16 would only negate the low half); accepted plain and VOP3P forms still pass.
|
VERIFY-3032: verified Tests
Review (from reading the code only)
Overlap
AI-assisted (Claude Code). |
|
Automated triage for the maintainers.
Things to know before merging: a title shader that does use one of these forms will now fail to translate instead of being approximated. #1142 edits the same condition and will conflict textually. The new test module is not rustfmt-clean. CI: Generated by Claude Code |
Dukestar69
left a comment
There was a problem hiding this comment.
Tested locally merged onto origin/main (63bcca4) on Windows 11 x64:
- Diff review: Rejecting unmodeled
sdwa,abs, andfmac_f16neg/opselmodifiers inLower::packed16(with tests cleanly placed inemit/lower/packed_mod_tests.rsto stay under thelower.rssize limit) prevents silent mislowering of non-VOP3P modifiers. cargo test -p victory-shader packed_mod_tests: all tests passed.cargo clippy -p victory-shader --all-targets -- -D warnings: clean.cargo xtask policy: 192 files ok.
Synthetic tests only (no game files used). AI-assisted (Gemini 4 Neon).
v_pk_fmac_f16is decoded as VOP2 (0x03C, supporting DPP16/SDWA) and VOP3 (0x13C, not VOP3P), wherev.neg_hiis always0andv.abs,v.opsel, orv.sdwamay be set.Lower::packed16(crates/victory-shader/src/emit/lower.rs:7311-7334) previously checked onlyv.omod != 0 || !float && (v.clamp || v.neg != 0 || v.neg_hi != 0):v.neg != 0on VOP3/DPPv_pk_fmac_f16silently negated only the low f16 half (let neg = if high { v.neg_hi } else { v.neg }withneg_hi == 0).v.abs != 0,v.opsel != 0, orv.sdwa.is_some()was silently ignored.Fail closed on
v.sdwa.is_some() || v.abs != 0 || (op == "fmac_f16" && (v.neg != 0 || v.opsel != 0))while keeping plainv_pk_fmac_f16(and DPP withoutabs/neg) and all VOP3P modifiers (v_pk_fma_f16etc.) intact. Disjoint from #2229 (DPPself.src0infmac_half). Tests live incrates/victory-shader/src/emit/lower/packed_mod_tests.rs(keepinglower.rsat520,741 B, well under the 512 KiB limit).Verification
packed16_rejects_unmodeled_fmac_and_sdwa_modifiers_while_keeping_valid_opsfailed (VOP3 v_pk_fmac_f16 with neg must be rejected).v_pk_fmac_f16withneg,abs, oropsel, and VOP2 SDWAv_pk_fmac_f16, while plain VOP2/VOP3v_pk_fmac_f16and VOP3Pv_pk_fma_f16(withneg+neg_hi+dxil.dllvalidation) continue passing.--tests+--features diagnosticsclippy,xtask policy, full workspace tests): RVZO6/VIctory CI run #45748741503 (green, combined Wave 10 check on63bcca4).AI-assisted: T3 Code (Antigravity, gemini-4-neon).