shader: lower compute quad DPP OR #1613

Manually merged
github merged 3 commits from gh-pr/1613/head into gh-pr/1613/base 2026-11-26 23:20:54 +00:00
Owner

@⁠JustinDCosta on GitHub · 2026-11-24 15:02 UTC · original
JustinDCosta:compute/quad-perm-or → main · +207 −9 · 8 files · 3 commits · merged 2026-11-24 16:33 UTC

Scope

Adds a narrow gfx1013 compute translation for v_or_b32_dpp with quad_perm and full row/bank masks. It models the guest's logical 1D quad using SV_GroupThreadID.x and group-shared staging, so it does not assume that Shader Model 6.0 wave lane indices map to group thread IDs. The accepted group layout is 1D with a size divisible by four. Other DPP controls remain unsupported; row shifts, partial masks, non-VGPR operands, multidimensional groups, incomplete quads, and lane-guarded execution are refused.

The source-built fixture uses unique input words across logical lanes and quads. The CPU reference derives source lanes from logical thread IDs, and a probe verifies every logical thread participated. An identity-read mutant must fail.

Refs #1543

Validation

Generated HLSL on WARP

  • Debug and Release passed the source-built D3D12 WARP fixture. All 320 words matched; there were zero debug errors or warnings. The identity-read mutant produced the expected mismatch.

Generated HLSL on NVIDIA hardware

  • Debug and Release passed on the NVIDIA GeForce RTX 3060 Laptop GPU. All 320 words matched; there were zero debug errors or warnings. The identity-read mutant produced the expected mismatch.

gfx1013 LLVM round-trip

  • Ubuntu CI passed the LLVM 15 machine-code input check, including the assembly/disassembly round-trip.
  • This Windows environment does not have LLVM 15 assembler/library tools, so I could not run the round-trip locally.

Other checks

  • Debug and Release builds of offscreen_check — passed.
  • dpp_controls() — passed acceptance/refusal checks, including row_shr, incomplete quads, and multidimensional groups.
  • Platform-independent Python CI checks — passed.
  • python -B tests/docs_links_check.py — passed (349 links).
