shader: lower v_mul_lo_u32 in pixel_aot #672

Merged
Holastor merged 2 commits from upstream-pr/678 into main 2026-11-23 11:20:29 +00:00
Holastor commented 2026-11-22 19:35:09 +00:00 (Migrated from github.com)

Imported from R0Y00/Xbox2Windows. Originally posted by Holastor on 2026-11-22T19:35:09Z.


Summary

Support 32-bit vector integer arithmetic and bitwise operations in tools/pixel_aot.py:

  • v_lshl_add_u32 ((src0 << (src1 & 31u)) + src2)
  • v_lshl_or_b32 ((src0 << (src1 & 31u)) | src2)
  • v_and_or_b32 ((src0 & src1) | src2)
  • v_or3_b32 (src0 | src1 | src2)
  • v_add3_u32 (src0 + src1 + src2)
  • v_mul_lo_u32 (src0 * src1)

Motivation & Context

In the RDNA 2 (GFX1013) ISA, these 3-source and 2-source vector ALU operations are among the most frequently used instructions in shader resource addressing and bitfield packing:

  • v_lshl_add_u32 ranked #11 in the missing opcode roadmap (23,000 occurrences across 4,132 shaders).
  • v_or3_b32 ranked #29 (14,308 occurrences across 2,977 shaders).
  • v_mul_lo_u32 ranked #30 (93,540 occurrences across 2,958 shaders).

Adding them directly to pixel_aot.py's INTEGER dispatch table automatically enables lowering across pixel_aot.py, provides pattern coverage in scan_unsupported_shaders.py, and unlocks over 4,500 distinct shader programs.

Changes

  1. tools/pixel_aot.py:

    • Added mul_lo_u32 (arity 2, {0} * {1}).
    • Added add3_u32 (arity 3, {0} + {1} + {2}).
    • Added lshl_add_u32 (arity 3, ({0} << ({1} & 31u)) + {2}).
    • Added lshl_or_b32 (arity 3, ({0} << ({1} & 31u)) | {2}).
    • Added and_or_b32 (arity 3, ({0} & {1}) | {2}).
    • Added or3_b32 (arity 3, {0} | {1} | {2}).
  2. tests/pixel_aot_check.py:

    • Added test fixture verifying HLSL expression lowering for all 6 operations with constant buffer and prior-ALU dependencies.
    • Added negative controls verifying rejection of arity mismatches and out-of-range registers (v256).

Verification

python -B tests/pixel_aot_check.py
# Result: 0 (all checks passed)

python -B tests/pso_readiness_check.py
# Result: PSO census, evidence states, and native hash control passed

python -B tests/rdna2_tools_check.py
# Result: Ran 52 tests in 1.087s - OK (skipped=1)

