Repository navigation
gfx2hlsl: accept float neg/abs sources on pixel-stage DPP quad swaps (Part of #1723) - #2559
Conversation
tedin7
left a comment
There was a problem hiding this comment.
Review of head 4d0dda0 against 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.- Integer sources, SGPR sources and non-VGPR bases are still refused. The whole-quad / exec checks are unchanged.
- The
src1operand goes throughself.f(...), so it keeps its own modifier handling.
What is missing before this can merge
- The new test only checks the generated HLSL text (and that an integer
-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). - Small note: the destination operand (
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-> clean- Mutation 1: drop the
negwrap -> 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.
tedin7
left a comment
There was a problem hiding this comment.
Review of head 3248960 against 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.- The test now has a real binary round-trip (llvm-mc words) and a D3D12 draw with readback against a quad reference, wired into
.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. - No other open or merged PR covers float neg/abs on pixel-stage DPP quad swaps (searched
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: clean- Mutation: dropping the
negwrapper makes the check fail; dropping theabswrapper makes it fail. Both restored.
Care note: .github/workflows/windows.yml gains one line; the PR's own Windows CI run must execute it.
AI-assisted; commands listed were executed locally.
|
|
|
Win2025 WARP receipt for head d853584 after updating with main. Verified on Windows Server 2025 (Build 26100, MSVC 14.44.35207 + D3D12 WARP) at commit
Note: 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. |
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.