Repository navigation
Shaders: lower ds_permute_b32 and ds_nop - #2152
fuzeofficlal wants to merge 1 commit into
Conversation
DenRakEiw
left a comment
There was a problem hiding this comment.
Verified locally merged onto origin/main (940d32f, Windows 11 x64, NVIDIA GeForce RTX 5090 + WARP, Rust 1.98.1 MSVC, with dxil.dll validator):
cargo test -p victory-shader --lib emit::ds_permute_tests::— 4 passed, 0 failed on both RTX 5090 hardware andVICTORY_D3D12_WARP=1cargo clippy -p victory-shader --all-targets— 0 warningscargo xtask policy— ok (184 files ok)
Clean lowering of ds_permute_b32 and ds_nop with thorough end-to-end GPU+WARP test coverage in ds_permute_tests.rs. Looks good.
AI-assisted (Gemini 4 Neon).
Offline measurement on a retail dumpResult: no count change against I merged head d8150fc onto 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). |
|
Automated triage for the maintainers. Merge candidate. Thanks for the citation. It settles the Wave64 point. RDNA 2 ISA §10.4.4 ("LDS Lane-permute Ops") says that in wave64 the permute runs as two independent 32-lane halves. That matches The rest is unchanged from the last review and right:
For the maintainers: no title program starts translating because of this (offline count above), so it is a correctness addition. Land it together with #573. Generated by Claude Code |
gfx10::fields and Lower::inst already recognize ds_permute_b32 (0x0b2) and ds_nop (0x014), but Lower::ds only handled ds_swizzle_b32 and ds_bpermute_b32 before requiring an LDS allocation and falling through to "an LDS operation" (Marvisak#1481). Neither instruction touches LDS memory. Lower ds_nop as a no-op (and omit it from side-effect marking), and lower ds_permute_b32 as a forward cross-lane scatter within each 32-lane sub-vector (0..31, and 32..63 independently in wave64 per the RDNA2 ISA): active lanes route their source dword to ((addr + offset) >> 2) & 31 within their half, unwritten active destinations read 0, and inactive destination lanes retain their previous value. Part of Marvisak#1481.
d8150fc to
5e8053c
Compare
|
Updated in RDNA2 Wave64 Half-Wave Semantics
Once both #573 ( |
Problem
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.