fix(shader): reject unlowered VALU modifiers on f16 interpolation halves #3368

Open
reeledMarek wants to merge 1 commit from upstream-pr/3368 into main
reeledMarek commented 2026-11-26 20:40:26 +00:00 (Migrated from github.com)

Imported from Marvisak/VIctory. Originally posted by reeledMarek on 2026-11-26T20:40:26Z.


Summary

  • Halves::pair accepted v_interp_p1ll_f16 without checking VALU modifiers (abs, neg, opsel, clamp, omod, sdwa, dpp), even though lowering skips P1 completely and silently drops any P1 modifiers.
  • Similarly, v_interp_p2_f16 only lowers output clamp, omod, and op_sel[3], while silently ignoring input abs, neg, source op_sel[2:0], sdwa, and dpp.
  • Rejects modified v_interp_p1ll_f16 with "a modified first interpolation half" and unlowered input modifiers on v_interp_p2_f16 with "a modified interpolation", while preserving P2's supported clamp, omod, and op_sel[3].
  • Adds regression test modified_f16_interpolation_halves_are_rejected.

Verification

  • Executed all f16 interpolation cases directly against victory-shader on Linux
  • cargo clippy -p victory-shader --all-targets --target x86_64-pc-windows-msvc --locked -- -D warnings
  • cargo test -p xtask --locked
