shader: lower binary32 add, subtract and multiply in the compute store profile #1162

Merged
tedin7 merged 5 commits from upstream-pr/1169 into main 2026-11-24 05:05:54 +00:00
tedin7 commented 2026-11-24 02:22:37 +00:00 (Migrated from github.com)

Imported from R0Y00/Xbox2Windows. Originally posted by tedin7 on 2026-11-24T02:22:37Z.


Change

Lowers four binary32 vector ALU forms in tools/compute_store_aot.py between a guarded t0 read and the u0 store: v_add_f32_e32, v_sub_f32_e32, v_subrev_f32_e32 and v_mul_f32_e32. Each is a small HLSL helper over the word bit pattern whose result is precise, so a multiply followed by an add is not contracted. A result is again a word, so it can feed the integer forms already supported.

Fused multiply-add (v_fma_f32, v_fmac_f32_e32, v_mac_f32_e32) stays refused, because DXIL has no binary32 form with a guaranteed single rounding. NaN, infinity and denormal constants are refused (Unverified float operand). A word read from memory is not known statically, so the caller must keep operands and results finite and normal; the docs say so.

Refs #721 (claim: https://github.com/R0Y00/Xbox2Windows/issues/721#issuecomment-7120064357). It touches the same files as #1118 (vector shifts and subtract); the code is separate (own table, helper, test case, CTest entry) and this branch starts from current origin/main. Expect a mechanical merge in tests/compute_store_check.py, CMakeLists.txt and docs/experiments.md.

Verification

Commit 062b3c5e, Linux, no GPU available here.

  • python3 -B tests/compute_store_check.py binary llvm-mc-15 llvm-objcopy-15 libLLVM-15.so.1 (Debian LLVM 15.0.6): exit 0. The same with LLVM 19: exit 0.
  • Negative control: the new test file against tools/ and tests/ of origin/main exits 1 at Unsupported compute instruction: v_add_f32_e32 v4, v2, v3.
  • python3 -B tests/rdna2_tools_check.py with LLVM 15: 109 tests OK. docs_links_check and bidi_controls_check pass.
  • Mutations of the lowering that the translation controls catch: subrev lowered as sub, the multiply lowered as an add, precise dropped, the NaN refusal dropped, the denormal refusal dropped.
  • Not run here: the Windows readback (compute_store_aot_f32_warp and _hardware, new CTest entries, draw-f32 mode). I ran the same draw flow against a Python stand-in for the compiler and renderer that evaluates the lowered HLSL with numpy binary32: all runs, five wrong references, two sentinel changes and eight HLSL mutants behaved as expected. That is a check of the test logic, not of WARP or a GPU. The same evaluation of the lowered expression on all 167 active lanes of the three dispatches matches the CPU model.

Evidence and follow-up

The fixture is a guarded read-compute-write kernel built from source and assembled with LLVM 15 for gfx1013. The source word gives x in [1.5, 2) and y in [3, 4) with integer operations, and the chain is a = x + y, b = cap - a, c = b - pi, d = x * c, e = 1.0 + d, out = e - (-4.0) with cap = 20.0. It uses every form, an SGPR, a literal and two inline constants as sources, and every operand and result is finite and normal (asserted). The exponent constants are chosen so LLVM does not print them as inline floats in the integer forms.

The readback compares all 320 words on three dispatches (no lane passes, a split wave, five groups with 150 active lanes), so words past the bound must stay at their sentinel. The CPU model is separate Python that rounds each step to binary32; it shares no code with the lowering. Each of these must fail at its own word: five references with one operation swapped, a changed sentinel word at the bound and at word 319, and recompiled HLSL with add as subtract, exchanged subtract operands, multiply as add, the cap read from the next constant, a literal off by one bit, a flipped inline sign, 1.0 replaced by 2.0, and a guard that lets lane 150 write. No store or address code changes, so alignment and window handling are those of the existing guard.

Not claimed: NaN payloads, infinities, denormals, fused multiply-add, _e64 and modifier forms, v_min_f32 and v_max_f32. Anyone can pick up the fused forms if a binary32 construction with one rounding is found.

