Shader tests: translate the signed BCPack index residual sum #2676
No reviewers
Labels
No labels
accessibility
area: build
area: formats
area: gpu
area: loader
area: runtime
area: shader
bug
documentation
duplicate
enhancement
good first issue
gpu: amd
gpu: intel
gpu: nvidia
help wanted
host: wine
invalid
out of scope
question
request
run report
triage: confirmed
triage: has patch
triage: merge candidate
triage: needs info
triage: needs rebase
triage: needs work
triage: proposed close
wontfix
No milestone
No assignees
1 participant
Notifications
Due date
No due date set.
Dependencies
No dependencies set
Reference
github/Marvisak--VIctory!2676
Loading…
Reference in a new issue
No description provided.
Delete branch "github-bot/gh-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?
@Dathinel on GitHub · 2026-11-25 17:57 UTC · original
Dathinel:shader-tests/victory-bcpack-add-index→main· +76 −0 · 1 files · 1 commits · openAdds 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.
@cloph-dsp on GitHub · 2026-11-25 18:12 UTC · original
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).
@kotekompotek on GitHub · 2026-11-25 18:35 UTC · original
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.
@fuzeofficlal on GitHub · 2026-11-25 19:19 UTC · original
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.@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.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.