Shader tests: run v_perm_b32 on the GPU #1810
Loading…
Reference in a new issue
No description provided.
Delete branch "upstream-pr/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?
Imported from Marvisak/VIctory. Originally posted by n-romanovich on 2026-11-24T22:56:14Z.
Adds 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.Imported from Marvisak/VIctory. Originally posted by catminou4 on 2026-11-24T23:04:22Z.
Review: APPROVED
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.
Imported from Marvisak/VIctory. Originally posted by DesertGamer on 2026-11-24T22:56:26Z.
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.
Imported from Marvisak/VIctory. Originally posted by Melow-code on 2026-11-24T23:07:10Z.
Review: APPROVED
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.
Imported from Marvisak/VIctory. Originally posted by upipibi on 2026-11-24T23:11:04Z.
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.
Imported from Marvisak/VIctory. Originally posted by Headache3318 on 2026-11-25T01:53:29Z.
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.
Imported from Marvisak/VIctory. Originally posted by Marvisak on 2026-11-25T06:27:24Z.
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
Imported from Marvisak/VIctory. Originally posted by Melow-code on 2026-11-25T11:54:11Z.
Review: APPROVED
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)
Imported from Marvisak/VIctory. Originally posted by Marvisak on 2026-11-25T22:02:17Z.
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.
Imported from Marvisak/VIctory. Originally posted by n-romanovich on 2026-11-25T22:22:45Z.
@Marvisak, pushed
d899f22- ready for re-review.Imported from Marvisak/VIctory. Originally posted by n-romanovich on 2026-11-25T22:57:30Z.
@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.Imported from Marvisak/VIctory. Originally posted by fuzeofficlal on 2026-11-26T19:13:04Z.
Review: APPROVED
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.Warning: The "Autodetect manual merge" setting is not enabled for this repository, you will have to mark this pull request as manually merged afterwards.