Shader tests: translate XMA integer log2 across both input words #2685
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!2685
Loading…
Reference in a new issue
No description provided.
Delete branch "github-bot/gh-2685"
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 18:10 UTC · original
Dathinel:shader-tests/victory-xma-log2→main· +34 −0 · 1 files · 1 commits · openAdds a six-instruction synthetic compute shader for the XMA decoder’s integer log2 helper. On a 64-bit host, the shader selects the high word when nonzero, counts leading zeros in the selected word, and maps zero to zero.
The test covers 192 distinct inputs, including both neighbours of every power of two, mixed high and low words, and the unsigned maximum. Expected results use Rust’s integer logarithm with an explicit zero case. I checked that oracle separately against the private XMA helper on 65,536 generated CPU inputs and all power-of-two boundaries.
Tested on Windows with the RTX 3050 Laptop and WARP using
cargo test --locked -p victory-shader --features host --lib xma_integer_log2_handles_both_words -- --nocapture. Removing the zero guard returned 32 instead of 0. Forcing the low word returned 63 instead of 32 for0x1_ffff_ffff. Both mutations failed on hardware. Targeted Clippy, formatting of the added lines and the staged asset-policy check passed. The full workspace suite was not run.AI-assisted. Claude Code wrote the original single-word translation and reviewed the two-word implementation. Codex implemented the port and ran the checks.
@oni-swr on GitHub · 2026-11-25 18:26 UTC · original
Independent verification (review, not a task claim) — covered by the existing claim on #1633.
c54b00ea0fa6ce6185121b3558edf190bfbbbcd0(OPEN, non-draft, merges cleanly; merge-base ==origin/main)origin/main:13f91caee25f2fdf2c062be5f7a27f058e51cbcaVICTORY_WARP=1,VICTORY_D3D12_WARP=1,dxil.dll1.8.2502.11 (Windows Kit 10.0.26100.0 x64), WARP only (physical GPU not used), no game files.Commands and results
cargo test --locked -p victory-shader --features host --lib xma_integer_log2_handles_both_words -- --nocapture→ 1 passed, 0 failed, 0 ignored. WithVICTORY_WARP=1both the "hardware" and "warp" passes inrun_casesgo through WARP, so the test really ran and was not skipped.cargo test --locked -p victory-shader --features host(full) → 268 passed, 3 failed, 3 ignored. The same 3 fail on unmodifiedorigin/main(267 passed, 3 failed, 3 ignored), so they are pre-existing WARP failures unrelated to this PR:synthetic_tests::a_mask_joined_with_data_at_a_uniform_loop_is_its_number,synthetic_tests::gathers_at_a_level_match_the_hardware,synthetic_tests::permutes_read_the_lane_named_and_zero_from_lanes_left_out.cargo clippy --locked -p victory-shader --features host --all-targets→ clean, no warnings.Negative control (the PR only adds a test, so I mutated the test shader on the PR head, then restored it)
v_max_u32 v5, v5, 1zero guard → FAILED:hardware: log2(0x0)left 32, right 0.v_cndmask_b32 v5, v1, v1, vcc) → FAILED:log2(0x1ffffffff)left 63, right 32.Review notes
ffbhof the selected word, with the word clamped to at least 1 so zero maps to 0. This agrees withchecked_ilog2().unwrap_or(0).u64::MAX.AI disclosure: independent verification by Claude Code (Claude Sonnet 5.5).
@kotekompotek on GitHub · 2026-11-25 18:38 UTC · original
The shader is faithful - high-word selection via cmp+cndmask, max(v,1) so log2(0) maps to 0, and the 63/31 base matching the selected word. Boundary coverage at every power of two plus the mutation results in the description give confidence the ffbh path is really being tested.
@fuzeofficlal on GitHub · 2026-11-25 19:20 UTC · original
Independent Windows 11 + NVIDIA GeForce RTX 5090 + WARP +
dxil.dllverification and review ofc54b00ea(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 warnings: 0 warnings.cargo test --locked -p victory-shader --features host --lib xma_integer_log2_handles_both_words -- --nocapture: 1 passed, 0 failed (dxil.dllvalidation + RTX 5090 hardware + WARP all executed cleanly).Review Notes
victory-formats/src/xma.rs::log2across all 192 inputs (bit powers0..64±1,u64::MAX, mixed high/low words, and0 -> 0viav_max_u32) with exactassert_eq!assertions.git merge-treeacross #2676, #2681, #2685, #2687, and #2700.@Marvisak on GitHub · 2026-11-25 22:18 UTC · original
Automated triage for the maintainers.
Needs work. The test is correct (the expected values come from
checked_ilog2, not from the code under test) and CI passes, but it is not clear what it adds:victory_formats::xma::log2. That helper runs on the CPU and nothing turns it into a shader. The test hand-writes a six-instruction GFX10 sequence and checks it against Rust'silog2, so the doc comment ("Translate the 64-bit host'svictory_formats::xma::log2") describes something the test does not do.v_cmp_ne_u32,v_cndmask_b32,v_max_u32,v_ffbh_u32,v_sub_nc_u32) are already probed opcode by opcode, with edge inputs, incrates/victory-shader/src/emit/semantics_tests.rs(e.g.ffbhthere).What would change the verdict: name the translator path this sequence covers that the existing per-opcode probes miss (for example a VCC-from-VOP3 compare feeding
v_cndmaskwith inline constants, if that is uncovered), and word the test around that path instead of the CPU helper. The same applies to the sibling PRs #2687 and #2700; one PR that covers the untested paths would be easier to review than one per helper.CI:
checkpassing on this head.Generated by Claude Code
@cloph-dsp on GitHub · 2026-11-26 15:00 UTC · original
Independent verification of head
c54b00eon Windows, Rust 1.100.0/MSVC:cargo test --locked -p victory-shader --lib -- emit::valu_tests::xma_integer_log2_handles_both_words --exact— 1 passed, 0 failed, 273 filtered.git diff --checkagainst merge base — clean.CPU-only synthetic instruction case; worktree-local
CARGO_TARGET_DIR. AI-assisted (Hy4 flash). GPU/driver N/A. No game data used.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.