Shader tests: translate BCPack's signed nibble split and check every input #2654
Loading…
Reference in a new issue
No description provided.
Delete branch "upstream-pr/2656"
Deleting a branch is permanent. Although the deleted branch may continue to exist for a short time before it actually gets removed, it CANNOT be undone in most cases. Continue?
Imported from Marvisak/VIctory. Originally posted by Dathinel on 2026-11-25T17:39:08Z.
Translates the BCPack signed residual pair into a synthetic console compute shader. It gathers alternating bits from a byte, zigzag-decodes each half and packs the pair in either order. The test exercises all 256 bytes in both orders. The expected values come from a test-local copy of the private formats helper; I verified the two Rust function bodies match on base
13f91ca.On Windows,
cargo test --locked -p victory-shader --features host --lib bcpack_nibble_split -- --nocapturepassed on the RTX 3050 Laptop and WARP (512 cases per backend, 23.85 s). The staged asset-policy check passed. Only the focused test was run.AI-assisted. Claude Code wrote the original synthetic shader and reviewed the port; Codex ported it and ran the checks.
Imported from Marvisak/VIctory. Originally posted by kotekompotek on 2026-11-25T17:54:49Z.
Reviewed: the shader body faithfully re-implements
bcpack::nibbles(bit-gather halves, zigzag to signed, odd/even order flag) and checks all 256 byte values × 2 orders against the reference — a real end-to-end check of the translation chain, not just the math. Test-only change; CI green expected.Imported from Marvisak/VIctory. Originally posted by oni-swr on 2026-11-25T18:13:26Z.
Independent verification of head
68e09ee6e84d521698e504b3dfda833500a111a9onorigin/main13f91caee25f2fdf2c062be5f7a27f058e51cbca(test-only PR; merges cleanly, fast-forward).Environment: Windows 11 Pro 10.0.26100, WARP (d3d10warp 10.0.26100.9818) only, rustc/cargo 1.98.1 (per rust-toolchain.toml), DXC 1.8.2502.11 / dxil.dll 1.8.2502.11 (Windows SDK 10.0.26100.0 x64).
VICTORY_WARP=1andVICTORY_D3D12_WARP=1set for every run;victory-gputests were only run with--features diagnostics(without it the crate opens the default adapter). Limits: no physical GPU, no game files, no title-driven runs; this says nothing about behaviour on real hardware.cargo test -j 4 --locked -p victory-shader bcpack_nibble_splitwith WARP + dxil.dll on PATH ->emit::valu_tests::bcpack_nibble_split_matches_the_formats_function1 passed (512 cases: every byte, both orders; bit-exact compare of the packed 32-bit result).origin/mainbaseline: 267 passed, 3 failed, 3 ignored. The same three fail in both:synthetic_tests::{a_mask_joined_with_data_at_a_uniform_loop_is_its_number, gathers_at_a_level_match_the_hardware, permutes_read_the_lane_named_and_zero_from_lanes_left_out}. They are lane/wave tests that fail on WARP; unrelated to this PR.-p victory-shader --all-targets [--all-features] -- -D warnings: clean.origin/mainhas no such test (0 matches); (b)nibbles_referenceis textually identical to the formats crate'snibbles; (c) mutation check: changing the shader's zigzag shift amount (vop3(0x116, 9, 129, ..)->130) makes the test fail (nibbles[4, 0, 0, 0]: got 0, want 1), so the shader body is really being compared.victory_formats::bcpack::nibblesis a copy that can drift without any check (victory-shaderdoes not depend onvictory-formats); and the failure message sayshardware:even when the run was on WARP.AI disclosure: independent verification by Claude Code / Claude Sonnet 5.5, run for a user; no game files, dumps or hashes involved.
Imported from Marvisak/VIctory. Originally posted by Marvisak on 2026-11-25T22:19:45Z.
Automated triage for the maintainers.
Needs work. The new test in
crates/victory-shader/src/emit/valu_tests.rschecks a hand-written shader against a copy of the privatebcpack::nibbleshelper. VIctory never runs that helper as console code, so the test mostly checks that the hand-written shader matches the copy. The translator behaviour it touches (v_bfe_u32,v_lshl_or_b32,v_lshrrev_b32,v_xor_b32,v_cndmask_b32) is basic and already exercised by instruction-level tests such asbfe_signed_and_unsigned_match_rdna2. The copied helper can also drift from the formats crate unnoticed, sincevictory-shaderdoes not depend on it.What would change the verdict: rework it as a test of a specific instruction edge case that the existing
valu_tests.rs/semantics_tests.rscases do not cover, named after the instruction, with expected values from the public RDNA ISA rather than a copied CPU helper. A failure onmainbefore a fix would make the value obvious.Generated by Claude Code
View command line instructions
Checkout
From your project repository, check out a new branch and test the changes.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.