startup: lower v_mul_hi_i32 and s_mul_hi_i32 in gfx2hlsl #2397

Merged
R0D4X merged 2 commits from upstream-pr/2405 into main 2026-11-26 02:13:45 +00:00
R0D4X commented 2026-11-25 15:26:43 +00:00 (Migrated from github.com)

Imported from R0Y00/Xbox2Windows. Originally posted by R0D4X on 2026-11-25T15:26:43Z.


Summary

  • Lower the signed 32x32 -> high-32 multiply instructions (v_mul_hi_i32 VOP3A and s_mul_hi_i32 SOP2, SCC unchanged) in tools/startup/gfx2hlsl.py, completing the signed counterpart to s_mul_hi_u32 (#2176) and v_mul_hi_u32 (#1747).
  • Reuse Pipeline.common()'s existing mul_hi_u32(uint a, uint b) helper via a one-line signed correction (mul_hi_i32(a, b) = mul_hi_u32(a, b) - ((a >> 31) != 0u ? b : 0u) - ((b >> 31) != 0u ? a : 0u)), avoiding any duplicate halfword-product helper.
  • Apply s_mul_hi_u32's whole-word, lane-mask, vcc/exec, symbolic-source, and bounds guards to s_mul_hi_i32, and add an explicit 3-operand count guard for s_mul_hi_{u,i}32 so malformed forms raise Unsupported instead of IndexError.
  • Add tests/startup_gfx2hlsl_mul_hi_i32_check.py with:
    • Pure-Python verification of the emitted mul_hi_i32 helper over a 361-pair edge grid (including INT_MIN * INT_MIN, INT_MIN * -1, -1 * -1, mixed signs) against ((s32(a) * s32(b)) >> 32) & 0xffffffff, sign-correction drop controls, unsigned-multiply mutation controls, exec-masked emission, s_mul_hi_i32 SOP2 decode/lowering/mask-overwrite/refusals, and modifier/arity refusals.
    • binary <llvm-mc> round-trip checks for the Ubuntu pixel-binary CI job.
    • draw <dxc> <offscreen_check> <warp|hardware> [fxc] end-to-end FXC ps_5_1 + DXC ps_6_0 offscreen readbacks across 3 draw sets (12 pairs) plus an unsigned-multiply GPU mutation control.
  • Register startup_gfx2hlsl_mul_hi_i32_{controls,warp,hardware} in CMakeLists.txt and wire tests/startup_gfx2hlsl_mul_hi_i32_check.py into pixel-binary and python-linux in .github/workflows/windows.yml.

Verification

  • Base commit: 7092683a (upstream/main)
  • Branch commit: 29536aa3
  • Host environment: Windows 11 x64 (10.0.26300.9974), MSVC 19.44.35230, Windows SDK 10.0.26100.0, FXC + DXC 1.9.2602.17
  • WARP: Microsoft Basic Render Driver (1414:008c), driver 10.0.26100.9818, D3D12 debug layer enabled
  • Hardware GPU: NVIDIA GeForce RTX 5080 (10de:2c02), driver 32.0.16.2124, D3D12 debug layer enabled

Commands and Observed Results

.\out\pe-env\Scripts\python.exe -B tests/startup_gfx2hlsl_mul_hi_i32_check.py
.\out\pe-env\Scripts\python.exe -B tests/startup_gfx2hlsl_sop2_complement_check.py
.\out\pe-env\Scripts\python.exe -B tests/startup_gfx2hlsl_cvt_alu_check.py
.\out\pe-env\Scripts\python.exe -B tests/startup_gfx2hlsl_operand_count_check.py
.\out\pe-env\Scripts\python.exe -B tests/startup_gfx2hlsl_bit_alu_check.py
.\out\pe-env\Scripts\python.exe -B tests/startup_gfx2hlsl_handler_arity_check.py
.\out\pe-env\Scripts\python.exe -B tests/startup_translator_check.py
.\out\pe-env\Scripts\python.exe -B tests/docs_links_check.py
.\out\pe-env\Scripts\python.exe -B tests/bidi_controls_check.py
ctest --preset dev --no-tests=error -R '^startup_tools_lint$' --output-on-failure
  • Observed: all passed (startup_gfx2hlsl_mul_hi_i32_check.py: 17/17 checks ok; docs_links_check.py: 19 files / 464 links ok; bidi_controls_check.py: 1723 files ok; startup_tools_lint: passed).
  • Self-mutation check: 4/4 mutations (drop_sign_a, v_unsigned, s_unsigned, drop_arity_guard) caught (rc=1) and reverted cleanly.
ctest --preset dev --no-tests=error -j 1 -R '^startup_gfx2hlsl_mul_hi_i32_' -V
ctest --preset release --no-tests=error -j 1 -R '^startup_gfx2hlsl_mul_hi_i32_' -V
  • Observed (dev): 3 passed, 0 skipped, 0 failed (3.47 s: controls 0.17 s, warp 0.78 s, hardware 2.46 s, debug_errors=0 debug_warnings=0).
  • Observed (release): 3 passed, 0 skipped, 0 failed (3.02 s: controls 0.17 s, warp 0.67 s, hardware 2.13 s).
  • Note: tests/startup_gfx2hlsl_mul_hi_i32_check.py binary llvm-mc-15 was not run locally (llvm-mc is not installed on this Windows host); fixture words were cross-checked against tools/disasm_rdna2.py / gfx2hlsl.decode() and are exercised by the Ubuntu pixel-binary CI job.
  • Scope note: these passing fixtures verify v_mul_hi_i32 / s_mul_hi_i32 lowering and desktop GPU execution in isolation; they do not establish full-game startup.
<!-- greyfinch-sync:R0Y00/Xbox2Windows:issue:6607929412 --> Imported from [R0Y00/Xbox2Windows](https://github.com/R0Y00/Xbox2Windows/pull/2405). Originally posted by [R0D4X](https://github.com/R0D4X) on 2026-11-25T15:26:43Z. --- ## Summary - Lower the signed 32x32 -> high-32 multiply instructions (`v_mul_hi_i32` VOP3A and `s_mul_hi_i32` SOP2, SCC unchanged) in `tools/startup/gfx2hlsl.py`, completing the signed counterpart to `s_mul_hi_u32` (#2176) and `v_mul_hi_u32` (#1747). - Reuse `Pipeline.common()`'s existing `mul_hi_u32(uint a, uint b)` helper via a one-line signed correction (`mul_hi_i32(a, b) = mul_hi_u32(a, b) - ((a >> 31) != 0u ? b : 0u) - ((b >> 31) != 0u ? a : 0u)`), avoiding any duplicate halfword-product helper. - Apply `s_mul_hi_u32`'s whole-word, lane-mask, `vcc`/`exec`, symbolic-source, and bounds guards to `s_mul_hi_i32`, and add an explicit 3-operand count guard for `s_mul_hi_{u,i}32` so malformed forms raise `Unsupported` instead of `IndexError`. - Add `tests/startup_gfx2hlsl_mul_hi_i32_check.py` with: - Pure-Python verification of the emitted `mul_hi_i32` helper over a 361-pair edge grid (including `INT_MIN * INT_MIN`, `INT_MIN * -1`, `-1 * -1`, mixed signs) against `((s32(a) * s32(b)) >> 32) & 0xffffffff`, sign-correction drop controls, unsigned-multiply mutation controls, `exec`-masked emission, `s_mul_hi_i32` SOP2 decode/lowering/mask-overwrite/refusals, and modifier/arity refusals. - `binary <llvm-mc>` round-trip checks for the Ubuntu `pixel-binary` CI job. - `draw <dxc> <offscreen_check> <warp|hardware> [fxc]` end-to-end FXC `ps_5_1` + DXC `ps_6_0` offscreen readbacks across 3 draw sets (12 pairs) plus an unsigned-multiply GPU mutation control. - Register `startup_gfx2hlsl_mul_hi_i32_{controls,warp,hardware}` in `CMakeLists.txt` and wire `tests/startup_gfx2hlsl_mul_hi_i32_check.py` into `pixel-binary` and `python-linux` in `.github/workflows/windows.yml`. ## Verification - **Base commit:** `7092683a` (`upstream/main`) - **Branch commit:** `29536aa3` - **Host environment:** Windows 11 x64 (`10.0.26300.9974`), MSVC `19.44.35230`, Windows SDK `10.0.26100.0`, FXC + DXC `1.9.2602.17` - **WARP:** `Microsoft Basic Render Driver` (`1414:008c`), driver `10.0.26100.9818`, D3D12 debug layer enabled - **Hardware GPU:** `NVIDIA GeForce RTX 5080` (`10de:2c02`), driver `32.0.16.2124`, D3D12 debug layer enabled ### Commands and Observed Results ```powershell .\out\pe-env\Scripts\python.exe -B tests/startup_gfx2hlsl_mul_hi_i32_check.py .\out\pe-env\Scripts\python.exe -B tests/startup_gfx2hlsl_sop2_complement_check.py .\out\pe-env\Scripts\python.exe -B tests/startup_gfx2hlsl_cvt_alu_check.py .\out\pe-env\Scripts\python.exe -B tests/startup_gfx2hlsl_operand_count_check.py .\out\pe-env\Scripts\python.exe -B tests/startup_gfx2hlsl_bit_alu_check.py .\out\pe-env\Scripts\python.exe -B tests/startup_gfx2hlsl_handler_arity_check.py .\out\pe-env\Scripts\python.exe -B tests/startup_translator_check.py .\out\pe-env\Scripts\python.exe -B tests/docs_links_check.py .\out\pe-env\Scripts\python.exe -B tests/bidi_controls_check.py ctest --preset dev --no-tests=error -R '^startup_tools_lint$' --output-on-failure ``` - Observed: all passed (`startup_gfx2hlsl_mul_hi_i32_check.py`: 17/17 checks ok; `docs_links_check.py`: 19 files / 464 links ok; `bidi_controls_check.py`: 1723 files ok; `startup_tools_lint`: passed). - Self-mutation check: 4/4 mutations (`drop_sign_a`, `v_unsigned`, `s_unsigned`, `drop_arity_guard`) caught (`rc=1`) and reverted cleanly. ```powershell ctest --preset dev --no-tests=error -j 1 -R '^startup_gfx2hlsl_mul_hi_i32_' -V ctest --preset release --no-tests=error -j 1 -R '^startup_gfx2hlsl_mul_hi_i32_' -V ``` - Observed (`dev`): **3 passed, 0 skipped, 0 failed** (3.47 s: `controls` 0.17 s, `warp` 0.78 s, `hardware` 2.46 s, `debug_errors=0 debug_warnings=0`). - Observed (`release`): **3 passed, 0 skipped, 0 failed** (3.02 s: `controls` 0.17 s, `warp` 0.67 s, `hardware` 2.13 s). - Note: `tests/startup_gfx2hlsl_mul_hi_i32_check.py binary llvm-mc-15` was not run locally (`llvm-mc` is not installed on this Windows host); fixture words were cross-checked against `tools/disasm_rdna2.py` / `gfx2hlsl.decode()` and are exercised by the Ubuntu `pixel-binary` CI job. - Scope note: these passing fixtures verify `v_mul_hi_i32` / `s_mul_hi_i32` lowering and desktop GPU execution in isolation; they do not establish full-game startup.
ChazY11 commented 2026-11-25 16:05:24 +00:00 (Migrated from github.com)

Imported from R0Y00/Xbox2Windows. Originally posted by ChazY11 on 2026-11-25T15:43:03Z.


Six mutations, all caught — and the helper's formula checks out against a reference on 100 boundary pairs plus 20 000 random ones

Baseline: tests/startup_gfx2hlsl_mul_hi_i32_check.py exit 0.

mutation result
v_mul_hi_i32 mapped to mul_hi_u32 caught
s_mul_hi_i32 mapped to mul_hi_u32 caught
helper drops the - (b if a<0) correction caught
helper drops the - (a if b<0) correction caught
correction term uses the wrong operand (? a : instead of ? b :) caught
the new len(srcs) != 2 refusal disabled caught

The last one is the one I did not expect to be pinned, because it guards a shape rather than a value; a check that only compared results would miss it.

Independent arithmetic check

The signed multiply-high is built on the unsigned one:

uint mul_hi_i32(uint a, uint b) { return mul_hi_u32(a, b) - ((a >> 31) != 0u ? b : 0u)
                                                                - ((b >> 31) != 0u ? a : 0u); }

I evaluated that identity in Python against (sext(a) * sext(b)) >> 32 rather than trusting it:

boundary pairs: 100 combinations of {0, 1, 2, 0x7fffffff, 0x80000000, 0x80000001, 0xffffffff,
                                     0xfffffffe, 0x12345678, 0xdeadbeef}   -> 0 mismatches
random pairs:   20 000 uniform 32-bit pairs                                -> 0 mismatches

So the formula is right, including INT_MIN x INT_MIN, INT_MIN x -1 and the 0x80000000 sign boundary.

Two things the check could add without touching production

1. mul_hi_i32 may already exist. The helper joins mul_hi_u32 in the same helper table, and the diff adds a second definition-shaped string. If pixel_aot emits mul_hi_i32 too, a later change to one and not the other would show up as a translation that compiles in one pipeline and not the other. Worth one grep before merge if you have not done it — I checked that the check itself only exercises the gfx2hlsl helper, so nothing pins the two against each other.

2. The word_pack list is now four entries long and hand-maintained. s_pack_hh_b32_b16, s_sext_i32_i8, s_sext_i32_i16, s_mul_hi_u32, s_mul_hi_i32 — the reason each is there is that the per-lane mask cannot supply the whole word. A dictionary ({base: reason}) instead of a tuple would keep the reason next to the entry when the sixth one is added; the comment above it already carries the explanation for all of them together, which is fine until one entry needs a different reason.

Neither is a blocker; the change is correct and the controls are stronger than most.

AI-assisted; the six mutations and the arithmetic check were run locally on Windows 11 build 26300.9974.

<!-- greyfinch-sync:R0Y00/Xbox2Windows:comment:7167271224 --> Imported from [R0Y00/Xbox2Windows](https://github.com/R0Y00/Xbox2Windows/pull/2405#issuecomment-7167271224). Originally posted by [ChazY11](https://github.com/ChazY11) on 2026-11-25T15:43:03Z. --- ## Six mutations, all caught — and the helper's formula checks out against a reference on 100 boundary pairs plus 20 000 random ones Baseline: `tests/startup_gfx2hlsl_mul_hi_i32_check.py` exit 0. | mutation | result | |---|---| | `v_mul_hi_i32` mapped to `mul_hi_u32` | **caught** | | `s_mul_hi_i32` mapped to `mul_hi_u32` | **caught** | | helper drops the `- (b if a<0)` correction | **caught** | | helper drops the `- (a if b<0)` correction | **caught** | | correction term uses the wrong operand (`? a :` instead of `? b :`) | **caught** | | the new `len(srcs) != 2` refusal disabled | **caught** | The last one is the one I did not expect to be pinned, because it guards a *shape* rather than a value; a check that only compared results would miss it. ## Independent arithmetic check The signed multiply-high is built on the unsigned one: ```hlsl uint mul_hi_i32(uint a, uint b) { return mul_hi_u32(a, b) - ((a >> 31) != 0u ? b : 0u) - ((b >> 31) != 0u ? a : 0u); } ``` I evaluated that identity in Python against `(sext(a) * sext(b)) >> 32` rather than trusting it: ```text boundary pairs: 100 combinations of {0, 1, 2, 0x7fffffff, 0x80000000, 0x80000001, 0xffffffff, 0xfffffffe, 0x12345678, 0xdeadbeef} -> 0 mismatches random pairs: 20 000 uniform 32-bit pairs -> 0 mismatches ``` So the formula is right, including `INT_MIN x INT_MIN`, `INT_MIN x -1` and the `0x80000000` sign boundary. ## Two things the check could add without touching production **1. `mul_hi_i32` may already exist.** The helper joins `mul_hi_u32` in the same helper table, and the diff adds a second definition-shaped string. If `pixel_aot` emits `mul_hi_i32` too, a later change to one and not the other would show up as a translation that compiles in one pipeline and not the other. Worth one grep before merge if you have not done it — I checked that the check itself only exercises the `gfx2hlsl` helper, so nothing pins the two against each other. **2. The `word_pack` list is now four entries long and hand-maintained.** `s_pack_hh_b32_b16`, `s_sext_i32_i8`, `s_sext_i32_i16`, `s_mul_hi_u32`, `s_mul_hi_i32` — the reason each is there is that the per-lane mask cannot supply the whole word. A dictionary (`{base: reason}`) instead of a tuple would keep the reason next to the entry when the sixth one is added; the comment above it already carries the explanation for all of them together, which is fine until one entry needs a *different* reason. Neither is a blocker; the change is correct and the controls are stronger than most. AI-assisted; the six mutations and the arithmetic check were run locally on Windows 11 build 26300.9974.
KelboLive commented 2026-11-25 16:05:25 +00:00 (Migrated from github.com)

Imported from R0Y00/Xbox2Windows. Originally posted by KelboLive on 2026-11-25T15:55:22Z.


APPROVED: +12/-6 gfx2hlsl.py adding signed mul_hi_i32 via mul_hi_u32+sign correction. word_pack/mask_dest/arity guard updated. 303-line test with 361-pair grid, mutations, GPU draws. ChazY11 review verified formula on 20K pairs and 6 mutations. No game files.

<!-- greyfinch-sync:R0Y00/Xbox2Windows:comment:7167432487 --> Imported from [R0Y00/Xbox2Windows](https://github.com/R0Y00/Xbox2Windows/pull/2405#issuecomment-7167432487). Originally posted by [KelboLive](https://github.com/KelboLive) on 2026-11-25T15:55:22Z. --- APPROVED: +12/-6 gfx2hlsl.py adding signed mul_hi_i32 via mul_hi_u32+sign correction. word_pack/mask_dest/arity guard updated. 303-line test with 361-pair grid, mutations, GPU draws. ChazY11 review verified formula on 20K pairs and 6 mutations. No game files.
ChazY11 commented 2026-11-25 17:02:00 +00:00 (Migrated from github.com)

Imported from R0Y00/Xbox2Windows. Originally posted by ChazY11 on 2026-11-25T16:57:15Z.


Closing the loop on the note above: pixel_aot already ships the same helper, and the two copies agree today

I flagged in my first comment that mul_hi_i32 may already exist elsewhere. It does:

tools/pixel_aot.py:858   uint mul_hi_i32(uint a, uint b) {
                             // Reinterpreting either operand as signed subtracts its partner from the high word.
                             return mul_hi_u32(a, b) - ((a >> 31) != 0u ? b : 0u) - ((b >> 31) != 0u ? a : 0u);
                         }

and the mul_hi_u32 under it (pixel_aot.py:850) is the same 16-bit carry decomposition as gfx2hlsl.py:5088, written out with longer names and a comment. So this PR adds the third copy of a formula that already exists twice:

gfx2hlsl.py:5088   mul_hi_u32   (no mul_hi_i32 today — this PR adds it)
pixel_aot.py:850   mul_hi_u32
pixel_aot.py:858   mul_hi_i32   identical formula to the one this PR adds

The two mul_hi_i32 bodies are textually different (variable names, comment, line breaks) and semantically identical, which is the pairing that drifts: a fix to one reads as "already handled" to anyone looking at the other. I checked that the arithmetic matches rather than assuming it — evaluating both forms against (sext(a) * sext(b)) >> 32 over the 100 boundary pairs and 20 000 random pairs gives zero mismatches for either.

Two ways to keep them together, in the order I would try them:

  1. Share the text. Both files already carry HLSL helper strings; nothing in the design requires two copies of a pure-integer helper. If pixel_aot's version is the older one, importing it from the other module keeps a single definition and this PR shrinks.
  2. Compare behaviour, not text. If the copies must stay (different precise/legacy moded helpers nearby suggest the two files are not ready to share), a check that evaluates both mul_hi_i32 strings over the same boundary table and compares the results would catch drift without demanding identical text — the text differs legitimately (ftz32 and mad32 already do, and mad32 differs by a whole legacy argument).

I looked at a text-equality check first and dropped it: comparing the six function names the two files share (class16, class32, ftz32, mad32, mul_hi_u32, pack16_rne) shows four of them legitimately different, so "same name ⇒ same text" would be wrong. Behaviour comparison is the version that survives.

Nothing here blocks the PR as it stands.

AI-assisted; the comparison and the arithmetic check were run locally on main at e06aca8b plus this branch.

<!-- greyfinch-sync:R0Y00/Xbox2Windows:comment:7168780532 --> Imported from [R0Y00/Xbox2Windows](https://github.com/R0Y00/Xbox2Windows/pull/2405#issuecomment-7168780532). Originally posted by [ChazY11](https://github.com/ChazY11) on 2026-11-25T16:57:15Z. --- ## Closing the loop on the note above: `pixel_aot` already ships the same helper, and the two copies agree today I flagged in my first comment that `mul_hi_i32` may already exist elsewhere. It does: ```text tools/pixel_aot.py:858 uint mul_hi_i32(uint a, uint b) { // Reinterpreting either operand as signed subtracts its partner from the high word. return mul_hi_u32(a, b) - ((a >> 31) != 0u ? b : 0u) - ((b >> 31) != 0u ? a : 0u); } ``` and the `mul_hi_u32` under it (`pixel_aot.py:850`) is the same 16-bit carry decomposition as `gfx2hlsl.py:5088`, written out with longer names and a comment. So this PR adds the **third** copy of a formula that already exists twice: ```text gfx2hlsl.py:5088 mul_hi_u32 (no mul_hi_i32 today — this PR adds it) pixel_aot.py:850 mul_hi_u32 pixel_aot.py:858 mul_hi_i32 identical formula to the one this PR adds ``` The two `mul_hi_i32` bodies are textually different (variable names, comment, line breaks) and semantically identical, which is the pairing that drifts: a fix to one reads as "already handled" to anyone looking at the other. I checked that the arithmetic matches rather than assuming it — evaluating both forms against `(sext(a) * sext(b)) >> 32` over the 100 boundary pairs and 20 000 random pairs gives zero mismatches for either. Two ways to keep them together, in the order I would try them: 1. **Share the text.** Both files already carry HLSL helper strings; nothing in the design requires two copies of a pure-integer helper. If `pixel_aot`'s version is the older one, importing it from the other module keeps a single definition and this PR shrinks. 2. **Compare behaviour, not text.** If the copies must stay (different `precise`/`legacy` moded helpers nearby suggest the two files are not ready to share), a check that evaluates *both* `mul_hi_i32` strings over the same boundary table and compares the results would catch drift without demanding identical text — the text differs legitimately (`ftz32` and `mad32` already do, and `mad32` differs by a whole `legacy` argument). I looked at a text-equality check first and dropped it: comparing the six function names the two files share (`class16`, `class32`, `ftz32`, `mad32`, `mul_hi_u32`, `pack16_rne`) shows four of them legitimately different, so "same name ⇒ same text" would be wrong. Behaviour comparison is the version that survives. Nothing here blocks the PR as it stands. AI-assisted; the comparison and the arithmetic check were run locally on `main` at `e06aca8b` plus this branch.
tedin7 commented 2026-11-25 19:03:36 +00:00 (Migrated from github.com)

Imported from R0Y00/Xbox2Windows. Originally posted by tedin7 on 2026-11-25T18:31:41Z.

Review: COMMENTED


Review of head 29536aa3 (comment only, no approval).

Code (tools/startup/gfx2hlsl.py): the signed correction mul_hi_u32(a,b) - (a<0 ? b : 0) - (b<0 ? a : 0) is the standard identity and is correct modulo 2^32. v_mul_hi_i32 (VEC_U) and s_mul_hi_i32 (SCA) sit next to their unsigned siblings. The whole-word, lane-mask, vcc/exec and bounds guards of s_mul_hi_u32 are reused. The new operand-count guard also covers the unsigned form. SCC stays unchanged, as for the unsigned op.

Test: the new check covers the helper over a 361-pair edge grid (INT_MININT_MIN, INT_MIN-1, -1*-1, mixed signs), refusals, and WARP/hardware readback with an unsigned-multiply mutation control. It is registered in CMakeLists.txt (controls, warp, hardware) and in both lists in windows.yml. The PR's own CI run exercised the changed workflow: pixel-binary, python-linux and the Windows build are green.

Siblings and duplicates: v_mul_hi_u32 and s_mul_hi_u32 are already handled. A search for other open or merged PRs on mul_hi_i32 found none. #532 (draft) and #1278 (merged) cover other integer multiplies. No "depends on" in the body.

Windows results: the body lists WARP and hardware runs on branch commit 29536aa3, which is this exact head. I did not run Windows and did not re-check those results. No startup claim is made. The PR is 30 commits behind main and I did not update it, to keep the head SHA.

Commands run locally on this head:

  • python3 -B tests/startup_gfx2hlsl_mul_hi_i32_check.py (all ok)
  • git diff --check origin/main...HEAD (clean)
  • python3 tests/docs_links_check.py (19 files, 464 links ok)
  • python3 tests/bidi_controls_check.py (ok)
  • Mutation 1: dropped the b sign-correction term. The test fails at "emitted helper matches reference on 361 edge pairs".
  • Mutation 2: removed s_mul_hi_i32 from the whole-word list. The test fails at "mask-marked SGPR source refused".
  • Both mutations were reverted.

No blocking findings. Merge is left to @R0Y00 / MasterDomino.

AI-assisted; commands listed were executed locally.

<!-- greyfinch-sync:R0Y00/Xbox2Windows:review:6062927749 --> Imported from [R0Y00/Xbox2Windows](https://github.com/R0Y00/Xbox2Windows/pull/2405#pullrequestreview-6062927749). Originally posted by [tedin7](https://github.com/tedin7) on 2026-11-25T18:31:41Z. **Review:** COMMENTED --- Review of head 29536aa3 (comment only, no approval). Code (tools/startup/gfx2hlsl.py): the signed correction `mul_hi_u32(a,b) - (a<0 ? b : 0) - (b<0 ? a : 0)` is the standard identity and is correct modulo 2^32. `v_mul_hi_i32` (VEC_U) and `s_mul_hi_i32` (SCA) sit next to their unsigned siblings. The whole-word, lane-mask, vcc/exec and bounds guards of `s_mul_hi_u32` are reused. The new operand-count guard also covers the unsigned form. SCC stays unchanged, as for the unsigned op. Test: the new check covers the helper over a 361-pair edge grid (INT_MIN*INT_MIN, INT_MIN*-1, -1*-1, mixed signs), refusals, and WARP/hardware readback with an unsigned-multiply mutation control. It is registered in CMakeLists.txt (controls, warp, hardware) and in both lists in windows.yml. The PR's own CI run exercised the changed workflow: pixel-binary, python-linux and the Windows build are green. Siblings and duplicates: v_mul_hi_u32 and s_mul_hi_u32 are already handled. A search for other open or merged PRs on mul_hi_i32 found none. #532 (draft) and #1278 (merged) cover other integer multiplies. No "depends on" in the body. Windows results: the body lists WARP and hardware runs on branch commit 29536aa3, which is this exact head. I did not run Windows and did not re-check those results. No startup claim is made. The PR is 30 commits behind main and I did not update it, to keep the head SHA. Commands run locally on this head: - python3 -B tests/startup_gfx2hlsl_mul_hi_i32_check.py (all ok) - git diff --check origin/main...HEAD (clean) - python3 tests/docs_links_check.py (19 files, 464 links ok) - python3 tests/bidi_controls_check.py (ok) - Mutation 1: dropped the `b` sign-correction term. The test fails at "emitted helper matches reference on 361 edge pairs". - Mutation 2: removed `s_mul_hi_i32` from the whole-word list. The test fails at "mask-marked SGPR source refused". - Both mutations were reverted. No blocking findings. Merge is left to @R0Y00 / MasterDomino. AI-assisted; commands listed were executed locally.
upstream-sync closed this pull request 2026-11-26 03:02:52 +00:00
tedin7 commented 2026-11-26 03:03:21 +00:00 (Migrated from github.com)

Imported from R0Y00/Xbox2Windows. Originally posted by tedin7 on 2026-11-26T02:11:24Z.


Pushed 570e4ea7f: merged current main into this branch (no rebase, no force) so it no longer conflicts.

Conflicts resolved, keeping both sides:

  • tools/startup/gfx2hlsl.py: s_mul_hi_i32 joins s_mul_hi_u32 in the whole-word / operand-count guards; v_mul_hi_i32 sits next to v_mul_hi_u32 in VEC_U; mul_hi_i32 helper added beside the new fma16o/f16rn helpers.
  • CMakeLists.txt and .github/workflows/windows.yml: the mul_hi_i32 tests/entry next to main's new ones.

Verification:

  • Linux: python3 tests/startup_gfx2hlsl_mul_hi_i32_check.py, tests/startup_gfx2hlsl_mul_hi_check.py, tests/startup_gfx2hlsl_sop2_complement_check.py: pass.
  • Win2025 (dev + release): x2w_pipe.py win2025 2405 --patch <merge diff> --regex startup_gfx2hlsl_mul_hi: 6/6 passed (mul_hi_i32 controls, warp, hardware; mul_hi controls, warp, hardware).

AI-assisted; commands listed were executed locally.

<!-- greyfinch-sync:R0Y00/Xbox2Windows:comment:7180549946 --> Imported from [R0Y00/Xbox2Windows](https://github.com/R0Y00/Xbox2Windows/pull/2405#issuecomment-7180549946). Originally posted by [tedin7](https://github.com/tedin7) on 2026-11-26T02:11:24Z. --- Pushed 570e4ea7f: merged current `main` into this branch (no rebase, no force) so it no longer conflicts. Conflicts resolved, keeping both sides: - `tools/startup/gfx2hlsl.py`: `s_mul_hi_i32` joins `s_mul_hi_u32` in the whole-word / operand-count guards; `v_mul_hi_i32` sits next to `v_mul_hi_u32` in `VEC_U`; `mul_hi_i32` helper added beside the new `fma16o`/`f16rn` helpers. - `CMakeLists.txt` and `.github/workflows/windows.yml`: the mul_hi_i32 tests/entry next to main's new ones. Verification: - Linux: `python3 tests/startup_gfx2hlsl_mul_hi_i32_check.py`, `tests/startup_gfx2hlsl_mul_hi_check.py`, `tests/startup_gfx2hlsl_sop2_complement_check.py`: pass. - Win2025 (dev + release): `x2w_pipe.py win2025 2405 --patch <merge diff> --regex startup_gfx2hlsl_mul_hi`: 6/6 passed (mul_hi_i32 controls, warp, hardware; mul_hi controls, warp, hardware). AI-assisted; commands listed were executed locally.
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!2397
No description provided.