shader: lower s_bitcmp0_b32 and s_bitcmp1_b32 in gfx2hlsl (Part of #1723) #2024

Manually merged
github merged 2 commits from gh-pr/2024/head into gh-pr/2024/base 2026-11-26 23:50:30 +00:00
Owner

@⁠tedin7 on GitHub · 2026-11-24 23:26 UTC · original
tedin7:x2w-r20-s-bitcmp → main · +101 −5 · 4 files · 2 commits · merged 2026-11-24 23:50 UTC

Part of #1723

What this unblocks: Run 20 census #1 (128/114 pairs).

Lowers s_bitcmp1_b32 and s_bitcmp0_b32 (SOPC) in tools/startup/gfx2hlsl.py: SCC is set to the tested bit of S0, selected by S1[4:0], being 1 or 0. Nothing else is written.

Verification:

  • python3 -B tests/startup_gfx2hlsl_s_bitcmp_check.py on the branch: s_bitcmp: ok (216 cases: 6 words x 9 bit indexes x immediate and register forms x both ops, including indexes above 31).
  • Same test against origin/main sources: 216 mismatches (every case refused as Unsupported).
  • Existing checks still pass: startup_gfx2hlsl_swap_check.py, startup_gfx2hlsl_sdwa_check.py, startup_gfx2hlsl_operand_count_check.py, startup_gfx2hlsl_op_refusals_check.py.
  • Test registered in CMakeLists.txt as startup_gfx2hlsl_s_bitcmp.
  • Win2025 run: not executed here (Linux worker); the check is pure Python.

AI-assisted; commands listed were executed locally.

**@⁠tedin7** on GitHub · 2026-11-24 23:26 UTC · [original](https://github.com/R0Y00/Xbox2Windows/pull/2024) `tedin7:x2w-r20-s-bitcmp` → `main` · +101 −5 · 4 files · 2 commits · merged 2026-11-24 23:50 UTC Part of #1723 What this unblocks: Run 20 census #1 (128/114 pairs). Lowers `s_bitcmp1_b32` and `s_bitcmp0_b32` (SOPC) in `tools/startup/gfx2hlsl.py`: SCC is set to the tested bit of S0, selected by S1[4:0], being 1 or 0. Nothing else is written. Verification: - `python3 -B tests/startup_gfx2hlsl_s_bitcmp_check.py` on the branch: `s_bitcmp: ok` (216 cases: 6 words x 9 bit indexes x immediate and register forms x both ops, including indexes above 31). - Same test against `origin/main` sources: `216 mismatches` (every case refused as `Unsupported`). - Existing checks still pass: `startup_gfx2hlsl_swap_check.py`, `startup_gfx2hlsl_sdwa_check.py`, `startup_gfx2hlsl_operand_count_check.py`, `startup_gfx2hlsl_op_refusals_check.py`. - Test registered in CMakeLists.txt as `startup_gfx2hlsl_s_bitcmp`. - Win2025 run: not executed here (Linux worker); the check is pure Python. AI-assisted; commands listed were executed locally.
github-bot locked as GitHub sync and limited conversation to collaborators 2026-11-26 23:50:28 +00:00
github manually merged commit ca1ed1a990 into gh-pr/2024/base 2026-11-26 23:50:30 +00:00
Author
Owner

@⁠chatgpt-codex-connector[bot] on GitHub · 2026-11-24 23:27 UTC · original · edited 2026-11-24 23:30 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:30:48.543393Z 7ea4990 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:27 UTC · [original](https://github.com/R0Y00/Xbox2Windows/pull/2024#issuecomment-7147413005) · edited 2026-11-24 23:30 UTC <!-- codex-pull-request-review-summary --> <!-- codex-review-state:v1 {"code_review":{"commit_sha":"7ea4990831a4023f1afb13b33fc841a8788d21eb","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:30:48.543393Z">2026-11-24T23:30:48.543393Z</relative-time> | `7ea4990` | 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>
@ -1751,0 +1757,4 @@
raise Unsupported('scalar bit test requires two unmodified operands')
if any(self.is_lane_mask(tok) for tok in ops):
raise Unsupported('scalar bit test on a lane mask')
self.emit('scc = ((%s >> (%s & 31)) & 1u) == %du;' % (self.u(ops[0]), self.u(ops[1]), bit))
Author
Owner

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

P1 Badge Reject wave-mask operands before lowering scalar bit tests

When a source is exec_lo, vcc_lo, or an SGPR tracked in self.masks, self.u() returns the current lane's projected 0/1 bit rather than the full 32-bit mask. For a fully active wave, s_bitcmp1_b32 exec_lo, 1 should set SCC, but the emitted expression evaluates to false because the generated exec starts at 1; copying EXEC to an SGPR has the same problem. A subsequent SCC branch or scalar select therefore takes the wrong path, whereas this program was previously refused. Reject lane-mask sources, as the existing word-level scalar handlers do, unless their full mask value can be modeled.

Useful? React with 👍 / 👎.

**@⁠chatgpt-codex-connector[bot]** on GitHub · 2026-11-24 23:30 UTC · [original](https://github.com/R0Y00/Xbox2Windows/pull/2024#discussion_r4687989684) **<sub><sub>![P1 Badge](https://img.shields.io/badge/P1-orange?style=flat)</sub></sub> Reject wave-mask operands before lowering scalar bit tests** When a source is `exec_lo`, `vcc_lo`, or an SGPR tracked in `self.masks`, `self.u()` returns the current lane's projected 0/1 bit rather than the full 32-bit mask. For a fully active wave, `s_bitcmp1_b32 exec_lo, 1` should set SCC, but the emitted expression evaluates to false because the generated `exec` starts at 1; copying EXEC to an SGPR has the same problem. A subsequent SCC branch or scalar select therefore takes the wrong path, whereas this program was previously refused. Reject lane-mask sources, as the existing word-level scalar handlers do, unless their full mask value can be modeled. Useful? React with 👍 / 👎. <!-- codex-code-review-finding:v1 -->
Author
Owner

@⁠R0Y00 on GitHub · 2026-11-24 23:43 UTC · original

I pushed a maintainer follow-up for the existing lane-mask finding. It reuses the integer word mask guard, checks direct EXEC/VCC and mask-tagged SGPRs in both operand positions, and documents the CPU-only test. On Windows the 216 scalar cases and 10 refusal controls passed, along with five existing translator checks and docs links. Full-mask SCC remains outside this patch.

**@⁠R0Y00** on GitHub · 2026-11-24 23:43 UTC · [original](https://github.com/R0Y00/Xbox2Windows/pull/2024#issuecomment-7147718106) I pushed a maintainer follow-up for the existing lane-mask finding. It reuses the integer word mask guard, checks direct EXEC/VCC and mask-tagged SGPRs in both operand positions, and documents the CPU-only test. On Windows the 216 scalar cases and 10 refusal controls passed, along with five existing translator checks and docs links. Full-mask SCC remains outside this patch.
Author
Owner

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

💡 Codex Review

Here are some automated review suggestions for this pull request.

Reviewed commit: 7ea4990831

ℹ️ 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:30 UTC · [original](https://github.com/R0Y00/Xbox2Windows/pull/2024#pullrequestreview-6049082888) · **reviewed** <!-- codex-review-receipt:v1 --> ### 💡 Codex Review Here are some automated review suggestions for this pull request. **Reviewed commit:** `7ea4990831` <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>
This discussion has been locked. Commenting is limited to contributors.
No description provided.