shader: lower v_add_f32_dpp, v_or_b32_dpp, v_add_nc_u32_dpp and v_sub_f32_dpp in gfx2hlsl (Part of #1723) #2038

Closed
github-bot wants to merge 5 commits from gh-pr/2038/head into gh-pr/2038/base
Owner

@⁠tedin7 on GitHub · 2026-11-24 23:32 UTC · original
tedin7:x2w-r20-dpp-ops → main · +301 −0 · 5 files · 5 commits · closed without merging

Part of #1723

What this unblocks: Run 20 census #15, the _dpp spellings of v_add_f32, v_sub_f32, v_or_b32 and v_add_nc_u32, but only for the lane-local controls (see the open question).

The translator models one lane, so a DPP control that reads a neighbouring lane cannot be lowered correctly. The new dpp_form accepts quad_perm:[0,1,2,3] and the identity dpp8 with row_mask:0xf bank_mask:0xf, and translates them exactly like the plain operation (any source or output modifier travels along). quad_perm with another order, row_*, wave_*, a partial mask, bound_ctrl and fi are refused by name. Only ops in VEC_F/VEC_U are accepted.

Open question: if the census pairs mostly use cross-lane controls (for example quad_perm:[1,0,3,2] or row_shr), they stay refused. Lowering them needs lane or quad access, which fxc SM5 does not offer except through ddx_fine/ddy_fine in pixel shaders. I did not guess that.

Verification:

  • python3 -B tests/startup_gfx2hlsl_dpp_check.py -> PASS (on origin/main the same test fails with Unsupported: v_add_f32_dpp)
  • python3 -B tests/startup_gfx2hlsl_swap_check.py, ..._op_refusals_check.py, ..._refusals_check.py, ..._operand_count_check.py, ..._cndmask_neg_check.py -> exit 0
  • Not run: a Win2025 build; the change is Python only and registered as startup_gfx2hlsl_dpp in CMakeLists.txt.

AI-assisted; commands listed were executed locally.

**@⁠tedin7** on GitHub · 2026-11-24 23:32 UTC · [original](https://github.com/R0Y00/Xbox2Windows/pull/2038) `tedin7:x2w-r20-dpp-ops` → `main` · +301 −0 · 5 files · 5 commits · closed without merging Part of #1723 What this unblocks: Run 20 census #15, the `_dpp` spellings of `v_add_f32`, `v_sub_f32`, `v_or_b32` and `v_add_nc_u32`, but only for the lane-local controls (see the open question). The translator models one lane, so a DPP control that reads a neighbouring lane cannot be lowered correctly. The new `dpp_form` accepts `quad_perm:[0,1,2,3]` and the identity `dpp8` with `row_mask:0xf bank_mask:0xf`, and translates them exactly like the plain operation (any source or output modifier travels along). `quad_perm` with another order, `row_*`, `wave_*`, a partial mask, `bound_ctrl` and `fi` are refused by name. Only ops in `VEC_F`/`VEC_U` are accepted. Open question: if the census pairs mostly use cross-lane controls (for example `quad_perm:[1,0,3,2]` or `row_shr`), they stay refused. Lowering them needs lane or quad access, which fxc SM5 does not offer except through `ddx_fine`/`ddy_fine` in pixel shaders. I did not guess that. Verification: - `python3 -B tests/startup_gfx2hlsl_dpp_check.py` -> PASS (on origin/main the same test fails with `Unsupported: v_add_f32_dpp`) - `python3 -B tests/startup_gfx2hlsl_swap_check.py`, `..._op_refusals_check.py`, `..._refusals_check.py`, `..._operand_count_check.py`, `..._cndmask_neg_check.py` -> exit 0 - Not run: a Win2025 build; the change is Python only and registered as `startup_gfx2hlsl_dpp` in CMakeLists.txt. AI-assisted; commands listed were executed locally.
v_add_f32_dpp, v_sub_f32_dpp, v_or_b32_dpp and v_add_nc_u32_dpp (and the other VEC_F/VEC_U ops) translate as the plain
operation when the control is quad_perm:[0,1,2,3] or the identity dpp8 with row_mask and bank_mask 0xf. Controls that
read another lane or mask the lane are refused by name.

Co-Authored-By: Claude Sonnet 5.5 <[email protected]>
github-bot locked as GitHub sync and limited conversation to collaborators 2026-11-26 23:51:27 +00:00
github-bot closed this pull request 2026-11-26 23:51:27 +00:00
Author
Owner

@⁠chatgpt-codex-connector[bot] on GitHub · 2026-11-24 23:32 UTC · original · edited 2026-11-24 23:36 UTC

Codex Review Summary: ✅ Completed

This comment shows the latest Codex review activity on this pull request.

Review Status Commit Review trigger
📝 Code Review ✅ Completed 2026-11-24T23:36:19.532140Z 9bea878 PR opened
ℹ️ About Codex in GitHub

Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you

  • Open a pull request for review
  • Mark a draft as ready
  • Comment "@⁠codex review" or "@⁠codex security review".

Codex reacts with 👀 while any review is running, comments if it has suggestions, and reacts with 👍 once all reviews finish with no findings.

**@⁠chatgpt-codex-connector[bot]** on GitHub · 2026-11-24 23:32 UTC · [original](https://github.com/R0Y00/Xbox2Windows/pull/2038#issuecomment-7147514455) · edited 2026-11-24 23:36 UTC <!-- codex-pull-request-review-summary --> <!-- codex-review-state:v1 {"code_review":{"commit_sha":"9bea8782445487f1b5744953b338476b4523a090","has_any_findings":true,"has_unresolved_findings":true,"status":"completed"},"security_review":{"commit_sha":null,"has_any_findings":null,"has_unresolved_findings":null,"status":null}} --> <details> <summary><strong>Codex Review Summary</strong>: ✅ Completed</summary> This comment shows the latest Codex review activity on this pull request. | Review | Status | Commit | Review trigger | | --- | --- | --- | --- | | 📝 **Code Review** | ✅ **Completed** <relative-time datetime="2026-11-24T23:36:19.532140Z">2026-11-24T23:36:19.532140Z</relative-time> | `9bea878` | PR opened | <details> <summary>ℹ️ About Codex in GitHub</summary> <br/> [Your team has set up Codex to review pull requests in this repo](https://chatgpt.com/codex/cloud/settings/general). Reviews are triggered when you - Open a pull request for review - Mark a draft as ready - Comment "@⁠codex review" or "@⁠codex security review". Codex reacts with 👀 while any review is running, comments if it has suggestions, and reacts with 👍 once all reviews finish with no findings. </details> </details>
Author
Owner

@⁠chatgpt-codex-connector[bot] on GitHub · 2026-11-24 23:36 UTC · original

P1 Badge Document the new startup-translator DPP capability

This adds publicly usable DPP lowering to the startup translator, but neither README.md nor docs/experiments.md is updated. The root AGENTS.md explicitly requires updating one of those documents when a public capability changes. Add an experiment entry recording the identity-only DPP16/DPP8 scope, full-mask requirement, remaining refusals, and reproduction command/result so contributors can discover and reproduce this narrowly supported behavior without relying on the commit message.

AGENTS.md reference: AGENTS.md:L210-L211

Useful? React with 👍 / 👎.

**@⁠chatgpt-codex-connector[bot]** on GitHub · 2026-11-24 23:36 UTC · [original](https://github.com/R0Y00/Xbox2Windows/pull/2038#discussion_r4688045839) **<sub><sub>![P1 Badge](https://img.shields.io/badge/P1-orange?style=flat)</sub></sub> Document the new startup-translator DPP capability** This adds publicly usable DPP lowering to the startup translator, but neither `README.md` nor `docs/experiments.md` is updated. The root `AGENTS.md` explicitly requires updating one of those documents when a public capability changes. Add an experiment entry recording the identity-only DPP16/DPP8 scope, full-mask requirement, remaining refusals, and reproduction command/result so contributors can discover and reproduce this narrowly supported behavior without relying on the commit message. AGENTS.md reference: [AGENTS.md:L210-L211](https://github.com/R0Y00/Xbox2Windows/blob/9bea8782445487f1b5744953b338476b4523a090/AGENTS.md#L210-L211) Useful? React with 👍 / 👎. <!-- codex-code-review-finding:v1 -->
Author
Owner

@⁠denn0x on GitHub · 2026-11-25 00:55 UTC · original

I checked this against the DPP use in a private executable's pixel and vertex programs (decode only, aggregate counts):

  • 695 programs use DPP, with 19,902 DPP instructions in total.
  • None of them uses quad_perm:[0,1,2,3] or the identity dpp8.
  • Every control reads another lane:
control instructions
quad swaps [1,0,3,2], [2,3,0,1], [3,2,1,0] 8,971
quad broadcasts [0,0,0,0], [1,1,1,1], [2,2,2,2] 6,342
pair broadcasts [1,1,3,3], [0,0,2,2], [2,3,2,3], [0,1,0,1] 2,419
row_mirror / row_half_mirror 2,170
  • About 78% of them also carry bound_ctrl.
  • The ops are mostly v_add_f32, v_mov_b32, v_subrev_f32, v_mul_f32, v_or_b32 and v_min_u32 / v_max_u32.

The patch looks correct to me. Every non-identity control is refused by name, so nothing is lowered silently with the wrong lane. The test passes locally (pure Python).

One small note: with the identity control and full masks, the source lane is always in range, so bound_ctrl cannot change the result there. Refusing it is stricter than needed, but harmless.

On these programs, though, the identity form never occurs, so this PR removes no refusal there. The forms that matter are the quad broadcasts and quad swaps. They need a model of the 2x2 quad, for example derivative intrinsics or quad-read intrinsics, rather than one lane. They could be a follow-up item.

I agree with the review note that a short docs/experiments.md entry would help: the identity-only scope, the full-mask requirement, and the refusals.

**@⁠denn0x** on GitHub · 2026-11-25 00:55 UTC · [original](https://github.com/R0Y00/Xbox2Windows/pull/2038#issuecomment-7149021128) I checked this against the DPP use in a private executable's pixel and vertex programs (decode only, aggregate counts): - 695 programs use DPP, with 19,902 DPP instructions in total. - **None** of them uses `quad_perm:[0,1,2,3]` or the identity `dpp8`. - Every control reads another lane: | control | instructions | |---|---| | quad swaps `[1,0,3,2]`, `[2,3,0,1]`, `[3,2,1,0]` | 8,971 | | quad broadcasts `[0,0,0,0]`, `[1,1,1,1]`, `[2,2,2,2]` | 6,342 | | pair broadcasts `[1,1,3,3]`, `[0,0,2,2]`, `[2,3,2,3]`, `[0,1,0,1]` | 2,419 | | `row_mirror` / `row_half_mirror` | 2,170 | - About 78% of them also carry `bound_ctrl`. - The ops are mostly `v_add_f32`, `v_mov_b32`, `v_subrev_f32`, `v_mul_f32`, `v_or_b32` and `v_min_u32` / `v_max_u32`. The patch looks correct to me. Every non-identity control is refused by name, so nothing is lowered silently with the wrong lane. The test passes locally (pure Python). One small note: with the identity control and full masks, the source lane is always in range, so `bound_ctrl` cannot change the result there. Refusing it is stricter than needed, but harmless. On these programs, though, the identity form never occurs, so this PR removes no refusal there. The forms that matter are the quad broadcasts and quad swaps. They need a model of the 2x2 quad, for example derivative intrinsics or quad-read intrinsics, rather than one lane. They could be a follow-up item. I agree with the review note that a short `docs/experiments.md` entry would help: the identity-only scope, the full-mask requirement, and the refusals.
Author
Owner

@⁠tedin7 on GitHub · 2026-11-25 00:55 UTC · original

Added a Startup translator: lane-local DPP forms entry to docs/experiments.md in e5abc5f0 (on the rebased branch, pending push). It records the identity-only quad_perm/dpp8 scope, the 0xf row_mask/bank_mask requirement, the refused controls and the reproduction command python3 -B tests/startup_gfx2hlsl_dpp_check.py (PASS).

AI-assisted; commands listed were executed locally.

**@⁠tedin7** on GitHub · 2026-11-25 00:55 UTC · [original](https://github.com/R0Y00/Xbox2Windows/pull/2038#discussion_r4688719297) Added a `Startup translator: lane-local DPP forms` entry to `docs/experiments.md` in e5abc5f0 (on the rebased branch, pending push). It records the identity-only quad_perm/dpp8 scope, the 0xf row_mask/bank_mask requirement, the refused controls and the reproduction command `python3 -B tests/startup_gfx2hlsl_dpp_check.py` (PASS). AI-assisted; commands listed were executed locally.
Author
Owner

@⁠tedin7 on GitHub · 2026-11-25 11:03 UTC · original

Closing: main already lowers quad swaps and broadcasts for these DPP ops, leaving only the identity control (measured at 0 of 19,902 DPP instructions in real programs), so this PR removes no real refusal.

**@⁠tedin7** on GitHub · 2026-11-25 11:03 UTC · [original](https://github.com/R0Y00/Xbox2Windows/pull/2038#issuecomment-7160535409) Closing: `main` already lowers quad swaps and broadcasts for these DPP ops, leaving only the identity control (measured at 0 of 19,902 DPP instructions in real programs), so this PR removes no real refusal.
Author
Owner

@⁠chatgpt-codex-connector[bot] on GitHub · 2026-11-24 23:36 UTC · original · reviewed

💡 Codex Review

Here are some automated review suggestions for this pull request.

Reviewed commit: 9bea878244

ℹ️ About Codex in GitHub

Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you

  • Open a pull request for review
  • Mark a draft as ready
  • Comment "@⁠codex review".

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".

**@⁠chatgpt-codex-connector[bot]** on GitHub · 2026-11-24 23:36 UTC · [original](https://github.com/R0Y00/Xbox2Windows/pull/2038#pullrequestreview-6049145606) · **reviewed** <!-- codex-review-receipt:v1 --> ### 💡 Codex Review Here are some automated review suggestions for this pull request. **Reviewed commit:** `9bea878244` <details> <summary>ℹ️ About Codex in GitHub</summary> <br/> [Your team has set up Codex to review pull requests in this repo](https://chatgpt.com/codex/cloud/settings/general). Reviews are triggered when you - Open a pull request for review - Mark a draft as ready - Comment "@⁠codex review". 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". </details>

Pull request closed

This discussion has been locked. Commenting is limited to contributors.
No description provided.