Shader tests: run v_perm_b32 on the GPU #1811
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!1811
Loading…
Reference in a new issue
No description provided.
Delete branch "github-bot/gh-1811"
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?
@n-romanovich on GitHub · 2026-11-24 22:56 UTC · original
n-romanovich:test/valu-perm-b32→main· +78 −0 · 1 files · 2 commits · openAdds an end-to-end synthetic GPU/WARP execution test (
v_perm_b32_matches_rdna2) incrates/victory-shader/src/emit/valu_tests.rs.Exercises both dynamic (
vgpr) and inline-constant selector lowering paths across byte selection (0..7), sign-extension (8..11, both bit polarities),12(0x00), and>= 13(0xFF).AI-assisted; verified with
cargo test -p victory-shader --locked(121 passed, 1 ignored) andcargo clippy -p victory-shader --all-targets --lockedon Windows 11 / RTX 5060 Ti + WARP, plus independent subagent review.@DesertGamer on GitHub · 2026-11-24 22:56 UTC · original
VIctory V2: community PRs, merged and tested
Open PRs sitting in the queue? V2 pulls them into one build, screens each one (binaries, build scripts, hooks, new deps) and runs tests after every batch.
Where it stands today: launches, runs the menu at 30 fps, plays the intro video, reaches the start screen and loads the world (~50 s). Entering the world is the current blocker: rendering fails with a GPU "device removed" error (tracked in issue #1).
⚠️ Entering the world on a real GPU can hang it and make Windows reset the driver. Try it at your own risk.
Not playable yet, but every batch of merged fixes moves it closer. If you have a PR that's stuck, or a GPU to test on, I'd love your help:
https://DesertGamer/VIctory-V2
Unofficial community fork of Marvisak/VIctory, GPL-3.0.
@upipibi on GitHub · 2026-11-24 23:11 UTC · original · edited 2026-11-25 23:21 UTC
Update, head
d899f22(with the literal-selector cases):cargo test -p victory-shader --lib v_perm_b32 -- --test-threads=1, 3 runs:v_perm_b32_matches_rdna2passes each time, on the RTX 3070 and on WARP (the test runs both). Control: the same test copied ontomainf3578e3(main lacks it) also passes 3 of 3, so main's lowering already gives these values; this PR adds the coverage.NVIDIA run: RTX 3070 8 GB, driver 616.56, Windows 11, debug,
aa2a55f(onmain70564ae).v_perm_b32_matches_rdna2passes.AI-assisted (Claude Code). Synthetic tests only.
@Headache3318 on GitHub · 2026-11-25 01:53 UTC · original
Tested on Linux (Arch, kernel 7.3.5, 3× RTX 4090 driver 620.73.04), Rust 1.98.1 (pinned). PR head
84bbefcapplied cleanly onto currentmainccfb029.cargo test -p victory-shader --locked: 144 passed, 0 failed, 2 ignored. All tests pass. The newv_perm_b32_matches_rdna2test is GPU-specific (requires dxil.dll/WARP) and is skipped on Linux.cargo clippy -p victory-shader --all-targets -- -D warnings: 4 pre-existing errors in test code (fail identically on mainccfb029). The PR introduces no new clippy warnings.Not tested: Windows MSVC build, the title itself. AI-assisted.
@Marvisak on GitHub · 2026-11-25 06:27 UTC · original · edited 2026-11-26 00:22 UTC
Automated triage for the maintainers.
Merge candidate.
v_perm_b32_matches_rdna2incrates/victory-shader/src/emit/valu_tests.rsrunsv_perm_b32(VOP3 0x344) on the host GPU and WARP in three ways: with a run-time selector, with every selector indyn_casesas a 32-bit literal (0xFFplus the dword), and with the inline constants -1 (0xC1) and 12 (0x8C).ref_permmatches the ISA's selector table.mainhas no value test for this opcode.On your reply: the requested literal-selector loop is in
d899f22and covers all sixdyn_casesrows, so it reaches the constant-selector branch of the lowering inlower.rs. The merge withmainleaves the PR's diff as a single appended test.CI: two
checkresults are listed, one passing and one failing. The failure is most likely the run before the merge; worth a glance before merging.Generated by Claude Code
@Marvisak on GitHub · 2026-11-25 22:02 UTC · original
Automated triage for the maintainers, second look (a review against
main, with the PR built and tested).v_perm_b32has no value test onmain, so this is welcome; it can be merged after one addition. Most of the title's uses take the selector as a literal, and the lowering has a separate constant branch for that, which the test does not reach. Incrates/victory-shader/src/emit/valu_tests.rsv_perm_b32_matches_rdna2, please also run each selector ofdyn_cases(or at least 0x07060504, 0x0B0A0908, 0x00070205 and 0xFF0D0C04) as a literal:let mut w = vop3(0x344, 0, vgpr(1), vgpr(2), 0xFF).to_vec(); w.push(sel); build_valu_cs(&w), checked againstref_perm(src0, src1, sel). The -1 and 12 inline cases can stay. With that addition the test passes on an RX 6700 XT and on WARP. It also needs a rebase: it conflicts withmaininvalu_tests.rsafter today's merges.Push the change and it will be reviewed again. Thank you for the contribution.
@n-romanovich on GitHub · 2026-11-25 22:22 UTC · original
@Marvisak, pushed
d899f22- ready for re-review.@n-romanovich on GitHub · 2026-11-25 22:57 UTC · original
@Marvisak Updated
test/valu-perm-b32(d899f22):mainto resolve thevalu_tests.rsconflict.v_perm_b32_matches_rdna2covering every selector indyn_cases(0x03020100,0x07060504,0x00070205,0x0B0A0908, and0xFF0D0C04) viavop3(0x344, 0, vgpr(1), vgpr(2), 0xFF)+sel, checked againstref_perm.-1(0xC1) and12(0x8C) inline-constant cases.v_perm_b32_matches_rdna2passes locally and CIcheckpasses.@catminou4 on GitHub · 2026-11-24 23:04 UTC · original · approved these changes
Tested locally on macOS arm64 (rustc 1.98.1): PR head merged cleanly into current main (
70564ae), cargo test -p victory-shader --locked → 118 passed, 0 failed. GPU execution tests (valu_tests/host) are #[cfg(all(test, windows))] and run only on Windows; macOS covers lowering/structure unit tests.GPU test: v_perm_b32 matches_rdna2 — Windows-gated.
@Melow-code on GitHub · 2026-11-24 23:07 UTC · original · approved these changes
The ref_perm matches the lowering in lower.rs exactly, including the detail that selectors 8..11 repeat the sign of bytes 1 and 3 (not 0 and 2). The inline-constant path is exercised: 0xC1 (−1, all 0xFF) and 0x8C (12, the zero constant) are verified against resource::inline.
The source pair 0x8765_4321 / 0x7EAB_CD01 was chosen so that bytes 1 and 3 of each source carry opposite signs — every sign-repeat selector gets a definite value.
Nit: in the constants case, byte 0 of the selector word is 0x04 (byte 0 of src0), not a constant, though the comment lists only 12/13/255. Harmless since the expected value comes from ref_perm.
@Melow-code on GitHub · 2026-11-25 11:54 UTC · original · approved these changes
Review: PR #1811 — GPU test for v_perm_b32
Author: n-romanovich. One test in valu_tests.rs, 64 lines. Fetch:
git fetch upstream pull/1811/head:pr1811.Verdict: mergeable as is
The opcode checks against the tree:
v_perm_b32= 0x344 (gfx10/opcodes.rs 738). The referenceref_permmatches the semantics the tree's own lowering implements (lower.rs 6738, the "Byte i of the result is byte S of {src0, src1} (src1 the low dword)" comment), which is the ground truth this repository already ships:The inline-constant encodings check against
resource::inline(resource.rs 2112): 0xC1 = 193 →(192 - 193) as u32= 0xFFFF_FFFF (the "−1" selector, every field ≥ 13 → all 0xFF), and 0x8C = 140 → 12 (the zero constant). Both are exercised, so the selector-through-inline-constant path of the lowering is covered too.The dynamic cases cover: the src1 identity (0x0302_0100), the src0 identity (0x0706_0504), a mixed-byte gather across both sources, the four sign-repeat selectors with a value pair whose bytes 1 and 3 carry opposite signs in each source, and a pair that flips those signs (0x1234_8000 / 0x8000_7FFF) so a sign bug shows as a byte difference, not a whole-dword one. The constants case adds selectors 4, 12, 13 and 255 in one word.
Notes (non-blocking)
@fuzeofficlal on GitHub · 2026-11-26 19:13 UTC · original · approved these changes
Verified locally merged onto
origin/main(63bcca43, Windows 11 x64, Rust 1.98.1 MSVC, RTX 5090 & WARP):cargo test --locked -p victory-shader --lib v_perm_b32_matches_rdna2(VICTORY_WARP=0andVICTORY_WARP=1) — 1 passed, 0 failed on both backendscargo clippy --locked -p victory-shader --all-targets -- -D warnings(default and--all-features) — 0 warningscargo xtask policy— ok (191 files ok)Review notes
v_perm_b32(0x344) encodings andref_permagainst RDNA2 semantics (0..=3fromsrc1,4..=7fromsrc0,8..=11sign extensions ofsrc1[15]/src1[31]/src0[15]/src0[31],12->0x00,13..=255->0xFF), exercising both the dynamicv3path and the inline-constant (0xC1,0x8C) / 32-bit literal (0xFF+sel) constant-selector paths inlower.rs.rustfmt --edition 2024 --checkflags the added one-lineifmatch arms and closure wrapping inv_perm_b32_matches_rdna2(valu_tests.rs:2298-2355).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.