Repository navigation
compute: forget EXEC symbols after 64-bit saveexec and wrexec - #3314
Merged
Merged
Conversation
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
reviewed
Nov 28, 2026
tedin7
left a comment
Collaborator
There was a problem hiding this comment.
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_b64and*_wrexec_b64SOP1 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_controlsbuilds a wave64 container, copies EXEC into a sampler word afters_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.pyok,python3 tests/bidi_controls_check.pyok,git diff --check origin/main...HEADclean,python3 -m py_compile tests/native_exec_symbol_b64_check.pyok. - 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_controlsfails at thesaveexeccase. - Mutation 2 (wrexec suffix no longer matches):
native_exec_symbol_b64_controlsfails at thewrexeccase.
No blocking findings. The receipt follows in a separate comment.
AI-assisted; commands listed were executed locally.
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
AI-assisted; commands listed were executed locally. |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
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 ins[126]/s[127], for example a constant afters_mov_b64 exec, <literal>. The wave32 saveexec/wrexec branch clearss[126]. The 64-bit*_saveexec_b64and*_wrexec_b64instead fell into the generic SOP1 branch, which clears only the destination pair, so the old EXEC constant survived them.s_mov_b32 sN, exec_lothen 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.*_saveexec_b64(two added by shader: lower remaining SOP1 *_saveexec_* and *_wrexec_* ops in direct Compute DXIL #3297),s_andn1_wrexec_b64(shader: lower remaining SOP1 *_saveexec_* and *_wrexec_* ops in direct Compute DXIL #3297) ands_andn2_wrexec_b64(my compute: lower s_andn2_wrexec_b64 for wave64 direct compute #3247).Change. Compute SOP1 ops whose name ends in
_saveexec_b64or_wrexec_b64now 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
mainc6f23813plus this commit.native_exec_symbol_b64_controlsbuilds a wave64 program that takes a sampler word fromexec_lo:s_and_saveexec_b64ors_andn2_wrexec_b64with an unknown source, it is refused with "nonconstant sampler".main'scompile_dxil, both the saveexec and the wrexec case compile, because the stale constant is folded. With this commit both are refused with "nonconstant sampler".native_direct_containertests pass, 11 of 11.ctest -R "native_|startup_compute|compile_dxil|salu"passes 526 of 527.native_scalar_lds_hardwarefails as onmain.The test reads only
exec_lo, so thes[127]clear is not covered, and I did not run a mutation that keeps one EXEC word. The results onmaincover removing the fix entirely.AI-assisted.