python -B tests/form_coverage_check.py
python -B tests/docs_links_check.py
python -B tests/bidi_controls_check.py
# All passed cleanly
<!-- greyfinch-sync:R0Y00/Xbox2Windows:issue:6546797543 --> Imported from [R0Y00/Xbox2Windows](https://github.com/R0Y00/Xbox2Windows/pull/678). Originally posted by [Holastor](https://github.com/Holastor) on 2026-11-22T19:35:09Z. --- ### Summary Support 32-bit vector integer arithmetic and bitwise operations in `tools/pixel_aot.py`: - `v_lshl_add_u32` (`(src0 << (src1 & 31u)) + src2`) - `v_lshl_or_b32` (`(src0 << (src1 & 31u)) | src2`) - `v_and_or_b32` (`(src0 & src1) | src2`) - `v_or3_b32` (`src0 | src1 | src2`) - `v_add3_u32` (`src0 + src1 + src2`) - `v_mul_lo_u32` (`src0 * src1`) ### Motivation & Context In the RDNA 2 (GFX1013) ISA, these 3-source and 2-source vector ALU operations are among the most frequently used instructions in shader resource addressing and bitfield packing: - `v_lshl_add_u32` ranked #11 in the missing opcode roadmap (23,000 occurrences across 4,132 shaders). - `v_or3_b32` ranked #29 (14,308 occurrences across 2,977 shaders). - `v_mul_lo_u32` ranked #30 (93,540 occurrences across 2,958 shaders). Adding them directly to `pixel_aot.py`'s `INTEGER` dispatch table automatically enables lowering across `pixel_aot.py`, provides pattern coverage in `scan_unsupported_shaders.py`, and unlocks over 4,500 distinct shader programs. ### Changes 1. **`tools/pixel_aot.py`**: - Added `mul_lo_u32` (arity 2, `{0} * {1}`). - Added `add3_u32` (arity 3, `{0} + {1} + {2}`). - Added `lshl_add_u32` (arity 3, `({0} << ({1} & 31u)) + {2}`). - Added `lshl_or_b32` (arity 3, `({0} << ({1} & 31u)) | {2}`). - Added `and_or_b32` (arity 3, `({0} & {1}) | {2}`). - Added `or3_b32` (arity 3, `{0} | {1} | {2}`). 2. **`tests/pixel_aot_check.py`**: - Added test fixture verifying HLSL expression lowering for all 6 operations with constant buffer and prior-ALU dependencies. - Added negative controls verifying rejection of arity mismatches and out-of-range registers (`v256`). ### Verification ```powershell python -B tests/pixel_aot_check.py # Result: 0 (all checks passed) python -B tests/pso_readiness_check.py # Result: PSO census, evidence states, and native hash control passed python -B tests/rdna2_tools_check.py # Result: Ran 52 tests in 1.087s - OK (skipped=1) python -B tests/form_coverage_check.py python -B tests/docs_links_check.py python -B tests/bidi_controls_check.py # All passed cleanly ```
upstream-sync closed this pull request 2026-11-24 06:44:16 +00:00
Holastor commented 2026-11-24 06:48:44 +00:00 (Migrated from github.com)

Imported from R0Y00/Xbox2Windows. Originally posted by Holastor on 2026-11-22T21:03:26Z.


Thanks for the detailed review and verification on the RX 9070 XT @thepatrickworld!

Updated in e9022f26:

  • Parenthesised \mul_lo_u32\ as ({0} * {1}).
  • Added render fixture \check_valu_int32_draw\ in \ ests/pixel_aot_check.py\ (invoked via \check_e64_render):
    • Program A: covers \ _mul_lo_u32, \ _add3_u32, \ _lshl_add_u32, \ _lshl_or_b32\ with wrap-around and overflow bit patterns.
    • Program B: covers \ _and_or_b32\ (verifying precedence S0 & S1) | S2\ on row \(0x0f, 0xf0, 0xff) and \ _or3_b32.
    • Program C: covers shift count masking on immediate values above 31 (\ _lshl_add_u32 v12, 1, 33, 0 -> 2).
    • All programs export bit-exact words through the integer readback target (\integer_export=True) and include oracle mismatch negative controls.
<!-- greyfinch-sync:R0Y00/Xbox2Windows:comment:7085751268 --> Imported from [R0Y00/Xbox2Windows](https://github.com/R0Y00/Xbox2Windows/pull/678#issuecomment-7085751268). Originally posted by [Holastor](https://github.com/Holastor) on 2026-11-22T21:03:26Z. --- Thanks for the detailed review and verification on the RX 9070 XT @thepatrickworld! Updated in e9022f26: - Parenthesised \mul_lo_u32\ as \({0} * {1})\. - Added render fixture \check_valu_int32_draw\ in \ ests/pixel_aot_check.py\ (invoked via \check_e64_render\): - **Program A**: covers \ _mul_lo_u32\, \ _add3_u32\, \ _lshl_add_u32\, \ _lshl_or_b32\ with wrap-around and overflow bit patterns. - **Program B**: covers \ _and_or_b32\ (verifying precedence \(S0 & S1) | S2\ on row \(0x0f, 0xf0, 0xff)\) and \ _or3_b32\. - **Program C**: covers shift count masking on immediate values above 31 (\ _lshl_add_u32 v12, 1, 33, 0 -> 2\). - All programs export bit-exact words through the integer readback target (\integer_export=True\) and include oracle mismatch negative controls.
thepatrickworld commented 2026-11-24 06:48:46 +00:00 (Migrated from github.com)

Imported from R0Y00/Xbox2Windows. Originally posted by thepatrickworld on 2026-11-22T20:52:55Z.


Verification: #678 shader: lower 32-bit vector integer ALU operations

Head c5b0a9e7, merged with main at the time of the run. Two files: tools/pixel_aot.py (+6) and
tests/pixel_aot_check.py (+23).

What it changes

Six entries added to the ALU table:

form lowering
mul_lo_u32 {0} * {1}
add3_u32 {0} + {1} + {2}
lshl_add_u32 ({0} << ({1} & 31u)) + {2}
lshl_or_b32 ({0} << ({1} & 31u)) | {2}
and_or_b32 ({0} & {1}) | {2}
or3_b32 {0} | {1} | {2}

I emitted the HLSL for each and checked it against the RDNA 2 ISA description: lshl_* shift by
S1.u[4:0], and_or is (S0 & S1) | S2, add3 and or3 are three-operand, mul_lo_u32 keeps the
low 32 bits. All six are correct, and the explicit & 31u matches the 5-bit shift field.

Precedence and casting are fine, because int_operand only ever produces atoms — asuint(x),
asint(x), <n>u, or the bits of a float literal — so no template can be captured by a larger
expression. A register and an immediate produce the same shape: v_lshl_add_u32 v12, s44, s45, s46
and v_lshl_add_u32 v12, s44, 2, 7 differ only in the atoms.

One fragility worth a pair of parentheses, not a bug today: "{0} * {1}" is unparenthesised. It is
harmless while operands are atoms, but int16_operand already returns composed expressions such as
(asint(x) << 16) >> 16, so the day a narrowing operand reaches this table the multiplication will
associate wrongly and silently.

Environment

Windows 11 25H2 (build 26200.9711), MSVC 19.44.35230, DXC 1.9.2602.17, AMD RX 9070 XT (vendor
1002, device 7550), driver 32.0.32029.2010. Python 3.15.2 in the worktree venv.

Commands and output

cmake --preset dev -DINTAKE_PYTHON=<venv>
cmake --build --preset dev --parallel 12 --target offscreen_check
set XBOX2WINDOWS_ADAPTER=AMD Radeon RX 9070 XT
ctest --preset dev --no-tests=error -R "^pixel_aot_"
100% tests passed out of 22

No pre-existing suite changed behaviour.

Negative control: I replaced mul_lo_u32 with {0} + {1} in the translator and re-ran
^pixel_aot_hardware$:

0% tests passed, 1 tests failed out of 1

So the added assertions do catch a wrong template.

The reserve: no draw, and no compilation either

None of the six forms is observed by a draw. There is a fixture named check_lshl_add_u32_draw,
and it is easy to count it as cover — I did at first. It does not: it runs s_lshl1_add_u32 through
s_lshl4_add_u32, which are SOP2 scalar forms taking two operands, not v_lshl_add_u32, which is
VOP3 with three. v_lshl_add_u32 appears nowhere in the file outside the new block.

The new block calls translate() but never compile_shader(). Every assertion is a substring match
on HLSL that is never handed to DXC. A template that produces uncompilable code — a wrong type, an
unresolved operand, a mismatched arity that still formats — passes all six.

must_reject also catches KeyError, not just ValueError, so a negative control can succeed for
the wrong reason: a form absent from the table raises KeyError and looks like a rejected arity.

What I would add

A render fixture modelled on the existing one, with integer_export=True so the comparison is
bit-exact. Two four-channel programs cover all six forms:

A: v_mul_lo_u32  v12, s44, s45
   v_add3_u32    v13, s44, s45, s46
   v_lshl_add_u32 v14, s44, 2, s45
   v_lshl_or_b32  v15, s44, s45, s46
   (0xffffffff, 0xffffffff, 0) -> 0x1, 0xfffffffe, 0xfffffffb, 0x80000000
   (0x40000000, 0x80000000, 1) -> 0x0, 0xc0000001, 0x80000000, 0x40000001

B: v_and_or_b32  v14, s44, s45, s46
   v_or3_b32     v15, s44, s45, s46
   v_mul_lo_u32  v12, s44, s45
   v_add3_u32    v13, s44, s45, s46
   (0x0f, 0xf0, 0xff)     -> 0xff, 0xff, 0xe10, 0x1fe
   (0xffffffff, 0x1, 0)   -> 0x1, 0xffffffff, 0xffffffff, 0x0

The (0x0f, 0xf0, 0xff) row is the one that kills a wrong parenthesis: (S0 & S1) | S2 gives 0xff
while S0 & (S1 | S2) gives 0x0f.

For the shift mask, the only case observable at runtime is an immediate above 31:
v_lshl_add_u32 v12, 1, 33, 0 must yield 2. Without the & 31u, DXC folds 1u << 33u to zero on
constants, so a render catches it where the string comparison does not.

What this does not prove

  • Nothing about the six forms running on hardware.
  • Nothing about source modifiers, the e64 encodings, or v_lshl_or_b32 with a shift of exactly 32.
  • The register-range negative control (v_or3_b32 v256) checks a boundary, not the maximum the
    encoder allows.

AI-assisted; runs executed locally.

<!-- greyfinch-sync:R0Y00/Xbox2Windows:comment:7085617217 --> Imported from [R0Y00/Xbox2Windows](https://github.com/R0Y00/Xbox2Windows/pull/678#issuecomment-7085617217). Originally posted by [thepatrickworld](https://github.com/thepatrickworld) on 2026-11-22T20:52:55Z. --- **Verification: #678 `shader: lower 32-bit vector integer ALU operations`** Head `c5b0a9e7`, merged with `main` at the time of the run. Two files: `tools/pixel_aot.py` (+6) and `tests/pixel_aot_check.py` (+23). ### What it changes Six entries added to the ALU table: | form | lowering | | --- | --- | | `mul_lo_u32` | `{0} * {1}` | | `add3_u32` | `{0} + {1} + {2}` | | `lshl_add_u32` | `({0} << ({1} & 31u)) + {2}` | | `lshl_or_b32` | `({0} << ({1} & 31u)) \| {2}` | | `and_or_b32` | `({0} & {1}) \| {2}` | | `or3_b32` | `{0} \| {1} \| {2}` | I emitted the HLSL for each and checked it against the RDNA 2 ISA description: `lshl_*` shift by `S1.u[4:0]`, `and_or` is `(S0 & S1) | S2`, `add3` and `or3` are three-operand, `mul_lo_u32` keeps the low 32 bits. All six are correct, and the explicit `& 31u` matches the 5-bit shift field. Precedence and casting are fine, because `int_operand` only ever produces atoms — `asuint(x)`, `asint(x)`, `<n>u`, or the bits of a float literal — so no template can be captured by a larger expression. A register and an immediate produce the same shape: `v_lshl_add_u32 v12, s44, s45, s46` and `v_lshl_add_u32 v12, s44, 2, 7` differ only in the atoms. One fragility worth a pair of parentheses, not a bug today: `"{0} * {1}"` is unparenthesised. It is harmless while operands are atoms, but `int16_operand` already returns composed expressions such as `(asint(x) << 16) >> 16`, so the day a narrowing operand reaches this table the multiplication will associate wrongly and silently. ### Environment Windows 11 25H2 (build 26200.9711), MSVC 19.44.35230, DXC 1.9.2602.17, AMD RX 9070 XT (vendor `1002`, device `7550`), driver 32.0.32029.2010. Python 3.15.2 in the worktree venv. ### Commands and output ``` cmake --preset dev -DINTAKE_PYTHON=<venv> cmake --build --preset dev --parallel 12 --target offscreen_check set XBOX2WINDOWS_ADAPTER=AMD Radeon RX 9070 XT ctest --preset dev --no-tests=error -R "^pixel_aot_" ``` ``` 100% tests passed out of 22 ``` No pre-existing suite changed behaviour. Negative control: I replaced `mul_lo_u32` with `{0} + {1}` in the translator and re-ran `^pixel_aot_hardware$`: ``` 0% tests passed, 1 tests failed out of 1 ``` So the added assertions do catch a wrong template. ### The reserve: no draw, and no compilation either **None of the six forms is observed by a draw.** There is a fixture named `check_lshl_add_u32_draw`, and it is easy to count it as cover — I did at first. It does not: it runs `s_lshl1_add_u32` through `s_lshl4_add_u32`, which are SOP2 scalar forms taking two operands, not `v_lshl_add_u32`, which is VOP3 with three. `v_lshl_add_u32` appears nowhere in the file outside the new block. The new block calls `translate()` but never `compile_shader()`. Every assertion is a substring match on HLSL that is never handed to DXC. A template that produces uncompilable code — a wrong type, an unresolved operand, a mismatched arity that still formats — passes all six. `must_reject` also catches `KeyError`, not just `ValueError`, so a negative control can succeed for the wrong reason: a form absent from the table raises `KeyError` and looks like a rejected arity. ### What I would add A render fixture modelled on the existing one, with `integer_export=True` so the comparison is bit-exact. Two four-channel programs cover all six forms: ``` A: v_mul_lo_u32 v12, s44, s45 v_add3_u32 v13, s44, s45, s46 v_lshl_add_u32 v14, s44, 2, s45 v_lshl_or_b32 v15, s44, s45, s46 (0xffffffff, 0xffffffff, 0) -> 0x1, 0xfffffffe, 0xfffffffb, 0x80000000 (0x40000000, 0x80000000, 1) -> 0x0, 0xc0000001, 0x80000000, 0x40000001 B: v_and_or_b32 v14, s44, s45, s46 v_or3_b32 v15, s44, s45, s46 v_mul_lo_u32 v12, s44, s45 v_add3_u32 v13, s44, s45, s46 (0x0f, 0xf0, 0xff) -> 0xff, 0xff, 0xe10, 0x1fe (0xffffffff, 0x1, 0) -> 0x1, 0xffffffff, 0xffffffff, 0x0 ``` The `(0x0f, 0xf0, 0xff)` row is the one that kills a wrong parenthesis: `(S0 & S1) | S2` gives `0xff` while `S0 & (S1 | S2)` gives `0x0f`. For the shift mask, the only case observable at runtime is an immediate above 31: `v_lshl_add_u32 v12, 1, 33, 0` must yield `2`. Without the `& 31u`, DXC folds `1u << 33u` to zero on constants, so a render catches it where the string comparison does not. ### What this does not prove - Nothing about the six forms running on hardware. - Nothing about source modifiers, the e64 encodings, or `v_lshl_or_b32` with a shift of exactly 32. - The register-range negative control (`v_or3_b32 v256`) checks a boundary, not the maximum the encoder allows. _AI-assisted; runs executed locally._
thepatrickworld commented 2026-11-24 06:48:49 +00:00 (Migrated from github.com)

Imported from R0Y00/Xbox2Windows. Originally posted by thepatrickworld on 2026-11-22T22:36:41Z.


Validated on e9022f2 — the render fixture does the job

ctest --preset dev --no-tests=error -R "^pixel_aot_" gives 22/22 on RDNA4 (RX 9070 XT, driver 32.0.32029.2010, MSVC 19.44.35230, DXC 1.9.2602.17).

The important part is that you moved from "the translator emits something" to "the GPU returns the right bits", so I mutated every lowered operation the new fixture claims to cover:

M1  mul_lo_u32      ({0} * {1})  ->  {0} * {1}                  22/22  (not observable)
M2  and_or_b32      (S0 & S1) | S2 -> S0 & (S1 | S2)             8 fails
M4  lshl_add_u32    drop & 31u from the shift                    6 fails
M5  add3_u32        {0} + {1} + {2} -> {0} + {1} - {2}           8 fails
M6  lshl_or_b32     | {2} -> + {2}                               6 fails
M7  or3_b32         {0} | {1} | {2} -> {0} | {1} & {2}           6 fails

So five of the six are load-bearing, and (0x0f, 0xf0, 0xff) does exactly what it was for: 0xff with the right precedence, 0x0f with the wrong one.

M1 is not a hole

mul_lo_u32 without the parentheses survives all 22 tests, and that is correct rather than a gap: the translator always emits the expression into a dst = expr;, so ({0} * {1}) and {0} * {1} produce the same code. The parenthesis is defensive, not observable. I am not asking for a test that cannot exist — a fixture only reaches it if the lowering is ever embedded in a larger expression, and then it will matter.

Two notes, neither blocking

  • The three programs are reached through check_e64_render, so the total stays at 22. Nothing wrong with that, but a future reader will look for valu_int32 in ctest -N and not find it.
  • Program C's shift row is the only place & 31u is pinned. Mutating it fails 6 tests, so it holds — worth keeping in mind if a later refactor folds the two lshl forms together.

Nothing blocking left from my side on this PR.

AI-assisted; runs executed locally.

<!-- greyfinch-sync:R0Y00/Xbox2Windows:comment:7086946485 --> Imported from [R0Y00/Xbox2Windows](https://github.com/R0Y00/Xbox2Windows/pull/678#issuecomment-7086946485). Originally posted by [thepatrickworld](https://github.com/thepatrickworld) on 2026-11-22T22:36:41Z. --- **Validated on `e9022f2` — the render fixture does the job** `ctest --preset dev --no-tests=error -R "^pixel_aot_"` gives **22/22** on RDNA4 (RX 9070 XT, driver 32.0.32029.2010, MSVC 19.44.35230, DXC 1.9.2602.17). The important part is that you moved from "the translator emits something" to "the GPU returns the right bits", so I mutated every lowered operation the new fixture claims to cover: ``` M1 mul_lo_u32 ({0} * {1}) -> {0} * {1} 22/22 (not observable) M2 and_or_b32 (S0 & S1) | S2 -> S0 & (S1 | S2) 8 fails M4 lshl_add_u32 drop & 31u from the shift 6 fails M5 add3_u32 {0} + {1} + {2} -> {0} + {1} - {2} 8 fails M6 lshl_or_b32 | {2} -> + {2} 6 fails M7 or3_b32 {0} | {1} | {2} -> {0} | {1} & {2} 6 fails ``` So five of the six are load-bearing, and `(0x0f, 0xf0, 0xff)` does exactly what it was for: `0xff` with the right precedence, `0x0f` with the wrong one. ### M1 is not a hole `mul_lo_u32` without the parentheses survives all 22 tests, and that is correct rather than a gap: the translator always emits the expression into a `dst = expr;`, so `({0} * {1})` and `{0} * {1}` produce the same code. The parenthesis is defensive, not observable. I am not asking for a test that cannot exist — a fixture only reaches it if the lowering is ever embedded in a larger expression, and then it will matter. ### Two notes, neither blocking - The three programs are reached through `check_e64_render`, so the total stays at 22. Nothing wrong with that, but a future reader will look for `valu_int32` in `ctest -N` and not find it. - Program C's shift row is the only place `& 31u` is pinned. Mutating it fails 6 tests, so it holds — worth keeping in mind if a later refactor folds the two `lshl` forms together. Nothing blocking left from my side on this PR. _AI-assisted; runs executed locally._
R0Y00 commented 2026-11-24 06:49:01 +00:00 (Migrated from github.com)

Imported from R0Y00/Xbox2Windows. Originally posted by R0Y00 on 2026-11-23T05:04:35Z.


#766 landed five of the forms in this branch. v_mul_lo_u32 is still separate and also appears in #532. Please coordinate with #532 so there is one implementation of the low product. Your RX 9070 XT precedence and count-masking controls are useful independent evidence for the merged forms. For the remaining multiply, keep a full-width case where nonzero high product bits must be dropped and make sure a wrong expression changes the result.

<!-- greyfinch-sync:R0Y00/Xbox2Windows:comment:7092098643 --> Imported from [R0Y00/Xbox2Windows](https://github.com/R0Y00/Xbox2Windows/pull/678#issuecomment-7092098643). Originally posted by [R0Y00](https://github.com/R0Y00) on 2026-11-23T05:04:35Z. --- #766 landed five of the forms in this branch. `v_mul_lo_u32` is still separate and also appears in #532. Please coordinate with #532 so there is one implementation of the low product. Your RX 9070 XT precedence and count-masking controls are useful independent evidence for the merged forms. For the remaining multiply, keep a full-width case where nonzero high product bits must be dropped and make sure a wrong expression changes the result.
Holastor commented 2026-11-24 06:49:08 +00:00 (Migrated from github.com)

Imported from R0Y00/Xbox2Windows. Originally posted by Holastor on 2026-11-23T10:22:43Z.


Rebased onto main (0306f88) following the merge of #766 and addressed review feedback:

  1. Coordination with #532:

    • _mul_lo_u32 uses the canonical parenthesised low product template: "mul_lo_u32": (2, "({0} * {1})"), matching #532.
    • Removed duplicate entries for the five forms landed in #766.
  2. VALU Independent Evidence Controls Preserved:

    • Program B keeps the _and_or_b32 precedence fixture distinguishing (s44 & s45) | s46 from s44 & (s45 | s46).
    • Program C keeps the _lshl_add_u32 shift-count masking fixture (shift 33 yielding 2, verifying & 31u).
  3. Full-width High-bit Dropping & Wrong Expression Detection:

    • In Program A, added full-width test cases where nonzero high product bits must be dropped:
      • �xffffffff * 0xffffffff = 0xfffffffe00000001 -> drops �xfffffffe, keeping low �x1.
      • �x12345678 * 0x9abcdef0 = 0xaffe56b7c006880 -> drops �x0affe56b, keeping low �x7c006880.
    • Added a dedicated oracle mismatch case specifically corrupting channel 0 ( _mul_lo_u32) to verify that an incorrect product is flagged as a mismatch.
    • Added a mutation negative control in check_valu_int32_draw replacing _mul_lo_u32 with addition and verifying --check-pixel-case detects the pixel mismatch and exits with code 1.

Verification

powershell python -B tests/pixel_aot_check.py python -B tests/rdna2_tools_check.py python -B tests/docs_links_check.py python -B tests/bidi_controls_check.py python -B tests/pso_readiness_check.py python -B tests/form_coverage_check.py
All checks passed cleanly.

<!-- greyfinch-sync:R0Y00/Xbox2Windows:comment:7097858108 --> Imported from [R0Y00/Xbox2Windows](https://github.com/R0Y00/Xbox2Windows/pull/678#issuecomment-7097858108). Originally posted by [Holastor](https://github.com/Holastor) on 2026-11-23T10:22:43Z. --- Rebased onto main (0306f88) following the merge of #766 and addressed review feedback: 1. **Coordination with #532**: - _mul_lo_u32 uses the canonical parenthesised low product template: "mul_lo_u32": (2, "({0} * {1})"), matching #532. - Removed duplicate entries for the five forms landed in #766. 2. **VALU Independent Evidence Controls Preserved**: - Program B keeps the _and_or_b32 precedence fixture distinguishing (s44 & s45) | s46 from s44 & (s45 | s46). - Program C keeps the _lshl_add_u32 shift-count masking fixture (shift 33 yielding 2, verifying & 31u). 3. **Full-width High-bit Dropping & Wrong Expression Detection**: - In Program A, added full-width test cases where nonzero high product bits must be dropped: - �xffffffff * 0xffffffff = 0xfffffffe00000001 -> drops �xfffffffe, keeping low �x1. - �x12345678 * 0x9abcdef0 = 0xaffe56b7c006880 -> drops �x0affe56b, keeping low �x7c006880. - Added a dedicated oracle mismatch case specifically corrupting channel 0 ( _mul_lo_u32) to verify that an incorrect product is flagged as a mismatch. - Added a mutation negative control in check_valu_int32_draw replacing _mul_lo_u32 with addition and verifying --check-pixel-case detects the pixel mismatch and exits with code 1. ### Verification `powershell python -B tests/pixel_aot_check.py python -B tests/rdna2_tools_check.py python -B tests/docs_links_check.py python -B tests/bidi_controls_check.py python -B tests/pso_readiness_check.py python -B tests/form_coverage_check.py ` All checks passed cleanly.
R0Y00 commented 2026-11-24 06:49:08 +00:00 (Migrated from github.com)

Imported from R0Y00/Xbox2Windows. Originally posted by R0Y00 on 2026-11-23T11:09:35Z.


Both Windows jobs failed on the positive wrap case. I reproduced it on WARP and corrected the three miscomputed reference words. The full-width product of 0x12345678 * 0x9abcdef0 is 0x0b00ea4e242d2080, so channel 0 must be 0x242d2080. The replacement-of-multiply mutation still fails. The updated head 93c853f passed the integer draws on RTX 4060 Laptop and WARP, plus LLVM 15 encoding/decoding and the Python checks. Waiting for the two Windows jobs on this head.

<!-- greyfinch-sync:R0Y00/Xbox2Windows:comment:7099146828 --> Imported from [R0Y00/Xbox2Windows](https://github.com/R0Y00/Xbox2Windows/pull/678#issuecomment-7099146828). Originally posted by [R0Y00](https://github.com/R0Y00) on 2026-11-23T11:09:35Z. --- Both Windows jobs failed on the positive wrap case. I reproduced it on WARP and corrected the three miscomputed reference words. The full-width product of `0x12345678 * 0x9abcdef0` is `0x0b00ea4e242d2080`, so channel 0 must be `0x242d2080`. The replacement-of-multiply mutation still fails. The updated head `93c853f` passed the integer draws on RTX 4060 Laptop and WARP, plus LLVM 15 encoding/decoding and the Python checks. Waiting for the two Windows jobs on this head.
thepatrickworld commented 2026-11-24 06:49:14 +00:00 (Migrated from github.com)

Imported from R0Y00/Xbox2Windows. Originally posted by thepatrickworld on 2026-11-23T15:34:57Z.


Post-merge check of 527a255 on RDNA4, and what the new VALU fixture does and does not pin. Measurements plus arithmetic.

Environment and results

  • Windows 11 25H2, build 26200.9711, MSVC 19.44.35230, DXC 1.9.2602.17
  • AMD Radeon RX 9070 XT, vendor 1002, device 7550, driver 32.0.32029.2010, wave width 64
git checkout 527a255 && cmake --preset dev && cmake --build --preset dev --parallel 12 --target offscreen_check
ctest --preset dev --no-tests=error -R "^pixel_aot_e64_(hardware|warp)$" -V
ctest --preset dev --no-tests=error -R "^pixel_aot_(hardware|warp)$" -V
1/2 Test #322: pixel_aot_e64_hardware ...   Passed  10.42 sec
2/2 Test #386: pixel_aot_e64_warp .......   Passed   5.00 sec
1/2 Test #297: pixel_aot_hardware .......   Passed  15.44 sec
2/2 Test #361: pixel_aot_warp ...........   Passed   9.73 sec

check_valu_int32_draw runs through check_e64_render, so pixel_aot_e64_* is where it lands, and both are green here: the nine-quadruplet programs and the mutation control fired on RDNA4, not only on WARP and the RTX.

What the one line does

Before this commit v_mul_lo_u32 was not in INTEGER and fell to the generic Unsupported instruction 20: v_mul_lo_u32 … path (tools/pixel_aot.py:3518 at 527a255^1), so this adds support rather than correcting an expression. What it emits is asfloat((asuint(a) * asuint(b))) — uint-typed, so the wrap is defined — and an immediate stays typed (… * 3u). Operand modifiers are refused before reaching it (Unsupported 32-bit scalar operand -s44), so the row cannot be reached with a sign.

The real risk on that line is its 24-bit neighbour, mul_u32_u24 (:565): copying that row would give mul24_u32(...). The fixture catches that on wrap-max and wrap-large-nonzero-high only. overflow-add is not discriminating: 0x40000000 * 0x80000000 is 0x0 under both * and mul24_u32, and so are the three other channels of that case. I recomputed all eight expected words mod 2^32 and they are right.

Also worth knowing when reading the coverage gain: of the six opcodes the programs exercise, five (add3_u32, or3_b32, and_or_b32, lshl_or_b32, lshl_add_u32) were already in INTEGER before the merge (:555-561 at 527a255^1). Most of the 123 added test lines cover pre-existing code.

Test strength

  • The only semantic mutation is v_mul_lo_u32 → v_add3_u32 (tests/pixel_aot_check.py:10083), and it lives in the draw path, so the Windows job is what exercises it. No mutation exists for lshl_add/lshl_or (& 31u), for the and_or_b32 precedence, or for add3/or3.
  • The oracle-mismatch-* cases are not mutations: they show the comparator rejects deliberately wrong words, not that a wrong lowering would be caught.
  • The expected words are literals rather than a reference function — contrast cmp64_expected (:1955) or swap_ops_reference (:12221) elsewhere in the same file. A wrong convention inside the tool would pass the literals and the GPU readback alike; the readback is the only independent oracle.

AI-assisted; runs executed locally. The arithmetic and the diff reading come from a separate review pass and were recomputed here at 527a255.

<!-- greyfinch-sync:R0Y00/Xbox2Windows:comment:7105790835 --> Imported from [R0Y00/Xbox2Windows](https://github.com/R0Y00/Xbox2Windows/pull/678#issuecomment-7105790835). Originally posted by [thepatrickworld](https://github.com/thepatrickworld) on 2026-11-23T15:34:57Z. --- **Post-merge check of `527a255` on RDNA4, and what the new VALU fixture does and does not pin.** Measurements plus arithmetic. ### Environment and results - Windows 11 25H2, build **26200.9711**, MSVC **19.44.35230**, DXC **1.9.2602.17** - **AMD Radeon RX 9070 XT**, vendor 1002, device 7550, driver **32.0.32029.2010**, wave width 64 ``` git checkout 527a255 && cmake --preset dev && cmake --build --preset dev --parallel 12 --target offscreen_check ctest --preset dev --no-tests=error -R "^pixel_aot_e64_(hardware|warp)$" -V ctest --preset dev --no-tests=error -R "^pixel_aot_(hardware|warp)$" -V ``` ``` 1/2 Test #322: pixel_aot_e64_hardware ... Passed 10.42 sec 2/2 Test #386: pixel_aot_e64_warp ....... Passed 5.00 sec 1/2 Test #297: pixel_aot_hardware ....... Passed 15.44 sec 2/2 Test #361: pixel_aot_warp ........... Passed 9.73 sec ``` `check_valu_int32_draw` runs through `check_e64_render`, so `pixel_aot_e64_*` is where it lands, and both are green here: the nine-quadruplet programs and the mutation control fired on RDNA4, not only on WARP and the RTX. ### What the one line does Before this commit `v_mul_lo_u32` was not in `INTEGER` and fell to the generic `Unsupported instruction 20: v_mul_lo_u32 …` path (`tools/pixel_aot.py:3518` at `527a255^1`), so this adds support rather than correcting an expression. What it emits is `asfloat((asuint(a) * asuint(b)))` — uint-typed, so the wrap is defined — and an immediate stays typed (`… * 3u`). Operand modifiers are refused before reaching it (`Unsupported 32-bit scalar operand -s44`), so the row cannot be reached with a sign. The real risk on that line is its 24-bit neighbour, `mul_u32_u24` (`:565`): copying that row would give `mul24_u32(...)`. The fixture catches that on `wrap-max` and `wrap-large-nonzero-high` only. `overflow-add` is not discriminating: `0x40000000 * 0x80000000` is `0x0` under both `*` and `mul24_u32`, and so are the three other channels of that case. I recomputed all eight expected words mod 2^32 and they are right. Also worth knowing when reading the coverage gain: of the six opcodes the programs exercise, five (`add3_u32`, `or3_b32`, `and_or_b32`, `lshl_or_b32`, `lshl_add_u32`) were already in `INTEGER` before the merge (`:555-561` at `527a255^1`). Most of the 123 added test lines cover pre-existing code. ### Test strength - The only semantic mutation is `v_mul_lo_u32` → `v_add3_u32` (`tests/pixel_aot_check.py:10083`), and it lives in the draw path, so the Windows job is what exercises it. No mutation exists for `lshl_add`/`lshl_or` (`& 31u`), for the `and_or_b32` precedence, or for `add3`/`or3`. - The `oracle-mismatch-*` cases are not mutations: they show the comparator rejects deliberately wrong words, not that a wrong lowering would be caught. - The expected words are literals rather than a reference function — contrast `cmp64_expected` (`:1955`) or `swap_ops_reference` (`:12221`) elsewhere in the same file. A wrong convention inside the tool would pass the literals and the GPU readback alike; the readback is the only independent oracle. _AI-assisted; runs executed locally. The arithmetic and the diff reading come from a separate review pass and were recomputed here at `527a255`._
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!672
No description provided.