fix: zero masked sources of DS swizzles in VIctory #284
No reviewers
Labels
No labels
accessibility
bloqué : binaire console
bug
chargeur
console-dll
cpu
documentation
duplicate
enhancement
good first issue
gpu
help wanted
invalid
performance
question
runtime-gdk
wontfix
No milestone
No assignees
1 participant
Notifications
Due date
No due date set.
Dependencies
No dependencies set
Reference
github/LooperSalty--AnyXboxX!284
Loading…
Reference in a new issue
No description provided.
Delete branch "github-bot/gh-284"
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?
@Tiimonprog on GitHub · 2026-11-26 00:44 UTC · original
Tiimonprog:fix/victory-guarded-swizzle→main· +335 −1 · 5 files · 4 commits · openChange
VIctory’s DS swizzle lowering passes a masked source value to the cross-lane read. Select zero for an EXEC-masked source before the read, as the existing bpermute lowering already does.
The new synthetic wave64 regression activates only even lanes. A quad reversal reads inactive odd lanes, while a swap-16 reads active even lanes. Inactive destinations retain their sentinel. Before the fix, RTX 4060 Laptop returned 4 at thread 0, dword 1 instead of 0. After the fix, all 256 output dwords match the expected values.
Verification
Run from
third_party/victory, Rust 1.98.1 MSVC, Windows 11, NVIDIA RTX 4060 Laptop (driver 32.0.16.2124):Intel UHD and WARP were also probed using a temporary local adapter-selection change, excluded from this PR. Both refused this 32-lane program at pipeline creation, so the regression did not execute there. The test uses the existing helper that returns early on unsupported hardware. The full test run above used the unchanged host helper.
Oracle and test data
The test encodes its own small RDNA program and checks 64 lanes × 4 dwords against explicit expected values, including zero from inactive sources, live source values and preserved inactive destinations. No game inputs were used. In-game graphics and performance effects have not been measured.
Created with OpenAI Codex assistance.
@Tiimonprog on GitHub · 2026-11-26 00:48 UTC · original
Added
c8b9fff, an opt-in deterministic GPU sweep with 256 generated wave64 programs. Each performs an in-place QUAD_PERM, changes EXEC, then performs a BITMASK_PERM. The set covers all 256 quad selectors and varying sparse, empty and full masks. It compares 32,768 output dwords against an independent CPU calculation.Run from
third_party/victory:Measured on RTX 4060 Laptop, driver 32.0.16.2124: 256 cases passed (5.83 s in one run).
nvidia-smialso confirmed the test process on the NVIDIA adapter. To replay one case, setSWIZZLE_CASE=0(valid range 0–255). The sweep requires a GPU accepting these 32-lane shaders and fails explicitly if device or pipeline creation fails. It is opt-in because ordinary CI may lack that hardware.With the lowering restored to the pre-fix version, case 0 fails at lane 8:
[9, 31], expected[9, 0]. With the fix, all cases pass, including replay of case 0. No additional mismatch was found in this set. The earlier full-suite result in the description predates this added opt-in test.AI assistance: OpenAI Codex.
@Tiimonprog on GitHub · 2026-11-26 01:03 UTC · original
Added two commits,
13f1bf9and8dcc8d6, extending validation of this fix.The divergent-loop sweep covers 260 dispatch cases across four partner mappings (XOR 1, 16, 32 and 63), including empty/full entry masks and per-lane exits after 1–8 rounds. It checks values, iteration counts, reads inside the loop and reads after reconvergence against a CPU calculation. WAVE64_LOOP_CASE=131 replays one case (valid range 0–259).
Both generated sweeps now pass synthetic DXBC/XDAT/XBCH/FSSM containers through the public translate() entry point, including native parsing, spill handling and automatic translation-form selection for a 32-lane host. The loop sweep also dispatches the explicit paired form if its result differs. A new GPU-independent round-trip test checks the code, stage settings and root bindings of the synthetic container.
Measured on Windows, RTX 4060 Laptop, driver 32.0.16.2124, Rust 1.98.1 MSVC:
Negative controls were local and restored afterward. Removing the paired bpermute source guard makes loop case 131 fail (lane 0 reads 34 instead of 33). Restoring the swizzle lowering to its pre-fix version makes public-path swizzle case 0 fail at lane 8 ([9, 31] instead of [9, 0]). Both generated sweeps pass with the original bpermute guard and this PR’s swizzle fix restored. No additional mismatch was found in these cases. In-game effects remain unmeasured.
Created with OpenAI Codex assistance.
View command line instructions
Manual merge helper
Use this merge commit message when completing the merge manually.
Checkout
From your project repository, check out a new branch and test the changes.Merge
Merge the changes and update on Forgejo.