Cover VOP3 conversion modifiers #2159

Manually merged
github merged 1 commit from gh-pr/2159/head into gh-pr/2159/base 2026-11-26 04:56:43 +00:00
Owner

@⁠Halfect on GitHub · 2026-11-25 06:35 UTC · original
Halfect:fix/cvt-vop3-modifiers → main · +85 −33 · 2 files · 1 commits · merged 2026-11-25 21:55 UTC

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.

**@⁠Halfect** on GitHub · 2026-11-25 06:35 UTC · [original](https://github.com/Marvisak/VIctory/pull/2159) `Halfect:fix/cvt-vop3-modifiers` → `main` · +85 −33 · 2 files · 1 commits · merged 2026-11-25 21:55 UTC 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.
github-bot locked as GitHub sync and limited conversation to collaborators 2026-11-26 04:56:42 +00:00
github manually merged commit 7b952ece43 into gh-pr/2159/base 2026-11-26 04:56:43 +00:00
Author
Owner

@⁠Dathinel on GitHub · 2026-11-25 06:42 UTC · original

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.

**@⁠Dathinel** on GitHub · 2026-11-25 06:42 UTC · [original](https://github.com/Marvisak/VIctory/pull/2159#issuecomment-7155078452) 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.
Author
Owner

@⁠sinan-cmyk on GitHub · 2026-11-25 08:06 UTC · original

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

**@⁠sinan-cmyk** on GitHub · 2026-11-25 08:06 UTC · [original](https://github.com/Marvisak/VIctory/pull/2159#issuecomment-7156609431) ### 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).
Author
Owner

@⁠Halfect on GitHub · 2026-11-25 09:22 UTC · original

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.

**@⁠Halfect** on GitHub · 2026-11-25 09:22 UTC · [original](https://github.com/Marvisak/VIctory/pull/2159#issuecomment-7158247180) 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.
Author
Owner

@⁠Marvisak on GitHub · 2026-11-25 11:26 UTC · original

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

**@⁠Marvisak** on GitHub · 2026-11-25 11:26 UTC · [original](https://github.com/Marvisak/VIctory/pull/2159#issuecomment-7161046811) <!-- 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)_
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!2159
No description provided.