Cover VOP3 conversion modifiers #2157

Merged
Halfect merged 1 commit from upstream-pr/2159 into main 2026-11-25 21:55:07 +00:00
Halfect commented 2026-11-25 06:35:20 +00:00 (Migrated from github.com)

Imported from Marvisak/VIctory. Originally posted by Halfect on 2026-11-25T06:35:20Z.


Refs #1249 (VIC-BT-028).

Both conversions are intercepted by valu16 before valu_op's main match, so the shared implementation already applies VOP3 modifiers. The two low-half conversion arms later in that match are unreachable. Remove those arms and their now-unused helper, leaving one modifier-aware path.

Add portable lowering coverage for VOP1/VOP3 parity and for clamp, abs, and neg affecting the generated DXIL. Add hardware/WARP probes for low-half f16 source modifiers, f32 clamp before narrowing, ordinary conversion controls, and preservation of the destination's high half.

Validation on macOS:

  • cargo test --locked -p victory-shader --lib — 145 passed, 2 ignored
  • cargo xtask policy
  • git diff --check

Windows CI passed for head 7b952ec: run 45561725699, including clippy for all targets/features and cargo test --workspace --locked. The conversion probe test is included in that workspace test command; this does not by itself establish that a physical GPU rather than WARP executed it.

The portable modifier regression also passes on the base revision, confirming that this is coverage plus dead-code cleanup rather than a claim to fix a still-reproducible modifier bug.

