startup: treat wave32 vcc_hi as an ordinary scalar register in gfx2hlsl (Part of #1723) #2703

Manually merged
github merged 9 commits from gh-pr/2703/head into gh-pr/2703/base 2026-11-27 01:16:36 +00:00
Owner

@⁠tedin7 on GitHub · 2026-11-26 02:48 UTC · original
tedin7:x2w-vcchi-lowering → main · +332 −1 · 4 files · 9 commits · merged 2026-11-26 06:32 UTC

Part of #1723

What this unblocks: pixel and vertex programs that use vcc_hi as a compare or carry-out destination, a lane-mask source, or a scalar register now translate (wave32) instead of being refused, while the wave64 reading stays refused.

Builds on #2698, which turned the scalar vcc_hi / exec_hi destination crashes into refusals. Those guards stay as they are; this PR adds the lowering they leave open.

What changed

In wave32 only vcc_lo is the condition mask; vcc_hi is a free scalar register that compilers allocate like any other (RDNA 2 ISA, "VCC"). wave32_vcc_hi renames vcc_hi to an SGPR the program never names (taken from the top of s105 downwards) when that is exact in both wave sizes:

  • no instruction names the 64-bit pair vcc, and
  • a vector compare or carry-out writes vcc_hi or an odd SGPR as its mask (a misaligned pair in wave64, so the program is wave32), or no vector instruction writes vcc_lo (in wave64 that write would also set vcc_hi), and
  • the program has no s_movrel* that could reach the chosen register.

The second commit keeps vcc_hi refused when a possibly-wave64 program reads VCC as a mask. Applied to vs and ps stages only.

What stays refused

Everything not proven wave32 (the pair vcc, a vector write of vcc_lo with no wave32 proof, s_movrel*), exec_hi, and scalar writes into vcc_lo/exec_hi keep the refusals of #2698 (<op> destination vcc_hi).

Tests

tests/startup_gfx2hlsl_vcc_hi_check.py (registered in CMakeLists.txt, noted in docs/startup-runtime.md): translation controls, mutation controls (compare bit not read, carry lost, vcc_hi read as zero), binary mode (fixture words assemble to the recorded words), and a draw mode with a CPU reference for the pixel readback. On origin/main the controls fail (PS translates, SCALAR_ONLY translates); with the change they pass. The refusal expectations match the text #2698 produces.

Verification

  • python3 -B tests/startup_gfx2hlsl_vcc_hi_check.py: PASS (fails on origin/main)
  • python3 -B tests/startup_gfx2hlsl_vcc_hi_check.py binary llvm-mc-19: PASS
  • All tests/startup_gfx2hlsl_*_check.py run with no arguments on this branch and on origin/main: same result per script (export_null_draw and mul24_align_draw need a compiler and renderer and exit 1 on both); the only new script is vcc_hi_check.
  • Win2025 on the exact head 0caf9c9e (default 5-slot pool), python3 x2w_pipe.py win2025 2703 --regex '^startup_gfx2hlsl_vcc_hi': dev 3/3 and release 3/3 passed (startup_gfx2hlsl_vcc_hi_controls, startup_gfx2hlsl_vcc_hi_warp, startup_gfx2hlsl_vcc_hi_hardware). The draw reads back 16 x 16 pixels of a vcc_hi compare, carry and scalar use against the CPU reference; the mutation controls (compare bit dropped, carry lost, vcc_hi read as zero) fail the draw, and the controls keep the wave64 readings refused (a VALU vcc_lo write or mask read with no wave32 proof, the 64-bit vcc pair, exec_hi).
  • An independent check with compiler-built pixel shaders (wave64 ballot high word, 64-bit carry, two live compares) found no wave64 program that now translates with a wrong vcc_hi: the ballot high word stays refused with operand 'vcc_hi'.
  • Commands to paste: cmake --build --preset dev --target offscreen_check then ctest --preset dev --no-tests=error -R '^startup_gfx2hlsl_vcc_hi' -V.

AI-assisted; commands listed were executed locally.

**@⁠tedin7** on GitHub · 2026-11-26 02:48 UTC · [original](https://github.com/R0Y00/Xbox2Windows/pull/2703) `tedin7:x2w-vcchi-lowering` → `main` · +332 −1 · 4 files · 9 commits · merged 2026-11-26 06:32 UTC Part of #1723 What this unblocks: pixel and vertex programs that use `vcc_hi` as a compare or carry-out destination, a lane-mask source, or a scalar register now translate (wave32) instead of being refused, while the wave64 reading stays refused. Builds on #2698, which turned the scalar `vcc_hi` / `exec_hi` destination crashes into refusals. Those guards stay as they are; this PR adds the lowering they leave open. ## What changed In wave32 only `vcc_lo` is the condition mask; `vcc_hi` is a free scalar register that compilers allocate like any other (RDNA 2 ISA, "VCC"). `wave32_vcc_hi` renames `vcc_hi` to an SGPR the program never names (taken from the top of s105 downwards) when that is exact in both wave sizes: - no instruction names the 64-bit pair `vcc`, and - a vector compare or carry-out writes `vcc_hi` or an odd SGPR as its mask (a misaligned pair in wave64, so the program is wave32), or no vector instruction writes `vcc_lo` (in wave64 that write would also set `vcc_hi`), and - the program has no `s_movrel*` that could reach the chosen register. The second commit keeps `vcc_hi` refused when a possibly-wave64 program reads VCC as a mask. Applied to `vs` and `ps` stages only. ## What stays refused Everything not proven wave32 (the pair `vcc`, a vector write of `vcc_lo` with no wave32 proof, `s_movrel*`), `exec_hi`, and scalar writes into `vcc_lo`/`exec_hi` keep the refusals of #2698 (`<op> destination vcc_hi`). ## Tests `tests/startup_gfx2hlsl_vcc_hi_check.py` (registered in `CMakeLists.txt`, noted in `docs/startup-runtime.md`): translation controls, mutation controls (compare bit not read, carry lost, `vcc_hi` read as zero), `binary` mode (fixture words assemble to the recorded words), and a `draw` mode with a CPU reference for the pixel readback. On `origin/main` the controls fail (`PS translates`, `SCALAR_ONLY translates`); with the change they pass. The refusal expectations match the text #2698 produces. ## Verification - `python3 -B tests/startup_gfx2hlsl_vcc_hi_check.py`: PASS (fails on `origin/main`) - `python3 -B tests/startup_gfx2hlsl_vcc_hi_check.py binary llvm-mc-19`: PASS - All `tests/startup_gfx2hlsl_*_check.py` run with no arguments on this branch and on `origin/main`: same result per script (`export_null_draw` and `mul24_align_draw` need a compiler and renderer and exit 1 on both); the only new script is `vcc_hi_check`. - Win2025 on the exact head 0caf9c9e (default 5-slot pool), `python3 x2w_pipe.py win2025 2703 --regex '^startup_gfx2hlsl_vcc_hi'`: dev 3/3 and release 3/3 passed (`startup_gfx2hlsl_vcc_hi_controls`, `startup_gfx2hlsl_vcc_hi_warp`, `startup_gfx2hlsl_vcc_hi_hardware`). The draw reads back 16 x 16 pixels of a `vcc_hi` compare, carry and scalar use against the CPU reference; the mutation controls (compare bit dropped, carry lost, `vcc_hi` read as zero) fail the draw, and the controls keep the wave64 readings refused (a VALU `vcc_lo` write or mask read with no wave32 proof, the 64-bit `vcc` pair, `exec_hi`). - An independent check with compiler-built pixel shaders (wave64 ballot high word, 64-bit carry, two live compares) found no wave64 program that now translates with a wrong `vcc_hi`: the ballot high word stays refused with `operand 'vcc_hi'`. - Commands to paste: `cmake --build --preset dev --target offscreen_check` then `ctest --preset dev --no-tests=error -R '^startup_gfx2hlsl_vcc_hi' -V`. AI-assisted; commands listed were executed locally.
Symptom: vcc_hi as a compare or carry-out destination was refused
("v_cmp_gt_u32 into vcc_hi", "v_add_co_u32 carry-out destination vcc_hi"),
as a source refused ("operand 'vcc_hi'"), and a scalar write into vcc_hi or
exec_hi (s_mov_b32, s_add_u32, s_lshl_b32, s_bfm_b32 and 30 more forms)
crashed the translator with "TypeError: 'NoneType' object is not
subscriptable" instead of a refusal.

Root cause: the translator models SGPRs by number and had no number for
vcc_hi; in wave32, vcc_hi is not part of the mask and compilers allocate it
like any other scalar register.

Change: wave32_vcc_hi renames vcc_hi to an SGPR the program never names
(from the top of s0..s105) when that is exact in both wave sizes: no
instruction names the 64-bit pair vcc, and either a VALU compare/carry
writes vcc_hi or an odd SGPR, a VOP3 mask source reads one (a misaligned
pair in wave64, so the program is wave32), or no VALU instruction writes
vcc_lo (in wave64 that write also sets vcc_hi). s_movrel* programs keep the
old behaviour. Scalar destinations that are not an SGPR number (vcc_hi,
exec_hi) are now refused by name in scalar() and op_s_bfm_b32.

Test: tests/startup_gfx2hlsl_vcc_hi_check.py (controls fail before: PS
refused, three fixtures crash with TypeError). Win2025 WARP dev and release,
DXC and FXC: 256/256 pixels match the CPU reference for the compare, carry
and scalar uses; the three mutations (compare bit, carry, vcc_hi read as
zero) fail.

(cherry picked from commit 9f26fbdca247ebbc0d235eba508f39ef50e4a49f)
(cherry picked from commit 604867c925c47297297aebccb57c990b646edc7c)
Symptom (independent review of 9f26fbdca): s_mov_b32 vcc_lo, 0 /
s_mov_b32 vcc_hi, -1 / v_cndmask_b32_e32 v1, 1.0, v2, vcc_lo translated with
vcc_hi renamed to a plain SGPR. In wave64 lanes 32..63 read their mask bit
from vcc_hi (2.0 there), which the rename does not model.

Root cause: without a wave32 proof the rename only checked VALU writes of
vcc_lo, not VALU mask reads (v_cndmask_b32_e32, carry-in, v_div_fmas) or
s_cbranch_vccz/vccnz, which in wave64 read vcc_hi for the high lanes.

Change: without a wave32 proof, any VALU instruction naming vcc_lo, any
v_div_fmas and any vcc branch keep vcc_hi refused.

Test: startup_gfx2hlsl_vcc_hi_check.py fixture MASK_READ (the reviewer's
sequence): translated before, refused after.

(cherry picked from commit fe818614103f70ef01110b08c423c86b040eb048)
(cherry picked from commit 15c4e2302dd8b573cac596ecc240b5fb8872f28c)
The FXC (ps_5_1) WARP draw of startup_gfx2hlsl_vcc_hi read 0 where the
reference had the word 1, for the v_cndmask 1/2 select and for the carry
word: a value that can only be 0 or 1, exported as a denormal float, came
back 0 under FXC while DXC kept it. The same carry drawn as a 1.0/2.0
select matched under FXC with both carry spellings, so the translation is
right and the export word was the problem. The select now picks 1.0/2.0
and the carry rides on v0 + 0x40000000.

Win2025 WARP dev and release, DXC and FXC: 256/256 pixels match, the three
mutations fail.

(cherry picked from commit 1fe911bc57aafea5110795686d1af59dc69011f6)
(cherry picked from commit eea62afd68a1809bd7e5f7bac6a0888b2f17e34d)
s_load_dwordx4 s[104:107] writes SGPR 107 (vcc_hi), so no free alias exists. A VOP3 mask source that reads vcc_hi after a scalar write holds a whole word, not the lane bit.
github-bot locked as GitHub sync and limited conversation to collaborators 2026-11-27 01:16:34 +00:00
github manually merged commit 5d35eca430 into gh-pr/2703/base 2026-11-27 01:16:36 +00:00
Author
Owner

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

Ready for review, @⁠MasterDomino.

Win2025 on head 0caf9c9e (default slots): dev 3/3 and release 3/3 passed (startup_gfx2hlsl_vcc_hi_controls, _warp, _hardware), including the pixel readback of the wave32 vcc_hi path and the wave64 refusal controls. I merged current main into the branch twice (one blank-line conflict next to the wave32_vcc_hi call; no code change). Details are in the PR body.

AI-assisted; commands listed were executed locally.

**@⁠tedin7** on GitHub · 2026-11-26 03:07 UTC · [original](https://github.com/R0Y00/Xbox2Windows/pull/2703#issuecomment-7181415969) Ready for review, @⁠MasterDomino. Win2025 on head 0caf9c9e (default slots): dev 3/3 and release 3/3 passed (`startup_gfx2hlsl_vcc_hi_controls`, `_warp`, `_hardware`), including the pixel readback of the wave32 `vcc_hi` path and the wave64 refusal controls. I merged current main into the branch twice (one blank-line conflict next to the `wave32_vcc_hi` call; no code change). Details are in the PR body. AI-assisted; commands listed were executed locally.
Author
Owner

@⁠chatgpt-codex-connector[bot] on GitHub · 2026-11-26 03:07 UTC · original · edited 2026-11-26 03:12 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-26T03:12:03.303433Z 0caf9c9 Draft marked ready
ℹ️ 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-26 03:07 UTC · [original](https://github.com/R0Y00/Xbox2Windows/pull/2703#issuecomment-7181417750) · edited 2026-11-26 03:12 UTC <!-- codex-pull-request-review-summary --> <!-- codex-review-state:v1 {"code_review":{"commit_sha":"0caf9c9e0c9ea046f8a73d14a255f9390e7296e2","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-26T03:12:03.303433Z">2026-11-26T03:12:03.303433Z</relative-time> | `0caf9c9` | Draft marked ready | <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-26 03:12 UTC · original · reviewed

💡 Codex Review

Here are some automated review suggestions for this pull request.

Reviewed commit: 0caf9c9e0c

ℹ️ 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-26 03:12 UTC · [original](https://github.com/R0Y00/Xbox2Windows/pull/2703#pullrequestreview-6068046276) · **reviewed** <!-- codex-review-receipt:v1 --> ### 💡 Codex Review Here are some automated review suggestions for this pull request. **Reviewed commit:** `0caf9c9e0c` <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>
@ -1016,0 +1084,4 @@
free = next((n for n in range(105, 63, -1) if n not in named), None)
if free is None:
return ins
return [(off, n, name, re.sub(r'\bvcc_hi\b', 's%d' % free, asm)) for off, n, name, asm in ins]
Author
Owner

@⁠chatgpt-codex-connector[bot] on GitHub · 2026-11-26 03:12 UTC · original

P1 Badge Preserve the s107 alias when renaming vcc_hi

With a descriptor load into s[104:107] (already supported by op_s_load_dwordx4), this rewrite moves explicit vcc_hi accesses to another register but leaves the load targeting s107, which aliases vcc_hi. A synthetic bytecode fixture that initializes vcc_hi to 0x1234, performs that load, waits, and then reads vcc_hi now generates v0 = 0x00001234u, although the source reads the fourth loaded word. This newly accepts a previously refused shader with stale-register output. Preserve the range alias too, or refuse overlapping loads before renaming.

Useful? React with 👍 / 👎.

**@⁠chatgpt-codex-connector[bot]** on GitHub · 2026-11-26 03:12 UTC · [original](https://github.com/R0Y00/Xbox2Windows/pull/2703#discussion_r4703472112) **<sub><sub>![P1 Badge](https://img.shields.io/badge/P1-orange?style=flat)</sub></sub> Preserve the s107 alias when renaming vcc_hi** With a descriptor load into `s[104:107]` (already supported by `op_s_load_dwordx4`), this rewrite moves explicit `vcc_hi` accesses to another register but leaves the load targeting `s107`, which aliases `vcc_hi`. A synthetic bytecode fixture that initializes `vcc_hi` to `0x1234`, performs that load, waits, and then reads `vcc_hi` now generates `v0 = 0x00001234u`, although the source reads the fourth loaded word. This newly accepts a previously refused shader with stale-register output. Preserve the range alias too, or refuse overlapping loads before renaming. Useful? React with 👍 / 👎. <!-- codex-code-review-finding:v1 -->
@ -1016,0 +1063,4 @@
masks.append(ops[1])
if name in ('v_cndmask_b32_e64', 'v_add_co_ci_u32_e64', 'v_sub_co_ci_u32_e64', 'v_subrev_co_ci_u32_e64') \
and ops[-1] != 'vcc_lo':
masks.append(ops[-1]) # a lane-mask source is a pair in wave64 too: vcc_hi or an odd SGPR proves wave32
Author
Owner

@⁠chatgpt-codex-connector[bot] on GitHub · 2026-11-26 03:12 UTC · original

P1 Badge Require a per-lane representation for vcc_hi mask sources

When vcc_hi is scalar-written and then used as an explicit select mask, this establishes wave32 but does not establish that the renamed SGPR contains the current lane's bit. For s_mov_b32 vcc_hi, 0x55555555 followed by v_cndmask_b32_e64 v2, 1.0, 2.0, vcc_hi, the emitted HLSL tests (0x55555555u & 1), so every lane selects 2.0, although odd lanes must select 1.0. This shader was previously refused. Require a tracked per-lane mask or an all-zero/all-one constant, or implement lane-bit extraction for full-word mask sources before allowing this lowering.

Useful? React with 👍 / 👎.

**@⁠chatgpt-codex-connector[bot]** on GitHub · 2026-11-26 03:12 UTC · [original](https://github.com/R0Y00/Xbox2Windows/pull/2703#discussion_r4703472119) **<sub><sub>![P1 Badge](https://img.shields.io/badge/P1-orange?style=flat)</sub></sub> Require a per-lane representation for vcc_hi mask sources** When `vcc_hi` is scalar-written and then used as an explicit select mask, this establishes wave32 but does not establish that the renamed SGPR contains the current lane's bit. For `s_mov_b32 vcc_hi, 0x55555555` followed by `v_cndmask_b32_e64 v2, 1.0, 2.0, vcc_hi`, the emitted HLSL tests `(0x55555555u & 1)`, so every lane selects `2.0`, although odd lanes must select `1.0`. This shader was previously refused. Require a tracked per-lane mask or an all-zero/all-one constant, or implement lane-bit extraction for full-word mask sources before allowing this lowering. Useful? React with 👍 / 👎. <!-- codex-code-review-finding:v1 -->
@ -1016,0 +1084,4 @@
free = next((n for n in range(105, 63, -1) if n not in named), None)
if free is None:
return ins
return [(off, n, name, re.sub(r'\bvcc_hi\b', 's%d' % free, asm)) for off, n, name, asm in ins]
Author
Owner

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

Confirmed and fixed in 5d283a63e. A wide operand that covers SGPR 107 (such as s_load_dwordx4 s[104:107]) writes vcc_hi, so there is no free register to rename it to. wave32_vcc_hi now returns the instructions unchanged (vcc_hi stays refused by name) when any register range covers s107.

Test: startup_gfx2hlsl_vcc_hi_check.py, "a load into s[104:107] keeps vcc_hi refused" (fails on the previous head, passes now).

Commands run:

  • python3 tests/startup_gfx2hlsl_vcc_hi_check.py and ... binary llvm-mc-19
  • all tests/startup_gfx2hlsl_* scripts (same exit codes as before)
  • Windows (WARP) on 5d283a63e: ctest --preset dev|release -R startup_gfx2hlsl_vcc_hi 3/3 on both presets

AI-assisted; commands listed were executed locally.

**@⁠tedin7** on GitHub · 2026-11-26 03:47 UTC · [original](https://github.com/R0Y00/Xbox2Windows/pull/2703#discussion_r4703668019) Confirmed and fixed in `5d283a63e`. A wide operand that covers SGPR 107 (such as `s_load_dwordx4 s[104:107]`) writes vcc_hi, so there is no free register to rename it to. `wave32_vcc_hi` now returns the instructions unchanged (vcc_hi stays refused by name) when any register range covers s107. Test: `startup_gfx2hlsl_vcc_hi_check.py`, "a load into s[104:107] keeps vcc_hi refused" (fails on the previous head, passes now). Commands run: - `python3 tests/startup_gfx2hlsl_vcc_hi_check.py` and `... binary llvm-mc-19` - all `tests/startup_gfx2hlsl_*` scripts (same exit codes as before) - Windows (WARP) on `5d283a63e`: `ctest --preset dev|release -R startup_gfx2hlsl_vcc_hi` 3/3 on both presets AI-assisted; commands listed were executed locally.
@ -1016,0 +1063,4 @@
masks.append(ops[1])
if name in ('v_cndmask_b32_e64', 'v_add_co_ci_u32_e64', 'v_sub_co_ci_u32_e64', 'v_subrev_co_ci_u32_e64') \
and ops[-1] != 'vcc_lo':
masks.append(ops[-1]) # a lane-mask source is a pair in wave64 too: vcc_hi or an odd SGPR proves wave32
Author
Owner

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

Confirmed and fixed in 5d283a63e. s_mov_b32 vcc_hi, 0x55555555 then v_cndmask_b32_e64 v2, 1.0, 2.0, vcc_hi produced (0x55555555u & 1) for every lane. A VOP3 lane-mask source that reads vcc_hi after a scalar write (or in a program with branches, where the order is unknown) now keeps vcc_hi refused. A compare or carry-out that wrote vcc_hi last keeps the per-lane form, so the existing draw fixture is unchanged.

Note: an ordinary SGPR used the same way (s_mov_b32 s7, 0x55555555 then the same v_cndmask_b32_e64 ... s7) lowers the same way on main. I left that alone here since it is not part of this change; this PR now just does not extend it to vcc_hi.

Test: new fixture SCALAR_MASK in startup_gfx2hlsl_vcc_hi_check.py (refused with "s_mov_b32 destination vcc_hi"; fails on the previous head).

Commands run: same as the first thread on this PR; Windows dev+release 3/3 on 5d283a63e.

AI-assisted; commands listed were executed locally.

**@⁠tedin7** on GitHub · 2026-11-26 03:47 UTC · [original](https://github.com/R0Y00/Xbox2Windows/pull/2703#discussion_r4703668250) Confirmed and fixed in `5d283a63e`. `s_mov_b32 vcc_hi, 0x55555555` then `v_cndmask_b32_e64 v2, 1.0, 2.0, vcc_hi` produced `(0x55555555u & 1)` for every lane. A VOP3 lane-mask source that reads vcc_hi after a scalar write (or in a program with branches, where the order is unknown) now keeps vcc_hi refused. A compare or carry-out that wrote vcc_hi last keeps the per-lane form, so the existing draw fixture is unchanged. Note: an ordinary SGPR used the same way (`s_mov_b32 s7, 0x55555555` then the same `v_cndmask_b32_e64 ... s7`) lowers the same way on `main`. I left that alone here since it is not part of this change; this PR now just does not extend it to vcc_hi. Test: new fixture `SCALAR_MASK` in `startup_gfx2hlsl_vcc_hi_check.py` (refused with "s_mov_b32 destination vcc_hi"; fails on the previous head). Commands run: same as the first thread on this PR; Windows dev+release 3/3 on `5d283a63e`. AI-assisted; commands listed were executed locally.
Author
Owner

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

Independent re-check of the fix pushed after Ready (48f889350: vcc_hi stays refused when a wide operand covers s107, or when a scalar word is read as a lane mask), head 5d283a63e.

  • Counter-shapes (pixel stage): a scalar write to vcc_hi followed by a v_cmp_* that rewrites it and a v_cndmask read keeps the per-lane form and translates; the same with a branch between the scalar write and the compare is refused (conservative); a load into s[106:107] followed by the compare also translates, since the compare writes last.
  • tests/startup_gfx2hlsl_vcc_hi_check.py reports 2 mismatches on the parent of the fix and passes with it.
  • Win2025 (dev + release) was already run on this exact head (3/3); not repeated.

AI-assisted; commands listed were executed locally.

**@⁠tedin7** on GitHub · 2026-11-26 03:48 UTC · [original](https://github.com/R0Y00/Xbox2Windows/pull/2703#issuecomment-7182046070) Independent re-check of the fix pushed after Ready (48f889350: vcc_hi stays refused when a wide operand covers s107, or when a scalar word is read as a lane mask), head 5d283a63e. - Counter-shapes (pixel stage): a scalar write to `vcc_hi` followed by a `v_cmp_*` that rewrites it and a `v_cndmask` read keeps the per-lane form and translates; the same with a branch between the scalar write and the compare is refused (conservative); a load into `s[106:107]` followed by the compare also translates, since the compare writes last. - `tests/startup_gfx2hlsl_vcc_hi_check.py` reports 2 mismatches on the parent of the fix and passes with it. - Win2025 (dev + release) was already run on this exact head (3/3); not repeated. AI-assisted; commands listed were executed locally.
Author
Owner

@⁠R0Y00 on GitHub · 2026-11-26 06:29 UTC · original · approved these changes

Verified the narrow VCC high proof and the original refusals after preserving the existing DPP and wave64-spill registrations. The host controls and the DXC/FXC draw all passed using WARP and RTX 4060 Laptop. Each draw matched 256 pixels and caught wrong compare, carry-out and VCC high mutations.

**@⁠R0Y00** on GitHub · 2026-11-26 06:29 UTC · [original](https://github.com/R0Y00/Xbox2Windows/pull/2703#pullrequestreview-6069507647) · **approved these changes** Verified the narrow VCC high proof and the original refusals after preserving the existing DPP and wave64-spill registrations. The host controls and the DXC/FXC draw all passed using WARP and RTX 4060 Laptop. Each draw matched 256 pixels and caught wrong compare, carry-out and VCC high mutations.
This discussion has been locked. Commenting is limited to contributors.
No description provided.