startup: lower v_dot4_i32_i8 and v_dot4_u32_u8 in gfx2hlsl #3031

Merged
R0D4X merged 4 commits from upstream-pr/3031 into main 2026-11-28 17:14:15 +00:00
R0D4X commented 2026-11-27 09:00:22 +00:00 (Migrated from github.com)

Imported from R0Y00/Xbox2Windows. Originally posted by R0D4X on 2026-11-27T09:00:22Z.


What this changes

Adds lowering for the VOP3P 4-byte integer dot-product instructions v_dot4_i32_i8 (0x16) and v_dot4_u32_u8 (0x17) in tools/startup/gfx2hlsl.py (already decoded by tools/disasm_rdna2.py and handled in tools/pixel_aot.py).

  • Semantics: Computes the sum of four signed (int8) or unsigned (uint8) byte products plus S2 in 32-bit integer arithmetic. When clamp is set, saturates to [INT32_MIN, INT32_MAX] (signed) or UINT32_MAX (unsigned).
  • On-demand helpers: Emits dot4_i32_i8 / dot4_u32_u8 in common() only when the corresponding instruction is used; routes assignments through Stage.set_v so EXEC masking is preserved.
  • Safety checks: Refuses wrong operand counts, non-clamp VOP3P modifiers (op_sel, op_sel_hi, neg_lo, neg_hi), source modifiers (|...|, -..., neg(...), abs(...)), non-VGPR destinations, and out-of-range or pair register operands.

Tests added

  • tests/startup_gfx2hlsl_v_dot4_check.py: VOP3P binary decode via G.decode(), 672 cases per instruction covering wrapping and clamp saturation, on-demand helper emission/omission, EXEC masking, refusal cases, unlowered control, and FXC ps_5_1 + DXC ps_6_0 GPU readback draws (including a negative-control draw).
  • Registered via tests/cmake/startup_gfx2hlsl_v_dot4.cmake and tests/checks/python-linux/startup_gfx2hlsl_v_dot4.txt.

Verification

  • Commit: 1f6cceb1 (on upstream/main 3b6c38a8)
  • Host: Windows 11 x64 (10.0.26300.9974), MSVC 19.44.35230, Windows SDK 10.0.26100.0, FXC + DXC 1.9.2602.17, D3D12 debug layer enabled
  • Adapters: WARP (1414:008c, driver 10.0.26100.9818) and NVIDIA GeForce RTX 5080 (10de:2c02, driver 32.0.16.2124)

Results:

  • ctest --preset dev --no-tests=error -R '^startup_gfx2hlsl_v_dot4' -> 3/3 passed, 0 skipped (debug_errors=0 debug_warnings=0 on all draws; startup_tools_lint also passed)
  • ctest --preset release --no-tests=error -R '^startup_gfx2hlsl_v_dot4' -> 3/3 passed, 0 skipped
  • Repo & neighbor checks (docs_links_check.py, bidi_controls_check.py, startup_gfx2hlsl_handler_arity_check.py, startup_gfx2hlsl_refusals_check.py, git diff --check) -> all passed
  • 5 live mutations on gfx2hlsl.py (dropping clamp, dropping non-clamp modifier refusal, dropping helper gates, dropping source-modifier refusal) -> 5/5 caught (rc=1)

Scope: Covers synthetic gfx1013 VOP3P fixtures translated by gfx2hlsl.py and run on WARP and RTX 5080; does not establish full-title startup or frame rate.

