shader: lower mesh float median and base-2 exponent (Part of #3703) #3921

Merged
timbot103 merged 1 commit from upstream-pr/3921 into main 2026-12-03 11:59:48 +00:00
timbot103 commented 2026-12-03 10:38:50 +00:00 (Migrated from github.com)

Imported from R0Y00/Xbox2Windows. Originally posted by timbot103 on 2026-12-03T10:38:50Z.


Part of #3703

A2 mesh median and exponent

The census reports 67 first refusals at v_med3_f32 and 23 at v_exp_f32. Source-built fixtures for both opcodes reproduced the standard unsupported mesh instruction diagnostic before this change. Private census coverage is pending.

The mesh frontend routes VOP3 v_med3_f32 and VOP1 or VOP3 v_exp_f32 through the existing direct float ALU. Median selects the folded FMin result when any operand is NaN. The exponent uses DXIL Exp, opcode 21, for a base-2 power. Valid source abs and neg use the shared sign-bit transformations. Clamp, omod, op_sel, SDWA, DPP and nonzero unused exponent fields stay refused.

The fixture evaluates the DXIL feeding the position export. It covers ordinary medians, each NaN position, multiple NaNs, infinities and positive and negative exponents. GPU regression tests cover the existing mesh suite. Exact hardware floating-point parity was not measured.

Verification

Base d2e6a4ed, patch 326b56e8. Both builds passed, including the full Debug build and its C++17 shader frontend target.

  • Debug mesh suite passed 22/23. The missing-position WARP case reported accepted=1 refused=0 and passed its synchronized retry.
  • Release mesh suite passed 20/23. The three known asynchronous WARP failures were guarded allocation, empty allocation and missing position. Each reported accepted=1 refused=0, as on the clean Release baseline. All three passed with X2W_SYNC_MESH_REQUESTS=1.
  • All five RTX 5080 mesh cases passed in both configurations. The PR preset passed 1/1, covering 14 source-built DXIL cases and 10 refusal controls. No test skipped. The bidi, documentation link and diff checks passed.

Windows 11 10.0.26200.9974, MSVC 19.44.35230, Windows SDK 10.0.26100, DXC 1.9.2602.17. WARP 10.0.26100.9818 and NVIDIA GeForce RTX 5080 with driver 32.0.16.2140. The D3D12 debug layer was unavailable.

cmake --build out/build/dev -- -j 6
cmake --build out/build/release --target compile_dxil offscreen_check d3d12_xs_shim startup_indirect_draw_indexed -- -j 6
ctest --preset dev --no-tests=error -j 1 -R 'native_direct_mesh|native_direct_container|native_mesh_'
ctest --preset release --no-tests=error -j 1 -R 'native_direct_mesh|native_direct_container|native_mesh_'
ctest --preset pr --no-tests=error -j 1 -R '^native_mesh_med3_exp_ir$'
$env:X2W_SYNC_MESH_REQUESTS = '1'
ctest --preset release --no-tests=error -j 1 -R '^native_mesh_((guarded|empty)_allocation|missing_position)_warp$'
ctest --preset dev --no-tests=error -j 1 -R '^native_mesh_missing_position_warp
python tests/docs_links_check.py
git diff --check origin/main...HEAD
python tests/bidi_controls_check.py
python tests/docs_links_check.py
git diff --check origin/main...HEAD

🤖 Generated with Claude Code

<!-- greyfinch-sync:R0Y00/Xbox2Windows:issue:5624797717 --> Imported from [R0Y00/Xbox2Windows](https://github.com/R0Y00/Xbox2Windows/pull/3921). Originally posted by [timbot103](https://github.com/timbot103) on 2026-12-03T10:38:50Z. --- Part of #3703 ## A2 mesh median and exponent The census reports 67 first refusals at `v_med3_f32` and 23 at `v_exp_f32`. Source-built fixtures for both opcodes reproduced the standard unsupported mesh instruction diagnostic before this change. Private census coverage is pending. The mesh frontend routes VOP3 `v_med3_f32` and VOP1 or VOP3 `v_exp_f32` through the existing direct float ALU. Median selects the folded FMin result when any operand is NaN. The exponent uses DXIL Exp, opcode 21, for a base-2 power. Valid source abs and neg use the shared sign-bit transformations. Clamp, omod, op_sel, SDWA, DPP and nonzero unused exponent fields stay refused. The fixture evaluates the DXIL feeding the position export. It covers ordinary medians, each NaN position, multiple NaNs, infinities and positive and negative exponents. GPU regression tests cover the existing mesh suite. Exact hardware floating-point parity was not measured. ## Verification Base `d2e6a4ed`, patch `326b56e8`. Both builds passed, including the full Debug build and its C++17 shader frontend target. - Debug mesh suite passed 22/23. The missing-position WARP case reported `accepted=1 refused=0` and passed its synchronized retry. - Release mesh suite passed 20/23. The three known asynchronous WARP failures were guarded allocation, empty allocation and missing position. Each reported `accepted=1 refused=0`, as on the clean Release baseline. All three passed with `X2W_SYNC_MESH_REQUESTS=1`. - All five RTX 5080 mesh cases passed in both configurations. The PR preset passed 1/1, covering 14 source-built DXIL cases and 10 refusal controls. No test skipped. The bidi, documentation link and diff checks passed. Windows 11 10.0.26200.9974, MSVC 19.44.35230, Windows SDK 10.0.26100, DXC 1.9.2602.17. WARP 10.0.26100.9818 and NVIDIA GeForce RTX 5080 with driver 32.0.16.2140. The D3D12 debug layer was unavailable. ```powershell cmake --build out/build/dev -- -j 6 cmake --build out/build/release --target compile_dxil offscreen_check d3d12_xs_shim startup_indirect_draw_indexed -- -j 6 ctest --preset dev --no-tests=error -j 1 -R 'native_direct_mesh|native_direct_container|native_mesh_' ctest --preset release --no-tests=error -j 1 -R 'native_direct_mesh|native_direct_container|native_mesh_' ctest --preset pr --no-tests=error -j 1 -R '^native_mesh_med3_exp_ir$' $env:X2W_SYNC_MESH_REQUESTS = '1' ctest --preset release --no-tests=error -j 1 -R '^native_mesh_((guarded|empty)_allocation|missing_position)_warp$' ctest --preset dev --no-tests=error -j 1 -R '^native_mesh_missing_position_warp python tests/docs_links_check.py git diff --check origin/main...HEAD python tests/bidi_controls_check.py python tests/docs_links_check.py git diff --check origin/main...HEAD ``` 🤖 Generated with [Claude Code](https://claude.com/claude-code)
JohnConnorNPC commented 2026-12-03 11:17:34 +00:00 (Migrated from github.com)

Imported from R0Y00/Xbox2Windows. Originally posted by JohnConnorNPC on 2026-12-03T11:17:34Z.


Reviewed 326b56e8955c against main d2e6a4ed. Verdict: no MUST or SHOULD, two NITs.

  1. NIT (PR body): in the reproduction block, ctest --preset dev --no-tests=error -j 1 -R '^native_mesh_missing_position_warp has no closing quote, so pasted into PowerShell it waits for more input. python tests/docs_links_check.py and git diff --check origin/main...HEAD are each listed twice.
  2. NIT (docs/experiments/native-mesh-vector-alu.md): there are now two blank lines before ## Mesh median and base-2 exponentiation.

Checked on Linux (clang-cl cross build, run under Wine): the new IR check passes at head (14 DXIL cases, 10 refusal controls); four source mutations each turned it red; docs links, bidi controls, form coverage and git diff --check pass; the branch merged cleanly with main at d31b66435. Not run: MSVC suites, WARP or hardware readbacks, census delta.

Not a finding on the code: the question on #3703 about the A2 row still had no reply at review time.

AI-assisted review.

<!-- greyfinch-sync:R0Y00/Xbox2Windows:comment:7376486411 --> Imported from [R0Y00/Xbox2Windows](https://github.com/R0Y00/Xbox2Windows/pull/3921#issuecomment-7376486411). Originally posted by [JohnConnorNPC](https://github.com/JohnConnorNPC) on 2026-12-03T11:17:34Z. --- Reviewed `326b56e8955c` against main `d2e6a4ed`. **Verdict: no MUST or SHOULD, two NITs.** 1. **NIT** (PR body): in the reproduction block, `ctest --preset dev --no-tests=error -j 1 -R '^native_mesh_missing_position_warp` has no closing quote, so pasted into PowerShell it waits for more input. `python tests/docs_links_check.py` and `git diff --check origin/main...HEAD` are each listed twice. 2. **NIT** (`docs/experiments/native-mesh-vector-alu.md`): there are now two blank lines before `## Mesh median and base-2 exponentiation`. Checked on Linux (clang-cl cross build, run under Wine): the new IR check passes at head (14 DXIL cases, 10 refusal controls); four source mutations each turned it red; docs links, bidi controls, form coverage and `git diff --check` pass; the branch merged cleanly with main at `d31b66435`. Not run: MSVC suites, WARP or hardware readbacks, census delta. Not a finding on the code: the question on #3703 about the A2 row still had no reply at review time. AI-assisted review.
R0Y00 commented 2026-12-03 11:59:43 +00:00 (Migrated from github.com)

Imported from R0Y00/Xbox2Windows. Originally posted by R0Y00 on 2026-12-03T11:59:43Z.

Review: APPROVED


Approved 326b56e8. The mesh entry routes plain median and exponent through the existing float lowering, with checks for unsupported modifiers and the unused VOP3 exponent operands. Independent MSVC Debug with SDK DXC, Windows build 26300: native_mesh_med3_exp_ir and native_direct_mesh passed (2/2), including the emitted median NaN cases, exponent infinities and operand refusals. This checks the compiler output; I did not run a GPU draw. Optional follow-up: guard the CTest registration on the DXC executable and DLLs, like the other tool-dependent fixtures.

<!-- greyfinch-sync:R0Y00/Xbox2Windows:review:6169330588 --> Imported from [R0Y00/Xbox2Windows](https://github.com/R0Y00/Xbox2Windows/pull/3921#pullrequestreview-6169330588). Originally posted by [R0Y00](https://github.com/R0Y00) on 2026-12-03T11:59:43Z. **Review:** APPROVED --- Approved 326b56e8. The mesh entry routes plain median and exponent through the existing float lowering, with checks for unsupported modifiers and the unused VOP3 exponent operands. Independent MSVC Debug with SDK DXC, Windows build 26300: native_mesh_med3_exp_ir and native_direct_mesh passed (2/2), including the emitted median NaN cases, exponent infinities and operand refusals. This checks the compiler output; I did not run a GPU draw. Optional follow-up: guard the CTest registration on the DXC executable and DLLs, like the other tool-dependent fixtures.
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!3921
No description provided.