shader: admit s_max_u32 and v_mul_hi_u32 in the mesh frontend #3447

Manually merged
github merged 1 commit from github-bot/gh-3445 into main 2026-11-29 10:14:39 +00:00 AGit
Owner

@⁠Leyukaka on GitHub · 2026-11-29 09:16 UTC · original
Leyukaka:shader-mesh-udiv-ops → main · +24 −2 · 2 files · 1 commits · merged 2026-11-29 10:10 UTC

Part of #3418

Branch shader-mesh-udiv-ops, head 0f84c3ac, based on main 1a0120ba. One commit:

  • 0f84c3ac mesh: admit s_max_u32 and v_mul_hi_u32 in the native frontend

Files: src/gfx1013_direct_mesh.inl, tests/native_direct_mesh_check.py.

What changes

The shared compute translator already lowers both ops, and the native mesh frontend refused them as unsupported (line numbers at the branch head):

  • s_max_u32: select on unsigned strict S0 > S1, with SCC set to that compare (src/gfx1013_direct_compute.inl:4134-4146).
  • v_mul_hi_u32: 16-bit partial products, without the signed correction (:4160-4171).

In src/gfx1013_direct_mesh.inl:

  • :911 adds s_max_u32 to the scalar ALU list.
  • :1104 adds v_mul_hi_u32 to the VALU list, with that list's existing condition and partial-write handling.

Evidence

On this head (base 1a0120ba): configure, build compile_dxil, then

ctest -R '^native_direct_mesh$'

Result: native_direct_mesh Passed.

Tests: v-mul-hi-u32 and s-max-u32 are accepted fixtures whose result reaches POS0.x. assert_position_x follows the exported value back through uitofp to the op that produced it.

Mutation on this head, reverted afterwards:

Mutation Result
drop v_mul_hi_u32 from the mesh VALU list (:1104) fails: native compute +0x18: unsupported mesh instruction or EXEC state: v_mul_hi_u32

Mutations on previous revisions (same source change, same two fixtures), not repeated on this head:

Mutation Revision Result
drop s_max_u32 from the mesh scalar list ddd77faf on main d58a9f63 fails: native compute +0x24: unsupported mesh instruction or EXEC state: s_max_u32
signed predicate for s_max_u32 in gfx1013_direct_compute.inl c04dad83 on main 212d4b5f fails: assert 'icmp ugt i32' in text
v_mul_hi_u32 takes the signed correction in gfx1013_direct_compute.inl c04dad83 on main 212d4b5f fails: assert_position_x(text, r'add i32')

Not covered

  • The v_mul_hi_u32 check sees only the last op before POS0.x: add i32 for the unsigned path, sub i32 for the signed correction. The partial-product sequence and the numeric result are not checked. A signed lowering that still ended in add i32 would pass.
  • The s_max_u32 position regex accepts both signed and unsigned selects. The icmp ugt i32 substring is what separates them, and nothing ties that compare to the select.
  • SCC after s_max_u32 is not read by any case. A tie, where > and >= give different SCC values, is not tested.

CI

On main 1a0120ba the pr test preset filter in CMakePresets.json does not match native_direct_mesh, and the pr build preset does not list compile_dxil. Build and test on Windows does not exercise this change.

Interactions with our other open mesh branches

This branch touches the same two files as #3441 (f74eacc8) and the same test file as #3440 (0feac9c2). By git merge-tree --write-tree at these heads:

  • with #3441: content conflict in src/gfx1013_direct_mesh.inl, on the scalar ALU name list. This branch adds s_max_u32 on the line where #3441 adds s_sub_i32 || s_mul_hi_u32. The resolution is the union. tests/native_direct_mesh_check.py merges automatically.
  • with #3440: clean
  • with shader-mesh-exec-widen (958d341e): clean
  • with shader-mesh-exchange-nosave (08cf44c8): clean

The combinations were not built. Whichever of this branch and #3441 merges second needs a rebase.

