Shader tests: translate BCPack pixel-pair residual lookup #2679

Open
Dathinel wants to merge 1 commit from upstream-pr/2681 into main
Dathinel commented 2026-11-25 18:04:44 +00:00 (Migrated from github.com)

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


Translates BCPack’s pairs lookup into a synthetic console compute shader. Each symbol selects one of 64 table entries and yields two 3-bit residuals. The test checks all 256 symbol bytes against a test-local copy of the private formats helper (verified identical on 13f91ca). All 64 addresses produce distinct pairs, and both padding bits vary.

On Windows, cargo test --locked -p victory-shader --features host --lib bcpack_pixel_pair_residuals -- --nocapture passed on the RTX 3050 Laptop and WARP in 15.14 s. Two local mutations failed on hardware at symbol 255: using three address bits returned 0x0202, and shifting by half the byte stride returned 0x0107. Both should yield 0x0502. Targeted Clippy, formatting of the added code and the asset-policy hook passed. The full workspace suite was not run.

AI-assisted. Claude Code wrote the original synthetic translation and audited the port. Codex changed the fixture and ran the hardware checks.

<!-- greyfinch-sync:Marvisak/VIctory:issue:6610638975 --> Imported from [Marvisak/VIctory](https://github.com/Marvisak/VIctory/pull/2681). Originally posted by [Dathinel](https://github.com/Dathinel) on 2026-11-25T18:04:44Z. --- Translates BCPack’s `pairs` lookup into a synthetic console compute shader. Each symbol selects one of 64 table entries and yields two 3-bit residuals. The test checks all 256 symbol bytes against a test-local copy of the private formats helper (verified identical on `13f91ca`). All 64 addresses produce distinct pairs, and both padding bits vary. On Windows, `cargo test --locked -p victory-shader --features host --lib bcpack_pixel_pair_residuals -- --nocapture` passed on the RTX 3050 Laptop and WARP in 15.14 s. Two local mutations failed on hardware at symbol 255: using three address bits returned 0x0202, and shifting by half the byte stride returned 0x0107. Both should yield 0x0502. Targeted Clippy, formatting of the added code and the asset-policy hook passed. The full workspace suite was not run. AI-assisted. Claude Code wrote the original synthetic translation and audited the port. Codex changed the fixture and ran the hardware checks.
cloph-dsp commented 2026-11-25 19:06:12 +00:00 (Migrated from github.com)

Imported from Marvisak/VIctory. Originally posted by cloph-dsp on 2026-11-25T18:12:52Z.


Independent Windows WARP verification of PR #2681 (head 1423e5d), claim PR-2681-BCPACK-PIXEL-PAIR-RESIDUALS on #1633.

Toolchain: rustc/cargo 1.100.0, Windows MSVC, VICTORY_WARP=1 with dxil.dll from Windows SDK 10.0.26100.0 on PATH. Synthetic inputs only, no game data, no source edits.

  • cargo test --locked -p victory-shader --lib emit::valu_tests::bcpack_pixel_pair_residuals_match_the_cpu_reference -- --exact --test-threads=1 -> 1 passed, 0 failed, 273 filtered.
  • Negative control on merge base / current origin/main 13f91ca: the same filter reports 0 tests (the new test is absent).

No bug found. AI-assisted (Hy4 flash).

<!-- greyfinch-sync:Marvisak/VIctory:comment:7170599406 --> Imported from [Marvisak/VIctory](https://github.com/Marvisak/VIctory/pull/2681#issuecomment-7170599406). Originally posted by [cloph-dsp](https://github.com/cloph-dsp) on 2026-11-25T18:12:52Z. --- Independent Windows WARP verification of PR #2681 (head `1423e5d`), claim `PR-2681-BCPACK-PIXEL-PAIR-RESIDUALS` on #1633. Toolchain: rustc/cargo 1.100.0, Windows MSVC, `VICTORY_WARP=1` with `dxil.dll` from Windows SDK 10.0.26100.0 on PATH. Synthetic inputs only, no game data, no source edits. - `cargo test --locked -p victory-shader --lib emit::valu_tests::bcpack_pixel_pair_residuals_match_the_cpu_reference -- --exact --test-threads=1` -> **1 passed**, 0 failed, 273 filtered. - Negative control on merge base / current `origin/main` `13f91ca`: the same filter reports **0 tests** (the new test is absent). No bug found. AI-assisted (Hy4 flash).
Vedoxdev123 commented 2026-11-25 19:06:14 +00:00 (Migrated from github.com)

Imported from Marvisak/VIctory. Originally posted by Vedoxdev123 on 2026-11-25T18:16:25Z.


RTX 4060 test (AI-assisted)
Windows 64-bit, Ryzen 5 5600X, GeForce RTX 4060 (8 GB).

  • cargo test -p victory-gpu --lib: 193 passed, 2 failed, 1 ignored, identical to main (descriptor::host::tests::dynamic_slots_are_held_until_released and memory::tests::lists_share_a_table_and_copies_keep_their_views fail on both). No change from this PR.
  • cargo test -p victory-shader: segfaults on both main and this PR, so there is no summary line and I can't confirm the new BCPack test on this hardware. No change from this PR.
<!-- greyfinch-sync:Marvisak/VIctory:comment:7170682338 --> Imported from [Marvisak/VIctory](https://github.com/Marvisak/VIctory/pull/2681#issuecomment-7170682338). Originally posted by [Vedoxdev123](https://github.com/Vedoxdev123) on 2026-11-25T18:16:25Z. --- **RTX 4060 test (AI-assisted)** Windows 64-bit, Ryzen 5 5600X, GeForce RTX 4060 (8 GB). - `cargo test -p victory-gpu --lib`: **193 passed, 2 failed, 1 ignored**, identical to `main` (`descriptor::host::tests::dynamic_slots_are_held_until_released` and `memory::tests::lists_share_a_table_and_copies_keep_their_views` fail on both). No change from this PR. - `cargo test -p victory-shader`: segfaults on both `main` and this PR, so there is no summary line and I can't confirm the new BCPack test on this hardware. No change from this PR.
kotekompotek commented 2026-11-25 19:06:26 +00:00 (Migrated from github.com)

Imported from Marvisak/VIctory. Originally posted by kotekompotek on 2026-11-25T18:38:01Z.


Solid coverage - all 256 symbol bytes against all 64 distinct table entries, with both padding bits varied so the high nibble path is really exercised. The dword-select chain (one cmp+cndmask per row) is a clean way to keep the whole 64-byte table in registers.

<!-- greyfinch-sync:Marvisak/VIctory:comment:7171179038 --> Imported from [Marvisak/VIctory](https://github.com/Marvisak/VIctory/pull/2681#issuecomment-7171179038). Originally posted by [kotekompotek](https://github.com/kotekompotek) on 2026-11-25T18:38:01Z. --- Solid coverage - all 256 symbol bytes against all 64 distinct table entries, with both padding bits varied so the high nibble path is really exercised. The dword-select chain (one cmp+cndmask per row) is a clean way to keep the whole 64-byte table in registers.
fuzeofficlal commented 2026-11-25 20:06:10 +00:00 (Migrated from github.com)

Imported from Marvisak/VIctory. Originally posted by fuzeofficlal on 2026-11-25T19:19:44Z.


Independent Windows 11 + NVIDIA GeForce RTX 5090 + WARP + dxil.dll verification and review of 1423e5db (on 13f91ca):

Verification (rustc 1.98.1 MSVC, Windows SDK 10.0.26100.0 dxil.dll)

  • cargo xtask policy: 184 files ok.
  • cargo clippy --locked -p victory-shader --all-targets -- -D warnings and --features host: 0 warnings.
  • cargo test --locked -p victory-shader --features host --lib bcpack -- --nocapture: 1 passed, 0 failed (bcpack_pixel_pair_residuals_match_the_cpu_reference, dxil.dll validation + RTX 5090 hardware + WARP all executed cleanly).

Review Notes

  • pairs_reference matches victory-formats/src/bcpack.rs::pairs verbatim across all 256 byte symbols with 64 distinct lookup entries and padding-bit flip checks (bits 3, 7) using exact 16-bit equality assertions.
  • Inserts at a disjoint anchor in valu_tests.rs, merging cleanly alongside #2676, #2685, #2687, and #2700.
<!-- greyfinch-sync:Marvisak/VIctory:comment:7172144059 --> Imported from [Marvisak/VIctory](https://github.com/Marvisak/VIctory/pull/2681#issuecomment-7172144059). Originally posted by [fuzeofficlal](https://github.com/fuzeofficlal) on 2026-11-25T19:19:44Z. --- Independent Windows 11 + NVIDIA GeForce RTX 5090 + WARP + `dxil.dll` verification and review of `1423e5db` (on `13f91ca`): ### Verification (`rustc 1.98.1` MSVC, Windows SDK `10.0.26100.0` `dxil.dll`) - `cargo xtask policy`: **184 files ok**. - `cargo clippy --locked -p victory-shader --all-targets -- -D warnings` and `--features host`: **0 warnings**. - `cargo test --locked -p victory-shader --features host --lib bcpack -- --nocapture`: **1 passed, 0 failed** (`bcpack_pixel_pair_residuals_match_the_cpu_reference`, `dxil.dll` validation + RTX 5090 hardware + WARP all executed cleanly). ### Review Notes - `pairs_reference` matches `victory-formats/src/bcpack.rs::pairs` verbatim across all 256 byte symbols with 64 distinct lookup entries and padding-bit flip checks (`bits 3, 7`) using exact 16-bit equality assertions. - Inserts at a disjoint anchor in `valu_tests.rs`, merging cleanly alongside #2676, #2685, #2687, and #2700.
Marvisak commented 2026-11-25 23:06:10 +00:00 (Migrated from github.com)

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


Automated triage for the maintainers.

Needs work. The new test in crates/victory-shader/src/emit/valu_tests.rs checks a hand-written shader against a copy of the private bcpack::pairs helper. VIctory never runs that helper as console code, so the test mostly checks that the hand-written shader matches the copy, and the copy can drift from the formats crate unnoticed. The instructions it uses (v_bfe_u32, v_lshrrev_b32, v_lshlrev_b32, v_cmp_eq_u32, v_cndmask_b32, v_lshl_or_b32) are basic and already exercised by instruction-level tests such as bfe_signed_and_unsigned_match_rdna2. The two mutations described in the PR break the hand-written shader, not the translator.

What would change the verdict: a focused test of a translator edge case that the existing valu_tests.rs/semantics_tests.rs cases do not cover, named after the instruction, with expected values from the public RDNA ISA.


Generated by Claude Code

<!-- greyfinch-sync:Marvisak/VIctory:comment:7176234838 --> Imported from [Marvisak/VIctory](https://github.com/Marvisak/VIctory/pull/2681#issuecomment-7176234838). Originally posted by [Marvisak](https://github.com/Marvisak) on 2026-11-25T22:20:11Z. --- <!-- victory-triage v1 head=1423e5db07ff41ae35f6d272df9b3b687625dda0 verdict=needs-work at=2026-11-25T22:22:45Z --> Automated triage for the maintainers. **Needs work.** The new test in `crates/victory-shader/src/emit/valu_tests.rs` checks a hand-written shader against a copy of the private `bcpack::pairs` helper. VIctory never runs that helper as console code, so the test mostly checks that the hand-written shader matches the copy, and the copy can drift from the formats crate unnoticed. The instructions it uses (`v_bfe_u32`, `v_lshrrev_b32`, `v_lshlrev_b32`, `v_cmp_eq_u32`, `v_cndmask_b32`, `v_lshl_or_b32`) are basic and already exercised by instruction-level tests such as `bfe_signed_and_unsigned_match_rdna2`. The two mutations described in the PR break the hand-written shader, not the translator. What would change the verdict: a focused test of a translator edge case that the existing `valu_tests.rs`/`semantics_tests.rs` cases do not cover, named after the instruction, with expected values from the public RDNA ISA. --- _Generated by [Claude Code](https://claude.ai/code)_
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/2681:upstream-pr/2681'
git switch 'upstream-pr/2681'

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/2681'
git switch 'upstream-pr/2681'
git rebase 'main'
git switch 'main'
git merge --ff-only 'upstream-pr/2681'
git switch 'upstream-pr/2681'
git rebase 'main'
git switch 'main'
git merge --no-ff 'upstream-pr/2681'
git switch 'main'
git merge --squash 'upstream-pr/2681'
git switch 'main'
git merge --ff-only 'upstream-pr/2681'
git switch 'main'
git merge 'upstream-pr/2681'
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!2679
No description provided.