Skip to content

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

Open
reeledMarek wants to merge 1 commit into
Marvisak:mainfrom
reeledMarek:fix/shader-interp-p1-f16-modifiers
Open

reeledMarek wants to merge 1 commit into
Marvisak:mainfrom
reeledMarek:fix/shader-interp-p1-f16-modifiers

Conversation

@reeledMarek

Copy link
Copy Markdown
Contributor

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 Dukestar69 left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

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 fuzeofficlal left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

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.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants