Shader tests: BCPack's zigzag decode as console code matches the formats function #2593

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

@⁠Dathinel on GitHub · 2026-11-25 16:22 UTC · original
Dathinel:shader-tests/bcpack-zz → main · +36 −0 · 1 files · 1 commits · open

Adds one synthetic test to emit/valu_tests.rs: BCPack's zigzag decode (zz in crates/victory-formats/src/bcpack.rs) written by hand as console code, translated by the emitter and run on the GPU, compared with the formats crate's function for every symbol.

  • Test only: one file, +36 lines, no production change, no new dependency. The reference is a copy of zz because victory-shader does not depend on victory-formats.
  • It checks a nine-instruction chain end to end (v_lshlrev_b32, v_add_nc_u32, v_bfe_u32, v_lshrrev_b32, v_cmp_ne_u32, v_cndmask_b32, v_xor_b32, v_and_b32) against a CPU function the repository already owns instead of hand-computed constants. Mnemonics in the comments were checked against the decoder.
  • Cases: all 256 symbols at widths 0 to 9, 16 and 31 (3,072). Widths of 8 and above cover the mask's truncation to a byte.

It is the first of a few small translations of the BCPack helpers to console code, one test per PR so each can be judged alone.

Tested

RTX 3050 Laptop (Ampere, 32-lane waves, driver 610.62), Windows 11 26200, Rust 1.98.1 MSVC, on main 67e8ae1:

  • cargo test --locked -p victory-shader --features host --lib bcpack_zigzag -- --test-threads=1: 1 passed (hardware and WARP).
  • cargo clippy --locked -p victory-shader --all-targets --all-features -- -D warnings: clean.
  • cargo fmt --all -- --check: no diff in the added lines. (With my rustfmt 1.98.1 it reports existing diffs in many files on main, earlier parts of this file included; this PR does not reformat them.)
  • The pre-commit asset-policy hook ran on the commit: asset policy: 1 files ok.
  • Earlier run of the same program on 940d32f with the D3D12 debug layer enabled by a local patch: 3,072/3,072 on both backends. Negative control, not included: with v_xnor_b32 in place of v_xor_b32 only the 256 width-0 cases match.
  • Not run: the whole workspace suite.

AI-assisted (Claude Code); synthetic data only.

🤖 Generated with Claude Code

**@⁠Dathinel** on GitHub · 2026-11-25 16:22 UTC · [original](https://github.com/Marvisak/VIctory/pull/2593) `Dathinel:shader-tests/bcpack-zz` → `main` · +36 −0 · 1 files · 1 commits · open Adds one synthetic test to `emit/valu_tests.rs`: BCPack's zigzag decode (`zz` in `crates/victory-formats/src/bcpack.rs`) written by hand as console code, translated by the emitter and run on the GPU, compared with the formats crate's function for every symbol. - Test only: one file, +36 lines, no production change, no new dependency. The reference is a copy of `zz` because `victory-shader` does not depend on `victory-formats`. - It checks a nine-instruction chain end to end (`v_lshlrev_b32`, `v_add_nc_u32`, `v_bfe_u32`, `v_lshrrev_b32`, `v_cmp_ne_u32`, `v_cndmask_b32`, `v_xor_b32`, `v_and_b32`) against a CPU function the repository already owns instead of hand-computed constants. Mnemonics in the comments were checked against the decoder. - Cases: all 256 symbols at widths 0 to 9, 16 and 31 (3,072). Widths of 8 and above cover the mask's truncation to a byte. It is the first of a few small translations of the BCPack helpers to console code, one test per PR so each can be judged alone. ## Tested RTX 3050 Laptop (Ampere, 32-lane waves, driver 610.62), Windows 11 26200, Rust 1.98.1 MSVC, on `main` `67e8ae1`: - `cargo test --locked -p victory-shader --features host --lib bcpack_zigzag -- --test-threads=1`: 1 passed (hardware and WARP). - `cargo clippy --locked -p victory-shader --all-targets --all-features -- -D warnings`: clean. - `cargo fmt --all -- --check`: no diff in the added lines. (With my rustfmt 1.98.1 it reports existing diffs in many files on `main`, earlier parts of this file included; this PR does not reformat them.) - The pre-commit asset-policy hook ran on the commit: `asset policy: 1 files ok`. - Earlier run of the same program on `940d32f` with the D3D12 debug layer enabled by a local patch: 3,072/3,072 on both backends. Negative control, not included: with `v_xnor_b32` in place of `v_xor_b32` only the 256 width-0 cases match. - Not run: the whole workspace suite. AI-assisted (Claude Code); synthetic data only. 🤖 Generated with [Claude Code](https://claude.com/claude-code)
github-bot locked as GitHub sync and limited conversation to collaborators 2026-11-26 05:09:56 +00:00
Author
Owner

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

Automated triage for the maintainers.

Needs rebase. This PR no longer merges cleanly into main: it conflicts in crates/victory-shader/src/emit/valu_tests.rs. No content review was done this time; it will be reviewed once it is rebased onto current main.


Generated by Claude Code

**@⁠Marvisak** on GitHub · 2026-11-25 22:15 UTC · [original](https://github.com/Marvisak/VIctory/pull/2593#issuecomment-7176131970) <!-- victory-triage v1 head=f202300ef0bbe78107267c89c5d4bc13012fe359 verdict=needs-rebase at=2026-11-25T22:15:25Z --> Automated triage for the maintainers. **Needs rebase.** This PR no longer merges cleanly into `main`: it conflicts in `crates/victory-shader/src/emit/valu_tests.rs`. No content review was done this time; it will be reviewed once it is rebased onto current `main`. --- _Generated by [Claude Code](https://claude.ai/code)_
This pull request has changes conflicting with the target branch.
  • crates/victory-shader/src/emit/valu_tests.rs
View command line instructions

Manual merge helper

Use this merge commit message when completing the merge manually.

Checkout

From your project repository, check out a new branch and test the changes.
git fetch -u origin '+refs/pull/2593/head:github-bot/gh-2593'
git switch 'github-bot/gh-2593'

Merge

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