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

Merged
tedin7 merged 1 commit from upstream-pr/1117 into main 2026-11-24 01:48:28 +00:00
tedin7 commented 2026-11-24 01:17:19 +00:00 (Migrated from github.com)

Imported from R0Y00/Xbox2Windows. Originally posted by tedin7 on 2026-11-24T01:17:19Z.


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.
<!-- greyfinch-sync:R0Y00/Xbox2Windows:issue:6572387156 --> Imported from [R0Y00/Xbox2Windows](https://github.com/R0Y00/Xbox2Windows/pull/1117). Originally posted by [tedin7](https://github.com/tedin7) on 2026-11-24T01:17:19Z. --- ## 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.
upstream-sync closed this pull request 2026-11-24 06:46:24 +00:00
chatgpt-codex-connector[bot commented 2026-11-24 06:50:01 +00:00 (Migrated from github.com)

Imported from R0Y00/Xbox2Windows. Originally posted by chatgpt-codex-connector[bot] on 2026-11-24T01:17:30Z.


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.

<!-- greyfinch-sync:R0Y00/Xbox2Windows:comment:7118954439 --> Imported from [R0Y00/Xbox2Windows](https://github.com/R0Y00/Xbox2Windows/pull/1117#issuecomment-7118954439). Originally posted by [chatgpt-codex-connector[bot]](https://github.com/chatgpt-codex-connector%5Bbot%5D) on 2026-11-24T01:17:30Z. --- <!-- 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>
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!1110
No description provided.