gfx2hlsl: accept float neg/abs sources on pixel-stage DPP quad swaps (Part of #1723) #2551
Loading…
Reference in a new issue
No description provided.
Delete branch "upstream-pr/2559"
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?
Imported from R0Y00/Xbox2Windows. Originally posted by lambirou on 2026-11-25T21:02:43Z.
Problem
Startup pixel-stage DPP16 quad swaps (
v_mov_b32_dppand the VOP2 float forms) refused a source carrying theneg/absmodifier (-vN,|vN|). The disassembler already prints those bits for the float forms, so a shader that uses them stopped translation.Change
dpp(), the binary32 path accepts-vN,|vN|and-|vN|on VGPR sources. The permuted word is read from the neighbour lane first (QuadReadAcross*), then the modifier applies, matching RDNA 2 ISA 12.19 and LLVM 15's_dppspelling.tests/startup_gfx2hlsl_dpp_quad_swap_check.pynow asserts that-v0negates the neighbour word and|v0|takes its absolute value, and keeps an integer-v0refused.docs/experiments.md.Verification
Rebased on
20725622.Limits
llvm-mcor DXC, so the existing swap binary/draw modes still cover the unmodified fixtures only. GPU behavior of the modifiers is not claimed here.Refs #1723.
Imported from R0Y00/Xbox2Windows. Originally posted by tedin7 on 2026-11-25T21:06:50Z.
Review: COMMENTED
Review of head
4d0dda0dagainst current main (comment only).What looks right
tools/startup/gfx2hlsl.pydpp(): for the float path the permuted word is read withQuadReadAcross*first, thenabs, thennegare applied. That order matches the ISA text cited in the PR. Theabsthennegnesting also gives-|vN|correctly.src1operand goes throughself.f(...), so it keeps its own modifier handling.What is missing before this can merge
-v0is refused). The repo rule for shader/math lowerings is a real D3D12 WARP GPU readback compared with a CPU reference, not string checks alone. The PR's own "Limits" section says the binary and draw modes cover only the unmodified fixtures. Please add a-v0and a|v0|case to the existing swap draw/readback fixture and show it passes on WARP (including a lane whose neighbour value is negative, soabsandnegare not no-ops).ops[0]) is no longer checked by thev\d+regex on the float path. A modifier on the destination should still be refused. A one-line check plus a test would close that.Checks run locally on a clean worktree of this head
python3 -B tests/startup_gfx2hlsl_dpp_quad_swap_check.py-> PASSpython3 tests/docs_links_check.py-> 19 files, 487 linkspython3 tests/bidi_controls_check.py-> cleangit diff --check origin/main...HEAD-> cleannegwrap -> test FAILS ("-v0 negates the neighbour word"). Mutation 2: drop theabswrap -> test FAILS ("|v0| takes abs"). So the text test does guard the lowering, but it does not prove GPU behavior.I did not run Win2025 for this head and did not merge. Merge stays blocked until the WARP readback test exists.
AI-assisted; commands listed were executed locally.
Imported from R0Y00/Xbox2Windows. Originally posted by tedin7 on 2026-11-25T21:21:36Z.
Review: COMMENTED
Review of head
32489609against current main (comment only).What looks right
tools/startup/gfx2hlsl.pydpp(): float path reads the neighbour lane first (QuadReadAcross*), thenabs, thenneg. Integer, SGPR and destination-modifier forms stay refused..github/workflows/windows.yml. Three control draws each omit one modifier and must fail the readback, so the draw really guards neg, abs and neg-abs.dpp neg abs).Commands run in a local worktree
python3 -B tests/startup_gfx2hlsl_dpp_quad_swap_check.py: PASS (the llvm-mc and DXC modes are skipped on Linux, they run in the Windows CI job)python3 -B tests/docs_links_check.py: ok, 19 files, 487 linkspython3 -B tests/bidi_controls_check.py: okgit diff --check origin/main...HEAD: cleannegwrapper makes the check fail; dropping theabswrapper makes it fail. Both restored.Care note:
.github/workflows/windows.ymlgains one line; the PR's own Windows CI run must execute it.AI-assisted; commands listed were executed locally.
Imported from R0Y00/Xbox2Windows. Originally posted by R0Y00 on 2026-11-25T21:23:03Z.
32489609adds a signed-normal DPP fixture and restores rejection of a modified destination. The Windows Release controls and draws passed 3/3 on WARP and RTX 4060 Laptop. Each of the 256 pixels matched the three neighbour channels (NEG, ABS, NEG+ABS); dropping each modifier separately changed the readback. The new gfx1013 assembly comparison runs in Linux CI.Imported from R0Y00/Xbox2Windows. Originally posted by tedin7 on 2026-11-25T21:24:57Z.
Win2025 WARP receipt for head
d853584aafter updating with main.Verified on Windows Server 2025 (Build 26100, MSVC 14.44.35207 + D3D12 WARP) at commit
d853584ae0928d799831c34cd6add59f88dae1fe:--preset dev):cmake --build --preset dev --target d3d12_xs_device_obj d3d12_xs_shim startup_buffer_format_word3_check -- -j 2):0.29s(configure0.00s)/O2(--preset release):cmake --build --preset release --target d3d12_xs_device_obj d3d12_xs_shim startup_buffer_format_word3_check -- -j 2):0.27s(configure0.00s)tests/startup_gfx2hlsl_dpp_quad_swap_check.pyok (0.1s),tests/startup_gfx2hlsl_swap_check.pyok (0.3s)6.9sNote: only the plain Python mode of the DPP check ran on the VM (0.1s); the llvm-mc binary and D3D12 draw modes run in the PR's own Windows CI job.
AI-assisted; commands listed were executed locally.