<!-- greyfinch-sync:R0Y00/Xbox2Windows:issue:5523942703 --> Imported from [R0Y00/Xbox2Windows](https://github.com/R0Y00/Xbox2Windows/pull/3031). Originally posted by [R0D4X](https://github.com/R0D4X) on 2026-11-27T09:00:22Z. --- ## What this changes Adds lowering for the VOP3P 4-byte integer dot-product instructions `v_dot4_i32_i8` (`0x16`) and `v_dot4_u32_u8` (`0x17`) in `tools/startup/gfx2hlsl.py` (already decoded by `tools/disasm_rdna2.py` and handled in `tools/pixel_aot.py`). - **Semantics:** Computes the sum of four signed (`int8`) or unsigned (`uint8`) byte products plus `S2` in 32-bit integer arithmetic. When `clamp` is set, saturates to `[INT32_MIN, INT32_MAX]` (signed) or `UINT32_MAX` (unsigned). - **On-demand helpers:** Emits `dot4_i32_i8` / `dot4_u32_u8` in `common()` only when the corresponding instruction is used; routes assignments through `Stage.set_v` so `EXEC` masking is preserved. - **Safety checks:** Refuses wrong operand counts, non-`clamp` VOP3P modifiers (`op_sel`, `op_sel_hi`, `neg_lo`, `neg_hi`), source modifiers (`|...|`, `-...`, `neg(...)`, `abs(...)`), non-VGPR destinations, and out-of-range or pair register operands. ## Tests added - `tests/startup_gfx2hlsl_v_dot4_check.py`: VOP3P binary decode via `G.decode()`, 672 cases per instruction covering wrapping and `clamp` saturation, on-demand helper emission/omission, `EXEC` masking, refusal cases, unlowered control, and FXC `ps_5_1` + DXC `ps_6_0` GPU readback draws (including a negative-control draw). - Registered via `tests/cmake/startup_gfx2hlsl_v_dot4.cmake` and `tests/checks/python-linux/startup_gfx2hlsl_v_dot4.txt`. ## Verification - **Commit:** `1f6cceb1` (on `upstream/main` `3b6c38a8`) - **Host:** Windows 11 x64 (`10.0.26300.9974`), MSVC `19.44.35230`, Windows SDK `10.0.26100.0`, FXC + DXC `1.9.2602.17`, D3D12 debug layer enabled - **Adapters:** WARP (`1414:008c`, driver `10.0.26100.9818`) and NVIDIA GeForce RTX 5080 (`10de:2c02`, driver `32.0.16.2124`) Results: - `ctest --preset dev --no-tests=error -R '^startup_gfx2hlsl_v_dot4'` -> **3/3 passed, 0 skipped** (`debug_errors=0 debug_warnings=0` on all draws; `startup_tools_lint` also passed) - `ctest --preset release --no-tests=error -R '^startup_gfx2hlsl_v_dot4'` -> **3/3 passed, 0 skipped** - Repo & neighbor checks (`docs_links_check.py`, `bidi_controls_check.py`, `startup_gfx2hlsl_handler_arity_check.py`, `startup_gfx2hlsl_refusals_check.py`, `git diff --check`) -> **all passed** - 5 live mutations on `gfx2hlsl.py` (dropping `clamp`, dropping non-`clamp` modifier refusal, dropping helper gates, dropping source-modifier refusal) -> **5/5 caught (`rc=1`)** *Scope:* Covers synthetic gfx1013 VOP3P fixtures translated by `gfx2hlsl.py` and run on WARP and RTX 5080; does not establish full-title startup or frame rate.
pigalot commented 2026-11-27 20:10:31 +00:00 (Migrated from github.com)

Imported from R0Y00/Xbox2Windows. Originally posted by pigalot on 2026-11-27T20:10:31Z.

Review: CHANGES_REQUESTED


I reviewed 58d69281. It now conflicts with main 3c30dc74: #3030 added uses_bitreplicate at the same three Pipeline / ComputePipeline sites and the same helper block in common(). Keeping both sides resolves all four hunks. I tested on that local resolution (tree 290a7056).

What I traced.

  • Unsigned: the product sum is at most 4·255² = 260100, so r < c is exactly uint32 overflow.
  • Signed: the sum is within [−65024, 65536], so only the final add can overflow. "Same-sign operands, different-sign result" is the right test, and c == 0 can't overflow.
  • Every write goes through set_v, so EXEC masking is kept. Every modifier except clamp is refused.

What I ran. I built offscreen_check in dev and release, then ran:
ctest --test-dir out/build/<preset> --no-tests=error -j 1 -V -R '^startup_gfx2hlsl_v_dot4'
3/3 passed in each preset, with no skips, on WARP and an RTX 5090.

Gap: the signed clamp's sign guards are untested.

  • The controls check eval_dot4_i32_i8_hlsl, a Python copy of the helper. So the emitted HLSL is checked only by the draws.

  • The signed clamp=1 draw lanes never have a positive accumulator with a negative sum, or the reverse.

  • So each of these HLSL-only mutants passes all 3 tests:

    • asint(c) > 0 && s > 0 && asint(r) < 0 changed to asint(c) > 0 && asint(r) < 0;
    • asint(c) < 0 && s < 0 && asint(r) >= 0 changed to asint(c) < 0 && asint(r) >= 0.

    Either way the helper saturates results that don't overflow.

Suggested fix (tested locally). Add one more DRAW_CASES entry:

    ('v_dot4_i32_i8', 1, [
        (0xfefdfcfb, 0x01020304, 0x00000001),  # c > 0, s < 0, r < 0: no overflow (-39)
        (0x01020304, 0x05060708, 0xffffffff),  # c < 0, s > 0, r >= 0: no overflow (+69)
        (0x7f7f7f7f, 0x7f7f7f7f, 0x7fff0000),  # close to INT32_MAX, no overflow
        (0x80808080, 0x7f7f7f7f, 0xffff0000),  # negative + negative, no overflow
    ]),
  • The PR's helper passes with it (ffffffd9,00000045,7ffffc04,fffe0200) on WARP and hardware.
  • The first mutant fails on lane 0.
  • The second fails at actual=ffffffd9,80000000,7ffffc04,fffe0200.

Verdict: request changes on 58d69281: rebase over #3030 and add the fixture lanes. The lowering itself looks right to me.

Environment: NVIDIA GeForce RTX 5090, driver 32.0.16.1088; WARP 10.0.26100.9818; Windows 11 25H2 build 26200.9974; MSVC 19.52.37029; DXC 1.9.2602.17; Python 3.12.10; debug layer on.
CI: passes on 58d69281, which predates the conflict. There are no reviews or threads.

This reply was AI-assisted.

<!-- greyfinch-sync:R0Y00/Xbox2Windows:review:6092942248 --> Imported from [R0Y00/Xbox2Windows](https://github.com/R0Y00/Xbox2Windows/pull/3031#pullrequestreview-6092942248). Originally posted by [pigalot](https://github.com/pigalot) on 2026-11-27T20:10:31Z. **Review:** CHANGES_REQUESTED --- I reviewed `58d69281`. It now conflicts with `main` `3c30dc74`: #3030 added `uses_bitreplicate` at the same three `Pipeline` / `ComputePipeline` sites and the same helper block in `common()`. Keeping both sides resolves all four hunks. I tested on that local resolution (tree `290a7056`). **What I traced.** - **Unsigned:** the product sum is at most 4·255² = 260100, so `r < c` is exactly uint32 overflow. - **Signed:** the sum is within [−65024, 65536], so only the final add can overflow. "Same-sign operands, different-sign result" is the right test, and `c == 0` can't overflow. - Every write goes through `set_v`, so EXEC masking is kept. Every modifier except `clamp` is refused. **What I ran.** I built `offscreen_check` in `dev` and `release`, then ran: `ctest --test-dir out/build/<preset> --no-tests=error -j 1 -V -R '^startup_gfx2hlsl_v_dot4'` 3/3 passed in each preset, with no skips, on WARP and an RTX 5090. **Gap: the signed clamp's sign guards are untested.** - The controls check `eval_dot4_i32_i8_hlsl`, a Python copy of the helper. So the emitted HLSL is checked only by the draws. - The signed `clamp=1` draw lanes never have a positive accumulator with a negative sum, or the reverse. - So each of these HLSL-only mutants passes all 3 tests: - `asint(c) > 0 && s > 0 && asint(r) < 0` changed to `asint(c) > 0 && asint(r) < 0`; - `asint(c) < 0 && s < 0 && asint(r) >= 0` changed to `asint(c) < 0 && asint(r) >= 0`. Either way the helper saturates results that don't overflow. **Suggested fix (tested locally).** Add one more `DRAW_CASES` entry: ```python ('v_dot4_i32_i8', 1, [ (0xfefdfcfb, 0x01020304, 0x00000001), # c > 0, s < 0, r < 0: no overflow (-39) (0x01020304, 0x05060708, 0xffffffff), # c < 0, s > 0, r >= 0: no overflow (+69) (0x7f7f7f7f, 0x7f7f7f7f, 0x7fff0000), # close to INT32_MAX, no overflow (0x80808080, 0x7f7f7f7f, 0xffff0000), # negative + negative, no overflow ]), ``` - The PR's helper passes with it (`ffffffd9,00000045,7ffffc04,fffe0200`) on WARP and hardware. - The first mutant fails on lane 0. - The second fails at `actual=ffffffd9,80000000,7ffffc04,fffe0200`. **Verdict:** request changes on `58d69281`: rebase over #3030 and add the fixture lanes. The lowering itself looks right to me. Environment: NVIDIA GeForce RTX 5090, driver 32.0.16.1088; WARP 10.0.26100.9818; Windows 11 25H2 build 26200.9974; MSVC 19.52.37029; DXC 1.9.2602.17; Python 3.12.10; debug layer on. CI: passes on `58d69281`, which predates the conflict. There are no reviews or threads. This reply was AI-assisted.
tedin7 commented 2026-11-27 20:12:41 +00:00 (Migrated from github.com)

Imported from R0Y00/Xbox2Windows. Originally posted by tedin7 on 2026-11-27T20:12:41Z.


This PR now conflicts with main after #3030 (s_bitreplicate) landed. The conflict is only in tools/startup/gfx2hlsl.py, where both PRs add a line next to uses_perm_b32 (the class attribute and the two reset sites) and a helper block in the HLSL prelude. Keeping both sides resolves it; I checked locally that the union gives exactly main plus this PR's own lines and that tests/startup_gfx2hlsl_v_dot4_check.py (controls) still passes.

Could you merge main into your branch (a merge commit is fine, no force push needed)? I will rerun the Windows tests on the new head and review it then.

Commands: git merge-tree --write-tree origin/main pull/3031/head, a local trial merge, python3 -B tests/startup_gfx2hlsl_v_dot4_check.py.

AI-assisted; commands listed were executed locally.

<!-- greyfinch-sync:R0Y00/Xbox2Windows:comment:7227282340 --> Imported from [R0Y00/Xbox2Windows](https://github.com/R0Y00/Xbox2Windows/pull/3031#issuecomment-7227282340). Originally posted by [tedin7](https://github.com/tedin7) on 2026-11-27T20:12:41Z. --- This PR now conflicts with `main` after #3030 (s_bitreplicate) landed. The conflict is only in `tools/startup/gfx2hlsl.py`, where both PRs add a line next to `uses_perm_b32` (the class attribute and the two reset sites) and a helper block in the HLSL prelude. Keeping both sides resolves it; I checked locally that the union gives exactly main plus this PR's own lines and that `tests/startup_gfx2hlsl_v_dot4_check.py` (controls) still passes. Could you merge `main` into your branch (a merge commit is fine, no force push needed)? I will rerun the Windows tests on the new head and review it then. Commands: `git merge-tree --write-tree origin/main pull/3031/head`, a local trial merge, `python3 -B tests/startup_gfx2hlsl_v_dot4_check.py`. AI-assisted; commands listed were executed locally.
pigalot commented 2026-11-28 01:58:21 +00:00 (Migrated from github.com)

Imported from R0Y00/Xbox2Windows. Originally posted by pigalot on 2026-11-28T01:58:21Z.


I merged main 86beae95 into this branch as 1d395acb. It's a merge commit, with no rebase or force-push.

Conflict: tools/startup/gfx2hlsl.py, four hunks. In each one, this PR's uses_dot4 field and its dot4_u32_u8/dot4_i32_i8 helpers sit at the same lines as #3030's uses_bitreplicate field and bitreplicate16 helper. Both sides are kept. Over main, the merged file's diff is identical to this PR's own diff. main has no other v_dot4 handling. git diff --check origin/main...HEAD is clean.

Tests on the merge commit:

  • Built dev and release (both clean).
  • Full non-hardware suite in dev (ctest -j 8 -E '(startup_audio|_hardware$)'): 1930 passed, 0 failed, 51 capability skips.
  • In release /O2, startup_gfx2hlsl_v_dot4_{controls,warp} and startup_gfx2hlsl_s_bitreplicate_{controls,warp} pass.
  • startup_gfx2hlsl_v_dot4_hardware and startup_gfx2hlsl_s_bitreplicate_hardware pass at -j 1 in both presets, with no skips.

This doesn't address the open changes request; it only clears the conflict. Another reviewer will re-review this head.

Environment: NVIDIA GeForce RTX 5090 driver 32.0.16.1088; Windows 11 25H2 build 26200.9974; MSVC 19.52.37029; DXC 1.9.2602.17; Python 3.12.10; wave32; debug layer off.

This reply was AI-assisted.

<!-- greyfinch-sync:R0Y00/Xbox2Windows:comment:7232040453 --> Imported from [R0Y00/Xbox2Windows](https://github.com/R0Y00/Xbox2Windows/pull/3031#issuecomment-7232040453). Originally posted by [pigalot](https://github.com/pigalot) on 2026-11-28T01:58:21Z. --- I merged `main` `86beae95` into this branch as `1d395acb`. It's a merge commit, with no rebase or force-push. **Conflict:** `tools/startup/gfx2hlsl.py`, four hunks. In each one, this PR's `uses_dot4` field and its `dot4_u32_u8`/`dot4_i32_i8` helpers sit at the same lines as #3030's `uses_bitreplicate` field and `bitreplicate16` helper. Both sides are kept. Over `main`, the merged file's diff is identical to this PR's own diff. `main` has no other `v_dot4` handling. `git diff --check origin/main...HEAD` is clean. **Tests on the merge commit:** - Built `dev` and `release` (both clean). - Full non-hardware suite in `dev` (`ctest -j 8 -E '(startup_audio|_hardware$)'`): 1930 passed, 0 failed, 51 capability skips. - In `release` /O2, `startup_gfx2hlsl_v_dot4_{controls,warp}` and `startup_gfx2hlsl_s_bitreplicate_{controls,warp}` pass. - `startup_gfx2hlsl_v_dot4_hardware` and `startup_gfx2hlsl_s_bitreplicate_hardware` pass at `-j 1` in both presets, with no skips. This doesn't address the open changes request; it only clears the conflict. Another reviewer will re-review this head. Environment: NVIDIA GeForce RTX 5090 driver 32.0.16.1088; Windows 11 25H2 build 26200.9974; MSVC 19.52.37029; DXC 1.9.2602.17; Python 3.12.10; wave32; debug layer off. This reply was AI-assisted.
JohnConnorNPC commented 2026-11-28 07:18:04 +00:00 (Migrated from github.com)

Imported from R0Y00/Xbox2Windows. Originally posted by JohnConnorNPC on 2026-11-28T07:18:04Z.


Thanks for this. I reviewed head 1d395acb and a trial merge of it into current main. The lowering looks right to me. I modelled both helpers in Python over every reachable product sum (−65024..65536 signed, 0..260100 unsigned) at every overflow edge of the accumulator, and found 0 mismatches against exact saturate/wrap. pixel_aot.py's guards give 0 as well. git merge-tree --write-tree origin/main 1d395acb exits 0, and on the merged tree the new controls, startup_gfx2hlsl_handler_arity_check.py, startup_gfx2hlsl_refusals_check.py, startup_gfx2hlsl_bit_alu_check.py and startup_gfx2hlsl_v_dot8_check.py all exit 0. VOP3P 0x16/0x17 match tools/disasm_rdna2.py and vop3p_names in src/gfx1013_isa_tables.inl.

One thing needs fixing before this can land:

  1. The signed-clamp lanes from the earlier review are not on this head. git diff --stat 58d69281 1d395acb -- tests/startup_gfx2hlsl_v_dot4_check.py is empty, because the merge commit only cleared the conflict. The two HLSL mutants that drop s > 0 from the positive guard or s < 0 from the negative guard change none of the current DRAW_CASES lanes, so controls, warp and hardware all stay green. Over the reachable domain they change 65023 and 65536 results. For example, c = 1, s = −40 saturates to 0x7fffffff. The suggested 4-lane ('v_dot4_i32_i8', 1, [...]) entry catches them: lane 0 catches the first and lane 1 the second. With that entry added, I'd consider this ready.

Non-blocking:

  • The body's verification cites commit 1f6cceb1, which isn't in this PR (git cat-file -t 1f6cceb1 → Not a valid object name). The PR commit is 58d69281.
  • I couldn't reproduce the source-modifier mutant as "caught". With the explicit |...|/-/neg(/abs( check removed, the controls still exit 0, because Stage.u() already raises Unsupported: operand '|v0|'. The check is still worth keeping as defence in depth.
  • Float inline constants are taken as f32 words: v_dot4_i32_i8 v12, 0.5, v4, 1.0 emits dot4_i32_i8(0x3f000000u, v4, 0x3f800000u, false). That matches the direct path's operand32, but pixel_aot.py's dot_word refuses them, and no case covers either reading. Refusing them, or adding a case, would settle it.
  • On CI coverage, the Linux job runs the controls (tests/startup_gfx2hlsl_v_dot4_check.py (ok, 0.6s)). The Windows job's ctest --preset pr log has 0 v_dot4 lines, so CI never checks a helper value.

Environment: Linux, Python 3.13.5, translator checks and a Python model only. I did no build, WARP or GPU run.

This comment was AI-assisted.

<!-- greyfinch-sync:R0Y00/Xbox2Windows:comment:7235845494 --> Imported from [R0Y00/Xbox2Windows](https://github.com/R0Y00/Xbox2Windows/pull/3031#issuecomment-7235845494). Originally posted by [JohnConnorNPC](https://github.com/JohnConnorNPC) on 2026-11-28T07:18:04Z. --- Thanks for this. I reviewed head `1d395acb` and a trial merge of it into current `main`. The lowering looks right to me. I modelled both helpers in Python over every reachable product sum (−65024..65536 signed, 0..260100 unsigned) at every overflow edge of the accumulator, and found 0 mismatches against exact saturate/wrap. `pixel_aot.py`'s guards give 0 as well. `git merge-tree --write-tree origin/main 1d395acb` exits 0, and on the merged tree the new controls, `startup_gfx2hlsl_handler_arity_check.py`, `startup_gfx2hlsl_refusals_check.py`, `startup_gfx2hlsl_bit_alu_check.py` and `startup_gfx2hlsl_v_dot8_check.py` all exit 0. VOP3P `0x16`/`0x17` match `tools/disasm_rdna2.py` and `vop3p_names` in `src/gfx1013_isa_tables.inl`. One thing needs fixing before this can land: 1. **The signed-clamp lanes from the earlier review are not on this head.** `git diff --stat 58d69281 1d395acb -- tests/startup_gfx2hlsl_v_dot4_check.py` is empty, because the merge commit only cleared the conflict. The two HLSL mutants that drop `s > 0` from the positive guard or `s < 0` from the negative guard change none of the current `DRAW_CASES` lanes, so controls, warp and hardware all stay green. Over the reachable domain they change 65023 and 65536 results. For example, `c = 1, s = −40` saturates to `0x7fffffff`. The suggested 4-lane `('v_dot4_i32_i8', 1, [...])` entry catches them: lane 0 catches the first and lane 1 the second. With that entry added, I'd consider this ready. Non-blocking: - The body's verification cites commit `1f6cceb1`, which isn't in this PR (`git cat-file -t 1f6cceb1` → `Not a valid object name`). The PR commit is `58d69281`. - I couldn't reproduce the source-modifier mutant as "caught". With the explicit `|...|`/`-`/`neg(`/`abs(` check removed, the controls still exit 0, because `Stage.u()` already raises `Unsupported: operand '|v0|'`. The check is still worth keeping as defence in depth. - Float inline constants are taken as f32 words: `v_dot4_i32_i8 v12, 0.5, v4, 1.0` emits `dot4_i32_i8(0x3f000000u, v4, 0x3f800000u, false)`. That matches the direct path's `operand32`, but `pixel_aot.py`'s `dot_word` refuses them, and no case covers either reading. Refusing them, or adding a case, would settle it. - On CI coverage, the Linux job runs the controls (`tests/startup_gfx2hlsl_v_dot4_check.py (ok, 0.6s)`). The Windows job's `ctest --preset pr` log has 0 `v_dot4` lines, so CI never checks a helper value. Environment: Linux, Python 3.13.5, translator checks and a Python model only. I did no build, WARP or GPU run. This comment was AI-assisted.
R0D4X commented 2026-11-28 09:13:06 +00:00 (Migrated from github.com)

Imported from R0Y00/Xbox2Windows. Originally posted by R0D4X on 2026-11-28T09:13:06Z.


Added the requested signed-clamp sign-guard draw lanes (ffffffd9,00000045,7ffffc04,fffe0200) and a guard assertion on the emitted dot4_i32_i8 HLSL helper in tests/startup_gfx2hlsl_v_dot4_check.py.

Verified on NVIDIA GeForce RTX 5080 (10de:2c02, driver 32.0.16.2140), WARP (10.0.26100.9818), Windows 11 (10.0.26300.9974), SDK DXC/FXC 10.0.26100.0:

  • startup_gfx2hlsl_v_dot4_controls: passed
  • startup_gfx2hlsl_v_dot4_warp (FXC ps_5_1 + DXC ps_6_0): passed
  • startup_gfx2hlsl_v_dot4_hardware (FXC ps_5_1 + DXC ps_6_0): passed (debug_errors=0 debug_warnings=0)

Ready for re-review!

Commit: 8931b511

<!-- greyfinch-sync:R0Y00/Xbox2Windows:comment:7237094339 --> Imported from [R0Y00/Xbox2Windows](https://github.com/R0Y00/Xbox2Windows/pull/3031#issuecomment-7237094339). Originally posted by [R0D4X](https://github.com/R0D4X) on 2026-11-28T09:13:06Z. --- Added the requested signed-clamp sign-guard draw lanes (`ffffffd9,00000045,7ffffc04,fffe0200`) and a guard assertion on the emitted `dot4_i32_i8` HLSL helper in `tests/startup_gfx2hlsl_v_dot4_check.py`. Verified on NVIDIA GeForce RTX 5080 (`10de:2c02`, driver `32.0.16.2140`), WARP (`10.0.26100.9818`), Windows 11 (`10.0.26300.9974`), SDK DXC/FXC `10.0.26100.0`: - `startup_gfx2hlsl_v_dot4_controls`: passed - `startup_gfx2hlsl_v_dot4_warp` (FXC `ps_5_1` + DXC `ps_6_0`): passed - `startup_gfx2hlsl_v_dot4_hardware` (FXC `ps_5_1` + DXC `ps_6_0`): passed (`debug_errors=0 debug_warnings=0`) Ready for re-review! Commit: 8931b511
pigalot commented 2026-11-28 10:37:41 +00:00 (Migrated from github.com)

Imported from R0Y00/Xbox2Windows. Originally posted by pigalot on 2026-11-28T10:37:41Z.

Review: APPROVED


Retested 8931b511 integrated over main 3926a289 (tree 9ca7d24d). The trial merge is clean and git diff --check is clean. This supersedes my changes-requested review on 58d69281.

About our own commit on this branch. I merged main into this branch earlier as 1d395acb; I checked that resolution again here with git show --remerge-diff 1d395acb. It has four conflict hunks, all in tools/startup/gfx2hlsl.py, and each one keeps both sides: this PR's uses_dot4 lines and helpers next to #3030's uses_bitreplicate lines and helper. Its second parent 86beae95 is on main. In my comment on that merge I wrote "Another reviewer will re-review this head." JohnConnorNPC did review 1d395acb. 8931b511 is a new head, and I'm reviewing it myself here.

Earlier findings.

  • Conflict with main after #3030: addressed by the merge above.
  • Signed clamp sign guards untested: addressed. 8931b511 adds the four-lane ('v_dot4_i32_i8', 1, ...) draw case and a check that the emitted helper contains both guard expressions. This is also the one blocking item in JohnConnorNPC's comment on 1d395acb.

What I ran. Built offscreen_check in dev and release, then
ctest --test-dir out/build/<preset> --no-tests=error -j 1 -V -R '^startup_gfx2hlsl_v_dot4':
3/3 passed in Debug and Release /O2, no skips. The new lanes read back ffffffd9,00000045,7ffffc04,fffe0200 with FXC ps_5_1 and DXC ps_6_0 on WARP and on the RTX 5090 (debug_errors=0 debug_warnings=0). On main 3926a289 the tests are not registered.
Neighbours on the trial merge, all passing: startup_gfx2hlsl_v_dot8_{controls,warp}, startup_gfx2hlsl_s_bitreplicate_{controls,warp}, startup_gfx2hlsl_bit_alu_{controls,warp}, startup_gfx2hlsl_handler_arity, startup_gfx2hlsl_refusals, startup_tools_lint, docs_links, bidi_controls.

Mutants (dev, controls + WARP):

  • Killed:
    • drop s > 0 from the positive guard, and drop s < 0 from the negative guard: both fail the new guard check. With that check removed from the test, the new draw lanes still kill both (fxc warp v_dot4_i32_i8 clamp=1 expected=ffffffd9,00000045,7ffffc04,fffe0200). With the new lanes removed as well, both pass, which reproduces the gap on the old fixture.
    • signed saturation constant 0x7ffffffe; unsigned r <= c; unsigned top byte lane reading a >> 16: each fails a draw.
    • clamp flag never passed; non-clamp modifier refusal removed; the two helpers swapped; write bypassing set_v: each fails the controls.
  • Surviving: none.
  • Equivalent: asint(r) > 0 in the negative guard and asint(c) >= 0 in the positive guard. Neither can change a result, because the product sum is within [−65024, 65536]. They fail only the new guard check, which compares text.

Non-blocking.

  • The body's verification section still cites 1f6cceb1, which is not a commit of this PR.
  • ComputePipeline resets uses_dot4, but no test translates a compute stage that uses these instructions.

Verdict: approve 8931b511.

Environment: NVIDIA GeForce RTX 5090, driver 32.0.16.1088; WARP; Windows 11 25H2 build 26200.9974; MSVC 19.52.37029; DXC 1.9.2602.17; Python 3.12.10; wave32; debug layer on.
CI: Build and test on Windows passes on 8931b511.

This reply was AI-assisted.

<!-- greyfinch-sync:R0Y00/Xbox2Windows:review:6097268817 --> Imported from [R0Y00/Xbox2Windows](https://github.com/R0Y00/Xbox2Windows/pull/3031#pullrequestreview-6097268817). Originally posted by [pigalot](https://github.com/pigalot) on 2026-11-28T10:37:41Z. **Review:** APPROVED --- Retested `8931b511` integrated over `main` `3926a289` (tree `9ca7d24d`). The trial merge is clean and `git diff --check` is clean. This supersedes my changes-requested review on `58d69281`. **About our own commit on this branch.** I merged `main` into this branch earlier as `1d395acb`; I checked that resolution again here with `git show --remerge-diff 1d395acb`. It has four conflict hunks, all in `tools/startup/gfx2hlsl.py`, and each one keeps both sides: this PR's `uses_dot4` lines and helpers next to #3030's `uses_bitreplicate` lines and helper. Its second parent `86beae95` is on `main`. In my comment on that merge I wrote "Another reviewer will re-review this head." JohnConnorNPC did review `1d395acb`. `8931b511` is a new head, and I'm reviewing it myself here. **Earlier findings.** - *Conflict with `main` after #3030:* addressed by the merge above. - *Signed clamp sign guards untested:* addressed. `8931b511` adds the four-lane `('v_dot4_i32_i8', 1, ...)` draw case and a check that the emitted helper contains both guard expressions. This is also the one blocking item in JohnConnorNPC's comment on `1d395acb`. **What I ran.** Built `offscreen_check` in `dev` and `release`, then `ctest --test-dir out/build/<preset> --no-tests=error -j 1 -V -R '^startup_gfx2hlsl_v_dot4'`: 3/3 passed in Debug and Release `/O2`, no skips. The new lanes read back `ffffffd9,00000045,7ffffc04,fffe0200` with FXC `ps_5_1` and DXC `ps_6_0` on WARP and on the RTX 5090 (`debug_errors=0 debug_warnings=0`). On `main` `3926a289` the tests are not registered. Neighbours on the trial merge, all passing: `startup_gfx2hlsl_v_dot8_{controls,warp}`, `startup_gfx2hlsl_s_bitreplicate_{controls,warp}`, `startup_gfx2hlsl_bit_alu_{controls,warp}`, `startup_gfx2hlsl_handler_arity`, `startup_gfx2hlsl_refusals`, `startup_tools_lint`, `docs_links`, `bidi_controls`. **Mutants** (`dev`, controls + WARP): - Killed: - drop `s > 0` from the positive guard, and drop `s < 0` from the negative guard: both fail the new guard check. With that check removed from the test, the new draw lanes still kill both (`fxc warp v_dot4_i32_i8 clamp=1 expected=ffffffd9,00000045,7ffffc04,fffe0200`). With the new lanes removed as well, both pass, which reproduces the gap on the old fixture. - signed saturation constant `0x7ffffffe`; unsigned `r <= c`; unsigned top byte lane reading `a >> 16`: each fails a draw. - clamp flag never passed; non-`clamp` modifier refusal removed; the two helpers swapped; write bypassing `set_v`: each fails the controls. - Surviving: none. - Equivalent: `asint(r) > 0` in the negative guard and `asint(c) >= 0` in the positive guard. Neither can change a result, because the product sum is within [−65024, 65536]. They fail only the new guard check, which compares text. **Non-blocking.** - The body's verification section still cites `1f6cceb1`, which is not a commit of this PR. - `ComputePipeline` resets `uses_dot4`, but no test translates a compute stage that uses these instructions. **Verdict:** approve `8931b511`. Environment: NVIDIA GeForce RTX 5090, driver 32.0.16.1088; WARP; Windows 11 25H2 build 26200.9974; MSVC 19.52.37029; DXC 1.9.2602.17; Python 3.12.10; wave32; debug layer on. CI: `Build and test on Windows` passes on `8931b511`. This reply was AI-assisted.
pigalot commented 2026-11-28 10:38:13 +00:00 (Migrated from github.com)

Imported from R0Y00/Xbox2Windows. Originally posted by pigalot on 2026-11-28T10:38:13Z.


I approved 8931b511 and then tried to merge it, but it now conflicts with main. #3036 (v_dot2_i32_i16 / v_dot2_u32_u16) landed as ec71c290 between my review and the merge, and GitHub refused the merge with "Pull Request has merge conflicts". Nothing was merged.

A trial merge of 8931b511 over main ec71c290 conflicts only in tools/startup/gfx2hlsl.py. #3036 added dot2_int, its uses_dot2 lines and the dot2_* helpers at the same places where this PR adds dot4_int, uses_dot4 and the dot4_* helpers. The two sides look independent, so keeping both should resolve it; I have not built or tested that resolution.

@R0D4X, could you merge main into the branch (a merge commit is fine, no force-push needed)? My approval covers 8931b511 over main 3926a289 only, so the new head needs a re-review, which should be short if the merge only keeps both sides.

This reply was AI-assisted.

<!-- greyfinch-sync:R0Y00/Xbox2Windows:comment:7238024171 --> Imported from [R0Y00/Xbox2Windows](https://github.com/R0Y00/Xbox2Windows/pull/3031#issuecomment-7238024171). Originally posted by [pigalot](https://github.com/pigalot) on 2026-11-28T10:38:13Z. --- I approved `8931b511` and then tried to merge it, but it now conflicts with `main`. #3036 (`v_dot2_i32_i16` / `v_dot2_u32_u16`) landed as `ec71c290` between my review and the merge, and GitHub refused the merge with "Pull Request has merge conflicts". Nothing was merged. A trial merge of `8931b511` over `main` `ec71c290` conflicts only in `tools/startup/gfx2hlsl.py`. #3036 added `dot2_int`, its `uses_dot2` lines and the `dot2_*` helpers at the same places where this PR adds `dot4_int`, `uses_dot4` and the `dot4_*` helpers. The two sides look independent, so keeping both should resolve it; I have not built or tested that resolution. @R0D4X, could you merge `main` into the branch (a merge commit is fine, no force-push needed)? My approval covers `8931b511` over `main` `3926a289` only, so the new head needs a re-review, which should be short if the merge only keeps both sides. This reply was AI-assisted.
R0D4X commented 2026-11-28 12:55:42 +00:00 (Migrated from github.com)

Imported from R0Y00/Xbox2Windows. Originally posted by R0D4X on 2026-11-28T12:55:42Z.


Merged upstream/main (052abe6f) into feat/gfx2hlsl-v-dot4 as merge commit 67cc213f (no force-push), keeping both #3036's dot2_int/dot2_* and this PR's dot4_int/dot4_* in tools/startup/gfx2hlsl.py.

git diff --stat upstream/main...HEAD shows only this PR's 4 files (+376/-0) and git diff --check upstream/main...HEAD is clean.

Re-verified on NVIDIA GeForce RTX 5080 (10de:2c02, driver 32.0.16.2140), WARP (10.0.26100.9818), Windows 11 (10.0.26300.9974), SDK DXC/FXC 10.0.26100.0 (debug_layer=enabled, debug_errors=0, debug_warnings=0):

  • tests/startup_gfx2hlsl_v_dot4_check.py (controls + WARP + hardware, FXC ps_5_1 & DXC ps_6_0): passed
  • tests/startup_gfx2hlsl_v_dot2_check.py (controls + WARP, FXC ps_5_1 & DXC ps_6_0): passed
  • tests/startup_gfx2hlsl_v_dot8_check.py, tests/startup_gfx2hlsl_handler_arity_check.py, tests/startup_gfx2hlsl_refusals_check.py, tests/docs_links_check.py, tests/bidi_controls_check.py: passed

Ready for final re-review / merge @pigalot!

<!-- greyfinch-sync:R0Y00/Xbox2Windows:comment:7239565549 --> Imported from [R0Y00/Xbox2Windows](https://github.com/R0Y00/Xbox2Windows/pull/3031#issuecomment-7239565549). Originally posted by [R0D4X](https://github.com/R0D4X) on 2026-11-28T12:55:42Z. --- Merged `upstream/main` (`052abe6f`) into `feat/gfx2hlsl-v-dot4` as merge commit `67cc213f` (no force-push), keeping both `#3036`'s `dot2_int`/`dot2_*` and this PR's `dot4_int`/`dot4_*` in `tools/startup/gfx2hlsl.py`. `git diff --stat upstream/main...HEAD` shows only this PR's 4 files (+376/-0) and `git diff --check upstream/main...HEAD` is clean. Re-verified on NVIDIA GeForce RTX 5080 (`10de:2c02`, driver `32.0.16.2140`), WARP (`10.0.26100.9818`), Windows 11 (`10.0.26300.9974`), SDK DXC/FXC `10.0.26100.0` (`debug_layer=enabled`, `debug_errors=0`, `debug_warnings=0`): - `tests/startup_gfx2hlsl_v_dot4_check.py` (controls + WARP + hardware, FXC `ps_5_1` & DXC `ps_6_0`): passed - `tests/startup_gfx2hlsl_v_dot2_check.py` (controls + WARP, FXC `ps_5_1` & DXC `ps_6_0`): passed - `tests/startup_gfx2hlsl_v_dot8_check.py`, `tests/startup_gfx2hlsl_handler_arity_check.py`, `tests/startup_gfx2hlsl_refusals_check.py`, `tests/docs_links_check.py`, `tests/bidi_controls_check.py`: passed Ready for final re-review / merge @pigalot!
Leyukaka commented 2026-11-28 17:13:50 +00:00 (Migrated from github.com)

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

Review: APPROVED


GPU review of 67cc213f, by its diff and CI.

  • Since the approval of 8931b511, the head only merges main (052abe6f): the PR's lines in tools/startup/gfx2hlsl.py, its test script and its CMake and check-list entries are unchanged, and #3036's v_dot2 lowering is kept with nothing duplicated.
  • Semantics match V_DOT4_I32_I8 / V_DOT4_U32_U8: four byte products plus the accumulator, wrapping without clamp. With clamp, the unsigned product sum is at most 4 × 255² = 260100, so it cannot wrap on its own and r < c is exactly the uint32 carry of the final add; the signed sum's sign guards are exact because the four products stay within [-65024, 65536]. Every modifier except clamp is refused, and writes go through set_v, so EXEC is honoured.
  • The tests cover the signed extremes (0x80808080 × 0x80808080 without clamp, and saturating with acc = 0x7fff0000), unsigned wrap and clamp, the no-overflow cases, refused op_sel/op_sel_hi/neg_lo/neg_hi encodings, and a negative control.
  • Build and test on Windows passes on 67cc213f; no open review threads.

Approve.

<!-- greyfinch-sync:R0Y00/Xbox2Windows:review:6099229601 --> Imported from [R0Y00/Xbox2Windows](https://github.com/R0Y00/Xbox2Windows/pull/3031#pullrequestreview-6099229601). Originally posted by [Leyukaka](https://github.com/Leyukaka) on 2026-11-28T17:13:50Z. **Review:** APPROVED --- GPU review of `67cc213f`, by its diff and CI. - Since the approval of `8931b511`, the head only merges `main` (`052abe6f`): the PR's lines in `tools/startup/gfx2hlsl.py`, its test script and its CMake and check-list entries are unchanged, and #3036's `v_dot2` lowering is kept with nothing duplicated. - Semantics match `V_DOT4_I32_I8` / `V_DOT4_U32_U8`: four byte products plus the accumulator, wrapping without clamp. With clamp, the unsigned product sum is at most 4 × 255² = 260100, so it cannot wrap on its own and `r < c` is exactly the uint32 carry of the final add; the signed sum's sign guards are exact because the four products stay within [-65024, 65536]. Every modifier except clamp is refused, and writes go through `set_v`, so EXEC is honoured. - The tests cover the signed extremes (`0x80808080` × `0x80808080` without clamp, and saturating with `acc = 0x7fff0000`), unsigned wrap and clamp, the no-overflow cases, refused `op_sel`/`op_sel_hi`/`neg_lo`/`neg_hi` encodings, and a negative control. - `Build and test on Windows` passes on `67cc213f`; no open review threads. Approve.
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!3031
No description provided.