**@⁠Leyukaka** on GitHub · 2026-11-29 09:16 UTC · [original](https://github.com/R0Y00/Xbox2Windows/pull/3445) `Leyukaka:shader-mesh-udiv-ops` → `main` · +24 −2 · 2 files · 1 commits · merged 2026-11-29 10:10 UTC Part of #3418 Branch `shader-mesh-udiv-ops`, head 0f84c3ac, based on main 1a0120ba. One commit: - 0f84c3ac mesh: admit s_max_u32 and v_mul_hi_u32 in the native frontend Files: `src/gfx1013_direct_mesh.inl`, `tests/native_direct_mesh_check.py`. ## What changes The shared compute translator already lowers both ops, and the native mesh frontend refused them as unsupported (line numbers at the branch head): - `s_max_u32`: select on unsigned strict `S0 > S1`, with SCC set to that compare (`src/gfx1013_direct_compute.inl:4134-4146`). - `v_mul_hi_u32`: 16-bit partial products, without the signed correction (:4160-4171). In `src/gfx1013_direct_mesh.inl`: - :911 adds `s_max_u32` to the scalar ALU list. - :1104 adds `v_mul_hi_u32` to the VALU list, with that list's existing condition and partial-write handling. ## Evidence On this head (base 1a0120ba): configure, build `compile_dxil`, then ``` ctest -R '^native_direct_mesh$' ``` Result: `native_direct_mesh` Passed. Tests: `v-mul-hi-u32` and `s-max-u32` are accepted fixtures whose result reaches POS0.x. `assert_position_x` follows the exported value back through `uitofp` to the op that produced it. Mutation on this head, reverted afterwards: | Mutation | Result | |---|---| | drop `v_mul_hi_u32` from the mesh VALU list (:1104) | fails: `native compute +0x18: unsupported mesh instruction or EXEC state: v_mul_hi_u32` | Mutations on previous revisions (same source change, same two fixtures), not repeated on this head: | Mutation | Revision | Result | |---|---|---| | drop `s_max_u32` from the mesh scalar list | ddd77faf on main d58a9f63 | fails: `native compute +0x24: unsupported mesh instruction or EXEC state: s_max_u32` | | signed predicate for `s_max_u32` in `gfx1013_direct_compute.inl` | c04dad83 on main 212d4b5f | fails: `assert 'icmp ugt i32' in text` | | `v_mul_hi_u32` takes the signed correction in `gfx1013_direct_compute.inl` | c04dad83 on main 212d4b5f | fails: `assert_position_x(text, r'add i32')` | ## Not covered - The `v_mul_hi_u32` check sees only the last op before POS0.x: `add i32` for the unsigned path, `sub i32` for the signed correction. The partial-product sequence and the numeric result are not checked. A signed lowering that still ended in `add i32` would pass. - The `s_max_u32` position regex accepts both signed and unsigned selects. The `icmp ugt i32` substring is what separates them, and nothing ties that compare to the select. - SCC after `s_max_u32` is not read by any case. A tie, where `>` and `>=` give different SCC values, is not tested. ## CI On main 1a0120ba the `pr` test preset filter in `CMakePresets.json` does not match `native_direct_mesh`, and the `pr` build preset does not list `compile_dxil`. `Build and test on Windows` does not exercise this change. ## Interactions with our other open mesh branches This branch touches the same two files as #3441 (f74eacc8) and the same test file as #3440 (0feac9c2). By `git merge-tree --write-tree` at these heads: - with #3441: content conflict in `src/gfx1013_direct_mesh.inl`, on the scalar ALU name list. This branch adds `s_max_u32` on the line where #3441 adds `s_sub_i32 || s_mul_hi_u32`. The resolution is the union. `tests/native_direct_mesh_check.py` merges automatically. - with #3440: clean - with `shader-mesh-exec-widen` (958d341e): clean - with `shader-mesh-exchange-nosave` (08cf44c8): clean The combinations were not built. Whichever of this branch and #3441 merges second needs a rebase.
Both are already lowered by the shared compute translator (s_max_u32
with SCC = S0 > S1, v_mul_hi_u32 through 16-bit partial products); the
mesh frontend refused them as unsupported. s_max_u32 joins the scalar
ALU list and v_mul_hi_u32 the VALU list, keeping that list's EXEC and
partial-write handling.

Tests: one accepted fixture per op whose result reaches POS0.x; each
fails when the op is removed from its list.
github-bot locked as GitHub sync and limited conversation to collaborators 2026-11-29 09:16:40 +00:00
github manually merged commit badc9a499e into main 2026-11-29 10:14:39 +00:00
This discussion has been locked. Commenting is limited to contributors.
No description provided.