Shaders: lower ds_permute_b32 and ds_nop #2152
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!2152
Loading…
Reference in a new issue
No description provided.
Delete branch "github-bot/gh-2152"
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?
@fuzeofficlal on GitHub · 2026-11-25 06:19 UTC · original
fuzeofficlal:fix/shader-ds-permute-b32-1481→main· +740 −1 · 3 files · 1 commits · openProblem
gfx10::opcodes,gfx10::fields, andLower::instalready recognizeds_permute_b32(0x0b2) andds_nop(0x014), whereasLower::ds(crates/victory-shader/src/emit/lower.rs) only lowersds_swizzle_b32andds_bpermute_b32before requiring an LDS allocation and falling through toErr("an LDS operation")(#1481). Neither instruction accesses physical LDS memory.Changes
ds_nop(0x014): ReturnOk(())as a no-op without requiring allocated LDS, and omitds_nopfromLower::instside-effect marking.ds_permute_b32(0x0b2): Lower forward cross-lane scatter within each 32-lane sub-vector (0..31, and32..63independently in Wave64 per the RDNA2 ISA) usingwaveActiveBallotand uniform-lanewaveReadLaneAt: active lanes routevdatato((vaddr + offset) >> 2) & 31within their half, unwritten active destinations read0, and inactive destination lanes retain their priorvdstvalue.emit::ds_permute_testscovering Wave32 bijection/unaligned/offset/partial-EXEC/collision arbitration, Wave64 32-lane half isolation, zero-LDSds_nopexecution, and non-compute stage refusal (dxil.dllvalidated, verified on RTX 5090 Wave32, AMD Radeon Graphics Wave32/Wave64, and D3D12 WARP).Part of #1481.
@sinan-cmyk on GitHub · 2026-11-25 08:16 UTC · original
Offline measurement on a retail dump
Result: no count change against
main.I merged head d8150fcb onto
main940d32f(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: 23,918 onmain, 23,918 with this PR.No program changes its failure reason. The count shows that the change rejects nothing on this data. It does not show whether the output is right.
No shader names or data are included, per the asset policy. AI-assisted (Claude Code).
@Marvisak on GitHub · 2026-11-25 11:24 UTC · original · edited 2026-11-26 03:24 UTC
Automated triage for the maintainers.
Verdict: merge candidate (unchanged). Thanks for the rebase. At
72cd605theds_permute_b32andds_nophandling inLower::ds(crates/victory-shader/src/emit/lower.rs) is the same as the reviewed version. That includes the RDNA2 ISA §10.4.4 half-wave indexing, the highest active source winning a collision, and 0 for lanes that receive nothing. The only change is inds_permute_tests.rs, which now usesHost::from_device(device)to matchemit/host.rsonmain.#573 (the matching
ds_bpermute_b32fix) has landed since the last review, somainand this PR now use the same 32-lane-half semantics.CI: passing (
check). Merges cleanly.Generated by Claude Code
@fuzeofficlal on GitHub · 2026-11-25 12:08 UTC · original
Updated in
5e8053c6with the RDNA2 ISA citation inLower::ds, while leavingds_bpermute_b32untouched here so this PR stays conflict-free with #573 (verdict=merge-candidate), which already fixesds_bpermute_b32to use the same 32-lane half-wave indexing.RDNA2 Wave64 Half-Wave Semantics
AMD RDNA 2 ISA Reference Guide (§10.4.4, LDS Lane-permute Ops):
LLVM AMDGPU Backend (
llvm/lib/Target/AMDGPU/GCNSubtarget.h):GCNSubtarget::supportsWaveWideBPermute()returns(getGeneration() <= GFX9 || getGeneration() >= GFX12) || isWave32()—falseon GFX10/RDNA2 in Wave64, where full-wave shuffles must synthesize cross-half movement separately viav_permlane64_b32.Once both #573 (
ds_bpermute_b32) and this PR (ds_permute_b32+ds_nop) land, both permute instructions match RDNA2's(lane_index() & !31) | (((addr + offset) >> 2) & 31)behavior.@fuzeofficlal on GitHub · 2026-11-26 02:56 UTC · original
Rebased onto current
main(63bcca43) and updatedds_permute_tests.rsfor theHost::from_device(device)signature change; all 37ds_permute/lowertests, clippy, and policy checks pass.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.