**@⁠JustinDCosta** on GitHub · 2026-11-24 15:02 UTC · [original](https://github.com/R0Y00/Xbox2Windows/pull/1613) `JustinDCosta:compute/quad-perm-or` → `main` · +207 −9 · 8 files · 3 commits · merged 2026-11-24 16:33 UTC ## Scope Adds a narrow gfx1013 compute translation for `v_or_b32_dpp` with `quad_perm` and full row/bank masks. It models the guest's logical 1D quad using `SV_GroupThreadID.x` and group-shared staging, so it does not assume that Shader Model 6.0 wave lane indices map to group thread IDs. The accepted group layout is 1D with a size divisible by four. Other DPP controls remain unsupported; row shifts, partial masks, non-VGPR operands, multidimensional groups, incomplete quads, and lane-guarded execution are refused. The source-built fixture uses unique input words across logical lanes and quads. The CPU reference derives source lanes from logical thread IDs, and a probe verifies every logical thread participated. An identity-read mutant must fail. Refs #1543 ## Validation ### Generated HLSL on WARP - Debug and Release passed the source-built D3D12 WARP fixture. All 320 words matched; there were zero debug errors or warnings. The identity-read mutant produced the expected mismatch. ### Generated HLSL on NVIDIA hardware - Debug and Release passed on the NVIDIA GeForce RTX 3060 Laptop GPU. All 320 words matched; there were zero debug errors or warnings. The identity-read mutant produced the expected mismatch. ### gfx1013 LLVM round-trip - Ubuntu CI passed the LLVM 15 machine-code input check, including the assembly/disassembly round-trip. - This Windows environment does not have LLVM 15 assembler/library tools, so I could not run the round-trip locally. ### Other checks - Debug and Release builds of `offscreen_check` — passed. - `dpp_controls()` — passed acceptance/refusal checks, including `row_shr`, incomplete quads, and multidimensional groups. - Platform-independent Python CI checks — passed. - `python -B tests/docs_links_check.py` — passed (349 links).
github-bot locked as GitHub sync and limited conversation to collaborators 2026-11-26 23:20:52 +00:00
github manually merged commit d383358b7b into gh-pr/1613/base 2026-11-26 23:20:54 +00:00
Author
Owner

@⁠JustinDCosta on GitHub · 2026-11-24 15:40 UTC · original

Updated in 5c599b9. The generated HLSL now stages each source word in group-shared memory indexed by SV_GroupThreadID.x, and derives the quad source from that logical 1D thread ID. The translator accepts only 1D groups with X divisible by four, so this path no longer depends on the unspecified Shader Model 6.0 mapping from group IDs to wave lanes.

The fixture CPU reference now derives expected sources from logical thread IDs and verifies all 32 IDs participated. The identity-read mutant fails as expected. WARP and the RTX 3060 passed in Debug and Release; Ubuntu CI passed the gfx1013 LLVM 15 round-trip. row_shr, incomplete quads, partial masks, multidimensional groups, and lane-guarded execution remain refused.

**@⁠JustinDCosta** on GitHub · 2026-11-24 15:40 UTC · [original](https://github.com/R0Y00/Xbox2Windows/pull/1613#issuecomment-7136427444) Updated in `5c599b9`. The generated HLSL now stages each source word in group-shared memory indexed by `SV_GroupThreadID.x`, and derives the quad source from that logical 1D thread ID. The translator accepts only 1D groups with X divisible by four, so this path no longer depends on the unspecified Shader Model 6.0 mapping from group IDs to wave lanes. The fixture CPU reference now derives expected sources from logical thread IDs and verifies all 32 IDs participated. The identity-read mutant fails as expected. WARP and the RTX 3060 passed in Debug and Release; Ubuntu CI passed the gfx1013 LLVM 15 round-trip. `row_shr`, incomplete quads, partial masks, multidimensional groups, and lane-guarded execution remain refused.
Author
Owner

@⁠R0Y00 on GitHub · 2026-11-24 16:28 UTC · original

Resolved the CTest and documentation conflicts in d383358b. Both entry-layout and DPP tests are retained, and the description now matches the logical group-thread implementation. Windows Release DPP, RSRC2, full-mask image store and MED3 passed on RTX and WARP, 8/8 with no skips.

**@⁠R0Y00** on GitHub · 2026-11-24 16:28 UTC · [original](https://github.com/R0Y00/Xbox2Windows/pull/1613#issuecomment-7137723347) Resolved the CTest and documentation conflicts in d383358b. Both entry-layout and DPP tests are retained, and the description now matches the logical group-thread implementation. Windows Release DPP, RSRC2, full-mask image store and MED3 passed on RTX and WARP, 8/8 with no skips.
Author
Owner

@⁠R0Y00 on GitHub · 2026-11-24 15:12 UTC · original · requested changes

The added probe computes expected source lanes from the host WaveGetLaneIndex measured in the same dispatch. It verifies the host shuffle but can pass if the host quad differs from the logical guest quad. The branch accepts multidimensional groups and uses cs_6_0, which does not guarantee mapping quad lanes to SV_GroupThreadID. Please use a proven 1D quad layout (SM 6.6 quad semantics with capability gating) or index a logical 1D quad explicitly, and compute the reference from logical thread IDs. Keep the incomplete-quad, row_shift and identity controls. https://microsoft.github.io/DirectX-Specs/d3d/HLSL_SM_6_6_Derivatives.html

**@⁠R0Y00** on GitHub · 2026-11-24 15:12 UTC · [original](https://github.com/R0Y00/Xbox2Windows/pull/1613#pullrequestreview-6041912736) · **requested changes** The added probe computes expected source lanes from the host WaveGetLaneIndex measured in the same dispatch. It verifies the host shuffle but can pass if the host quad differs from the logical guest quad. The branch accepts multidimensional groups and uses cs_6_0, which does not guarantee mapping quad lanes to SV_GroupThreadID. Please use a proven 1D quad layout (SM 6.6 quad semantics with capability gating) or index a logical 1D quad explicitly, and compute the reference from logical thread IDs. Keep the incomplete-quad, row_shift and identity controls. https://microsoft.github.io/DirectX-Specs/d3d/HLSL_SM_6_6_Derivatives.html
Author
Owner

@⁠tedin7 on GitHub · 2026-11-24 15:13 UTC · original · reviewed

Reviewed 79226e74af0fb986eda2c5eadbf6a1309d8f10a6:

  • Diff & semantics: tools/compute_store_aot.py lowers v_or_b32_dpp with quad_perm:[p0,p1,p2,p3] and row_mask:0xf bank_mask:0xf on gfx1013 (unmasked guard_span is None, VGPR operands <= 255, workgroup size divisible by 4) using WaveGetLaneIndex() and WaveReadLaneAt(..., source_lane). tests/compute_check.cpp (run_compute with dpp_case = true) validates the same-dispatch WaveGetLaneIndex(), WaveGetLaneCount(), WaveActiveBallot(true) quad liveness, and the expected input_word(source_lane) | lane output. tests/compute_store_check.py covers dpp_controls(), dpp_binary() (LLVM round-trip), and draw_dpp including a no-shuffle mutant negative control.
  • Linux (LLVM-19 + hygiene):
    • python3 -B tests/compute_store_check.py binary llvm-mc-19 llvm-objcopy-19 libLLVM-19.so passed (exit 0).
    • python3 tests/docs_links_check.py (16 Markdown files, 349 links) and python3 tests/bidi_controls_check.py (1262 files) passed.
  • Windows Server 2025 (Build 26100, MSVC 14.44.35207 + D3D12 WARP):
    • Debug (--preset dev): cmake --build --preset dev --target offscreen_check + ctest --preset dev -R '^(compute_store_aot_dpp_warp|compute_store_aot_warp|compute_store_aot_ds_route_warp)$' --parallel 4 --no-tests=error --output-on-failure -> 3/3 passed (6.81s).
    • Release /O2 (--preset release): cmake --build --preset release --target offscreen_check + ctest --preset release -R '^(compute_store_aot_dpp_warp|compute_store_aot_warp|compute_store_aot_ds_route_warp)$' --parallel 4 --no-tests=error --output-on-failure -> 3/3 passed (6.73s).

AI-assisted; commands listed were executed locally.

**@⁠tedin7** on GitHub · 2026-11-24 15:13 UTC · [original](https://github.com/R0Y00/Xbox2Windows/pull/1613#pullrequestreview-6041919474) · **reviewed** Reviewed `79226e74af0fb986eda2c5eadbf6a1309d8f10a6`: - **Diff & semantics**: `tools/compute_store_aot.py` lowers `v_or_b32_dpp` with `quad_perm:[p0,p1,p2,p3]` and `row_mask:0xf bank_mask:0xf` on `gfx1013` (unmasked `guard_span is None`, VGPR operands `<= 255`, workgroup size divisible by 4) using `WaveGetLaneIndex()` and `WaveReadLaneAt(..., source_lane)`. `tests/compute_check.cpp` (`run_compute` with `dpp_case = true`) validates the same-dispatch `WaveGetLaneIndex()`, `WaveGetLaneCount()`, `WaveActiveBallot(true)` quad liveness, and the expected `input_word(source_lane) | lane` output. `tests/compute_store_check.py` covers `dpp_controls()`, `dpp_binary()` (LLVM round-trip), and `draw_dpp` including a no-shuffle mutant negative control. - **Linux (LLVM-19 + hygiene)**: - `python3 -B tests/compute_store_check.py binary llvm-mc-19 llvm-objcopy-19 libLLVM-19.so` passed (exit 0). - `python3 tests/docs_links_check.py` (16 Markdown files, 349 links) and `python3 tests/bidi_controls_check.py` (1262 files) passed. - **Windows Server 2025 (Build 26100, MSVC 14.44.35207 + D3D12 WARP)**: - Debug (`--preset dev`): `cmake --build --preset dev --target offscreen_check` + `ctest --preset dev -R '^(compute_store_aot_dpp_warp|compute_store_aot_warp|compute_store_aot_ds_route_warp)$' --parallel 4 --no-tests=error --output-on-failure` -> **3/3 passed** (`6.81s`). - Release `/O2` (`--preset release`): `cmake --build --preset release --target offscreen_check` + `ctest --preset release -R '^(compute_store_aot_dpp_warp|compute_store_aot_warp|compute_store_aot_ds_route_warp)$' --parallel 4 --no-tests=error --output-on-failure` -> **3/3 passed** (`6.73s`). AI-assisted; commands listed were executed locally.
Author
Owner

@⁠R0Y00 on GitHub · 2026-11-24 16:33 UTC · original · approved these changes

The logical quad staging, windows readback oracle and updated docs now agree. The integrated Windows Release candidate passed 8/8 on RTX and WARP covering DPP, entry layout, MED3 and full-mask image stores, with no skips.

**@⁠R0Y00** on GitHub · 2026-11-24 16:33 UTC · [original](https://github.com/R0Y00/Xbox2Windows/pull/1613#pullrequestreview-6043333426) · **approved these changes** The logical quad staging, windows readback oracle and updated docs now agree. The integrated Windows Release candidate passed 8/8 on RTX and WARP covering DPP, entry layout, MED3 and full-mask image stores, with no skips.
This discussion has been locked. Commenting is limited to contributors.
No description provided.