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

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

@⁠Dathinel on GitHub · 2026-11-25 18:04 UTC · original
Dathinel:shader-tests/victory-bcpack-pixel-pairs → main · +51 −0 · 1 files · 1 commits · open

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.

**@⁠Dathinel** on GitHub · 2026-11-25 18:04 UTC · [original](https://github.com/Marvisak/VIctory/pull/2681) `Dathinel:shader-tests/victory-bcpack-pixel-pairs` → `main` · +51 −0 · 1 files · 1 commits · open 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.
github-bot locked as GitHub sync and limited conversation to collaborators 2026-11-26 05:11:54 +00:00
Author
Owner

@⁠cloph-dsp on GitHub · 2026-11-25 18:12 UTC · original

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

**@⁠cloph-dsp** on GitHub · 2026-11-25 18:12 UTC · [original](https://github.com/Marvisak/VIctory/pull/2681#issuecomment-7170599406) 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).
Author
Owner

@⁠Vedoxdev123 on GitHub · 2026-11-25 18:16 UTC · original

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.
**@⁠Vedoxdev123** on GitHub · 2026-11-25 18:16 UTC · [original](https://github.com/Marvisak/VIctory/pull/2681#issuecomment-7170682338) **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.
Author
Owner

@⁠kotekompotek on GitHub · 2026-11-25 18:38 UTC · original

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.

**@⁠kotekompotek** on GitHub · 2026-11-25 18:38 UTC · [original](https://github.com/Marvisak/VIctory/pull/2681#issuecomment-7171179038) 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.
Author
Owner

@⁠fuzeofficlal on GitHub · 2026-11-25 19:19 UTC · original

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

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

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

**@⁠Marvisak** on GitHub · 2026-11-25 22:20 UTC · [original](https://github.com/Marvisak/VIctory/pull/2681#issuecomment-7176234838) <!-- 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 can be merged automatically.
This branch is out-of-date with the base branch
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/2681/head:github-bot/gh-2681'
git switch 'github-bot/gh-2681'

Merge

Merge the changes and update on Forgejo.
git switch 'main'
git merge --no-ff 'github-bot/gh-2681'
git switch 'github-bot/gh-2681'
git rebase 'main'
git switch 'main'
git merge --ff-only 'github-bot/gh-2681'
git switch 'github-bot/gh-2681'
git rebase 'main'
git switch 'main'
git merge --no-ff 'github-bot/gh-2681'
git switch 'main'
git merge --squash 'github-bot/gh-2681'
git switch 'main'
git merge --ff-only 'github-bot/gh-2681'
git switch 'main'
git merge 'github-bot/gh-2681'
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!2681
No description provided.