Shader tests: translate the signed BCPack index residual sum #2674
Loading…
Reference in a new issue
No description provided.
Delete branch "upstream-pr/2676"
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:57:49Z.
Adds a synthetic console compute shader for BCPack’s
add_index. It aligns the residual and predictor to their own widths, adds modulo 2¹⁶, then sign-extends the result. The test compares the emitted shader with a copy of the private Rust helper, verified identical on base13f91ca.170 inputs cover all residual widths 0–16, both directions of signed wraparound, and invalid predictor widths. Width 48 matters: its shift count wraps to zero on the GPU. Removing the predictor-width check passed the earlier cases but returned −1 instead of 0 for that input. Replacing the arithmetic shift with a logical shift also failed on hardware.
cargo test --locked -p victory-shader --features host --lib bcpack_index_residual_sum -- --nocapturepassed on the RTX 3050 Laptop and WARP (10.28 s). Targeted Clippy and the staged asset check passed. The full workspace was not run.AI-assisted. Claude Code wrote the original shader and identified the missing width case during review. Codex ported it and ran the hardware checks.
Imported from Marvisak/VIctory. Originally posted by cloph-dsp on 2026-11-25T18:12:59Z.
Independent Windows WARP verification of PR #2676 (head
6f3368d), claimPR-2676-BCPACK-INDEX-RESIDUAL-SUMon #1633.Toolchain: rustc/cargo 1.100.0, Windows MSVC,
VICTORY_WARP=1withdxil.dllfrom 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_index_residual_sum_matches_the_formats_function -- --exact --test-threads=1-> 1 passed, 0 failed, 273 filtered.origin/main13f91ca: the same filter reports 0 tests (the new test is absent).No bug found. AI-assisted (Hy4 flash).
Imported from Marvisak/VIctory. Originally posted by kotekompotek on 2026-11-25T18:35:27Z.
Solid coverage - residual width 0, ref-width out of range, and the width-48 shift-wraparound are exactly the cases a naive port gets wrong; the 48 case specifically forces the validity check to clear refv rather than relying on GPU shift behaviour.
Imported from Marvisak/VIctory. Originally posted by fuzeofficlal on 2026-11-25T19:19:42Z.
Independent Windows 11 + NVIDIA GeForce RTX 5090 + WARP +
dxil.dllverification and review of6f3368dc(on13f91ca):Verification (
rustc 1.98.1MSVC, Windows SDK10.0.26100.0dxil.dll)cargo xtask policy: 184 files ok.cargo clippy --locked -p victory-shader --all-targets -- -D warningsand--features host: 0 warnings.cargo test --locked -p victory-shader --features host --lib bcpack_index_residual_sum -- --nocapture: 1 passed, 0 failed (dxil.dllvalidation + RTX 5090 hardware + WARP all executed cleanly).Review Notes
add_index_referencematchesvictory-formats/src/bcpack.rs::add_indexverbatim across all 170 test cases (bits = 0..=16, out-of-rangeref_bitsincluding48, and signed 16-bit wraparound) with exactu32equality assertions.valu_tests.rs, so it merges cleanly alongside #2681, #2685, #2687, and #2700.Imported from Marvisak/VIctory. Originally posted by Marvisak on 2026-11-25T22:20:00Z.
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::add_indexhelper. 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 one translator property it hits, shift counts taken modulo 32 forv_lshlrev_b32/v_ashrrev_i32(the width-48 case), is generic instruction semantics. As written, that case passes because the shader's own range check clears the value, not because of the translator.What would change the verdict: a focused test of the instruction edge case (for example, shift counts of 32 and above for the VALU shifts, if
valu_tests.rs/semantics_tests.rsdo not already cover them), named after the instruction, with expected values from the public RDNA ISA rather than a copied CPU helper.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.