Repository navigation
Shaders: v_pk_fmac_f16 with DPP reads src0 from the selected lane - #2229
BastienRodz wants to merge 1 commit into
Conversation
Lower::valu puts a DPP instruction's cross-lane src0 in self.src0 before lowering the operation; fsrc, src, half_src and v_cndmask_b32 read it for source 0, but fmac_half read the operand directly, so v_pk_fmac_f16_dpp multiplied the lane's own src0 in both halves. Read self.src0 for source 0 as the other readers do. The test draws a 2x2 quad whose pixels swap their packed src0 through quad_perm:[1,0,3,2]. Co-Authored-By: Gemini 4 Neon <noreply@google.com> Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
|
I ran the same quad-permute fixture on 940d32f and exact head 754e60e on native Windows. I made DXIL validation and the software-device creation mandatory. The DXC 1.9.2609 validator accepted both shaders on both revisions. The render used Agility 1.620.2 and packaged WARP 1.0.22, with both loaded module paths checked. Reading the 2x2 target gave these low/high pairs in pixel order.
The inbox WARP device reported SM 6.2 and could not run this fixture. AI-assisted. Synthetic shaders only. |
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 packed_fmac_dpp_reads_the_swizzled_lane— passed on both RTX 5090 hardware andVICTORY_D3D12_WARP=1cargo clippy -p victory-shader --all-targets— 0 warningscargo xtask policy— ok (183 files ok)
Clean fix reading src0 from the DPP-selected lane in v_pk_fmac_f16, verified end-to-end on RTX 5090 + WARP. Looks great.
AI-assisted (Gemini 4 Neon).
|
I also checked the DPP8 encoding from #2228 with a separate compute fixture. The existing pixel test covers DPP16. This fixture dispatches one group of 32 threads, swaps adjacent lanes within each eight-lane DPP8 group, and reads back both packed halves from every thread.
Native DXIL validation passed for both. The execution used app-local Agility 1.620.2 and WARP 1.0.22. The test-only |
|
Thanks for running the DPP8 case. I'll keep the PR to the one test: DPP16 and DPP8 both go through |
Offline measurement on a retail dumpResult: no count change against I merged head 754e60e 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 (worth a look). The head is unchanged ( On your reply: agreed. DPP Generated by Claude Code |
|
Tested on NVIDIA hardware (RTX 4070, Ada, wave32), Windows 11, Agility 1.620.2, on base #2229 (head Cross-check with #2266 (head Full crate ( So #2229 looks fine to merge from the NVIDIA side, and #2266 is a duplicate of it. One adjacent point, not covered by either PR: the DPP16 dword's AI-assisted. |
|
Thanks @Mericas77, it's useful to have it confirmed on Ada hardware, and the cross-check with #2266 too. On the DPP |
fyernald
left a comment
There was a problem hiding this comment.
Verified on RTX 3080 (617.42), Windows 10 (19045) plus WARP, main 67e8ae1 + #486 + #2596 (the suite crashes on NVIDIA without #2596, #2571). cargo test -p victory-shader --lib --locked -- --test-threads=1: 268 passed, 3 failed (the #1835 ones, also on the base). packed_fmac_dpp_reads_the_swizzled_lane passes on both adapters.
#2266 makes the identical change (self.src0 for k == 0 in the packed-operand read). This PR came first and has the more thorough test, so I'd take this one.
…the selected lane
…the selected lane
What's wrong
For a VOP1/VOP2 instruction with DPP,
Lower::valufetchessrc0from the selected lane and leaves it inself.src0;fsrc,src,half_srcandv_cndmask_b32use it for source 0.Lower::fmac_half, which reads the halves ofv_pk_fmac_f16, calledself.operandinstead, sov_pk_fmac_f16_dppmultiplied the lane's ownsrc0in both halves. RDNA 2 ISA §12.7 defines the operation on S0, and §6.9 says DPP selects VOP1/VOP2 operands "from different lanes (threads) rather than just using a thread's own lane".What the fix does
fmac_halftakesself.src0for source 0 when it is set, like the other readers. Nothing changes without DPP.Tests
New
emit::valu_tests::packed_fmac_dpp_reads_the_swizzled_lane: a pixel program on a 2x2 target packs a per-pixel pair of halves, runsv_pk_fmac_f16_dpp quad_perm:[1,0,3,2], and checks each pixel got its horizontal neighbour's product. A pixel program is used because quad permutes behave the same at any wave size, so the test also runs on WARP (a compute version would declare the console's wave of 32, which WARP and llvmpipe refuse).main(940d32f) it fails: every pixel gets its own product (left: [[6.5, 6.0, …], [10.5, 8.0, …], …],right: [[10.5, 8.0, …], [6.5, 6.0, …], …]).packed_fmac_accumulates_each_halfpass.VKD3D_FEATURE_LEVEL=12_2 VKD3D_SHADER_MODEL=6_6).Not tested
Not run on an AMD/NVIDIA GPU. No
dxil.dllhere, so the new program was not run through the validator locally. Whether title shaders usev_pk_fmac_f16with DPP is not measured.Fixes #2228
AI-assisted (Gemini 4 Neon found and wrote it, Claude Code reviewed, trimmed and verified it). No game data used.
🤖 Generated with Claude Code