shader: lower IEEE multiply and lt, le and ge kills in the sampled coverage translator #1147

Merged
tedin7 merged 1 commit from upstream-pr/1154 into main 2026-11-24 02:33:18 +00:00
tedin7 commented 2026-11-24 01:54:09 +00:00 (Migrated from github.com)

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


Change

AI-assisted. Extends tools/sampled_coverage_aot.py so the coverage-only sampled pixel translator accepts v_mul_f32_e32 (IEEE multiply) beside v_mul_legacy_f32_e32, and the kill comparisons v_cmpx_lt_f32_e32, v_cmpx_le_f32_e32 and v_cmpx_ge_f32_e32 beside v_cmpx_gt_f32_e32. Before, any of them raised "Unsupported coverage instruction". The legacy multiply and the greater-than output are unchanged. Related earlier work: #497 (merged). No overlapping open PR found (gh pr list --state open --search sampled_coverage).

Verification

LLVM 19 locally (CI uses LLVM 15, not available here), on top of main edee8d07:

  • python3 -B tests/sampled_coverage_check.py binary llvm-mc-19 llvm-objcopy-19 /usr/lib/llvm-19/lib/libLLVM-19.so: exit 0 with the change. It assembles four new programs, runs the translator CLI on each and compares with lower.
  • The same test with tools/sampled_coverage_aot.py from main: fails with ValueError: Unsupported coverage instruction v_mul_f32_e32.
  • python3 -B tests/rdna2_tools_check.py: OK (106 tests, 10 skipped).
  • Not run: the new Windows readback draw_ops (run by the existing sampled_coverage_<adapter> CTest). It needs dxc and a D3D12 adapter, which this Linux host lacks. No WARP or GPU readback of these forms has been observed yet; the CI result on this pull request is the first measurement. Capability skip is exit 77 as before.

Evidence and follow-up

  • Fixtures are original synthetic gfx1013 programs assembled by llvm-mc; no game data.
  • The readback runs the IEEE multiply with each of the four comparisons on both textures, with a binary32 CPU reference that does not share code with the translator. Cases include equality at exact sample values 0 and 1, a negative scale, negative zero and an infinite scale (zero times infinity is NaN, which kills nothing).
  • Negative controls: for every comparison the reference of each other comparison must fail at the pixel readback, and on texture 0 so must the legacy multiply reference. The Linux step also checks that all these references differ, and rejects v_cmpx_lg_f32, v_cmpx_lt_f64, swapped compare operands, a VGPR as first multiply source, v_mul_f16, v_add_f32 and a product read before s_waitcnt vmcnt(0).
  • No store or atomic is lowered here (coverage export only), so there is no memory-window guard to test. No mnemonic was added to the disassembler.
  • Assumption: sample and limit are finite or infinite values; the textures have one mip.
  • Docs: docs/experiments.md "Coverage-only texture sampling" 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:6572816357 --> Imported from [R0Y00/Xbox2Windows](https://github.com/R0Y00/Xbox2Windows/pull/1154). Originally posted by [tedin7](https://github.com/tedin7) on 2026-11-24T01:54:09Z. --- ## Change AI-assisted. Extends `tools/sampled_coverage_aot.py` so the coverage-only sampled pixel translator accepts `v_mul_f32_e32` (IEEE multiply) beside `v_mul_legacy_f32_e32`, and the kill comparisons `v_cmpx_lt_f32_e32`, `v_cmpx_le_f32_e32` and `v_cmpx_ge_f32_e32` beside `v_cmpx_gt_f32_e32`. Before, any of them raised "Unsupported coverage instruction". The legacy multiply and the greater-than output are unchanged. Related earlier work: #497 (merged). No overlapping open PR found (`gh pr list --state open --search sampled_coverage`). ## Verification LLVM 19 locally (CI uses LLVM 15, not available here), on top of main edee8d07: - `python3 -B tests/sampled_coverage_check.py binary llvm-mc-19 llvm-objcopy-19 /usr/lib/llvm-19/lib/libLLVM-19.so`: exit 0 with the change. It assembles four new programs, runs the translator CLI on each and compares with `lower`. - The same test with `tools/sampled_coverage_aot.py` from main: fails with `ValueError: Unsupported coverage instruction v_mul_f32_e32`. - `python3 -B tests/rdna2_tools_check.py`: OK (106 tests, 10 skipped). - Not run: the new Windows readback `draw_ops` (run by the existing `sampled_coverage_<adapter>` CTest). It needs dxc and a D3D12 adapter, which this Linux host lacks. No WARP or GPU readback of these forms has been observed yet; the CI result on this pull request is the first measurement. Capability skip is exit 77 as before. ## Evidence and follow-up - Fixtures are original synthetic gfx1013 programs assembled by llvm-mc; no game data. - The readback runs the IEEE multiply with each of the four comparisons on both textures, with a binary32 CPU reference that does not share code with the translator. Cases include equality at exact sample values 0 and 1, a negative scale, negative zero and an infinite scale (zero times infinity is NaN, which kills nothing). - Negative controls: for every comparison the reference of each other comparison must fail at the pixel readback, and on texture 0 so must the legacy multiply reference. The Linux step also checks that all these references differ, and rejects `v_cmpx_lg_f32`, `v_cmpx_lt_f64`, swapped compare operands, a VGPR as first multiply source, `v_mul_f16`, `v_add_f32` and a product read before `s_waitcnt vmcnt(0)`. - No store or atomic is lowered here (coverage export only), so there is no memory-window guard to test. No mnemonic was added to the disassembler. - Assumption: sample and limit are finite or infinite values; the textures have one mip. - Docs: `docs/experiments.md` "Coverage-only texture sampling" 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:34 +00:00
chatgpt-codex-connector[bot commented 2026-11-24 06:50:10 +00:00 (Migrated from github.com)

Imported from R0Y00/Xbox2Windows. Originally posted by chatgpt-codex-connector[bot] on 2026-11-24T02:26:25Z.


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-24T02:30:06.146603Z 20bd771 Draft marked ready
ℹ️ 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:7120143668 --> Imported from [R0Y00/Xbox2Windows](https://github.com/R0Y00/Xbox2Windows/pull/1154#issuecomment-7120143668). Originally posted by [chatgpt-codex-connector[bot]](https://github.com/chatgpt-codex-connector%5Bbot%5D) on 2026-11-24T02:26:25Z. --- <!-- codex-pull-request-review-summary --> <!-- codex-review-state:v1 {"code_review":{"commit_sha":"20bd771fb8fe76c08ccbf8904e62c1143fe9e213","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-24T02:30:06.146603Z">2026-11-24T02:30:06.146603Z</relative-time> | `20bd771` | Draft marked ready | <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!1147
No description provided.