compute: forget EXEC symbols after 64-bit saveexec and wrexec #3314

Merged
Leyukaka merged 2 commits from upstream-pr/3314 into main 2026-11-28 11:01:11 +00:00
Leyukaka commented 2026-11-28 08:38:00 +00:00 (Migrated from github.com)

Imported from R0Y00/Xbox2Windows. Originally posted by Leyukaka on 2026-11-28T08:38:00Z.


Part of #2935. Target branch main. Follow-up to my review on #3297.

Problem. transfer() (src/gfx1013_compute_native.cpp) records a symbol for EXEC in s[126]/s[127], for example a constant after s_mov_b64 exec, <literal>. The wave32 saveexec/wrexec branch clears s[126]. The 64-bit *_saveexec_b64 and *_wrexec_b64 instead fell into the generic SOP1 branch, which clears only the destination pair, so the old EXEC constant survived them.

  • A later s_mov_b32 sN, exec_lo then copied that constant into sN, and the constant-sampler path could fold a value the program no longer had. I have not seen this in a real shader; it is a soundness gap.
  • This covered all twelve 64-bit forms the direct path lowers: the ten *_saveexec_b64 (two added by #3297), s_andn1_wrexec_b64 (#3297) and s_andn2_wrexec_b64 (my #3247).

Change. Compute SOP1 ops whose name ends in _saveexec_b64 or _wrexec_b64 now clear the destination pair and both EXEC words. Nothing else changes.

Tests. The setup was Windows 11 with an NVIDIA GeForce RTX 5080 and DXC from the Windows SDK 10.0.26100, Release, on main c6f23813 plus this commit.

  • New native_exec_symbol_b64_controls builds a wave64 program that takes a sampler word from exec_lo:
    • with a constant EXEC and no saveexec, it compiles;
    • after s_and_saveexec_b64 or s_andn2_wrexec_b64 with an unknown source, it is refused with "nonconstant sampler".
  • With main's compile_dxil, both the saveexec and the wrexec case compile, because the stale constant is folded. With this commit both are refused with "nonconstant sampler".
  • The saveexec, wrexec, wave64 EXEC SALU and native_direct_container tests pass, 11 of 11.
  • On a full build, ctest -R "native_|startup_compute|compile_dxil|salu" passes 526 of 527. native_scalar_lds_hardware fails as on main.

The test reads only exec_lo, so the s[127] clear is not covered, and I did not run a mutation that keeps one EXEC word. The results on main cover removing the fix entirely.

AI-assisted.

<!-- greyfinch-sync:R0Y00/Xbox2Windows:issue:5538375611 --> Imported from [R0Y00/Xbox2Windows](https://github.com/R0Y00/Xbox2Windows/pull/3314). Originally posted by [Leyukaka](https://github.com/Leyukaka) on 2026-11-28T08:38:00Z. --- Part of #2935. Target branch `main`. Follow-up to my review on #3297. **Problem.** `transfer()` (`src/gfx1013_compute_native.cpp`) records a symbol for EXEC in `s[126]`/`s[127]`, for example a constant after `s_mov_b64 exec, <literal>`. The wave32 saveexec/wrexec branch clears `s[126]`. The 64-bit `*_saveexec_b64` and `*_wrexec_b64` instead fell into the generic SOP1 branch, which clears only the destination pair, so the old EXEC constant survived them. - A later `s_mov_b32 sN, exec_lo` then copied that constant into sN, and the constant-sampler path could fold a value the program no longer had. I have not seen this in a real shader; it is a soundness gap. - This covered all twelve 64-bit forms the direct path lowers: the ten `*_saveexec_b64` (two added by #3297), `s_andn1_wrexec_b64` (#3297) and `s_andn2_wrexec_b64` (my #3247). **Change.** Compute SOP1 ops whose name ends in `_saveexec_b64` or `_wrexec_b64` now clear the destination pair and both EXEC words. Nothing else changes. **Tests.** The setup was Windows 11 with an NVIDIA GeForce RTX 5080 and DXC from the Windows SDK 10.0.26100, Release, on `main` `c6f23813` plus this commit. - New `native_exec_symbol_b64_controls` builds a wave64 program that takes a sampler word from `exec_lo`: - with a constant EXEC and no saveexec, it compiles; - after `s_and_saveexec_b64` or `s_andn2_wrexec_b64` with an unknown source, it is refused with "nonconstant sampler". - With `main`'s `compile_dxil`, both the saveexec and the wrexec case compile, because the stale constant is folded. With this commit both are refused with "nonconstant sampler". - The saveexec, wrexec, wave64 EXEC SALU and `native_direct_container` tests pass, 11 of 11. - On a full build, `ctest -R "native_|startup_compute|compile_dxil|salu"` passes 526 of 527. `native_scalar_lds_hardware` fails as on `main`. The test reads only `exec_lo`, so the `s[127]` clear is not covered, and I did not run a mutation that keeps one EXEC word. The results on `main` cover removing the fix entirely. AI-assisted.
tedin7 commented 2026-11-28 11:00:54 +00:00 (Migrated from github.com)

Imported from R0Y00/Xbox2Windows. Originally posted by tedin7 on 2026-11-28T11:00:54Z.

Review: COMMENTED


Review of head 2814bec1 (the PR's own change is unchanged from 4c8513e0; the new head only merges current main).

What I checked:

  • src/gfx1013_compute_native.cpp, transfer(): the new branch covers the 64-bit *_saveexec_b64 and *_wrexec_b64 SOP1 forms, clears the destination pair plus both EXEC words (126/127) and is limited to the non-graphics path. The wave32 branch above it is untouched. The name suffix tests are length-safe.
  • Test native_exec_symbol_b64_controls builds a wave64 container, copies EXEC into a sampler word after s_and_saveexec_b64 / s_andn2_wrexec_b64, and requires the translator to refuse the now non-constant sampler (the constant-EXEC control still compiles). It guards the behavior the caller sees (compile result and message).
  • No other open PR covers this slice: #3335 only stacks on this commit; #3297 (merged) is the earlier lowering.

Commands run:

  • Linux: python3 tests/docs_links_check.py ok, python3 tests/bidi_controls_check.py ok, git diff --check origin/main...HEAD clean, python3 -m py_compile tests/native_exec_symbol_b64_check.py ok.
  • Windows Server 2025, D3D12 WARP 1.0.22, -R '^native_(exec_symbol_b64_controls|direct_container|salu64_controls|compute_clear)$': dev 4/4 passed, release 4/4 passed.
  • Mutation 1 (drop set(126, {}) in the new branch): native_exec_symbol_b64_controls fails at the saveexec case.
  • Mutation 2 (wrexec suffix no longer matches): native_exec_symbol_b64_controls fails at the wrexec case.

No blocking findings. The receipt follows in a separate comment.

AI-assisted; commands listed were executed locally.

<!-- greyfinch-sync:R0Y00/Xbox2Windows:review:6097350606 --> Imported from [R0Y00/Xbox2Windows](https://github.com/R0Y00/Xbox2Windows/pull/3314#pullrequestreview-6097350606). Originally posted by [tedin7](https://github.com/tedin7) on 2026-11-28T11:00:54Z. **Review:** COMMENTED --- Review of head `2814bec1` (the PR's own change is unchanged from `4c8513e0`; the new head only merges current `main`). What I checked: - `src/gfx1013_compute_native.cpp`, `transfer()`: the new branch covers the 64-bit `*_saveexec_b64` and `*_wrexec_b64` SOP1 forms, clears the destination pair plus both EXEC words (126/127) and is limited to the non-graphics path. The wave32 branch above it is untouched. The name suffix tests are length-safe. - Test `native_exec_symbol_b64_controls` builds a wave64 container, copies EXEC into a sampler word after `s_and_saveexec_b64` / `s_andn2_wrexec_b64`, and requires the translator to refuse the now non-constant sampler (the constant-EXEC control still compiles). It guards the behavior the caller sees (compile result and message). - No other open PR covers this slice: #3335 only stacks on this commit; #3297 (merged) is the earlier lowering. Commands run: - Linux: `python3 tests/docs_links_check.py` ok, `python3 tests/bidi_controls_check.py` ok, `git diff --check origin/main...HEAD` clean, `python3 -m py_compile tests/native_exec_symbol_b64_check.py` ok. - Windows Server 2025, D3D12 WARP 1.0.22, `-R '^native_(exec_symbol_b64_controls|direct_container|salu64_controls|compute_clear)$'`: dev 4/4 passed, release 4/4 passed. - Mutation 1 (drop `set(126, {})` in the new branch): `native_exec_symbol_b64_controls` fails at the `saveexec` case. - Mutation 2 (wrexec suffix no longer matches): `native_exec_symbol_b64_controls` fails at the `wrexec` case. No blocking findings. The receipt follows in a separate comment. AI-assisted; commands listed were executed locally.
tedin7 commented 2026-11-28 11:00:56 +00:00 (Migrated from github.com)

Imported from R0Y00/Xbox2Windows. Originally posted by tedin7 on 2026-11-28T11:00:56Z.


Win2025 WARP receipt for head 2814bec1 after updating with main.

Verified on Windows Server 2025 (Build 26100, MSVC 14.44.35207 + D3D12 WARP) at commit 2814bec1b312728c2be3d1bbbe8b0cc57416e4c9:

  • Debug (--preset dev):
    • Build (cmake --build --preset dev --target compile_dxil native_store_replay -- -j 3): 8.07s (configure 2.38s)
    • Test (ctest --preset dev -R '^native_(exec_symbol_b64_controls|direct_container|salu64_controls|compute_clear)$' --parallel 4 --no-tests=error --output-on-failure): 4/4 passed (17.28s: native_salu64_controls 0.22s, native_exec_symbol_b64_controls 0.28s, native_compute_clear 0.33s, native_direct_container 16.74s)
  • Release /O2 (--preset release):
    • Build (cmake --build --preset release --target compile_dxil native_store_replay -- -j 3): 46.35s (configure 6.48s)
    • Test (ctest --preset release -R '^native_(exec_symbol_b64_controls|direct_container|salu64_controls|compute_clear)$' --parallel 4 --no-tests=error --output-on-failure): 4/4 passed (12.48s: native_salu64_controls 0.21s, native_exec_symbol_b64_controls 0.25s, native_compute_clear 0.30s, native_direct_container 11.98s)
  • sccache: 192/251 hits; wall 74.4s

AI-assisted; commands listed were executed locally.

<!-- greyfinch-sync:R0Y00/Xbox2Windows:comment:7238268803 --> Imported from [R0Y00/Xbox2Windows](https://github.com/R0Y00/Xbox2Windows/pull/3314#issuecomment-7238268803). Originally posted by [tedin7](https://github.com/tedin7) on 2026-11-28T11:00:56Z. --- Win2025 WARP receipt for head 2814bec1 after updating with main. Verified on Windows Server 2025 (Build 26100, MSVC 14.44.35207 + D3D12 WARP) at commit `2814bec1b312728c2be3d1bbbe8b0cc57416e4c9`: - **Debug (`--preset dev`)**: - Build (`cmake --build --preset dev --target compile_dxil native_store_replay -- -j 3`): `8.07s` (configure `2.38s`) - Test (`ctest --preset dev -R '^native_(exec_symbol_b64_controls|direct_container|salu64_controls|compute_clear)$' --parallel 4 --no-tests=error --output-on-failure`): **4/4 passed** (`17.28s`: `native_salu64_controls` `0.22s`, `native_exec_symbol_b64_controls` `0.28s`, `native_compute_clear` `0.33s`, `native_direct_container` `16.74s`) - **Release `/O2` (`--preset release`)**: - Build (`cmake --build --preset release --target compile_dxil native_store_replay -- -j 3`): `46.35s` (configure `6.48s`) - Test (`ctest --preset release -R '^native_(exec_symbol_b64_controls|direct_container|salu64_controls|compute_clear)$' --parallel 4 --no-tests=error --output-on-failure`): **4/4 passed** (`12.48s`: `native_salu64_controls` `0.21s`, `native_exec_symbol_b64_controls` `0.25s`, `native_compute_clear` `0.30s`, `native_direct_container` `11.98s`) - `sccache`: 192/251 hits; wall `74.4s` AI-assisted; commands listed were executed locally.
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!3314
No description provided.