Shaders: return zero for inactive compute swizzle sources #1416
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!1416
Loading…
Reference in a new issue
No description provided.
Delete branch "github-bot/gh-1416"
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?
@EatCodeSleep2 on GitHub · 2026-11-24 17:54 UTC · original
EatCodeSleep2:fix/swizzle-inactive-compute-lanes-1242→main· +91 −2 · 2 files · 1 commits · openAddresses the compute part of VIC-BT-018 in #1242. For ds_swizzle_b32, ballot the instruction guard over the executing host wave and test the selected source bit. When the source is absent from the workgroup tail or masked by EXEC, read from a valid host lane and return zero. The pixel, vertex and mesh paths need separate validation.
The synthetic wave32 test reads back both bitmask and quad swizzles with active and masked sources. A one-thread group covers a source absent from the hardware wave. On main that case returned 0xdeadbeef instead of zero. The regression passes on the hardware adapter. WARP skips wave32 because it does not support the requested size. The shader suite passed 120 tests with the existing v_med3_f32 host NaN failure excluded. Shader Clippy with warnings as errors passes.
AI use: Codex wrote and tested the change.
@geiyiliyabumo on GitHub · 2026-11-24 17:59 UTC · original
Independent verification of \
54dea15\ on Windows 11 / AMD Radeon RX 9060 XT (RDNA4, \gfx1200) / Rust 1.98.1 MSVC:Code audit looks clean: ballot of the EXEC guard + \lane_bit_at\ + clamping the DXIL
ead_lane\ source index to \lane\ before selecting \␀\ keeps inactive/out-of-group source lanes well-defined in DXIL.
AI-assisted; synthetic tests only, no game files.
@marquezinii on GitHub · 2026-11-24 18:10 UTC · original
Ran on an RTX 5070 (desktop, driver 621.40, the only adapter), Windows 11 26300, Rust 1.98.1 at
54dea15.cargo test -p victory-shader --lib -- --test-threads=1gives 121 passed, 0 failed, 1 ignored.ds_swizzle_reads_only_active_compute_lanesneeds wave32, so this is the case it was written for: NVIDIA's only wave size is 32 (WaveLaneCountMin=Max= 32), and the test ran on the hardware adapter. WARP skips it here too, as your description says.@acetonahard-code on GitHub · 2026-11-24 19:22 UTC · original
Tested this on a GPU with SM 6.6 support (RTX 4070 SUPER, driver 621.14, Windows 11, repo toolchain), merged into current
main(ffe310e).cargo test -p victory-shadermainmain+ this PRmain,--all-featuresmain+ this PR,--all-features--nocapture, and no "no SM 6.6 ... device; skipped" lines were printed, so no GPU test skipped for lack of a device.cargo clippy --all-targets -- -D warnings, with and without--all-features: clean.cargo fmt --checkwould rewrap one block this PR adds (lower.rs).mainisn't rustfmt-clean either, so take it or leave it.I didn't test with game data.
Tested locally with an AI-assisted script (Claude Code); I checked the results before posting.
@sinan-cmyk on GitHub · 2026-11-24 20:44 UTC · original
Offline measurement on a retail dump, and the shader tests on Ada
Result: no count change against
main.Offline. I merged head
54dea15ontomainffe310e(clean merge) and ranvictory translate --validate --listonshaders.rpf(1.0.2.1), with dxil.dll 1.8.2502.11. I compared the result withmainprogram by program (25,889 programs). Validated: 21,724 onmain, 21,724 with this PR.No program changes its failure reason either. That is the expected result for a fix whose instructions sit behind the earlier failures on
main. The count shows that the change rejects nothing. It does not show whether the output is right.Tests: with the same merge,
cargo test --locked -p victory-shader --libpassed 121, failed 0. The bitcode benchmark is ignored, as onmain, where 120 pass. The run was on an RTX 4070 SUPER (Ada, 32-lane waves, driver 32.0.16.1088), the default adapter, withVICTORY_WARPunset.No shader names or data are included, per the asset policy. AI-assisted (Claude Code).
@Marvisak on GitHub · 2026-11-25 01:26 UTC · original
Automated triage for the maintainers.
Needs rebase. This pull request conflicts with
main(conflicting:crates/victory-shader/src/emit/valu_tests.rs). It will be reviewed once it is rebased onto the currentmain.Generated by Claude Code
@steven-seagull27 on GitHub · 2026-11-25 09:18 UTC · original
Compared
54dea150with its parentffe310ebusing the same five Wave32 compute swizzles on Windows 11 build 26300.10075. On an RTX 5080 (driver 621.40) this change fixes all three inactive-source cases. On Microsoft WARP 1.0.22 it fixes the two masked-source cases, but both active-neighbor swaps start returning zero.0x041f00xdeadbeef→00→00x041f00xdeadbeef→00xdeadbeef→00x80b100xdeadbeef→00xdeadbeef→00x041f0xdeadbeef0xdeadbeef→0xdeadbeef0xdeadbeef→00x80b10xdeadbeef0xdeadbeef→0xdeadbeef0xdeadbeef→0The RTX went from 2/5 to 5/5. Standalone WARP scored 3/5 on both commits, with different failing cases. Built-in WARP 10.0.26100.10068 skipped all five because it could not run the requested Wave32 mode.
To reproduce the first failure, run
ds_swizzle_reads_only_active_compute_laneson the PR head with the x64 WARP 1.0.22 DLL beside the test executable and WARP selected. The original assertion stops on the fourth case. For the table I recorded all five readbacks before asserting, then replayed the same fixture against the parent compiler. I verified the loaded WARP DLL path and its hash against the Microsoft package.@steven-seagull27 on GitHub · 2026-11-26 02:07 UTC · original
@EatCodeSleep2 I resolved the conflict on your
54dea150branch against main63bcca43. Merged #1582 already covers the compute source ballot. Git would retain both ballots if I resolved only the conflict it reports invalu_tests.rs. The branch I tested keeps main's shared lowering and your regression coverage. It tags each lane's value and adds two full-wave controls, so an active neighbor can be distinguished from reading the caller's own lane. Fast-forwardable test branch0instead of lane 1's0xdeadbef0. Both swaps succeeded in 32-thread groups.An independent DXC shader isolates the failure to the ballot of a partially occupied wave. Two active lanes directly read each other's distinct values correctly on both adapters. The RTX returns ballot
0x3; WARP 1.0.21, 1.0.22 and 1.65535.22-preview all return0for both lanes. A 32-thread Wave32 control returned0xffffffffon RTX and WARP 1.0.22. This also distinguishes the failure from the full-wave dynamic lane permutation in #2949. Expected active-lane ballot semanticsI compiled this with
dxc -T cs_6_6 -E main -O3and dispatched one group with a raw UAV at heap index 2. Lane 0 returned(0, 3, 0xface0001, 32)on RTX and(0, 0, 0xface0001, 32)on all three WARP packages. I also checked a bitwise-OR substitute. It fixes the two-thread control but gives0xfffffor 17 active lanes where the RTX gives0x1ffff, so it would be unsafe to generalize this workaround across group sizes.The branch passes strict shader Clippy. The no-device control fails explicitly. To pick up the test changes on the original PR branch:
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.