Shaders: clamp inactive source lane in ds_bpermute_b32 before WaveReadLaneAt #3189
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!3189
Loading…
Reference in a new issue
No description provided.
Delete branch "github-bot/gh-3189"
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?
@reeledMarek on GitHub · 2026-11-26 11:28 UTC · original
reeledMarek:fix/shader-bpermute-safe-lane→main· +55 −5 · 2 files · 1 commits · openSummary
crates/victory-shader/src/emit/lower.rs,ds_bpermute_b32passed the computed sourcelanedirectly toself.read_lane(x, lane)(dx.op.waveReadLaneAt.i32) before checkingrunningviawaveActiveBallot.WaveReadLaneAtis undefined behavior in DXIL/SM6.0+ (matching the bug fixed for DPP16/DPP8/ds_swizzle_b32in commitb51011aa).me = self.lane_index()(reused for wave64 half masking) andrunningbeforeread_lane, selectsafe_lane = select(running, lane, me), and passsafe_lanetoread_lanebefore zeroing inactive sources.Testing
Module::wave_read_lane_clamps_inactiveincrates/victory-shader/src/emit/bitcode.rsand asserted it inds_bpermute_wave64_preserves_32_lane_halffor both wave32 and wave64 (fails onmain, passes with the fix).cargo clippy -p victory-shader --all-targets --target x86_64-pc-windows-msvc --locked -- -D warningsandcargo test -p xtask --lockedpass.@oni-swr on GitHub · 2026-11-26 11:47 UTC · original
WARP verification of #3189 (head
707f71541c15446c3fd443ad42921059c45f970e)Environment: Windows 11 Pro 10.0.26200; WARP
D3D10Warp.dll10.0.26100.9818 (VICTORY_D3D12_WARP=1, physical GPU not used);dxil.dllanddxc.exe1.8.2502.11 from Windows SDK 10.0.26100.0 (VICTORY_DXILpoints at thatdxil.dll); rustc 1.98.1.Commands:
cargo test -p victory-shader --lib -j 4 --locked -- --test-threads=1, on the PR head and on the merge-base withmain(63bcca43c6a00a758510398fa43096ce7e4f7df0). The test builds the container and validates it with the SDKdxil.dll.emit::lower::tests::ds_bpermute_wave64_preserves_32_lane_half, wave32 and wave64)read_lane(x, safe_lane)back toread_lane(x, lane)), test keptDefects found: none. Reading the diff,
runningis still computed from the unclampedlane, so inactive sources are still zeroed.lane_index()is now emitted for wave32 as well, and the test'suses_lane_indexassertion is updated to match. Note the test checks the DXIL structure (select onwaveGetLaneIndexfeedingwaveReadLaneAt), not lane values on a device; no WARP execution test covers it.AI use: Claude Code (Claude Sonnet 5.5), coordinated by Claude Code (Claude Opus 5.5). Test report only, no code changes. Claim: #1633
@Dukestar69 on GitHub · 2026-11-26 11:47 UTC · original · approved these changes
Verified on RTX 5090 & WARP against
origin/main(63bcca4):cargo test -p victory-shader --lib ds_bpermute -- --test-threads=1: passed.cargo test -p victory-shader --lib emit::crosslane_tests:: -- --test-threads=1: 5/5 passed on RTX 5090 and WARP.cargo clippy -p victory-shader --all-targets -- -D warnings: clean.cargo xtask policy: 191 files ok.Cleanly clamps inactive source lanes before
WaveReadLaneAtinds_bpermute_b32.Synthetic tests only (no game files used). AI-assisted (Gemini 4 Neon).
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.