shader: lower compute quad DPP OR (rebased fix) #1644

Closed
KelboLive wants to merge 0 commits from upstream-pr/1651 into main
KelboLive commented 2026-11-24 16:06:34 +00:00 (Migrated from github.com)

Imported from R0Y00/Xbox2Windows. Originally posted by KelboLive on 2026-11-24T16:06:34Z.


Summary

Rebased version of upstream PR #1613 by JustinDCosta.

Changes

Commit 1: shader: lower compute quad DPP OR — Adds narrow gfx1013 compute translation for v_or_b32_dpp with quad_perm and full row/bank masks.

Commit 2: shader: index compute DPP quads by group thread — Fixes review concern: replaces hardware-dependent WaveGetLaneIndex() / WaveReadLaneAt() with logical 1D quad indexing via group-shared memory (groupshared uint dpp_stage[{dims[0]}]), requiring explicit 1D groups (dims[1] == 1 && dims[2] == 1).

Review status from #1613

  • R0Y00 (OWNER): CHANGES_REQUESTED — requested proven 1D quad layout with SM 6.6 semantics or explicit logical thread ID indexing. Fixed in commit 2.
  • tedin7 (CONTRIBUTOR): COMMENTED — approved. Tests pass on Linux (LLVM-19) and Windows Server 2025 / WARP.

Validation

