shader: lower the e64 spellings of the sampled coverage multiply and kill compare #1194

Merged
tedin7 merged 1 commit from upstream-pr/1201 into main 2026-11-24 04:33:37 +00:00
tedin7 commented 2026-11-24 03:31:54 +00:00 (Migrated from github.com)

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


Change

AI-assisted. Extends tools/sampled_coverage_aot.py so the coverage-only sampled pixel translator also accepts the VOP3 (_e64) spellings of v_mul_legacy_f32, v_mul_f32 and v_cmpx_{lt,le,gt,ge}_f32, in any pairing with the VOP2 spellings. Before, an e64 form raised "Unsupported coverage instruction". The e64 form is lowered only as plain registers: clamp, mul:/div: output scale, negate, absolute value, swapped operands, special registers (vcc_lo, exec_lo, null) and inline constants are rejected with an explicit error (both forms now check operands, so no modifier text can be silently ignored). Follows #1154. No overlapping open PR found (gh pr list --state open --search sampled_coverage).

Verification

Local, on top of main d1ea005d. LLVM 15.0.6 was taken from the Debian packages (libllvm15, llvm-15, extracted without installing); LLVM 19 was also run:

  • python3 -B tests/sampled_coverage_check.py binary llvm-mc-15 llvm-objcopy-15 libLLVM-15.so.1 (LLVM 15 binaries): exit 0.
  • Same with llvm-mc-19 llvm-objcopy-19 /usr/lib/llvm-19/lib/libLLVM-19.so: exit 0.
  • The same test with the translator from main fails: ValueError: Unsupported coverage instruction v_mul_f32_e64.
  • python3 -B tests/rdna2_tools_check.py: OK (121 tests, 13 skipped).
  • git diff --check: clean.
  • Not run: the new Windows readback draw_ops (needs dxc and a D3D12 adapter; this Linux host has neither). Only its Python control flow was exercised with a stubbed renderer (180 calls, no error). The CI result on this pull request is the first measurement.

Evidence and follow-up

  • Fixtures are original synthetic gfx1013 programs assembled by llvm-mc; no game data.
  • Linux step: all 8 e64 programs (2 multiplies x 4 relations) and 8 mixed-pairing programs are assembled by LLVM, run through the translator CLI and compared with lower; each lowers to the same HLSL as its e32 program on both textures. 58 mutated e64 forms (clamp, mul/div, negate, abs, swapped operands, special registers, constants) are rejected with the operand-check message, and the same forms assembled by the real LLVM make the CLI exit 2 and write no output. Wrong mnemonics (f64, lg, class, v_cmp_, f16, add, sub), a missing operand and a product read before s_waitcnt vmcnt(0) are rejected too.
  • Windows readback: the e64 programs run on texture 0 with five cases against an independent binary32 CPU model (no shared code with the translator). For each program the reference of every other relation and of the other multiply must fail at the pixel readback; the Linux step checks that each such reference differs from the right one in at least one case.
  • sampled_coverage_<adapter> CTest limit raised from 60 to 150 s for the extra draws.
  • No store or atomic is lowered (coverage export only), so there is no memory-window guard to test. No disassembler mnemonic was added.
  • 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:6573988784 --> Imported from [R0Y00/Xbox2Windows](https://github.com/R0Y00/Xbox2Windows/pull/1201). Originally posted by [tedin7](https://github.com/tedin7) on 2026-11-24T03:31:54Z. --- ## Change AI-assisted. Extends `tools/sampled_coverage_aot.py` so the coverage-only sampled pixel translator also accepts the VOP3 (`_e64`) spellings of `v_mul_legacy_f32`, `v_mul_f32` and `v_cmpx_{lt,le,gt,ge}_f32`, in any pairing with the VOP2 spellings. Before, an e64 form raised "Unsupported coverage instruction". The e64 form is lowered only as plain registers: clamp, `mul:`/`div:` output scale, negate, absolute value, swapped operands, special registers (`vcc_lo`, `exec_lo`, `null`) and inline constants are rejected with an explicit error (both forms now check operands, so no modifier text can be silently ignored). Follows #1154. No overlapping open PR found (`gh pr list --state open --search sampled_coverage`). ## Verification Local, on top of main d1ea005d. LLVM 15.0.6 was taken from the Debian packages (`libllvm15`, `llvm-15`, extracted without installing); LLVM 19 was also run: - `python3 -B tests/sampled_coverage_check.py binary llvm-mc-15 llvm-objcopy-15 libLLVM-15.so.1` (LLVM 15 binaries): exit 0. - Same with `llvm-mc-19 llvm-objcopy-19 /usr/lib/llvm-19/lib/libLLVM-19.so`: exit 0. - The same test with the translator from main fails: `ValueError: Unsupported coverage instruction v_mul_f32_e64`. - `python3 -B tests/rdna2_tools_check.py`: OK (121 tests, 13 skipped). - `git diff --check`: clean. - Not run: the new Windows readback `draw_ops` (needs dxc and a D3D12 adapter; this Linux host has neither). Only its Python control flow was exercised with a stubbed renderer (180 calls, no error). The CI result on this pull request is the first measurement. ## Evidence and follow-up - Fixtures are original synthetic gfx1013 programs assembled by llvm-mc; no game data. - Linux step: all 8 e64 programs (2 multiplies x 4 relations) and 8 mixed-pairing programs are assembled by LLVM, run through the translator CLI and compared with `lower`; each lowers to the same HLSL as its e32 program on both textures. 58 mutated e64 forms (clamp, mul/div, negate, abs, swapped operands, special registers, constants) are rejected with the operand-check message, and the same forms assembled by the real LLVM make the CLI exit 2 and write no output. Wrong mnemonics (`f64`, `lg`, `class`, `v_cmp_`, `f16`, `add`, `sub`), a missing operand and a product read before `s_waitcnt vmcnt(0)` are rejected too. - Windows readback: the e64 programs run on texture 0 with five cases against an independent binary32 CPU model (no shared code with the translator). For each program the reference of every other relation and of the other multiply must fail at the pixel readback; the Linux step checks that each such reference differs from the right one in at least one case. - `sampled_coverage_<adapter>` CTest limit raised from 60 to 150 s for the extra draws. - No store or atomic is lowered (coverage export only), so there is no memory-window guard to test. No disassembler mnemonic was added. - 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:51 +00:00
chatgpt-codex-connector[bot commented 2026-11-24 06:50:15 +00:00 (Migrated from github.com)

Imported from R0Y00/Xbox2Windows. Originally posted by chatgpt-codex-connector[bot] on 2026-11-24T03:37:58Z.


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-24T03:42:18.497936Z f9a01b3 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:7121277302 --> Imported from [R0Y00/Xbox2Windows](https://github.com/R0Y00/Xbox2Windows/pull/1201#issuecomment-7121277302). Originally posted by [chatgpt-codex-connector[bot]](https://github.com/chatgpt-codex-connector%5Bbot%5D) on 2026-11-24T03:37:58Z. --- <!-- codex-pull-request-review-summary --> <!-- codex-review-state:v1 {"code_review":{"commit_sha":"f9a01b33eea7c93644001051bbc73b969eb5f119","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-24T03:42:18.497936Z">2026-11-24T03:42:18.497936Z</relative-time> | `f9a01b3` | 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!1194
No description provided.