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

Open
github-bot wants to merge 1 commit from github-bot/gh-3368 into main AGit
Owner

@⁠reeledMarek on GitHub · 2026-11-26 20:40 UTC · original
reeledMarek:fix/shader-interp-p1-f16-modifiers → main · +78 −4 · 1 files · 1 commits · open

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
**@⁠reeledMarek** on GitHub · 2026-11-26 20:40 UTC · [original](https://github.com/Marvisak/VIctory/pull/3368) `reeledMarek:fix/shader-interp-p1-f16-modifiers` → `main` · +78 −4 · 1 files · 1 commits · open ### 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`
github-bot locked as GitHub sync and limited conversation to collaborators 2026-11-26 20:43:35 +00:00
Author
Owner

@⁠Dukestar69 on GitHub · 2026-11-26 20:49 UTC · original · approved these changes

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).

**@⁠Dukestar69** on GitHub · 2026-11-26 20:49 UTC · [original](https://github.com/Marvisak/VIctory/pull/3368#pullrequestreview-6080347044) · **approved these changes** 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).
Author
Owner

@⁠fuzeofficlal on GitHub · 2026-11-26 20:54 UTC · original · approved these changes

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.
**@⁠fuzeofficlal** on GitHub · 2026-11-26 20:54 UTC · [original](https://github.com/Marvisak/VIctory/pull/3368#pullrequestreview-6080387397) · **approved these changes** 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.
This pull request can be merged automatically.
You are not authorized to merge this pull request.
View command line instructions

Checkout

From your project repository, check out a new branch and test the changes.
git fetch -u origin '+refs/pull/3368/head:github-bot/gh-3368'
git switch 'github-bot/gh-3368'

Merge

Merge the changes and update on Forgejo.
git switch 'main'
git merge --no-ff 'github-bot/gh-3368'
git switch 'github-bot/gh-3368'
git rebase 'main'
git switch 'main'
git merge --ff-only 'github-bot/gh-3368'
git switch 'github-bot/gh-3368'
git rebase 'main'
git switch 'main'
git merge --no-ff 'github-bot/gh-3368'
git switch 'main'
git merge --squash 'github-bot/gh-3368'
git switch 'main'
git merge --ff-only 'github-bot/gh-3368'
git switch 'main'
git merge 'github-bot/gh-3368'
git push origin 'main'
This discussion has been locked. Commenting is limited to contributors.
No reviewers
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.

Dependencies

No dependencies set

Reference
github/Marvisak--VIctory!3368
No description provided.