shader: lower binary32 add, sub, subrev and mul in the mesh-entry translator #1117

Manually merged
github merged 1 commit from gh-pr/1117/head into gh-pr/1117/base 2026-11-26 22:42:55 +00:00
Owner

@⁠tedin7 on GitHub · 2026-11-24 01:17 UTC · original
tedin7:x2w-mesh-entry-f32-sub-mul-add64 → main · +186 −1 · 4 files · 1 commits · merged 2026-11-24 01:48 UTC

Change

The mesh-entry translator now lowers the per-lane binary32 encodings v_add_f32_e64 and the _e32 and _e64 forms of v_sub_f32, v_subrev_f32 and v_mul_f32. They become precise float expressions (subrev is source 1 minus source 0; the multiply is IEEE, not the legacy zero-wins form). Source and output modifiers are still refused. The code is separate from the scalar and vector u32 work in #1080.

AI-assisted.

Verification

  • python3 -B tests/mesh_entry_check.py binary llvm-mc-19 llvm-objcopy-19 /usr/lib/llvm-19/lib/libLLVM-19.so: exit 0 on this branch (LLVM 19 locally; CI runs LLVM 15).
  • Same command with tools/mesh_entry_aot.py from origin/main: fails (the translator rejects the new opcodes).
  • python3 -B tests/rdna2_tools_check.py: OK (skipped=10).
  • New ctest mesh_entry_float_draw_<adapter> (draw-float) is written for Windows and was not run here (no D3D12 adapter on this Linux host). Its control flow was exercised only with stubbed dxc and renderer.

Evidence and follow-up

  • One synthetic program chains all seven encodings on exact binary32 values. The binary mode evaluates the emitted expressions in binary32 and compares the depth with an independent hand calculation (0.28125).
  • Each sibling opcode (sub for subrev, add for mul, etc.) must give a different depth; modifier spellings must be refused.
  • The draw compares the exported depth word and expects Mesh export trace mismatch for a depth one ulp off and for each sibling opcode.
  • Denormal handling is not exercised.
  • docs/experiments.md updated.

Checklist

  • This pull request covers one reviewable behavior.
  • I included the exact command and result for every check I ran.
  • I considered a negative control or failure case for a new fixture.
  • I updated README/docs when a capability or build requirement changed.
  • I did not include game files, dumps, distribution links or secrets.
**@⁠tedin7** on GitHub · 2026-11-24 01:17 UTC · [original](https://github.com/R0Y00/Xbox2Windows/pull/1117) `tedin7:x2w-mesh-entry-f32-sub-mul-add64` → `main` · +186 −1 · 4 files · 1 commits · merged 2026-11-24 01:48 UTC ## Change The mesh-entry translator now lowers the per-lane binary32 encodings `v_add_f32_e64` and the `_e32` and `_e64` forms of `v_sub_f32`, `v_subrev_f32` and `v_mul_f32`. They become `precise float` expressions (subrev is source 1 minus source 0; the multiply is IEEE, not the legacy zero-wins form). Source and output modifiers are still refused. The code is separate from the scalar and vector u32 work in #1080. AI-assisted. ## Verification - `python3 -B tests/mesh_entry_check.py binary llvm-mc-19 llvm-objcopy-19 /usr/lib/llvm-19/lib/libLLVM-19.so`: exit 0 on this branch (LLVM 19 locally; CI runs LLVM 15). - Same command with `tools/mesh_entry_aot.py` from origin/main: fails (the translator rejects the new opcodes). - `python3 -B tests/rdna2_tools_check.py`: OK (skipped=10). - New ctest `mesh_entry_float_draw_<adapter>` (`draw-float`) is written for Windows and was not run here (no D3D12 adapter on this Linux host). Its control flow was exercised only with stubbed `dxc` and renderer. ## Evidence and follow-up - One synthetic program chains all seven encodings on exact binary32 values. The binary mode evaluates the emitted expressions in binary32 and compares the depth with an independent hand calculation (0.28125). - Each sibling opcode (sub for subrev, add for mul, etc.) must give a different depth; modifier spellings must be refused. - The draw compares the exported depth word and expects `Mesh export trace mismatch` for a depth one ulp off and for each sibling opcode. - Denormal handling is not exercised. - docs/experiments.md updated. ## Checklist - [x] This pull request covers one reviewable behavior. - [x] I included the exact command and result for every check I ran. - [x] I considered a negative control or failure case for a new fixture. - [x] I updated README/docs when a capability or build requirement changed. - [x] I did not include game files, dumps, distribution links or secrets.
Adds v_add_f32_e64 and the e32/e64 forms of v_sub_f32, v_subrev_f32 and v_mul_f32 as precise float expressions. A binary-mode evaluation compares the emitted chain with an independent reference, sibling opcodes must differ, and a new draw-float test checks the exported depth word.
github-bot locked as GitHub sync and limited conversation to collaborators 2026-11-26 22:42:54 +00:00
github manually merged commit 9866ee6ac1 into gh-pr/1117/base 2026-11-26 22:42:55 +00:00
Author
Owner

@⁠chatgpt-codex-connector[bot] on GitHub · 2026-11-24 01:17 UTC · original · edited 2026-11-24 01:20 UTC

Codex Review Summary: ✅ Completed

This comment shows the latest Codex review activity on this pull request.

Review Status Commit Review trigger
📝 Code Review ✅ Completed 2026-11-24T01:20:54.949797Z 9866ee6 PR opened
ℹ️ About Codex in GitHub

Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you

  • Open a pull request for review
  • Mark a draft as ready
  • Comment "@⁠codex review" or "@⁠codex security review".

Codex reacts with 👀 while any review is running, comments if it has suggestions, and reacts with 👍 once all reviews finish with no findings.

**@⁠chatgpt-codex-connector[bot]** on GitHub · 2026-11-24 01:17 UTC · [original](https://github.com/R0Y00/Xbox2Windows/pull/1117#issuecomment-7118954439) · edited 2026-11-24 01:20 UTC <!-- codex-pull-request-review-summary --> <!-- codex-review-state:v1 {"code_review":{"commit_sha":"9866ee6ac1ead0f9a220fc318bb115f5f84732de","has_any_findings":false,"has_unresolved_findings":false,"status":"completed"},"security_review":{"commit_sha":null,"has_any_findings":null,"has_unresolved_findings":null,"status":null}} --> <details> <summary><strong>Codex Review Summary</strong>: ✅ Completed</summary> This comment shows the latest Codex review activity on this pull request. | Review | Status | Commit | Review trigger | | --- | --- | --- | --- | | 📝 **Code Review** | ✅ **Completed** <relative-time datetime="2026-11-24T01:20:54.949797Z">2026-11-24T01:20:54.949797Z</relative-time> | `9866ee6` | PR opened | <details> <summary>ℹ️ About Codex in GitHub</summary> <br/> [Your team has set up Codex to review pull requests in this repo](https://chatgpt.com/codex/cloud/settings/general). Reviews are triggered when you - Open a pull request for review - Mark a draft as ready - Comment "@⁠codex review" or "@⁠codex security review". Codex reacts with 👀 while any review is running, comments if it has suggestions, and reacts with 👍 once all reviews finish with no findings. </details> </details>
This discussion has been locked. Commenting is limited to contributors.
No description provided.