<!-- greyfinch-sync:Marvisak/VIctory:issue:6598748104 --> Imported from [Marvisak/VIctory](https://github.com/Marvisak/VIctory/pull/2159). Originally posted by [Halfect](https://github.com/Halfect) on 2026-11-25T06:35:20Z. --- Refs #1249 (`VIC-BT-028`). Both conversions are intercepted by `valu16` before `valu_op`'s main match, so the shared implementation already applies VOP3 modifiers. The two low-half conversion arms later in that match are unreachable. Remove those arms and their now-unused helper, leaving one modifier-aware path. Add portable lowering coverage for VOP1/VOP3 parity and for `clamp`, `abs`, and `neg` affecting the generated DXIL. Add hardware/WARP probes for low-half f16 source modifiers, f32 clamp before narrowing, ordinary conversion controls, and preservation of the destination's high half. Validation on macOS: - `cargo test --locked -p victory-shader --lib` — 145 passed, 2 ignored - `cargo xtask policy` - `git diff --check` Windows CI passed for head `7b952ec`: run `45561725699`, including clippy for all targets/features and `cargo test --workspace --locked`. The conversion probe test is included in that workspace test command; this does not by itself establish that a physical GPU rather than WARP executed it. The portable modifier regression also passes on the base revision, confirming that this is coverage plus dead-code cleanup rather than a claim to fix a still-reproducible modifier bug.
DenRakEiw commented 2026-11-25 07:02:59 +00:00 (Migrated from github.com)

Imported from Marvisak/VIctory. Originally posted by DenRakEiw on 2026-11-25T06:45:57Z.

Review: APPROVED


Verified locally merged onto origin/main (940d32f, Windows 11 x64, Rust 1.98.1 MSVC):

  • cargo test -p victory-shader --lib vop3_conversion_modifiers — passed
  • cargo clippy -p victory-shader --all-targets — 0 warnings
  • cargo xtask policy — ok (183 files ok)

Clean test coverage and handling of VOP3 conversion modifiers. Looks good.

AI-assisted (Gemini 4 Neon).

<!-- greyfinch-sync:Marvisak/VIctory:review:6053037023 --> Imported from [Marvisak/VIctory](https://github.com/Marvisak/VIctory/pull/2159#pullrequestreview-6053037023). Originally posted by [DenRakEiw](https://github.com/DenRakEiw) on 2026-11-25T06:45:57Z. **Review:** APPROVED --- Verified locally merged onto `origin/main` (`940d32f`, Windows 11 x64, Rust 1.98.1 MSVC): - `cargo test -p victory-shader --lib vop3_conversion_modifiers` — passed - `cargo clippy -p victory-shader --all-targets` — 0 warnings - `cargo xtask policy` — ok (`183 files ok`) Clean test coverage and handling of VOP3 conversion modifiers. Looks good. AI-assisted (Gemini 4 Neon).
catminou4 commented 2026-11-25 07:02:59 +00:00 (Migrated from github.com)

Imported from Marvisak/VIctory. Originally posted by catminou4 on 2026-11-25T06:54:17Z.

Review: APPROVED


Tested locally: macOS arm64, rustc 1.98.1, PR head merged into main 940d32f69b, cargo test -p victory-shader --locked.

145 passed / 0 failed / 2 ignored. VOP3 conversion modifiers covered (+1 test) — test coverage for VOP3 cvt modifier encodings.

<!-- greyfinch-sync:Marvisak/VIctory:review:6053114823 --> Imported from [Marvisak/VIctory](https://github.com/Marvisak/VIctory/pull/2159#pullrequestreview-6053114823). Originally posted by [catminou4](https://github.com/catminou4) on 2026-11-25T06:54:17Z. **Review:** APPROVED --- Tested locally: macOS arm64, rustc 1.98.1, PR head merged into main 940d32f69b, `cargo test -p victory-shader --locked`. 145 passed / 0 failed / 2 ignored. VOP3 conversion modifiers covered (+1 test) — test coverage for VOP3 cvt modifier encodings.
Dathinel commented 2026-11-25 07:03:22 +00:00 (Migrated from github.com)

Imported from Marvisak/VIctory. Originally posted by Dathinel on 2026-11-25T06:42:44Z.


Ran the Windows-only conversion probes on an RTX 3050 Laptop (driver 32.0.16.1062) and WARP. I tested both 7b952ec and its parent 940d32f with only the PR's semantics_tests.rs copied onto the parent.

The seven added probes covered 94 input/modifier combinations per backend on each revision: 5 × 16 for widening and 2 × 7 for narrowing. Both revisions had zero model mismatches and zero hardware/WARP differences in those records. The narrowing checks also compare the preserved upper half of the destination. This supports the coverage-only interpretation for these inputs.

Command: cargo test --frozen -p victory-shader --lib emit::semantics_tests::conversions_match_the_hardware -- --exact --nocapture --test-threads=1. AI-assisted.

<!-- greyfinch-sync:Marvisak/VIctory:comment:7155078452 --> Imported from [Marvisak/VIctory](https://github.com/Marvisak/VIctory/pull/2159#issuecomment-7155078452). Originally posted by [Dathinel](https://github.com/Dathinel) on 2026-11-25T06:42:44Z. --- Ran the Windows-only conversion probes on an RTX 3050 Laptop (driver 32.0.16.1062) and WARP. I tested both `7b952ec` and its parent `940d32f` with only the PR's `semantics_tests.rs` copied onto the parent. The seven added probes covered 94 input/modifier combinations per backend on each revision: 5 × 16 for widening and 2 × 7 for narrowing. Both revisions had zero model mismatches and zero hardware/WARP differences in those records. The narrowing checks also compare the preserved upper half of the destination. This supports the coverage-only interpretation for these inputs. Command: `cargo test --frozen -p victory-shader --lib emit::semantics_tests::conversions_match_the_hardware -- --exact --nocapture --test-threads=1`. AI-assisted.
sinan-cmyk commented 2026-11-25 08:06:46 +00:00 (Migrated from github.com)

Imported from Marvisak/VIctory. Originally posted by sinan-cmyk on 2026-11-25T08:06:12Z.


Offline measurement on a retail dump

Result: no count change against main.

I merged head 7b952ece onto main 940d32f (clean merge) and ran victory translate --validate --list on shaders.rpf (1.0.2.1), with dxil.dll 1.8.2502.11. I compared the result with main program by program (25,889 programs). Validated: 23,918 on main, 23,918 with this PR.

No program changes its failure reason. The count shows that the change rejects nothing on this data. It does not show whether the output is right.

No shader names or data are included, per the asset policy. AI-assisted (Claude Code).

<!-- greyfinch-sync:Marvisak/VIctory:comment:7156609431 --> Imported from [Marvisak/VIctory](https://github.com/Marvisak/VIctory/pull/2159#issuecomment-7156609431). Originally posted by [sinan-cmyk](https://github.com/sinan-cmyk) on 2026-11-25T08:06:12Z. --- ### Offline measurement on a retail dump **Result: no count change against `main`.** I merged head 7b952ece onto `main` 940d32f (clean merge) and ran `victory translate --validate --list` on `shaders.rpf` (1.0.2.1), with dxil.dll 1.8.2502.11. I compared the result with `main` program by program (25,889 programs). Validated: 23,918 on `main`, 23,918 with this PR. No program changes its failure reason. The count shows that the change rejects nothing on this data. It does not show whether the output is right. No shader names or data are included, per the asset policy. AI-assisted (Claude Code).
Halfect commented 2026-11-25 10:07:42 +00:00 (Migrated from github.com)

Imported from Marvisak/VIctory. Originally posted by Halfect on 2026-11-25T09:22:40Z.


Thanks @Dathinel for the hardware/WARP probe runs and @sinan-cmyk for the full-archive A/B.

Both results line up with the coverage-only claim of this PR: the modifier regression passes identically on the base revision (zero model mismatches and zero hardware/WARP differences across your 94-combination probes on both revisions), and the archive comparison shows no count change (23,918 validated on both main and this head) with no program changing its failure reason. That is exactly the intent here — remove the two unreachable duplicate arms and pin the VOP3 modifier behavior with portable tests, without changing any emitted output on the title data. Nothing further from my side; ready for review.

<!-- greyfinch-sync:Marvisak/VIctory:comment:7158247180 --> Imported from [Marvisak/VIctory](https://github.com/Marvisak/VIctory/pull/2159#issuecomment-7158247180). Originally posted by [Halfect](https://github.com/Halfect) on 2026-11-25T09:22:40Z. --- Thanks @Dathinel for the hardware/WARP probe runs and @sinan-cmyk for the full-archive A/B. Both results line up with the coverage-only claim of this PR: the modifier regression passes identically on the base revision (zero model mismatches and zero hardware/WARP differences across your 94-combination probes on both revisions), and the archive comparison shows no count change (23,918 validated on both `main` and this head) with no program changing its failure reason. That is exactly the intent here — remove the two unreachable duplicate arms and pin the VOP3 modifier behavior with portable tests, without changing any emitted output on the title data. Nothing further from my side; ready for review.
Marvisak commented 2026-11-25 12:03:47 +00:00 (Migrated from github.com)

Imported from Marvisak/VIctory. Originally posted by Marvisak on 2026-11-25T11:26:19Z.


Automated triage for the maintainers.

Merge candidate. Dead-code removal plus test coverage, with no behaviour change. Recommending a look, not approving.

  • I confirmed on main that valu16 in crates/victory-shader/src/emit/lower.rs returns Some for v_cvt_f16_f32 and v_cvt_f32_f16 every time (the explicit matches! guard), and valu_op calls it before its main match. The two opsel == 0 conversion arms this PR removes from that match were therefore unreachable. low_half had no other caller. The live path, valu16_op, already applies the source modifiers (half_fsrc) and clamp before narrow16.
  • The tests are new coverage. vop3_conversion_modifiers_affect_the_lowering checks that VOP3 without modifiers lowers exactly like VOP1, and that clamp, abs and neg change the DXIL. The new conversion_probes in semantics_tests.rs check f16 source modifiers before widening, clamp before narrowing, and that the destination's high half is kept. As the PR says, they pass on the base revision as well. The thread reports them matching on an NVIDIA card and WARP, and no validation change over the title's shaders.

CI: check passing.


Generated by Claude Code

<!-- greyfinch-sync:Marvisak/VIctory:comment:7161046811 --> Imported from [Marvisak/VIctory](https://github.com/Marvisak/VIctory/pull/2159#issuecomment-7161046811). Originally posted by [Marvisak](https://github.com/Marvisak) on 2026-11-25T11:26:19Z. --- <!-- victory-triage v1 head=7b952ece43afa3d08e6d60a1d050d90fb6effd55 verdict=merge-candidate at=2026-11-25T11:26:18Z --> Automated triage for the maintainers. **Merge candidate.** Dead-code removal plus test coverage, with no behaviour change. Recommending a look, not approving. - I confirmed on `main` that `valu16` in `crates/victory-shader/src/emit/lower.rs` returns `Some` for `v_cvt_f16_f32` and `v_cvt_f32_f16` every time (the explicit `matches!` guard), and `valu_op` calls it before its main match. The two `opsel == 0` conversion arms this PR removes from that match were therefore unreachable. `low_half` had no other caller. The live path, `valu16_op`, already applies the source modifiers (`half_fsrc`) and clamp before `narrow16`. - The tests are new coverage. `vop3_conversion_modifiers_affect_the_lowering` checks that VOP3 without modifiers lowers exactly like VOP1, and that `clamp`, `abs` and `neg` change the DXIL. The new `conversion_probes` in `semantics_tests.rs` check f16 source modifiers before widening, clamp before narrowing, and that the destination's high half is kept. As the PR says, they pass on the base revision as well. The thread reports them matching on an NVIDIA card and WARP, and no validation change over the title's shaders. CI: `check` passing. --- _Generated by [Claude Code](https://claude.ai/code)_
upstream-sync closed this pull request 2026-11-25 22:03:29 +00:00
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!2157
No description provided.