<!-- greyfinch-sync:Marvisak/VIctory:issue:5516861380 --> Imported from [Marvisak/VIctory](https://github.com/Marvisak/VIctory/pull/3368). Originally posted by [reeledMarek](https://github.com/reeledMarek) on 2026-11-26T20:40:26Z. --- ### Summary - `Halves::pair` accepted `v_interp_p1ll_f16` without checking VALU modifiers (`abs`, `neg`, `opsel`, `clamp`, `omod`, `sdwa`, `dpp`), even though lowering skips P1 completely and silently drops any P1 modifiers. - Similarly, `v_interp_p2_f16` only lowers output `clamp`, `omod`, and `op_sel[3]`, while silently ignoring input `abs`, `neg`, source `op_sel[2:0]`, `sdwa`, and `dpp`. - Rejects modified `v_interp_p1ll_f16` with `"a modified first interpolation half"` and unlowered input modifiers on `v_interp_p2_f16` with `"a modified interpolation"`, while preserving P2's supported `clamp`, `omod`, and `op_sel[3]`. - Adds regression test `modified_f16_interpolation_halves_are_rejected`. ### Verification - Executed all f16 interpolation cases directly against `victory-shader` on Linux - `cargo clippy -p victory-shader --all-targets --target x86_64-pc-windows-msvc --locked -- -D warnings` - `cargo test -p xtask --locked`
Dukestar69 commented 2026-11-26 20:49:27 +00:00 (Migrated from github.com)

Imported from Marvisak/VIctory. Originally posted by Dukestar69 on 2026-11-26T20:49:27Z.

Review: APPROVED


LGTM — verified on Windows against origin/main (63bcca4).

  • Rejecting unlowered modifiers on v_interp_p1ll_f16 (all modifiers) and v_interp_p2_f16 (abs, neg, source op_sel, sdwa, dpp, while still permitting lowered clamp, omod, and destination op_sel[3]) prevents silent miscompilation of modified f16 interpolation pairs.
  • cargo test -p victory-shader --lib io:: -- --test-threads=1: 5 passed, 0 failed (including modified_f16_interpolation_halves_are_rejected).
  • cargo clippy -p victory-shader --all-targets -- -D warnings: clean.
  • cargo xtask policy: 191 files ok.

Synthetic tests only (no game files used). AI-assisted (Gemini 4 Neon).

<!-- greyfinch-sync:Marvisak/VIctory:review:6080347044 --> Imported from [Marvisak/VIctory](https://github.com/Marvisak/VIctory/pull/3368#pullrequestreview-6080347044). Originally posted by [Dukestar69](https://github.com/Dukestar69) on 2026-11-26T20:49:27Z. **Review:** APPROVED --- LGTM — verified on Windows against `origin/main` (`63bcca4`). - Rejecting unlowered modifiers on `v_interp_p1ll_f16` (all modifiers) and `v_interp_p2_f16` (`abs`, `neg`, source `op_sel`, `sdwa`, `dpp`, while still permitting lowered `clamp`, `omod`, and destination `op_sel[3]`) prevents silent miscompilation of modified f16 interpolation pairs. - `cargo test -p victory-shader --lib io:: -- --test-threads=1`: 5 passed, 0 failed (including `modified_f16_interpolation_halves_are_rejected`). - `cargo clippy -p victory-shader --all-targets -- -D warnings`: clean. - `cargo xtask policy`: 191 files ok. Synthetic tests only (no game files used). AI-assisted (Gemini 4 Neon).
fuzeofficlal commented 2026-11-26 20:54:55 +00:00 (Migrated from github.com)

Imported from Marvisak/VIctory. Originally posted by fuzeofficlal on 2026-11-26T20:54:55Z.

Review: APPROVED


LGTM — io::Halves::pair and io::raise cleanly reject modifiers on v_interp_p1ll_f16 and unlowered input/lane modifiers (abs, neg, opsel & 0x7, sdwa, dpp) on v_interp_p2_f16, while preserving v_interp_p2_f16's lowered clamp, omod, and op_sel[3].

Verified

  • Cross-checked against emit/lower.rs:8066-8160 and gfx10/{opcodes.rs, fields.rs}: no supported modifier is rejected and no other decoded v_interp_* opcode exposes unguarded VALU modifier fields.
  • cargo clippy --locked -p victory-shader --all-targets -- -D warnings (default & --all-features): clean.
  • rustfmt --edition 2024: clean across crates/victory-shader/src/io.rs.
  • cargo test --locked -p victory-shader --lib -- --test-threads=1 io:: emit::tests:: (RTX 5090): 22 passed, 0 failed (including modified_f16_interpolation_halves_are_rejected and interpolated_f16_writes_the_op_sel_half_with_modifiers).

Minor non-blocking note

  • modified_f16_interpolation_halves_are_rejected covers P1 clamp/omod/abs/neg and P2 abs/neg/op_sel[1]; adding cases for P1 op_sel and P2 op_sel[0]/op_sel[2] would guard every masked bit directly.
<!-- greyfinch-sync:Marvisak/VIctory:review:6080387397 --> Imported from [Marvisak/VIctory](https://github.com/Marvisak/VIctory/pull/3368#pullrequestreview-6080387397). Originally posted by [fuzeofficlal](https://github.com/fuzeofficlal) on 2026-11-26T20:54:55Z. **Review:** APPROVED --- LGTM — `io::Halves::pair` and `io::raise` cleanly reject modifiers on `v_interp_p1ll_f16` and unlowered input/lane modifiers (`abs`, `neg`, `opsel & 0x7`, `sdwa`, `dpp`) on `v_interp_p2_f16`, while preserving `v_interp_p2_f16`'s lowered `clamp`, `omod`, and `op_sel[3]`. ### Verified - Cross-checked against `emit/lower.rs:8066-8160` and `gfx10/{opcodes.rs, fields.rs}`: no supported modifier is rejected and no other decoded `v_interp_*` opcode exposes unguarded VALU modifier fields. - `cargo clippy --locked -p victory-shader --all-targets -- -D warnings` (default & `--all-features`): clean. - `rustfmt --edition 2024`: clean across `crates/victory-shader/src/io.rs`. - `cargo test --locked -p victory-shader --lib -- --test-threads=1 io:: emit::tests::` (RTX 5090): **22 passed, 0 failed** (including `modified_f16_interpolation_halves_are_rejected` and `interpolated_f16_writes_the_op_sel_half_with_modifiers`). ### Minor non-blocking note - `modified_f16_interpolation_halves_are_rejected` covers P1 `clamp`/`omod`/`abs`/`neg` and P2 `abs`/`neg`/`op_sel[1]`; adding cases for P1 `op_sel` and P2 `op_sel[0]`/`op_sel[2]` would guard every masked bit directly.
Jackster commented 2026-11-26 22:36:56 +00:00 (Migrated from github.com)

Imported from Marvisak/VIctory. Originally posted by Jackster on 2026-11-26T22:36:56Z.


Windows 11, 63bcca4 + this PR:

  • io::tests::modified_f16_interpolation_halves_are_rejected by name: 1 passed.
  • cargo test -p victory-shader --lib io::: green.
  • cargo clippy -p victory-shader --all-targets -- -D warnings: clean.

The rejection is at the decoder (io.rs), so it runs without a device; the accepted forms are covered by the surrounding io:: tests. Synthetic only. AI-assisted.

<!-- greyfinch-sync:Marvisak/VIctory:comment:7204835579 --> Imported from [Marvisak/VIctory](https://github.com/Marvisak/VIctory/pull/3368#issuecomment-7204835579). Originally posted by [Jackster](https://github.com/Jackster) on 2026-11-26T22:36:56Z. --- Windows 11, `63bcca4` + this PR: - `io::tests::modified_f16_interpolation_halves_are_rejected` by name: 1 passed. - `cargo test -p victory-shader --lib io::`: green. - `cargo clippy -p victory-shader --all-targets -- -D warnings`: clean. The rejection is at the decoder (`io.rs`), so it runs without a device; the accepted forms are covered by the surrounding `io::` tests. Synthetic only. AI-assisted.
This pull request cannot be merged automatically due to conflicts.
Merge manually to resolve the conflicts.
View command line instructions

Checkout

From your project repository, check out a new branch and test the changes.
git fetch -u origin 'upstream-pr/3368:upstream-pr/3368'
git switch 'upstream-pr/3368'

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.

git switch 'main'
git merge --no-ff 'upstream-pr/3368'
git switch 'upstream-pr/3368'
git rebase 'main'
git switch 'main'
git merge --ff-only 'upstream-pr/3368'
git switch 'upstream-pr/3368'
git rebase 'main'
git switch 'main'
git merge --no-ff 'upstream-pr/3368'
git switch 'main'
git merge --squash 'upstream-pr/3368'
git switch 'main'
git merge --ff-only 'upstream-pr/3368'
git switch 'main'
git merge 'upstream-pr/3368'
git push origin 'main'
Sign in to join this conversation.
No reviewers
No labels
No milestone
No assignees
1 participant
Notifications
Due date
The due date is invalid or out of range. Please use the format "yyyy-mm-dd".

No due date set.

Reference
Marvisak/VIctory!3368
No description provided.