shader: lower DPP16 quad swaps in gfx2hlsl (Part of #2125) #2133
Loading…
Reference in a new issue
No description provided.
Delete branch "upstream-pr/2141"
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 tedin7 on 2026-11-25T01:29:55Z.
Part of #2125
What this unblocks: pixel shaders that swap values inside a 2x2 pixel quad (
quad_perm:[1,0,3,2],[2,3,0,1],[3,2,1,0], about 8,971 instructions) now translate instead of being refused.Changes:
tools/startup/gfx2hlsl.py: lower the three swaps inv_mov_b32_dppand the VOP2 integer and binary32 forms toQuadReadAcrossX,QuadReadAcrossYandQuadReadAcrossDiagonal. Only src0 is exchanged. Broadcasts, pair perms, partial masks, row_mirror, DPP8, fi:1, modifiers, SGPR sources, vertex stages, unknown EXEC and branches are still refused (broadcast and pair belong to the other items on #2125).X2W_DXCordxcon PATH is used. Pairs without a swap still use fxc 5.1.tests/startup_gfx2hlsl_dpp_quad_swap_check.py, registered inCMakeLists.txt(controls plus WARP/hardware draw). It draws 16x16 and reads pixels back against a CPU quad reference, with mutations (X to Y, Y to diagonal, diagonal to X, no exchange, dropped swap) that must fail.docs/experiments.md: new paragraph.Verification:
python3 tests/startup_gfx2hlsl_dpp_quad_swap_check.pyPASS (translation, refusals, no-dxc refusal).python3 tests/startup_gfx2hlsl_swap_check.pyandpython3 tests/startup_translator_check.pyPASS.binaryllvm-mc check and the WARP draw (no dxc, offscreen_check or Windows here). Needs the Win2025 gate:ctest --preset dev --no-tests=error -R '^startup_gfx2hlsl_dpp_quad_swap_' -V.Draft until the Win2025 WARP run passes and a peer reviews it.
AI-assisted; commands listed were executed locally.
Imported from R0Y00/Xbox2Windows. Originally posted by chatgpt-codex-connector[bot] on 2026-11-25T01:43:19Z.
Review: COMMENTED
💡 Codex Review
Here are some automated review suggestions for this pull request.
Reviewed commit:
b88898493cℹ️ About Codex in GitHub
Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you
If Codex has suggestions, it will comment; otherwise it will react with 👍.
Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".
Imported from R0Y00/Xbox2Windows. Originally posted by chatgpt-codex-connector[bot] on 2026-11-25T01:36:10Z.
Codex Review Summary: ✅ Completed
This comment shows the latest Codex review activity on this pull request.
b888984ℹ️ About Codex in GitHub
Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you
Codex reacts with 👀 while any review is running, comments if it has suggestions, and reacts with 👍 once all reviews finish with no findings.
Imported from R0Y00/Xbox2Windows. Originally posted by chatgpt-codex-connector[bot] on 2026-11-25T01:43:19Z.
Code review location:
tools/startup/gfx2hlsl.py; line 785For a pixel shader that executes DPP before entering whole-quad mode, a partially covered primitive can have inactive neighbours even though
exec_knownis true: that flag only records that EXEC still equals its entry mask. The accepted DPP forms mask inactive source lanes, whereasQuadReadAcross*reads helper lanes, so translated pixels at triangle edges can receive a neighbour's value instead of the hardware's zero/preserved result. Require a proven whole-quad EXEC state, or model/refuse inactive-source cases. The fullscreen 16×16 fixture does not exercise partial-quad coverage.Useful? React with 👍 / 👎.
Imported from R0Y00/Xbox2Windows. Originally posted by chatgpt-codex-connector[bot] on 2026-11-25T01:43:19Z.
Code review location:
tests/startup_gfx2hlsl_dpp_quad_swap_check.py; line 75Running the new
binarymode with LLVM 20 fails both fixtures.llvm-mc --show-encoding(documented as “Show instruction encodings”) encodesv_mov_b32_e32 v9, 0x40000000as the four-byte inline2.0form (0x7e1202f4), while this helper records the eight-byte literal form (0x7e1202ff, 0x40000000). Becausecheck_binary()compares the complete byte streams, the advertised round-trip fails even though the DPP encodings match. Use a flag without an inline encoding, or generate the canonical inline move.Useful? React with 👍 / 👎.
Imported from R0Y00/Xbox2Windows. Originally posted by tedin7 on 2026-11-25T02:30:57Z.
Review: COMMENTED
No description provided.
Imported from R0Y00/Xbox2Windows. Originally posted by tedin7 on 2026-11-25T02:30:59Z.
Review: COMMENTED
No description provided.
Imported from R0Y00/Xbox2Windows. Originally posted by tedin7 on 2026-11-25T02:30:57Z.
Code review location:
tools/startup/gfx2hlsl.py; line 785Fixed in
a351c0fb.s_wqm_b64 exec, execproved whole-quad EXEC. A later write to EXEC, or a restored older EXEC copy, drops the proof. New controls: fixtures withouts_wqmare refused, and a copy/wqm/restore sequence is refused.tests/startup_gfx2hlsl_dpp_quad_swap_check.pyPASS,... binary llvm-mcPASS, 53 related Python checks PASS (tools/run_checks_parallel.py). Win2025:x2w_pipe.py win2025 2141,ctest -R '^startup_gfx2hlsl_dpp_quad_swap_'3/3 passed on dev and on release (controls, warp, hardware).AI-assisted; commands listed were executed locally.
Imported from R0Y00/Xbox2Windows. Originally posted by tedin7 on 2026-11-25T02:30:58Z.
Code review location:
tests/startup_gfx2hlsl_dpp_quad_swap_check.py; line 75Fixed in
a351c0fb.v_mov_b32 v9, 2.0, the inline constant 244 (0x7e1202f4), so the words match the assembler. The fixtures also start withs_wqm_b64 exec, exec.tests/startup_gfx2hlsl_dpp_quad_swap_check.py binary <llvm-mc>PASS for both fixtures (LLVM 19 locally); Win2025 dev and release 3/3 passed.AI-assisted; commands listed were executed locally.