startup: keep s_cselect_b32 on descriptor data symbolic in compute (Refs #2618) #2903

Merged
Not-Saii merged 2 commits from upstream-pr/2903 into main 2026-11-27 05:02:42 +00:00
Not-Saii commented 2026-11-26 18:12:28 +00:00 (Migrated from github.com)

Imported from R0Y00/Xbox2Windows. Originally posted by Not-Saii on 2026-11-26T18:12:28Z.


Change

In 250 compute rows of the C500-01 and C500-02 batches, the recorded refusal is numeric use of sX holding descnum at s_cselect_b32 sX, 0, sX (FIX declaration: https://github.com/R0Y00/Xbox2Windows/issues/2618#issuecomment-7199319072). Stage.scalar_select in tools/startup/gfx2hlsl.py read both sources as run-time values, and a number derived from a descriptor (descnum) has none.

A select between descriptor data and zero can zero a buffer's size, which disables the buffer, so the result can't just be the descriptor arm. In a compute stage, s_cselect_b32 sD, a, b into an SGPR, with one source holding descnum and the others constants, now emits no HLSL. sD holds ('descnum', 'cselect', offset, arm a, arm b), and nothing reads that symbol as a value:

  • A numeric read still refuses with numeric use of sD holding descnum, through Stage.S, which is unchanged.
  • s_mov_b32 and s_mov_b64 copy the symbol. Any other scalar ALU with it in any register of a source, the high word of a 64-bit pair included, refuses with <op> on a select of descriptor data (Stage.refuse_select_source, called from Stage.scalar on the instruction's own operand ranges). Otherwise it would turn into a plain descnum or an in-place descriptor edit, and the arm would be lost.
  • A descriptor operand holding it in any word refuses (Stage.select_word, called by Stage.descriptor). A buffer load ignores edits to words 1–3 of its descriptor (#2901, not fixed here), so without this check a copied select would reach the load with the zero arm dropped.
  • In compute, a descriptor operand holding a word joined at a branch target after its first word refuses (Stage.joined_word, called by Stage.descriptor). A join of different symbols leaves only that mark, so a select that reached a descriptor word on one path, or through a loop back edge, would otherwise be dropped. This also refuses compute joins of two different non-select words there, which main translates while ignoring the difference (the #2901 class). Other stages are unchanged.
  • If its SCC came from an ALU on descriptor data, the select still refuses with scc from descriptor data in s_cselect_b32.

Unchanged: s_cselect_b64, m0/exec/vcc destinations, a raw descriptor word or a pointer as a source, a run-time register next to the descnum source, and every non-compute stage. Stage.execz_refusals and raw_descriptor_alu are not touched. #2603 (draft) has a mesh-subclass op_s_cselect_b32 override, but this change is gated to cs and doesn't touch mesh2hlsl.py.

A row gets past the select only if sX is dead afterwards or only copied. Where sX is read later, the refusal moves to that read. The packets record only the first refusal, so the row effect needs a coordinator replay of the C500 rows. I own C200-02, not these batches.

Refs #2618, #2022

Verification

Head 3469ef93 on base b505c32b. It adds the fixes for the review in https://github.com/R0Y00/Xbox2Windows/pull/2903#issuecomment-7203766582 on top of faef97d1. Windows 11 Pro build 26300, Python 3.14.8.

python -B tests/startup_gfx2hlsl_cselect_descnum_check.py

Result: exit 0, 0 failure(s). All 41 first-pass checks pass. They include:

  • Two branch cases: a read after a forward join where one path skips the select, and a read at a loop head reached by a back edge after the select. Both refuse with numeric use of s21 holding joined at a branch target, while the same join with a run-time write translates.
  • The review's cases: a load after a join where one path selects into word 2, the same select through a loop back edge, and s_or_b64 s[14:15], s[20:21], 0 with the select in the high word. All three refuse. The same join with the loaded word on both paths, and the same loop without the select, translate.
  • On faef97d1, exactly those three review checks fail.

Each negative control fails its named check:

  • zero-arm-dropped (the select keeps only its descnum source) fails 12 checks, including "raw conversion with the selected stride", which translates under it.
  • load-check-removed (select_word finds nothing) fails the four load checks, including "load through a select copied into s14".
  • alu-check-removed (refuse_select_source accepts everything) fails four checks, including "an ALU copy into word 2 before the load".
  • join-check-removed (joined_word finds nothing) fails the join and loop-head load checks.
  • high-word-unchecked (refuse_select_source sees only the low word of each source) fails the s_or_b64 check.

Before the change, the same check file run on b505c32b exits 1. It fails 20 of its 34 first-pass checks: the four accepted cases are refused at the select, and 16 later-use, branch and review checks get that refusal instead of their own reason. The mutation phase can't run there, because the helpers don't exist yet.

Existing pure-Python checks, each run directly with python -B tests/<name>.py on b505c32b, faef97d1 and 3469ef93, each exit 0 with no FAIL lines every time: startup_gfx2hlsl_compute_check, startup_gfx2hlsl_cselect_mask_check, startup_gfx2hlsl_scalar_m0_check, startup_gfx2hlsl_join_symbols_check, startup_gfx2hlsl_sopk_accum_check, startup_smem_address_check, startup_gfx2hlsl_refusals_check, startup_gfx2hlsl_handler_arity_check, startup_gfx2hlsl_scalar_null_check. Also on faef97d1, each exit 0: docs_links_check, bidi_controls_check, run_checks_parallel_check.

Coverage limit: the descriptor-operand refusal is exercised only for buffer load and buffer store operands. Image, sampler and s_buffer_load operands go through the same Stage.descriptor check, but nothing here tests them.

CTest and the CI Python list below were measured on faef97d1 and rerun on 3469ef93. The results are the same.

  • CTest: 2/2 passed. WARP compared 320 words with 0 mismatches, and the debug layer reported 0 errors and 0 warnings.
  • CI Python list: 209 passed, 0 failed, and the same 2 skips. No check newly refuses because of the joined-word refusal.

CTest, on faef97d1 (cmake --preset dev -DINTAKE_PYTHON=<pe-env python>, Debug, then cmake --build --preset dev --target offscreen_check):

ctest --preset dev --no-tests=error -R "^startup_gfx2hlsl_cselect_descnum_(controls|warp)$" -V

Result: 2/2 passed. startup_gfx2hlsl_cselect_descnum_controls passed (0.49 s). startup_gfx2hlsl_cselect_descnum_warp passed (0.62 s): backend=warp debug_layer=enabled, adapter Microsoft Basic Render Driver (1414:008c), driver 10.0.26100.9818, DXC 1.9.2602.17 (Windows SDK 10.0.26100 dxc.exe, cs_6_0). It dispatched 3x2x2 groups and compared all 320 words with case A's reference (0 mismatches, debug_errors=0 debug_warnings=0).

CI Python list: the Run Python checks step of the python-linux job, run on Windows with this interpreter. That is tools/run_checks_parallel.py --from-dir tests/checks/python-linux plus the 205 inline scripts, 211 checks in all, including the new one. Result in 29 s on all cores:

  • Passed: 209.
  • Failed: 0.
  • Capability skips (exit 77), both platform gaps of a Windows run, not results of this change:
    • tests/startup_run_sh_check.py: "a POSIX launcher; run it on Linux".
    • tests/startup_build_rev_check.py: "the generator controls need both on PATH"; cmake was not on PATH in that shell.
  • The runner exits 1 because it counts skips (docs/non-windows-hosts.md).

Not run:

  • startup_gfx2hlsl_cselect_descnum_hardware: the machine has one GPU, and no hardware run was requested.
  • The fixture words are hand-encoded from the RDNA 2 SOP1/SOP2/SOPC/VOP1/VOPC/SOPP layouts and checked against the translator's decoder. No llvm-mc reassembly or binary/decode mode was run, because there's no llvm-mc here.
  • No replay of the C500 rows: it needs capture access.

Evidence and follow-up

  • Fixture: synthetic instructions spliced into case A of tests/startup_gfx2hlsl_compute_check.py (source-built, in this repository). No capture input.
  • Open: the instructions that produce sX, write SCC and read sX afterwards in the C500 rows. The packets don't show them. That answer picks which later use to prove next, for example a load whose bounds check honours the zero arm.
  • Related: #2901 (the general buffer-load word gap), #2121, #2320, #2546, #2795.
  • Note: docs/experiments/startup-gfx2hlsl-cselect-descnum.md. Bullet in docs/startup-runtime.md. Registration: tests/cmake/startup_gfx2hlsl_cselect_descnum.cmake and tests/checks/python-linux/startup_gfx2hlsl_cselect_descnum.txt.

Checklist

  • This pull request covers one reviewable behavior.
  • I included the exact command and result for every check I ran.
  • I considered a negative control or failure case for a new fixture.
  • I updated README/docs when a capability or build requirement changed.
  • I did not include game files, dumps, distribution links or secrets.

AI-assisted (Claude Code).

<!-- greyfinch-sync:R0Y00/Xbox2Windows:issue:5515081179 --> Imported from [R0Y00/Xbox2Windows](https://github.com/R0Y00/Xbox2Windows/pull/2903). Originally posted by [Not-Saii](https://github.com/Not-Saii) on 2026-11-26T18:12:28Z. --- ## Change In 250 compute rows of the C500-01 and C500-02 batches, the recorded refusal is `numeric use of sX holding descnum` at `s_cselect_b32 sX, 0, sX` (FIX declaration: https://github.com/R0Y00/Xbox2Windows/issues/2618#issuecomment-7199319072). `Stage.scalar_select` in `tools/startup/gfx2hlsl.py` read both sources as run-time values, and a number derived from a descriptor (`descnum`) has none. A select between descriptor data and zero can zero a buffer's size, which disables the buffer, so the result can't just be the descriptor arm. In a compute stage, `s_cselect_b32 sD, a, b` into an SGPR, with one source holding `descnum` and the others constants, now emits no HLSL. sD holds `('descnum', 'cselect', offset, arm a, arm b)`, and nothing reads that symbol as a value: - A numeric read still refuses with `numeric use of sD holding descnum`, through `Stage.S`, which is unchanged. - `s_mov_b32` and `s_mov_b64` copy the symbol. Any other scalar ALU with it in any register of a source, the high word of a 64-bit pair included, refuses with `<op> on a select of descriptor data` (`Stage.refuse_select_source`, called from `Stage.scalar` on the instruction's own operand ranges). Otherwise it would turn into a plain `descnum` or an in-place descriptor edit, and the arm would be lost. - A descriptor operand holding it in any word refuses (`Stage.select_word`, called by `Stage.descriptor`). A buffer load ignores edits to words 1–3 of its descriptor (#2901, not fixed here), so without this check a copied select would reach the load with the zero arm dropped. - In compute, a descriptor operand holding a word joined at a branch target after its first word refuses (`Stage.joined_word`, called by `Stage.descriptor`). A join of different symbols leaves only that mark, so a select that reached a descriptor word on one path, or through a loop back edge, would otherwise be dropped. This also refuses compute joins of two different non-select words there, which main translates while ignoring the difference (the #2901 class). Other stages are unchanged. - If its SCC came from an ALU on descriptor data, the select still refuses with `scc from descriptor data in s_cselect_b32`. Unchanged: `s_cselect_b64`, m0/exec/vcc destinations, a raw descriptor word or a pointer as a source, a run-time register next to the `descnum` source, and every non-compute stage. `Stage.execz_refusals` and `raw_descriptor_alu` are not touched. #2603 (draft) has a mesh-subclass `op_s_cselect_b32` override, but this change is gated to `cs` and doesn't touch `mesh2hlsl.py`. A row gets past the select only if sX is dead afterwards or only copied. Where sX is read later, the refusal moves to that read. The packets record only the first refusal, so the row effect needs a coordinator replay of the C500 rows. I own C200-02, not these batches. Refs #2618, #2022 ## Verification Head 3469ef93 on base b505c32b. It adds the fixes for the review in https://github.com/R0Y00/Xbox2Windows/pull/2903#issuecomment-7203766582 on top of faef97d1. Windows 11 Pro build 26300, Python 3.14.8. ```powershell python -B tests/startup_gfx2hlsl_cselect_descnum_check.py ``` Result: exit 0, `0 failure(s)`. All 41 first-pass checks pass. They include: - Two branch cases: a read after a forward join where one path skips the select, and a read at a loop head reached by a back edge after the select. Both refuse with `numeric use of s21 holding joined at a branch target`, while the same join with a run-time write translates. - The review's cases: a load after a join where one path selects into word 2, the same select through a loop back edge, and `s_or_b64 s[14:15], s[20:21], 0` with the select in the high word. All three refuse. The same join with the loaded word on both paths, and the same loop without the select, translate. - On faef97d1, exactly those three review checks fail. Each negative control fails its named check: - `zero-arm-dropped` (the select keeps only its `descnum` source) fails 12 checks, including "raw conversion with the selected stride", which translates under it. - `load-check-removed` (`select_word` finds nothing) fails the four load checks, including "load through a select copied into s14". - `alu-check-removed` (`refuse_select_source` accepts everything) fails four checks, including "an ALU copy into word 2 before the load". - `join-check-removed` (`joined_word` finds nothing) fails the join and loop-head load checks. - `high-word-unchecked` (`refuse_select_source` sees only the low word of each source) fails the `s_or_b64` check. Before the change, the same check file run on b505c32b exits 1. It fails 20 of its 34 first-pass checks: the four accepted cases are refused at the select, and 16 later-use, branch and review checks get that refusal instead of their own reason. The mutation phase can't run there, because the helpers don't exist yet. Existing pure-Python checks, each run directly with `python -B tests/<name>.py` on b505c32b, faef97d1 and 3469ef93, each exit 0 with no FAIL lines every time: `startup_gfx2hlsl_compute_check`, `startup_gfx2hlsl_cselect_mask_check`, `startup_gfx2hlsl_scalar_m0_check`, `startup_gfx2hlsl_join_symbols_check`, `startup_gfx2hlsl_sopk_accum_check`, `startup_smem_address_check`, `startup_gfx2hlsl_refusals_check`, `startup_gfx2hlsl_handler_arity_check`, `startup_gfx2hlsl_scalar_null_check`. Also on faef97d1, each exit 0: `docs_links_check`, `bidi_controls_check`, `run_checks_parallel_check`. Coverage limit: the descriptor-operand refusal is exercised only for buffer load and buffer store operands. Image, sampler and `s_buffer_load` operands go through the same `Stage.descriptor` check, but nothing here tests them. CTest and the CI Python list below were measured on faef97d1 and rerun on 3469ef93. The results are the same. - CTest: 2/2 passed. WARP compared 320 words with 0 mismatches, and the debug layer reported 0 errors and 0 warnings. - CI Python list: 209 passed, 0 failed, and the same 2 skips. No check newly refuses because of the joined-word refusal. CTest, on faef97d1 (`cmake --preset dev -DINTAKE_PYTHON=<pe-env python>`, Debug, then `cmake --build --preset dev --target offscreen_check`): ```powershell ctest --preset dev --no-tests=error -R "^startup_gfx2hlsl_cselect_descnum_(controls|warp)$" -V ``` Result: 2/2 passed. `startup_gfx2hlsl_cselect_descnum_controls` passed (0.49 s). `startup_gfx2hlsl_cselect_descnum_warp` passed (0.62 s): `backend=warp debug_layer=enabled`, adapter Microsoft Basic Render Driver (1414:008c), driver 10.0.26100.9818, DXC 1.9.2602.17 (Windows SDK 10.0.26100 `dxc.exe`, `cs_6_0`). It dispatched 3x2x2 groups and compared all 320 words with case A's reference (0 mismatches, `debug_errors=0 debug_warnings=0`). CI Python list: the `Run Python checks` step of the `python-linux` job, run on Windows with this interpreter. That is `tools/run_checks_parallel.py --from-dir tests/checks/python-linux` plus the 205 inline scripts, 211 checks in all, including the new one. Result in 29 s on all cores: - Passed: 209. - Failed: 0. - Capability skips (exit 77), both platform gaps of a Windows run, not results of this change: - `tests/startup_run_sh_check.py`: "a POSIX launcher; run it on Linux". - `tests/startup_build_rev_check.py`: "the generator controls need both on PATH"; `cmake` was not on PATH in that shell. - The runner exits 1 because it counts skips (docs/non-windows-hosts.md). Not run: - `startup_gfx2hlsl_cselect_descnum_hardware`: the machine has one GPU, and no hardware run was requested. - The fixture words are hand-encoded from the RDNA 2 SOP1/SOP2/SOPC/VOP1/VOPC/SOPP layouts and checked against the translator's decoder. No llvm-mc reassembly or binary/decode mode was run, because there's no llvm-mc here. - No replay of the C500 rows: it needs capture access. ## Evidence and follow-up - Fixture: synthetic instructions spliced into case A of `tests/startup_gfx2hlsl_compute_check.py` (source-built, in this repository). No capture input. - Open: the instructions that produce sX, write SCC and read sX afterwards in the C500 rows. The packets don't show them. That answer picks which later use to prove next, for example a load whose bounds check honours the zero arm. - Related: #2901 (the general buffer-load word gap), #2121, #2320, #2546, #2795. - Note: `docs/experiments/startup-gfx2hlsl-cselect-descnum.md`. Bullet in `docs/startup-runtime.md`. Registration: `tests/cmake/startup_gfx2hlsl_cselect_descnum.cmake` and `tests/checks/python-linux/startup_gfx2hlsl_cselect_descnum.txt`. ## Checklist - [x] This pull request covers one reviewable behavior. - [x] I included the exact command and result for every check I ran. - [x] I considered a negative control or failure case for a new fixture. - [x] I updated README/docs when a capability or build requirement changed. - [x] I did not include game files, dumps, distribution links or secrets. AI-assisted (Claude Code).
Leyukaka commented 2026-11-26 21:28:50 +00:00 (Migrated from github.com)

Imported from R0Y00/Xbox2Windows. Originally posted by Leyukaka on 2026-11-26T21:28:50Z.


Review of head faef97d1, from reading the diff against main 6ee878d8 (not run). Two inputs that main refuses at the select, and this PR lets through:

  1. A select reaches a descriptor word across a branch join. Spliced into case A before LOAD:

    s_lshr_b32 s21, s14, 2
    s_cmp_eq_u32 s5, 0
    s_cbranch_scc1 <label after the select>
    s_cmp_eq_u32 s4, 0
    s_cselect_b32 s14, 0, s21
    <label>: buffer_load_dword v5, v4, s[12:15], 0 offen
    
    • At the join, s14 becomes ('joined at a branch target',): one edge brings the loaded descriptor word and the other the select, which names_one_value does not accept.
    • select_word only matches ('descnum', 'cselect', ...). descriptor() keys on the first word, so the load translates and binds the unmodified descriptor, where the console path may have zeroed the size word.
    • On main the same input is refused at the select (numeric use of s21 holding descnum).
    • Suggestion: refuse a joined word in words 1-3 of a descriptor operand in the same place, with a test that loads after the join.
  2. The high word of a 64-bit source is not checked. scalar() collapses a pair to its low register before building syms, so refuse_select_source never sees s21 in:

    s_lshr_b32 s20, s14, 2
    s_lshr_b32 s21, s14, 2
    s_cmp_eq_u32 s4, 0
    s_cselect_b32 s21, 0, s21
    s_or_b64 s[14:15], s[20:21], 0
    
    • The fall-through then sets s14 to ('descnum',) and leaves s15 as it was, so a following load through s[12:15] is accepted.
    • This is against the note's "any other scalar ALU instruction with it as a source refuses".
    • Checking every register of each source range in scalar(), before refuse_select_source runs, would close it.

Both rest on reading the code path, not on running the splices.

AI-assisted.

<!-- greyfinch-sync:R0Y00/Xbox2Windows:comment:7203766582 --> Imported from [R0Y00/Xbox2Windows](https://github.com/R0Y00/Xbox2Windows/pull/2903#issuecomment-7203766582). Originally posted by [Leyukaka](https://github.com/Leyukaka) on 2026-11-26T21:28:50Z. --- Review of head `faef97d1`, from reading the diff against main `6ee878d8` (not run). Two inputs that main refuses at the select, and this PR lets through: 1. **A select reaches a descriptor word across a branch join.** Spliced into case A before `LOAD`: ``` s_lshr_b32 s21, s14, 2 s_cmp_eq_u32 s5, 0 s_cbranch_scc1 <label after the select> s_cmp_eq_u32 s4, 0 s_cselect_b32 s14, 0, s21 <label>: buffer_load_dword v5, v4, s[12:15], 0 offen ``` - At the join, `s14` becomes `('joined at a branch target',)`: one edge brings the loaded descriptor word and the other the select, which `names_one_value` does not accept. - `select_word` only matches `('descnum', 'cselect', ...)`. `descriptor()` keys on the first word, so the load translates and binds the unmodified descriptor, where the console path may have zeroed the size word. - On main the same input is refused at the select (`numeric use of s21 holding descnum`). - Suggestion: refuse a joined word in words 1-3 of a descriptor operand in the same place, with a test that loads after the join. 2. **The high word of a 64-bit source is not checked.** `scalar()` collapses a pair to its low register before building `syms`, so `refuse_select_source` never sees `s21` in: ``` s_lshr_b32 s20, s14, 2 s_lshr_b32 s21, s14, 2 s_cmp_eq_u32 s4, 0 s_cselect_b32 s21, 0, s21 s_or_b64 s[14:15], s[20:21], 0 ``` - The fall-through then sets `s14` to `('descnum',)` and leaves `s15` as it was, so a following load through `s[12:15]` is accepted. - This is against the note's "any other scalar ALU instruction with it as a source refuses". - Checking every register of each source range in `scalar()`, before `refuse_select_source` runs, would close it. Both rest on reading the code path, not on running the splices. AI-assisted.
Not-Saii commented 2026-11-26 22:10:57 +00:00 (Migrated from github.com)

Imported from R0Y00/Xbox2Windows. Originally posted by Not-Saii on 2026-11-26T22:10:57Z.


@Leyukaka thanks, both are real. I reproduced them in pure Python, splicing your instructions into case A of tests/startup_gfx2hlsl_compute_check.py.

Input main 6ee878d8 this PR at faef97d1
1. s_cselect_b32 s14, 0, s21 on one path, then buffer_load_dword v5, v4, s[12:15], 0 offen after the join refused: numeric use of s21 holding descnum translated
1b. The same select at the bottom of a loop whose head is that load (back edge) refused: same translated
2. s_cselect_b32 s21, 0, s21, then s_or_b64 s[14:15], s[20:21], 0, then the load refused: same translated

Fixes in 3469ef93:

  1. Joined words: in compute, Stage.descriptor now refuses a descriptor operand that holds a word joined at a branch target after its first word (Stage.joined_word). The message is descriptor operand s[12:15]: s14 holds a word joined at a branch target.
    • A join only leaves the mark, without what each path brought, and a loop head is re-translated with a forced refusal. So the check refuses any joined word in that position, not only one a select reached.
    • Main translates compute joins of two different non-select words and ignores the difference, as in #2901. Those now refuse too.
    • Other stages are unchanged.
  2. High word: Stage.refuse_select_source now reads every register of each source range from the instruction's operands (scalar() had narrowed pairs to their low word), and it runs before the descriptor-data branch. Case 2 now refuses with s_or_b64 on a select of descriptor data. A s_mov_b64 with a run-time low word and the select in the high word already refused at the numeric read of the high word.

tests/startup_gfx2hlsl_cselect_descnum_check.py now covers cases 1, 1b and 2. Two positive controls go with them: the same join with the loaded word on both paths, and the same loop without the select, both of which translate. There are also two new mutated translators. join-check-removed fails the join and loop checks, and high-word-unchecked fails the s_or_b64 check.

Results with the fix (Windows 11 build 26300, Python 3.14.8):

  • python -B tests/startup_gfx2hlsl_cselect_descnum_check.py: exit 0. All 41 first-pass checks pass, and each of the 5 mutated translators fails its named check.
  • The same file on faef97d1: exactly the 3 new checks fail.
  • startup_gfx2hlsl_compute, cselect_mask, scalar_m0, join_symbols, sopk_accum, startup_smem_address, refusals, handler_arity and scalar_null checks: all exit 0 with no FAIL lines.
  • ctest --preset dev --no-tests=error -R "^startup_gfx2hlsl_cselect_descnum_(controls|warp)$" -V: 2/2 passed. The _warp test ran with backend=warp debug_layer=enabled, adapter Microsoft Basic Render Driver (1414:008c), driver 10.0.26100.9818. It compared all 320 words with 0 mismatches, and the debug layer reported 0 errors and 0 warnings.
  • The CI Run Python checks list (211 checks), run on Windows: 209 passed and 0 failed. Two checks were capability skips (exit 77), both platform gaps of a Windows run: startup_run_sh_check is a POSIX launcher check, and startup_build_rev_check needs cmake on PATH. These match the run on faef97d1, so no check in that list newly refuses because of the wider join refusal.

AI-assisted (Claude Code).

<!-- greyfinch-sync:R0Y00/Xbox2Windows:comment:7204439234 --> Imported from [R0Y00/Xbox2Windows](https://github.com/R0Y00/Xbox2Windows/pull/2903#issuecomment-7204439234). Originally posted by [Not-Saii](https://github.com/Not-Saii) on 2026-11-26T22:10:57Z. --- @Leyukaka thanks, both are real. I reproduced them in pure Python, splicing your instructions into case A of `tests/startup_gfx2hlsl_compute_check.py`. | Input | main 6ee878d8 | this PR at faef97d1 | |---|---|---| | 1. `s_cselect_b32 s14, 0, s21` on one path, then `buffer_load_dword v5, v4, s[12:15], 0 offen` after the join | refused: `numeric use of s21 holding descnum` | translated | | 1b. The same select at the bottom of a loop whose head is that load (back edge) | refused: same | translated | | 2. `s_cselect_b32 s21, 0, s21`, then `s_or_b64 s[14:15], s[20:21], 0`, then the load | refused: same | translated | Fixes in 3469ef93: 1. **Joined words:** in compute, `Stage.descriptor` now refuses a descriptor operand that holds a word joined at a branch target after its first word (`Stage.joined_word`). The message is `descriptor operand s[12:15]: s14 holds a word joined at a branch target`. - A join only leaves the mark, without what each path brought, and a loop head is re-translated with a forced refusal. So the check refuses any joined word in that position, not only one a select reached. - Main translates compute joins of two different non-select words and ignores the difference, as in #2901. Those now refuse too. - Other stages are unchanged. 2. **High word:** `Stage.refuse_select_source` now reads every register of each source range from the instruction's operands (`scalar()` had narrowed pairs to their low word), and it runs before the descriptor-data branch. Case 2 now refuses with `s_or_b64 on a select of descriptor data`. A `s_mov_b64` with a run-time low word and the select in the high word already refused at the numeric read of the high word. `tests/startup_gfx2hlsl_cselect_descnum_check.py` now covers cases 1, 1b and 2. Two positive controls go with them: the same join with the loaded word on both paths, and the same loop without the select, both of which translate. There are also two new mutated translators. `join-check-removed` fails the join and loop checks, and `high-word-unchecked` fails the `s_or_b64` check. Results with the fix (Windows 11 build 26300, Python 3.14.8): - `python -B tests/startup_gfx2hlsl_cselect_descnum_check.py`: exit 0. All 41 first-pass checks pass, and each of the 5 mutated translators fails its named check. - The same file on faef97d1: exactly the 3 new checks fail. - `startup_gfx2hlsl_compute`, `cselect_mask`, `scalar_m0`, `join_symbols`, `sopk_accum`, `startup_smem_address`, `refusals`, `handler_arity` and `scalar_null` checks: all exit 0 with no FAIL lines. - `ctest --preset dev --no-tests=error -R "^startup_gfx2hlsl_cselect_descnum_(controls|warp)$" -V`: 2/2 passed. The `_warp` test ran with `backend=warp debug_layer=enabled`, adapter Microsoft Basic Render Driver (1414:008c), driver 10.0.26100.9818. It compared all 320 words with 0 mismatches, and the debug layer reported 0 errors and 0 warnings. - The CI `Run Python checks` list (211 checks), run on Windows: 209 passed and 0 failed. Two checks were capability skips (exit 77), both platform gaps of a Windows run: `startup_run_sh_check` is a POSIX launcher check, and `startup_build_rev_check` needs `cmake` on PATH. These match the run on faef97d1, so no check in that list newly refuses because of the wider join refusal. AI-assisted (Claude Code).
R0Y00 commented 2026-11-27 05:00:59 +00:00 (Migrated from github.com)

Imported from R0Y00/Xbox2Windows. Originally posted by R0Y00 on 2026-11-27T05:00:59Z.

Review: APPROVED


Reviewed 3469ef933c060ffdd41316a8299b4bc2ad6089d5. The updates refuse an opaque select used through a joined descriptor word or the high half of an SGPR pair. The Release main integration build passed startup_gfx2hlsl_cselect_descnum_(controls|warp|hardware), including the refusal controls and the 320-word dispatch. Independent Windows 11 26200.9974 testing used WARP 10.0.26100.9818 and RTX 4060 Laptop 32.0.16.1656 where applicable. Required Windows CI passed.

<!-- greyfinch-sync:R0Y00/Xbox2Windows:review:6083689084 --> Imported from [R0Y00/Xbox2Windows](https://github.com/R0Y00/Xbox2Windows/pull/2903#pullrequestreview-6083689084). Originally posted by [R0Y00](https://github.com/R0Y00) on 2026-11-27T05:00:59Z. **Review:** APPROVED --- Reviewed `3469ef933c060ffdd41316a8299b4bc2ad6089d5`. The updates refuse an opaque select used through a joined descriptor word or the high half of an SGPR pair. The Release main integration build passed `startup_gfx2hlsl_cselect_descnum_(controls|warp|hardware)`, including the refusal controls and the 320-word dispatch. Independent Windows 11 26200.9974 testing used WARP 10.0.26100.9818 and RTX 4060 Laptop 32.0.16.1656 where applicable. Required Windows CI passed.
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!2903
No description provided.