AI-assisted (Codex).

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:6573173148 --> Imported from [R0Y00/Xbox2Windows](https://github.com/R0Y00/Xbox2Windows/pull/1169). Originally posted by [tedin7](https://github.com/tedin7) on 2026-11-24T02:22:37Z. --- ## Change Lowers four binary32 vector ALU forms in `tools/compute_store_aot.py` between a guarded t0 read and the u0 store: `v_add_f32_e32`, `v_sub_f32_e32`, `v_subrev_f32_e32` and `v_mul_f32_e32`. Each is a small HLSL helper over the word bit pattern whose result is `precise`, so a multiply followed by an add is not contracted. A result is again a word, so it can feed the integer forms already supported. Fused multiply-add (`v_fma_f32`, `v_fmac_f32_e32`, `v_mac_f32_e32`) stays refused, because DXIL has no binary32 form with a guaranteed single rounding. NaN, infinity and denormal constants are refused (`Unverified float operand`). A word read from memory is not known statically, so the caller must keep operands and results finite and normal; the docs say so. Refs #721 (claim: https://github.com/R0Y00/Xbox2Windows/issues/721#issuecomment-7120064357). It touches the same files as #1118 (vector shifts and subtract); the code is separate (own table, helper, test case, CTest entry) and this branch starts from current `origin/main`. Expect a mechanical merge in `tests/compute_store_check.py`, `CMakeLists.txt` and `docs/experiments.md`. ## Verification Commit 062b3c5e, Linux, no GPU available here. - `python3 -B tests/compute_store_check.py binary llvm-mc-15 llvm-objcopy-15 libLLVM-15.so.1` (Debian LLVM 15.0.6): exit 0. The same with LLVM 19: exit 0. - Negative control: the new test file against `tools/` and `tests/` of `origin/main` exits 1 at `Unsupported compute instruction: v_add_f32_e32 v4, v2, v3`. - `python3 -B tests/rdna2_tools_check.py` with LLVM 15: 109 tests OK. `docs_links_check` and `bidi_controls_check` pass. - Mutations of the lowering that the translation controls catch: `subrev` lowered as `sub`, the multiply lowered as an add, `precise` dropped, the NaN refusal dropped, the denormal refusal dropped. - Not run here: the Windows readback (`compute_store_aot_f32_warp` and `_hardware`, new CTest entries, `draw-f32` mode). I ran the same `draw` flow against a Python stand-in for the compiler and renderer that evaluates the lowered HLSL with numpy binary32: all runs, five wrong references, two sentinel changes and eight HLSL mutants behaved as expected. That is a check of the test logic, not of WARP or a GPU. The same evaluation of the lowered expression on all 167 active lanes of the three dispatches matches the CPU model. ## Evidence and follow-up The fixture is a guarded read-compute-write kernel built from source and assembled with LLVM 15 for gfx1013. The source word gives `x` in [1.5, 2) and `y` in [3, 4) with integer operations, and the chain is `a = x + y`, `b = cap - a`, `c = b - pi`, `d = x * c`, `e = 1.0 + d`, `out = e - (-4.0)` with `cap = 20.0`. It uses every form, an SGPR, a literal and two inline constants as sources, and every operand and result is finite and normal (asserted). The exponent constants are chosen so LLVM does not print them as inline floats in the integer forms. The readback compares all 320 words on three dispatches (no lane passes, a split wave, five groups with 150 active lanes), so words past the bound must stay at their sentinel. The CPU model is separate Python that rounds each step to binary32; it shares no code with the lowering. Each of these must fail at its own word: five references with one operation swapped, a changed sentinel word at the bound and at word 319, and recompiled HLSL with add as subtract, exchanged subtract operands, multiply as add, the cap read from the next constant, a literal off by one bit, a flipped inline sign, `1.0` replaced by `2.0`, and a guard that lets lane 150 write. No store or address code changes, so alignment and window handling are those of the existing guard. Not claimed: NaN payloads, infinities, denormals, fused multiply-add, `_e64` and modifier forms, `v_min_f32` and `v_max_f32`. Anyone can pick up the fused forms if a binary32 construction with one rounding is found. AI-assisted (Codex). ## 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:39 +00:00
chatgpt-codex-connector[bot commented 2026-11-24 06:46:40 +00:00 (Migrated from github.com)

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

Review: COMMENTED


💡 Codex Review

Here are some automated review suggestions for this pull request.

Reviewed commit: 044b39c82f

ℹ️ 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".

If Codex has suggestions, it will comment; otherwise it will react with 👍.

Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".

<!-- greyfinch-sync:R0Y00/Xbox2Windows:review:6033241201 --> Imported from [R0Y00/Xbox2Windows](https://github.com/R0Y00/Xbox2Windows/pull/1169#pullrequestreview-6033241201). Originally posted by [chatgpt-codex-connector[bot]](https://github.com/chatgpt-codex-connector%5Bbot%5D) on 2026-11-24T03:30:20Z. **Review:** COMMENTED --- <!-- codex-review-receipt:v1 --> ### 💡 Codex Review Here are some automated review suggestions for this pull request. **Reviewed commit:** `044b39c82f` <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". If Codex has suggestions, it will comment; otherwise it will react with 👍. Codex can also answer questions or update the PR. Try commenting "@codex address that feedback". </details>
tedin7 commented 2026-11-24 06:46:40 +00:00 (Migrated from github.com)

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

Review: COMMENTED


No description provided.

<!-- greyfinch-sync:R0Y00/Xbox2Windows:review:6033264010 --> Imported from [R0Y00/Xbox2Windows](https://github.com/R0Y00/Xbox2Windows/pull/1169#pullrequestreview-6033264010). Originally posted by [tedin7](https://github.com/tedin7) on 2026-11-24T03:33:51Z. **Review:** COMMENTED --- _No description provided._
tedin7 commented 2026-11-24 06:50:12 +00:00 (Migrated from github.com)

Imported from R0Y00/Xbox2Windows. Originally posted by tedin7 on 2026-11-24T02:45:48Z.


AI-assisted. Merged current main into this branch. The conflicts in the compute store lowerer and its check kept both sides: the binary32 add, subtract and multiply case, and the new shift and subtract case. compute_store_check.py binary (llvm 19) passes after the merge.

<!-- greyfinch-sync:R0Y00/Xbox2Windows:comment:7120455714 --> Imported from [R0Y00/Xbox2Windows](https://github.com/R0Y00/Xbox2Windows/pull/1169#issuecomment-7120455714). Originally posted by [tedin7](https://github.com/tedin7) on 2026-11-24T02:45:48Z. --- AI-assisted. Merged current main into this branch. The conflicts in the compute store lowerer and its check kept both sides: the binary32 add, subtract and multiply case, and the new shift and subtract case. compute_store_check.py binary (llvm 19) passes after the merge.
tedin7 commented 2026-11-24 06:50:13 +00:00 (Migrated from github.com)

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


AI-assisted. Merged main again. The only conflict was in CMakeLists.txt, where both new compute store tests (binary32 and the 32-bit typed buffer load) are kept. compute_store_check.py binary (llvm 19) exits 0 after the merge.

<!-- greyfinch-sync:R0Y00/Xbox2Windows:comment:7120983105 --> Imported from [R0Y00/Xbox2Windows](https://github.com/R0Y00/Xbox2Windows/pull/1169#issuecomment-7120983105). Originally posted by [tedin7](https://github.com/tedin7) on 2026-11-24T03:19:34Z. --- AI-assisted. Merged main again. The only conflict was in CMakeLists.txt, where both new compute store tests (binary32 and the 32-bit typed buffer load) are kept. compute_store_check.py binary (llvm 19) exits 0 after the merge.
tedin7 commented 2026-11-24 06:50:14 +00:00 (Migrated from github.com)

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


AI-assisted. Merged main again. The only conflict was the draw mode table in tests/compute_store_check.py, where the binary32 mode and the new typed buffer store mode are both kept. compute_store_check.py binary (llvm 19) exits 0 after the merge. Merge commit e56af416.

<!-- greyfinch-sync:R0Y00/Xbox2Windows:comment:7121130926 --> Imported from [R0Y00/Xbox2Windows](https://github.com/R0Y00/Xbox2Windows/pull/1169#issuecomment-7121130926). Originally posted by [tedin7](https://github.com/tedin7) on 2026-11-24T03:28:27Z. --- AI-assisted. Merged main again. The only conflict was the draw mode table in tests/compute_store_check.py, where the binary32 mode and the new typed buffer store mode are both kept. compute_store_check.py binary (llvm 19) exits 0 after the merge. Merge commit e56af416.
tedin7 commented 2026-11-24 06:50:14 +00:00 (Migrated from github.com)

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


AI-assisted. Fixed the inline P2 in d12a6b96: float helpers are now selected from the final body, including the LDS statements. The new case in f32_controls fails without the change (f32_mul called but not defined) and passes with it; tests/compute_store_check.py passes locally with LLVM 19.

<!-- greyfinch-sync:R0Y00/Xbox2Windows:comment:7121228300 --> Imported from [R0Y00/Xbox2Windows](https://github.com/R0Y00/Xbox2Windows/pull/1169#issuecomment-7121228300). Originally posted by [tedin7](https://github.com/tedin7) on 2026-11-24T03:34:44Z. --- AI-assisted. Fixed the inline P2 in d12a6b96: float helpers are now selected from the final body, including the LDS statements. The new case in f32_controls fails without the change (f32_mul called but not defined) and passes with it; tests/compute_store_check.py passes locally with LLVM 19.
tedin7 commented 2026-11-24 06:50:16 +00:00 (Migrated from github.com)

Imported from R0Y00/Xbox2Windows. Originally posted by tedin7 on 2026-11-24T04:06:06Z.


@codex review

AI-assisted: the inline findings are fixed and answered in their threads; please re-read the current head.

<!-- greyfinch-sync:R0Y00/Xbox2Windows:comment:7121707058 --> Imported from [R0Y00/Xbox2Windows](https://github.com/R0Y00/Xbox2Windows/pull/1169#issuecomment-7121707058). Originally posted by [tedin7](https://github.com/tedin7) on 2026-11-24T04:06:06Z. --- @codex review AI-assisted: the inline findings are fixed and answered in their threads; please re-read the current head.
chatgpt-codex-connector[bot commented 2026-11-24 06:50:17 +00:00 (Migrated from github.com)

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


Codex Review: Didn't find any major issues. Already looking forward to the next diff.

Reviewed commit: d12a6b96e9

ℹ️ 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".

If Codex has suggestions, it will comment; otherwise it will react with 👍.

Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".

<!-- greyfinch-sync:R0Y00/Xbox2Windows:comment:7121787623 --> Imported from [R0Y00/Xbox2Windows](https://github.com/R0Y00/Xbox2Windows/pull/1169#issuecomment-7121787623). Originally posted by [chatgpt-codex-connector[bot]](https://github.com/chatgpt-codex-connector%5Bbot%5D) on 2026-11-24T04:11:17Z. --- <!-- codex-review-receipt:v1 --> Codex Review: Didn't find any major issues. Already looking forward to the next diff. **Reviewed commit:** `d12a6b96e9` <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". If Codex has suggestions, it will comment; otherwise it will react with 👍. Codex can also answer questions or update the PR. Try commenting "@codex address that feedback". </details>
chatgpt-codex-connector[bot commented 2026-11-24 06:50:18 +00:00 (Migrated from github.com)

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


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-24T04:11:18.970851Z d12a6b9 Manual request
ℹ️ 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:7121047155 --> Imported from [R0Y00/Xbox2Windows](https://github.com/R0Y00/Xbox2Windows/pull/1169#issuecomment-7121047155). Originally posted by [chatgpt-codex-connector[bot]](https://github.com/chatgpt-codex-connector%5Bbot%5D) on 2026-11-24T03:23:42Z. --- <!-- codex-pull-request-review-summary --> <!-- codex-review-state:v1 {"code_review":{"commit_sha":"d12a6b96e98eae2fc7f1d757b9503e039c66d9c5","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-24T04:11:18.970851Z">2026-11-24T04:11:18.970851Z</relative-time> | `d12a6b9` | Manual request | <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>
tedin7 commented 2026-11-24 06:50:21 +00:00 (Migrated from github.com)

Imported from R0Y00/Xbox2Windows. Originally posted by tedin7 on 2026-11-24T04:47:34Z.


Windows Server 2025 verification (d12a6b96) — PASS (Debug + Release /O2, WARP)

  • Environment: Windows Server 2025 Build 26100, MSVC 14.44.35207, AMD Ryzen 5 PRO 5650U, D3D12 WARP
  • Debug (--preset dev) (35.17s build+test):
    • cmake --build --preset dev -j 6 --target offscreen_check
    • ctest --test-dir out\build\dev -R "^compute_store_aot_(f32_)?warp$" --output-on-failure -> 2/2 passed (0 skipped, 15.14s: compute_store_aot_warp 9.39s, compute_store_aot_f32_warp 5.71s)
  • Release /O2 (--preset release) (42.24s configure+build+test):
    • cmake --preset release && cmake --build --preset release -j 6 --target offscreen_check
    • ctest --test-dir out\build\release -R "^compute_store_aot_(f32_)?warp$" --output-on-failure -> 2/2 passed (0 skipped, 14.51s: compute_store_aot_warp 9.35s, compute_store_aot_f32_warp 5.11s)
<!-- greyfinch-sync:R0Y00/Xbox2Windows:comment:7122343148 --> Imported from [R0Y00/Xbox2Windows](https://github.com/R0Y00/Xbox2Windows/pull/1169#issuecomment-7122343148). Originally posted by [tedin7](https://github.com/tedin7) on 2026-11-24T04:47:34Z. --- Windows Server 2025 verification (`d12a6b96`) — **PASS (Debug + Release `/O2`, WARP)** - **Environment**: Windows Server 2025 Build 26100, MSVC 14.44.35207, AMD Ryzen 5 PRO 5650U, D3D12 WARP - **Debug (`--preset dev`)** (35.17s build+test): - `cmake --build --preset dev -j 6 --target offscreen_check` - `ctest --test-dir out\build\dev -R "^compute_store_aot_(f32_)?warp$" --output-on-failure` -> **2/2 passed** (0 skipped, 15.14s: `compute_store_aot_warp` 9.39s, `compute_store_aot_f32_warp` 5.71s) - **Release `/O2` (`--preset release`)** (42.24s configure+build+test): - `cmake --preset release && cmake --build --preset release -j 6 --target offscreen_check` - `ctest --test-dir out\build\release -R "^compute_store_aot_(f32_)?warp$" --output-on-failure` -> **2/2 passed** (0 skipped, 14.51s: `compute_store_aot_warp` 9.35s, `compute_store_aot_f32_warp` 5.11s)
chatgpt-codex-connector[bot commented 2026-11-24 06:50:40 +00:00 (Migrated from github.com)

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

Code review location: tools/compute_store_aot.py; line 1154

@@ -1119,6 +1151,7 @@ def lower(instructions, group, *, table_reg, descriptor_offset, group_reg=None,
         stores[start:end] = [f"    if ({hlsl_word(left)} {GUARD_COMPARES[op]} {hlsl_word(right)}) {{",
                              *("    " + store for store in stores[start:end]), "    }"]
     body = "\n".join(stores)
+    helpers = "".join(text for name, text in F32_HELPERS.items() if f"f32_{name}(" in body)

P2 Badge Include LDS steps when selecting float helpers

For gfx1030 kernels that feed a float ALU result into a materialized LDS operation, the helper call can appear only in ds_steps, which is prepended after this scan. Adding v_mul_f32_e32 v7, 2.0, v7 immediately before ds_add_f32 v5, v7 in the existing lds_f32_program("ds_add_f32") fixture reproduces this through the LLVM 20 assembly/CLI round trip: translation succeeds, but the generated ds_f32_0 statement calls f32_mul without emitting its definition. This leaves an accepted, finite-normal kernel with uncompilable HLSL. Select helpers from the final body, including the LDS statements.

Useful? React with 👍 / 👎.

<!-- greyfinch-sync:R0Y00/Xbox2Windows:review-comment:4675163945 --> Imported from [R0Y00/Xbox2Windows](https://github.com/R0Y00/Xbox2Windows/pull/1169#discussion_r4675163945). Originally posted by [chatgpt-codex-connector[bot]](https://github.com/chatgpt-codex-connector%5Bbot%5D) on 2026-11-24T03:30:21Z. **Code review location:** `tools/compute_store_aot.py`; line 1154 ~~~~diff @@ -1119,6 +1151,7 @@ def lower(instructions, group, *, table_reg, descriptor_offset, group_reg=None, stores[start:end] = [f" if ({hlsl_word(left)} {GUARD_COMPARES[op]} {hlsl_word(right)}) {{", *(" " + store for store in stores[start:end]), " }"] body = "\n".join(stores) + helpers = "".join(text for name, text in F32_HELPERS.items() if f"f32_{name}(" in body) ~~~~ --- **<sub><sub>![P2 Badge](https://img.shields.io/badge/P2-yellow?style=flat)</sub></sub> Include LDS steps when selecting float helpers** For gfx1030 kernels that feed a float ALU result into a materialized LDS operation, the helper call can appear only in `ds_steps`, which is prepended after this scan. Adding `v_mul_f32_e32 v7, 2.0, v7` immediately before `ds_add_f32 v5, v7` in the existing `lds_f32_program("ds_add_f32")` fixture reproduces this through the LLVM 20 assembly/CLI round trip: translation succeeds, but the generated `ds_f32_0` statement calls `f32_mul` without emitting its definition. This leaves an accepted, finite-normal kernel with uncompilable HLSL. Select helpers from the final body, including the LDS statements. Useful? React with 👍 / 👎. <!-- codex-code-review-finding:v1 -->
tedin7 commented 2026-11-24 06:50:40 +00:00 (Migrated from github.com)

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

Code review location: tools/compute_store_aot.py; line 1154

@@ -1119,6 +1151,7 @@ def lower(instructions, group, *, table_reg, descriptor_offset, group_reg=None,
         stores[start:end] = [f"    if ({hlsl_word(left)} {GUARD_COMPARES[op]} {hlsl_word(right)}) {{",
                              *("    " + store for store in stores[start:end]), "    }"]
     body = "\n".join(stores)
+    helpers = "".join(text for name, text in F32_HELPERS.items() if f"f32_{name}(" in body)

Fixed in d12a6b96 (AI-assisted): float helpers are now selected from the final body, DS steps included. New control lowers the LDS f32 fixture with a v_mul before ds_add_f32; it fails on the previous lowering (f32_mul called without its definition) and passes now. compute_store_check.py binary (llvm 19) exits 0.

<!-- greyfinch-sync:R0Y00/Xbox2Windows:review-comment:4675184064 --> Imported from [R0Y00/Xbox2Windows](https://github.com/R0Y00/Xbox2Windows/pull/1169#discussion_r4675184064). Originally posted by [tedin7](https://github.com/tedin7) on 2026-11-24T03:33:51Z. **Code review location:** `tools/compute_store_aot.py`; line 1154 ~~~~diff @@ -1119,6 +1151,7 @@ def lower(instructions, group, *, table_reg, descriptor_offset, group_reg=None, stores[start:end] = [f" if ({hlsl_word(left)} {GUARD_COMPARES[op]} {hlsl_word(right)}) {{", *(" " + store for store in stores[start:end]), " }"] body = "\n".join(stores) + helpers = "".join(text for name, text in F32_HELPERS.items() if f"f32_{name}(" in body) ~~~~ --- Fixed in d12a6b96 (AI-assisted): float helpers are now selected from the final body, DS steps included. New control lowers the LDS f32 fixture with a v_mul before ds_add_f32; it fails on the previous lowering (f32_mul called without its definition) and passes now. compute_store_check.py binary (llvm 19) exits 0.
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!1162
No description provided.