Skip to content

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

Merged
tedin7 merged 2 commits into
R0Y00:mainfrom
Leyukaka:exec-symbol-b64
Nov 28, 2026
Merged

tedin7 merged 2 commits into
R0Y00:mainfrom
Leyukaka:exec-symbol-b64

Conversation

@Leyukaka

Copy link
Copy Markdown
Collaborator

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.

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.

transfer() records the symbol of EXEC in s[126]/s[127], for example a
constant after s_mov_b64 exec, <literal>. The wave32 saveexec/wrexec
branch clears s[126], but the 64-bit *_saveexec_b64 and *_wrexec_b64
fell into the generic SOP1 branch, which clears only the destination
pair. The analysis then kept the old EXEC constant, and a later
s_mov_b32 sN, exec_lo copied it, so the constant-sampler path could
fold a value the program no longer had. These ops now clear the
destination pair and both EXEC words.

New test native_exec_symbol_b64_controls: a sampler word taken from
exec_lo compiles while EXEC is a known constant, and is refused with
"nonconstant sampler" after s_and_saveexec_b64 or s_andn2_wrexec_b64
with an unknown source.

AI-assisted.

@tedin7 tedin7 left a comment

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

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

tedin7 commented Nov 28, 2026

Copy link
Copy Markdown
Collaborator

Win2025 WARP receipt for head 2814bec 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.

@tedin7
tedin7 merged commit 7e5c378 into R0Y00:main Nov 28, 2026
5 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants