shader: lower v_add_co_ci_u32 in gfx2hlsl (Part of #1723) #2033

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

@⁠tedin7 on GitHub · 2026-11-24 23:30 UTC · original
tedin7:x2w-r20-v-add-co-ci → main · +209 −0 · 4 files · 2 commits · closed without merging

Part of #1723

What this unblocks: Run 20 census #19 (38 shader pairs) refused for v_add_co_ci_u32.

v_add_co_ci_u32 (e32 and e64) was refused as an unknown instruction. It now lowers to a + b + (carry_in & 1) and writes the carry out (bit 0) to vcc or an SGPR mask. A carry in from an SGPR that is not a known mask, source modifiers, and an exec destination stay refused. Under an unknown exec the write and the carry are guarded by exec. New test startup_gfx2hlsl_add_co_ci_check.py, registered as startup_gfx2hlsl_add_co_ci in CMakeLists.txt.

Verification:

  • python3 -B tests/startup_gfx2hlsl_add_co_ci_check.py -> PASS (on origin/main the same test fails with Unsupported: v_add_co_ci_u32)
  • for t in tests/startup_gfx2hlsl_*_check.py; do python3 -B $t; done -> no failures
  • Not run: a Win2025 build; the change is Python only.

AI-assisted; commands listed were executed locally.

**@⁠tedin7** on GitHub · 2026-11-24 23:30 UTC · [original](https://github.com/R0Y00/Xbox2Windows/pull/2033) `tedin7:x2w-r20-v-add-co-ci` → `main` · +209 −0 · 4 files · 2 commits · closed without merging Part of #1723 What this unblocks: Run 20 census #19 (38 shader pairs) refused for `v_add_co_ci_u32`. `v_add_co_ci_u32` (e32 and e64) was refused as an unknown instruction. It now lowers to `a + b + (carry_in & 1)` and writes the carry out (bit 0) to `vcc` or an SGPR mask. A carry in from an SGPR that is not a known mask, source modifiers, and an exec destination stay refused. Under an unknown exec the write and the carry are guarded by exec. New test `startup_gfx2hlsl_add_co_ci_check.py`, registered as `startup_gfx2hlsl_add_co_ci` in CMakeLists.txt. Verification: - `python3 -B tests/startup_gfx2hlsl_add_co_ci_check.py` -> PASS (on origin/main the same test fails with `Unsupported: v_add_co_ci_u32`) - `for t in tests/startup_gfx2hlsl_*_check.py; do python3 -B $t; done` -> no failures - Not run: a Win2025 build; the change is Python only. AI-assisted; commands listed were executed locally.
github-bot locked as GitHub sync and limited conversation to collaborators 2026-11-26 23:51:06 +00:00
github-bot closed this pull request 2026-11-26 23:51:06 +00:00
Author
Owner

@⁠chatgpt-codex-connector[bot] on GitHub · 2026-11-24 23:31 UTC · original · edited 2026-11-24 23:37 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:37:35.526398Z 0b62bd2 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:31 UTC · [original](https://github.com/R0Y00/Xbox2Windows/pull/2033#issuecomment-7147488569) · edited 2026-11-24 23:37 UTC <!-- codex-pull-request-review-summary --> <!-- codex-review-state:v1 {"code_review":{"commit_sha":"0b62bd2cd33b2327612a15107ac71af6c1f662b2","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:37:35.526398Z">2026-11-24T23:37:35.526398Z</relative-time> | `0b62bd2` | 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>
@ -2476,1 +2476,4 @@
set_tests_properties(startup_gfx2hlsl_neg_operand PROPERTIES TIMEOUT 60)
# v_add_co_ci_u32: add with carry in and out (#1723).
add_test(NAME startup_gfx2hlsl_add_co_ci COMMAND "${INTAKE_PYTHON}" -B
"${CMAKE_CURRENT_SOURCE_DIR}/tests/startup_gfx2hlsl_add_co_ci_check.py")
Author
Owner

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

P1 Badge Document the new startup carry-in experiment

This adds a public startup-translator capability and a new reproduction command, but neither README.md nor docs/experiments.md was updated. Searching those documents finds carry-in coverage for pixel_aot, not this new startup check. AGENTS.md requires a documentation update when capabilities or reproduction commands change; record the supported e32/e64 forms, remaining refusals and exact Python/CTest command alongside the other startup experiments.

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

Useful? React with 👍 / 👎.

**@⁠chatgpt-codex-connector[bot]** on GitHub · 2026-11-24 23:37 UTC · [original](https://github.com/R0Y00/Xbox2Windows/pull/2033#discussion_r4688058320) **<sub><sub>![P1 Badge](https://img.shields.io/badge/P1-orange?style=flat)</sub></sub> Document the new startup carry-in experiment** This adds a public startup-translator capability and a new reproduction command, but neither `README.md` nor `docs/experiments.md` was updated. Searching those documents finds carry-in coverage for `pixel_aot`, not this new startup check. `AGENTS.md` requires a documentation update when capabilities or reproduction commands change; record the supported e32/e64 forms, remaining refusals and exact Python/CTest command alongside the other startup experiments. AGENTS.md reference: [AGENTS.md:L210-L211](https://github.com/R0Y00/Xbox2Windows/blob/0b62bd2cd33b2327612a15107ac71af6c1f662b2/AGENTS.md#L210-L211) Useful? React with 👍 / 👎. <!-- codex-code-review-finding:v1 -->
Author
Owner

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

P2 Badge Refuse lane-mask registers as numeric addends

When a numeric addend is vcc, exec or an SGPR holding a lane mask, u() returns the translator's per-lane 0/1 projection rather than the full 32-bit register word. For example, after s_mov_b32 vcc_lo, -1, the valid gfx1013 instruction v_add_co_ci_u32_e32 v5, vcc_lo, vcc_lo, v2, vcc_lo with v2 = 0 must produce v5 = 0 with carry 1, but the emitted HLSL uses ca = 1 and produces v5 = 2 with carry 0. This changes a previously refused input into silently incorrect arithmetic. Reject lane-mask registers in these two numeric-source positions unless their full word is represented separately.

Useful? React with 👍 / 👎.

**@⁠chatgpt-codex-connector[bot]** on GitHub · 2026-11-24 23:37 UTC · [original](https://github.com/R0Y00/Xbox2Windows/pull/2033#discussion_r4688058330) **<sub><sub>![P2 Badge](https://img.shields.io/badge/P2-yellow?style=flat)</sub></sub> Refuse lane-mask registers as numeric addends** When a numeric addend is `vcc`, `exec` or an SGPR holding a lane mask, `u()` returns the translator's per-lane 0/1 projection rather than the full 32-bit register word. For example, after `s_mov_b32 vcc_lo, -1`, the valid gfx1013 instruction `v_add_co_ci_u32_e32 v5, vcc_lo, vcc_lo, v2, vcc_lo` with `v2 = 0` must produce `v5 = 0` with carry 1, but the emitted HLSL uses `ca = 1` and produces `v5 = 2` with carry 0. This changes a previously refused input into silently incorrect arithmetic. Reject lane-mask registers in these two numeric-source positions unless their full word is represented separately. Useful? React with 👍 / 👎. <!-- codex-code-review-finding:v1 -->
@ -2476,1 +2476,4 @@
set_tests_properties(startup_gfx2hlsl_neg_operand PROPERTIES TIMEOUT 60)
# v_add_co_ci_u32: add with carry in and out (#1723).
add_test(NAME startup_gfx2hlsl_add_co_ci COMMAND "${INTAKE_PYTHON}" -B
"${CMAKE_CURRENT_SOURCE_DIR}/tests/startup_gfx2hlsl_add_co_ci_check.py")
Author
Owner

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

Fixed in 39c36020: new "Add with carry in and out" paragraph in docs/experiments.md (e32/e64 forms, refusals, exact Python and CTest commands). Commit lands with the next rebased push.

**@⁠tedin7** on GitHub · 2026-11-25 00:55 UTC · [original](https://github.com/R0Y00/Xbox2Windows/pull/2033#discussion_r4688719251) Fixed in 39c36020: new "Add with carry in and out" paragraph in docs/experiments.md (e32/e64 forms, refusals, exact Python and CTest commands). Commit lands with the next rebased push.
Author
Owner

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

Fixed in 39c36020: vcc, exec and known mask SGPRs are now refused as numeric sources; four new refusal cases added to startup_gfx2hlsl_add_co_ci_check.py (all PASS). Commit lands with the next rebased push.

**@⁠tedin7** on GitHub · 2026-11-25 00:55 UTC · [original](https://github.com/R0Y00/Xbox2Windows/pull/2033#discussion_r4688719449) Fixed in 39c36020: vcc, exec and known mask SGPRs are now refused as numeric sources; four new refusal cases added to startup_gfx2hlsl_add_co_ci_check.py (all PASS). Commit lands with the next rebased push.
Author
Owner

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

Closing this PR for now to keep the Windows test queue short. Nothing is wrong with it and the branch stays as it is.

We will reopen it once the queue is clear, re-run the Win2025 WARP checks at its head, and post the result here.

AI-assisted; commands listed were executed locally.

**@⁠tedin7** on GitHub · 2026-11-25 13:51 UTC · [original](https://github.com/R0Y00/Xbox2Windows/pull/2033#issuecomment-7164400014) Closing this PR for now to keep the Windows test queue short. Nothing is wrong with it and the branch stays as it is. We will reopen it once the queue is clear, re-run the Win2025 WARP checks at its head, and post the result here. AI-assisted; commands listed were executed locally.
Author
Owner

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

💡 Codex Review

Here are some automated review suggestions for this pull request.

Reviewed commit: 0b62bd2cd3

ℹ️ 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:37 UTC · [original](https://github.com/R0Y00/Xbox2Windows/pull/2033#pullrequestreview-6049160716) · **reviewed** <!-- codex-review-receipt:v1 --> ### 💡 Codex Review Here are some automated review suggestions for this pull request. **Reviewed commit:** `0b62bd2cd3` <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.