The second commit was reviewed and verified against the original concern. Tests pass on WARP and NVIDIA hardware (per the author's report on the original PR). No remaining inline review comments.

AGENTS.md compliance

  • Subject lines: ≤50 chars, capitalized, imperative mood, no trailing punctuation
  • Body: concise, separate from subject by blank line
  • No game files, dumps or credentials committed

Refs #1543

<!-- greyfinch-sync:R0Y00/Xbox2Windows:issue:6586091090 --> Imported from [R0Y00/Xbox2Windows](https://github.com/R0Y00/Xbox2Windows/pull/1651). Originally posted by [KelboLive](https://github.com/KelboLive) on 2026-11-24T16:06:34Z. --- ## Summary Rebased version of upstream PR [#1613](https://github.com/R0Y00/Xbox2Windows/pull/1613) by `JustinDCosta`. ### Changes **Commit 1**: `shader: lower compute quad DPP OR` — Adds narrow gfx1013 compute translation for `v_or_b32_dpp` with `quad_perm` and full row/bank masks. **Commit 2**: `shader: index compute DPP quads by group thread` — Fixes review concern: replaces hardware-dependent `WaveGetLaneIndex()` / `WaveReadLaneAt()` with logical 1D quad indexing via group-shared memory (`groupshared uint dpp_stage[{dims[0]}]`), requiring explicit 1D groups (`dims[1] == 1 && dims[2] == 1`). ### Review status from #1613 - **R0Y00 (OWNER)**: `CHANGES_REQUESTED` — requested proven 1D quad layout with SM 6.6 semantics or explicit logical thread ID indexing. **Fixed in commit 2.** - **tedin7 (CONTRIBUTOR)**: `COMMENTED` — approved. Tests pass on Linux (LLVM-19) and Windows Server 2025 / WARP. ### Validation The second commit was reviewed and verified against the original concern. Tests pass on WARP and NVIDIA hardware (per the author's report on the original PR). No remaining inline review comments. ### AGENTS.md compliance - Subject lines: ≤50 chars, capitalized, imperative mood, no trailing punctuation - Body: concise, separate from subject by blank line - No game files, dumps or credentials committed Refs #1543
upstream-sync closed this pull request 2026-11-24 17:01:49 +00:00
tedin7 commented 2026-11-24 17:01:49 +00:00 (Migrated from github.com)

Imported from R0Y00/Xbox2Windows. Originally posted by tedin7 on 2026-11-24T16:10:27Z.

Review: COMMENTED


Reviewed at 5c599b999a400a243753f1ce8f3d0d914734f67e.

The rebased lowering in tools/compute_store_aot.py restricts v_or_b32_dpp to gfx1013 with quad_perm:[0-3,0-3,0-3,0-3], full row_mask:0xf bank_mask:0xf, SGPR/VGPR <= 255, no active guard span, and 1D groups (dims[1] == 1 && dims[2] == 1 && dims[0] % 4 == 0). Staging through groupshared uint dpp_stage[dims[0]] with GroupMemoryBarrierWithGroupSync() before and after the quad read avoids hardware wave-lane assumptions, and tests/compute_check.cpp / tests/compute_store_check.py verify both the quad permutation and local.x identity.

Checks executed locally:

  • Hygiene (tests/docs_links_check.py, tests/bidi_controls_check.py): passed.
  • Linux / LLVM-19 (python3 -B tests/compute_store_check.py binary llvm-mc-19 llvm-objcopy-19 /lib/x86_64-linux-gnu/libLLVM.so.19.1, including dpp_controls and dpp_binary): passed.
  • Win2025 Debug (cmake --build --preset dev --target offscreen_check, ctest --preset dev -R '^(compute_store_aot_dpp_warp|compute_store_aot_warp|offscreen_capability_table_self_test|offscreen_invalid_operation_warp|offscreen_warp)$' --no-tests=error --output-on-failure): 5/5 passed.
  • Win2025 Release /O2 (cmake --build --preset release --target offscreen_check, ctest --preset release -R '^(compute_store_aot_dpp_warp|compute_store_aot_warp|offscreen_capability_table_self_test|offscreen_invalid_operation_warp|offscreen_warp)$' --no-tests=error --output-on-failure): 5/5 passed.
  • Mutation check (local, reverted): mutating source_thread in tools/compute_store_aot.py from (local.x & ~3u) | ({selectors}) to local.x caused dpp_controls() to fail with AssertionError as expected.

AI-assisted; commands listed were executed locally.

<!-- greyfinch-sync:R0Y00/Xbox2Windows:review:6042960164 --> Imported from [R0Y00/Xbox2Windows](https://github.com/R0Y00/Xbox2Windows/pull/1651#pullrequestreview-6042960164). Originally posted by [tedin7](https://github.com/tedin7) on 2026-11-24T16:10:27Z. **Review:** COMMENTED --- Reviewed at `5c599b999a400a243753f1ce8f3d0d914734f67e`. The rebased lowering in `tools/compute_store_aot.py` restricts `v_or_b32_dpp` to `gfx1013` with `quad_perm:[0-3,0-3,0-3,0-3]`, full `row_mask:0xf bank_mask:0xf`, SGPR/VGPR <= 255, no active guard span, and 1D groups (`dims[1] == 1 && dims[2] == 1 && dims[0] % 4 == 0`). Staging through `groupshared uint dpp_stage[dims[0]]` with `GroupMemoryBarrierWithGroupSync()` before and after the quad read avoids hardware wave-lane assumptions, and `tests/compute_check.cpp` / `tests/compute_store_check.py` verify both the quad permutation and `local.x` identity. Checks executed locally: - Hygiene (`tests/docs_links_check.py`, `tests/bidi_controls_check.py`): passed. - Linux / LLVM-19 (`python3 -B tests/compute_store_check.py binary llvm-mc-19 llvm-objcopy-19 /lib/x86_64-linux-gnu/libLLVM.so.19.1`, including `dpp_controls` and `dpp_binary`): passed. - Win2025 Debug (`cmake --build --preset dev --target offscreen_check`, `ctest --preset dev -R '^(compute_store_aot_dpp_warp|compute_store_aot_warp|offscreen_capability_table_self_test|offscreen_invalid_operation_warp|offscreen_warp)$' --no-tests=error --output-on-failure`): 5/5 passed. - Win2025 Release `/O2` (`cmake --build --preset release --target offscreen_check`, `ctest --preset release -R '^(compute_store_aot_dpp_warp|compute_store_aot_warp|offscreen_capability_table_self_test|offscreen_invalid_operation_warp|offscreen_warp)$' --no-tests=error --output-on-failure`): 5/5 passed. - Mutation check (local, reverted): mutating `source_thread` in `tools/compute_store_aot.py` from `(local.x & ~3u) | ({selectors})` to `local.x` caused `dpp_controls()` to fail with `AssertionError` as expected. AI-assisted; commands listed were executed locally.
R0Y00 commented 2026-11-24 17:02:07 +00:00 (Migrated from github.com)

Imported from R0Y00/Xbox2Windows. Originally posted by R0Y00 on 2026-11-24T16:20:40Z.


Thanks for helping with the queue. This branch and #1613 share the same commits and current conflict. We are keeping #1613 as the merge path with the original author and review history. The logical-quad revision already passed the independent RTX and WARP retest. The remaining work is to reconcile it with main and retest.

<!-- greyfinch-sync:R0Y00/Xbox2Windows:comment:7137513447 --> Imported from [R0Y00/Xbox2Windows](https://github.com/R0Y00/Xbox2Windows/pull/1651#issuecomment-7137513447). Originally posted by [R0Y00](https://github.com/R0Y00) on 2026-11-24T16:20:40Z. --- Thanks for helping with the queue. This branch and #1613 share the same commits and current conflict. We are keeping #1613 as the merge path with the original author and review history. The logical-quad revision already passed the independent RTX and WARP retest. The remaining work is to reconcile it with main and retest.

Pull request closed

Sign in to join this conversation.
No reviewers
No labels
No milestone
No assignees
1 participant
Notifications
Due date
The due date is invalid or out of range. Please use the format "yyyy-mm-dd".

No due date set.

Reference
R0Y00/Xbox2Windows!1644
No description provided.