shader: keep an accumulated lane mask live at a compute execz exit #3109
Loading…
Reference in a new issue
No description provided.
Delete branch "upstream-pr/3109"
Deleting a branch is permanent. Although the deleted branch may continue to exist for a short time before it actually gets removed, it CANNOT be undone in most cases. Continue?
Imported from R0Y00/Xbox2Windows. Originally posted by SimSalabimse on 2026-11-27T15:44:57Z.
Change
A straight compute lane-exhaustion exit can keep one accumulated lane mask live in the staying span. The pair is
s_and_b32 sA, sA, exec_lothens_or_b32 sB, sB, sA. The exit branch jumps over it, so a lane that leaves keeps its own bit ofsB.sAmust be dead at the exit, and every later read ofsBmust be per lane. Refs #2645 (T4). This builds on #2900: the scalar run before the EXEC restore, the single-wave32 bound (x * y * z <= 32), the 32-thread edge, and the pre-guard ANDN2 save proof stay as merged.The counted loop with a backward latch and a second saved mask stays refused.
An AND that rewrites an already tracked carried mask ends that word's old definition and starts a new tracked definition at the same destination. A repeated carry (
ACCUM_REPEAT_*) and a longer chain that rewrites the tracked word (ACCUM_REWRITE_*) stay refused.Verification
All results below are for commit
ede53dce485b1028f78287026eb8a89a258bdd5a, rebased onto main77d1ba4d63ba31abaf4ca3635d4159189a423201.Windows test PC (MSVC,
--preset dev,-j 1). The command was:It passed 71 of 71 with ctest exit 0.
Linux, agent-reported at this head:
python3 -B tests/startup_gfx2hlsl_compute_check.py: exit 0.ACCUM_REPEAT_*andACCUM_REWRITE_*staybranch out of the block. Restoring the old carry rule accepts both and makes the check fail.python3 -B tests/startup_tools_lint_check.py tools/startup: exit 0.CI on this commit succeeded for
Build and test on Windows,Assemble and translate gfx1013 fixtures, andRun platform-independent Python checks on Linux.Evidence and follow-up
ACCUM_SOURCEintests/startup_gfx2hlsl_compute_check.pyis a hand-written gfx1013 program.ACCUM_WORDSis the recorded encoding;binary llvm-mc-15reassembles it. The host check compares a wave trace with one-lane traces.ACCUM_REPEAT_*andACCUM_REWRITE_*are recorded the same way. The fixture does not cover the #2645 counted loop.docs/experiments.mdhas the T4 section after the #2900 T3 section.Checklist
AI-assisted (Cursor)
Imported from R0Y00/Xbox2Windows. Originally posted by R0Y00 on 2026-11-27T15:58:04Z.
Review: CHANGES_REQUESTED
execz_accumulated_maskacceptss_and_b32 sX, sB, exec_loviaper_lane_readwithout checking the SCC value produced by that AND. The destination is a lane mask, but SCC observes whether the entire masked word is nonzero.Reproduced on
85e96f29integrated overmain811c4ceb(tree5285d53c9020224d717e962fbe61e35c9ae60178). In the existing 8-laneACCUM_WORDSfixture replace only050001d5050d6a00with1a7e1b8781801c851c020a7e. This changes the post-restore consumer tos_and_b32 s27, s26, exec_lo,s_cselect_b32 s28, 1, 0,v_mov_b32 v5, s28.translate('O', code=code).hlsl_cs()accepts it and emitss27 = (s26 & exec) & 1; scc = s27 != 0;, then broadcasts SCC into the stored scalar. The fixture's wave trace givess26=0xf8and restoredexec_lo=0xff, so the wave-wide SCC is true for all 8 lanes. The singleton translation sees SCC false for lanes 0–2, giving 0 there rather than 1.Please refuse this SCC-live use or prove SCC dead before accepting an AND-derived lane mask, and add the replacement as a negative control. The existing Python compute fixture and startup lint both passed on the same integration; this is a new control.
Imported from R0Y00/Xbox2Windows. Originally posted by pigalot on 2026-11-27T22:44:36Z.
Review: APPROVED
Reviewed
4f53dc60merged over currentmaine9d1d6a0. The merge is clean (tree50a726cb) andgit diff --cached --checkis clean.R0Y00's finding on
85e96f29is addressed. The SCC-lives_and_b32 sX, sB, exec_lois now refused. With R0Y00's replacement words (1a7e1b8781801c851c020a7efor050001d5050d6a00inACCUM_WORDS),translate('O', code=...).hlsl_cs()refuses with "s_cbranch_scc0 inside a block s_cbranch_execz skips per lane: branch out of the block". The newaccum_scc_deadchecks the must-write set of the reading instruction (effects[at][1]). It accepts the read only when no successor has SCC live-in.What I traced.
The AND's destination:
s27is still treated as a lane mask after the AND. I checked this with local word replacements in the same fixture:s_and_b32 s27, s26, exec_lothens_cmp_lg_u32 s27, 0is refused ("reads lane mask s27 as numeric data").v_mov_b32 v5, s27is refused ("data operand s27 is a lane mask").s_mov_b32 s28, s27thenv_mov_b32 v5, s28is refused ("data operand s28 is a lane mask").So the whole-word value cannot leak through the destination either.
s_and_saveexec_b32: the check runs on every read of the accumulated mask, so it also coverss_and_saveexec_b32, which sets SCC from the new EXEC.s_and_saveexec_b32 s28, s26thens_cselect_b32 s29, 1, 0(1a3c9cbe81801d851d020a7e) is refused.accum_scc_deadforced toTrue, it is accepted, so this refusal comes from the new check.s_cmp_eq_u32 s4, s4is accepted.What I ran.
ctest --test-dir out/build/<preset> --no-tests=error -j 8 -R '^startup_gfx2hlsl_compute_' -E 'startup_audio': 69/69 pass indevand inrelease.python -B tests/startup_gfx2hlsl_compute_check.py: exit 0.python -B tests/startup_tools_lint_check.py tools/startup: PASS.llvm-mcreassembly locally. CI'sAssemble and translate gfx1013 fixturespasses on4f53dc60.Mutants of the fix in
tools/startup/gfx2hlsl.py, each run againsttests/startup_gfx2hlsl_compute_check.py:accum_scc_deadcall removed (negative control)ACCUM_AND_WORDScase)s_and_b32onlyRestored afterwards;
git diff --quietis clean.Non-blocking.
s_and_b32would pass. Adding the saveexec words above as a second negative control would pin it.85e96f29on7a12818c, before the SCC fix.Verdict: approve on
4f53dc60. R0Y00's changes-requested review on85e96f29still stands, so I am not merging this. It needs R0Y00's re-review.Environment: NVIDIA GeForce RTX 5090 driver 32.0.16.1088; Windows 11 25H2 build 26200.9974; MSVC 19.52.37029; DXC 1.9.2602.17; Python 3.12.10; host-only translator checks, no GPU work.
CI:
Build and test on Windows,Assemble and translate gfx1013 fixturesandRun platform-independent Python checks on Linuxpass on4f53dc60.This reply was AI-assisted.
Imported from R0Y00/Xbox2Windows. Originally posted by SimSalabimse on 2026-11-27T22:49:59Z.
The AND of the accumulated mask with exec is a per-lane read only when nothing reads the SCC it sets. That SCC is the whole word, so a later s_cselect of it stays refused. Added a source program that kills the SCC with a compare and then uses the AND result in v_cndmask, plus the s_cselect program as a negative control. Dropping the dead-SCC check makes that refusal fail.
Linux: the python-linux list exited 0 (245 checks), startup tools lint exited 0, and the compute gfx2hlsl check exited 0. Windows test PC: startup_gfx2hlsl_compute_controls passed twice, startup_gfx2hlsl_compute_ 69/69 passed, exit 0.
AI-Assisted
Imported from R0Y00/Xbox2Windows. Originally posted by JohnConnorNPC on 2026-11-28T07:34:52Z.
Thanks for the update on
4f53dc60. R0Y00's SCC request is met:ACCUM_SCC_WORDScarries their exact replacement (1a7e1b8781801c851c020a7e) and the test asserts it is refused. Their review is still CHANGES_REQUESTED on85e96f29, so it needs a re-review from R0Y00. Before that, could you add a control for each of the two new refusals that has none? Mutant runs were on copies oftools/startup/gfx2hlsl.py, restored by hash.if kept in live_in[target] or accum not in live_in[target]:withif accum not in live_in[target]:leavespython3 -B tests/startup_gfx2hlsl_compute_check.pygreen (rc=0). Under that mutant, words050001d5050d6a00+80039abe+050001d5050d6600(v_cndmask … s26; s_mov_b32 s26, 0; v_cndmask_b32 v5, v5, v6, s25) in the ACCUM fixture are accepted asaccum=[('s25', 's26')]; unmutated they are refused (accum=[False]). That would make a good ACCUM refusal control.accum_scc_deadtos_and_b32only also leaves the suite green, and the tests never use the direct form (git show 4f53dc60:tests/startup_gfx2hlsl_compute_check.py | grep -c 1a3c9cbe→ 0).1a3c9cbe1c03febe81801d851d020a7e(s_and_saveexec_b32 s28, s26; s_mov_b32 exec_lo, s28; s_cselect_b32 s29, 1, 0; v_mov_b32 v5, s29) is refused on the head today, so it can go in as a second ACCUM_SCC control.Smaller points:
mainc3204a9cin one file (git merge-tree --write-tree --name-only c3204a9c 4f53dc60→tests/startup_gfx2hlsl_compute_check.py). Main'scheck_execz_mask_subsetand yourcheck_execz_accumulated_maskwere added at the same spot. Keeping both resolves it, and the compute check passes on that merge.85e96f29, not4f53dc60.ctest -R '^startup_gfx2hlsl_compute_', but no dispatch case uses ACCUM (grep -cE "CASES\[[^]]*\] *=.*(ACCUM|EXIT_RUN)"→ 0). That run doesn't exercise this fixture, so please say so in the docs or add ACCUM as a case.This comment was AI-assisted.
Imported from R0Y00/Xbox2Windows. Originally posted by SimSalabimse on 2026-11-28T10:52:39Z.
Retested
fc2341e2afon the Windows test PC (NVIDIA, 32-lane waves).ctest --preset dev --no-tests=error -j 1 -R '^startup_gfx2hlsl_compute_controls$' -E "startup_audio_output|startup_audio_pacing|startup_audio_provider"
That passed twice, 1/1 each time, exit 0.
ctest --preset dev --no-tests=error -j 1 -R startup_gfx2hlsl_ -E "startup_audio_output|startup_audio_pacing|startup_audio_provider"
387/387 passed, exit 0.
Both of JohnConnorNPC's described mutants fail the new ACCUM_KEPT_* and ACCUM_SAVEEXEC_* controls on the Linux run.
AI-Assisted
Imported from R0Y00/Xbox2Windows. Originally posted by pigalot on 2026-11-28T11:08:22Z.
Review: APPROVED
Retested
fc2341e2merged over currentmain7e5c378d. The merge is clean (tree100400ae) andgit diff --cached --checkis clean. This follows my approval on4f53dc60.What changed since
4f53dc60. A merge ofmain(6afd4163) and one commit (fc2341e2) that adds two refusal controls, a docstring note and a docs paragraph. The translator's logic is unchanged.git show --remerge-diff 6afd4163. The one conflict was intests/startup_gfx2hlsl_compute_check.py, wherecheck_execz_accumulated_maskand main'scheck_execz_mask_subsetwere added at the same spot. Both are kept whole.Earlier points.
ACCUM_SAVEEXEC_WORDS(1a3c9cbe1c03febe81801d851d020a7e) is refused. Narrowingaccum_scc_deadtos_and_b32now fails the check at that control (line 1441).ACCUM_KEPT_WORDSis refused. Droppingkept in live_in[target]now fails the check at that control (line 1437).docs/experiments.mdnow namesstartup_gfx2hlsl_compute_controlsand says none of these programs is a dispatch case.main(JohnConnorNPC): addressed by6afd4163.85e96f29. Non-blocking.85e96f29stays addressed:ACCUM_SCC_WORDSis still refused, and removing theaccum_scc_deadcall fails the check.What I ran.
python -B tests/startup_gfx2hlsl_compute_check.py: exit 0.python -B tests/startup_tools_lint_check.py tools/startup: PASS.devandrelease, thenctest --test-dir out/build/<preset> --no-tests=error -j 6 -R '^startup_gfx2hlsl_compute_' -E 'startup_audio|_hardware$': 37/37 pass in each, no skips._hardwaredispatch tests this time, because no dispatch case uses these programs. I did not run thellvm-mcreassembly locally; CI'sAssemble and translate gfx1013 fixturespasses onfc2341e2.Mutants of
tools/startup/gfx2hlsl.py, each run againsttests/startup_gfx2hlsl_compute_check.py:ACCUM_KEPT)s_and_b32onlyACCUM_SAVEEXEC)accum_scc_deadcall removedACCUM_AND_WORDS)Restored afterwards;
git diff --quietis clean.Non-blocking.
Three walk conditions are unpinned. None of the three surviving non-equivalent mutants makes the translator accept a wrong program as far as I can see:
So these are coverage notes, not defects.
The trace asserts for the two new controls repeat earlier ones. The
trace(...)lines beforeACCUM_KEPTandACCUM_SAVEEXECare the same model calls as forACCUM_READ_S25andACCUM_SCC. They do not model the new words (thes_mov_b32 s26, 0, or the saveexec and restore). The refusals themselves are real, as the mutants show.The PR body's Verification section still names
85e96f29.Verdict: approve on
fc2341e2. R0Y00's changes-requested review on85e96f29still stands, so I am not merging this. It needs R0Y00's re-review.Environment: Windows 11 25H2 build 26200.9974; MSVC 19.52.37029; Python 3.12.10; host-only translator checks and WARP, no hardware GPU tests.
CI:
Build and test on Windows,Assemble and translate gfx1013 fixturesandRun platform-independent Python checks on Linuxpass onfc2341e2.This reply was AI-assisted.
Imported from R0Y00/Xbox2Windows. Originally posted by SimSalabimse on 2026-11-28T20:34:30Z.
@R0Y00 Both of your requests are in, and the branch is rebased onto current main (head
2c6dd7a1).accum_scc_deadin3d205071only treatss_and_b32 sX, sB, exec_loas a per-lane read when no later instruction still has SCC live. Yours_cselectreplacement stays refused.ACCUM_SCC_WORDSis your replacement (1a7e1b8781801c851c020a7e), and the compute check asserts that it is refused. Forcing the dead-SCC check to pass makes that assertion fail.Linux: tools lint exited 0, and python-linux passed 258/258.
Windows test PC:
startup_gfx2hlsl_compute_71/71 passed at2c6dd7a1, ctest exit 0.AI-Assisted
Imported from R0Y00/Xbox2Windows. Originally posted by Leyukaka on 2026-11-29T00:16:21Z.
Review of
2c6dd7a1, diff only, againstmain51472392. The three touched files are unchanged onmainsince0614f68c(git diff --stat 0614f68c 51472392on them is empty), andgit merge-tree --write-treemerges cleanly.The sA/sB proof holds for one pair: a leaving lane skips the pair, so its bit of sB matches, and its bit of sA differs, which
kept in live_in[target]refuses. SCC of the pair is dead at the exit because main already requires that.A second pair is not caught by any test.
tools/startup/gfx2hlsl.py:3446: changingif (pair is None and base == 's_and_b32'toif (base == 's_and_b32'leaves the suite green, because no fixture has two pairs. Under that change the second pair overwritespair, and the first pair's sA liveness and sB reads are never checked. A control: start s27 as an entry EXEC copy and s28 as 0, adds_and_b32 s27, s27, exec_lo; s_or_b32 s28, s28, s27after the first pair, and after the restore read s28 withv_cndmask_b32 v5, v5, v6, s28, thenv_cndmask_b32 v5, v5, v6, s25. Under the change the s25 read is not checked and the words are accepted; lane 0 stores 9 in the wave and 1 in the model. It must staybranch out of the block.The walk does not follow the AND's destination. At
:3471-3476only reads of sA and sB are checked. A copy of sB throughs_and_b32 sX, sB, exec_locan carry the whole word to an SCC thataccum_scc_deadnever sees. Please add this control: inACCUM_WORDSreplace050001d5050d6a00withs_and_b32 s27, s26, exec_lo; s_and_b32 s28, s27, exec_lo; s_cselect_b32 s29, 1, 0; v_mov_b32 v5, s29(1a7e1b87 1b7e1c87 81801d85 1d020a7e, written from the fixture's encodings, not assembled). The first AND's SCC is dead, since the second AND overwrites it. The second AND reads s27, not s26, so its SCC is not checked. The wave's SCC is true, so all 8 lanes store 1, while the singletons give[0, 0, 0, 1, 1, 1, 1, 1]. The PR's own test showsACCUM_SCC_WORDStranslates onceaccum_scc_deadis forced toTrue, so nothing after the walk is shown to refuse the s_cselect path. If it translates, follow sX in the walk as sB is followed.Verdict on
2c6dd7a1: comment. Items 1 and 2 need a control each, and item 2 may need a code change.Imported from R0Y00/Xbox2Windows. Originally posted by SimSalabimse on 2026-11-29T00:37:11Z.
@Leyukaka Both controls are in (head
6e0bdf25, rebased onto main51472392).branch out of the block. The new program (ACCUM_SECOND_*) starts s27 as an entry EXEC copy and s28 as 0, putss_and_b32 s27, s27, exec_lo; s_or_b32 s28, s28, s27after the first pair, then selects with s28 and s25. Lane 0 is 9 in the wave and 1 in the model. Droppingpair is Noneaccepts those words, and the compute check exits 1 there.accum_carried). Your words decode ass_and_b32 s27, s26, exec_lo; s_and_b32 s28, s27, exec_lo; s_cselect_b32 s29, 1, 0; v_mov_b32 v5, s29(ACCUM_CARRY_*), and that program stays refused. Turning the follow off accepts it, and the check fails on that assertion.Linux: tools lint exited 0, and python-linux passed 259/259.
Windows test PC:
startup_gfx2hlsl_compute_71/71 passed at6e0bdf25, ctest exit 0.AI-Assisted
Imported from R0Y00/Xbox2Windows. Originally posted by Leyukaka on 2026-11-29T01:04:53Z.
Review: APPROVED
Review of
6e0bdf25, diff only, againstmain212d4b5f.git range-diffagainst2c6dd7a1shows the first three commits unchanged (=) and one new commit,6e0bdf25. The three touched files are unchanged onmainfrom51472392to212d4b5f, andgit merge-tree --write-treemerges cleanly.Second pair: addressed.
ACCUM_SECOND_WORDS(tests/startup_gfx2hlsl_compute_check.py:554-558) is the requested program, and:1469requiresbranch out of the block. I checked the new dwords against the fixture's own encodings. Ifpair is Noneis dropped, the second pair overwritespairwith(s27, s28). s27 is dead at the exit and s28 is live there, and thev_cndmaskof s25 reads neither, so, by reading, the words would then be accepted and:1469would fail. I did not run this mutation. Without the mutation, the seconds_and_b32reachesvector_spanand is refused.Chained AND: addressed, with a code change.
accum_carried(tools/startup/gfx2hlsl.py:3506) adds sX froms_and_b32 sX, sW, exec_loto the tracked set when sW is tracked. The walk now appliesper_lane_readandaccum_scc_deadto every tracked word.ACCUM_CARRY_WORDSis1a7e1b87 1b7e1c87 81801d85 1d020a7e, and it is refused at:1473.:1475-1486stubsaccum_carriedtoNoneand requires that the words are then accepted, so the refusal depends on following the destination.pigalot's approvals are on
4f53dc60andfc2341e2, and R0Y00's changes request is on85e96f29. Neither covers the walk change in6e0bdf25.ACCUM_SCC_WORDSis still refused at this head.Basis: reading of the diff, and CI on
6e0bdf25:Build and test on Windows,Assemble and translate gfx1013 fixtures(which asserts both new word strings against llvm-mc,:2788-2789) andRun platform-independent Python checks on Linuxpass. I ran nothing locally.Verdict on
6e0bdf25: approve.Imported from R0Y00/Xbox2Windows. Originally posted by pigalot on 2026-11-29T07:19:06Z.
Review: CHANGES_REQUESTED
Retested
6e0bdf25merged over currentmain212d4b5f. The merge is clean (treec79dafd0) andgit diff --cached --checkis clean. The branch was rebased since my approval onfc2341e2; the one new commit is6e0bdf25, which adds the one-pair control (ACCUM_SECOND_*), the walk that follows an AND's destination (accum_carried) and its control (ACCUM_CARRY_*).Blocking: a carried mask is dropped when the same AND is repeated.
ACCUM_WORDS, replace050001d5050d6a00with1a7e1b87 1a7e1b87 1b7e1c87 81801d85 1d020a7e. That isACCUM_CARRY_WORDSwith its first dword repeated:s_and_b32 s27, s26, exec_lo; s_and_b32 s27, s26, exec_lo; s_and_b32 s28, s27, exec_lo; s_cselect_b32 s29, 1, 0; v_mov_b32 v5, s29.translate('O', code=words).hlsl_cs()accepts it and emitss28 = (s27 & exec) & 1; scc = s28 != 0; s29 = scc ? 0x00000001u : 0x00000000u; if (exec & 1) v5 = s29;.branch out of the block, as forACCUM_CARRY_WORDS. The values are the ones the test already models for that control:trace(lanes, observe='scc')is[1] * 8andsingletons(lanes, observe='scc')is[0, 0, 0, 1, 1, 1, 1, 1].accum_carriedreturnsNone(if ops[0] in tracked). Thennxt -= (tracked & writes)removes s27, because the AND writes it. From there on s27 is not tracked, although it holds s26's lane bits again, so the third AND's SCC is never checked.1a7e1b87 1b7e1c87 1c7e1b87 1b7e1d87 81801e85 1e020a7e(s27 = s26 & exec; s28 = s27 & exec; s27 = s28 & exec; s29 = s27 & exec; s_cselect_b32 s30, 1, 0; v_mov_b32 v5, s30) is also accepted.ops[0] in trackedreturn inaccum_carriedand build the next set asset(tracked) - writes, then add the carried word. With that, both programs above are refused with the PR's reason andpython -B tests/startup_gfx2hlsl_compute_check.pystill exits 0. The in-places_and_b32 sX, sX, exec_loof a tracked word followed bys_cselect_b32is refused with or without that change (I checked1a7e1b87 1b7e1b87 81801d85 1d020a7e, and1a7e1a87 81801d85 1d020a7eon s26). Please add the first program as a control.Leyukaka's two points on
2c6dd7a1are addressed for the programs they named.ACCUM_SECOND_WORDSis refused. Droppingpair is Nonefails the check there (line 1469).ACCUM_CARRY_WORDSis refused. ReturningNonefromaccum_carried, checking SCC only for sB, or stopping the walk at the carrying AND each fails the check there (line 1473).Leyukaka approved
6e0bdf25from a reading of the diff; the program above is not one of theirs.R0Y00's SCC-live AND finding on
85e96f29stays addressed:ACCUM_SCC_WORDSis still refused, and forcingaccum_scc_deadtoTruefails the check (line 1445).What I ran.
python -B tests/startup_gfx2hlsl_compute_check.py: exit 0.python -B tests/startup_tools_lint_check.py tools/startup: PASS.devandrelease, thenctest --test-dir out/build/<preset> --no-tests=error -j 6 -R '^startup_gfx2hlsl_compute_' -E 'startup_audio|_hardware$': 37/37 pass in each, no skips._hardwaredispatch tests, because no dispatch case uses these programs. I did not run thellvm-mcreassembly locally; CI'sAssemble and translate gfx1013 fixturespasses on6e0bdf25. The words in this review are written from the fixture's own encodings, not assembled.7e1a1b87 7e1b1c87 81801d85 1d020a7e), and a whole-wordv_mov_b32 v5, s27of a carried word (1a7e1b87 040406bf 1b020a7e).6e0bdf25merged ontomain212d4b5fpassed: judged no worse than themainbaseline.Mutants of
tools/startup/gfx2hlsl.py, each run againsttests/startup_gfx2hlsl_compute_check.py:pair is Nonedropped (second pair adopted)ACCUM_SECOND)accum_carriedalways returnsNoneACCUM_CARRY)ACCUM_CARRY)ACCUM_CARRY)ACCUM_KEPT)accum_scc_deadalwaysTrueACCUM_SCC)exec_lo, source not checkedops[0] in trackedreturn dropped fromaccum_carriedexec_lono longer required inaccum_carriedRestored afterwards;
git diff --quietis clean.Notes on the survivors:
v_mov_b32of a carried word above is still refused, so this is a coverage note.fc2341e2; neither accepts a wrong program as far as I can see.ops[0] in trackedreturn: it survives because the write removal drops the word either way; with only this return dropped, the two programs in the blocking finding are still accepted. This is the blocking finding above.execz_scalar_exitaccepts, so each is visited once; and an AND of a tracked word withoutexec_lois already refused byper_lane_read.Non-blocking.
ACCUM_READ_S25andACCUM_SCC; they do not model the second pair or the second AND.85e96f29.s_and_saveexec_b32 s28, s26, thens_cmp_eq_u32 s4, s4, thens_and_b32 s29, s21, exec_loands_cselect_b32of that SCC is accepted (1a3c9cbe 040406bf 157e1d87 81801e85 1c03febe 1e020a7e). The same program without the pair, with a freshv_cmp_gt_u32 vcc_lo, 3, v0in place of s26, is accepted too, so the SCC of an AND with a narrowed EXEC is read per lane with or without this PR. I am not asking for it here.Verdict: request changes on
6e0bdf25, for the repeated-AND program above. This supersedes my approval onfc2341e2. R0Y00's changes-requested review on85e96f29also still stands.Environment: Windows 11 25H2 build 26200.9974; MSVC 19.52.37029; Python 3.12.10; host-only translator checks and WARP, no hardware GPU tests.
CI:
Build and test on Windows,Assemble and translate gfx1013 fixturesandRun platform-independent Python checks on Linuxpass on6e0bdf25.This reply was AI-assisted.
Imported from R0Y00/Xbox2Windows. Originally posted by Leyukaka on 2026-11-29T07:32:41Z.
Review: CHANGES_REQUESTED
Withdrawing my approval of
6e0bdf25: the repeated-AND program in the review above gets past the walk inexecz_accumulated_maskat this head. Read oftools/startup/gfx2hlsl.pyonly, nothing run.With
tracked = {s26}:s_and_b32 s27, s26, exec_lo:accum_carriedreturns s27, sotracked = {s26, s27}.accum_carriedreturnsNonebecause s27 is already tracked (:3517), thennxt -= (tracked & writes)(:3486) removes s27.s_and_b32 s28, s27, exec_lo: s27 is not tracked, so the per-lane read check (:3477) and the SCC check (:3479) do not apply, and s28 is not carried (:3523).s_cselect_b32reads that SCC unchecked.I did not check the fix suggested in that review.
Imported from R0Y00/Xbox2Windows. Originally posted by SimSalabimse on 2026-11-29T12:54:04Z.
Fixed at
ede53dce485b1028f78287026eb8a89a258bdd5a. An AND that rewrites an already tracked lane mask now ends the old definition and starts a new tracked definition at that destination, so a later AND's SCC stays inside the refusal. That covers the repeated carry into s27 (ACCUM_REPEAT_*, the first dword ofACCUM_CARRY_WORDSrepeated) and the longer chain that rewrites s27 from s28 then carries it into s29 (ACCUM_REWRITE_*). Restoring the old rule that returnsNonewhen the destination is already tracked accepts both, and the check then fails. The earlier accumulated-mask controls are unchanged. The branch is rebased onto main77d1ba4d.Windows test PC (MSVC,
--preset dev,-j 1), at that head:ctest --preset dev --no-tests=error -j 1 -R '^startup_gfx2hlsl_compute_' -E 'startup_audio_(output|pacing|provider)': 71/71 passed, exit 0.startup_gfx2hlsl_compute_controlsran the execz refusals, including the two new programs. The other 70 are the warp, hardware, spill and mask-spill cases, including the expected-fail controls.Not done in this head: the trace asserts for the new controls still repeat the earlier model calls. The in-place
s_and_b32 sX, sX, exec_loprograms from the review are not added as named controls.AI-Assisted
Imported from R0Y00/Xbox2Windows. Originally posted by JohnConnorNPC on 2026-11-29T12:55:35Z.
Review of
ede53dce(merge-base = main77d1ba4d). Verdict: no MUST from me. Merging is blocked only by the recorded change requests: pigalot and Leyukaka on6e0bdf25, and R0Y00 on85e96f29. Each needs its author's re-review.pigalot's blocking finding (a repeated AND drops a carried mask) is fixed the way pigalot suggested.
accum_carriedno longer returnsNonefor an already tracked destination, and the walk buildsnxt = set(tracked) - writesbefore adding the carry. What I ran, Linux, Python 3.13:python -B tests/startup_gfx2hlsl_compute_check.py→ exit 0.tools/startup/gfx2hlsl.pyfromede53dce~1→ exit 1 atAssertionError: accepted, expected a refusal naming 's_cbranch_scc0 inside a block s_cbranch_execz skips per lane: branch out of the block'. So the newACCUM_REPEAT/ACCUM_REWRITEcontrols pin the fix, and the in-testno_recarrystub covers the same ground.050001d5050d6a00inACCUM_WORDSwith each of these, and all are refused with that reason:s_mov_b32 s27, s26, thens_and_b32 s28, s27, exec_lo; s_cselect_b32 s29, 1, 0; v_mov_b32 v5, s29;s_and_b32 s27, s27, exec_loof a carried word, thens_cselect;assemble(llvm_mc, ACCUM_REPEAT_SOURCE) == ACCUM_REPEAT_WORDS, and the same forREWRITE), and CI's fixture job passes on this head.The change is gfx2hlsl-only. With
X2W_NATIVE_SHADERS_ONLY=1(the launcher default since #3449), its compute manifests aren't loaded, so it affects-Translateruns only.AI-assisted.
Imported from R0Y00/Xbox2Windows. Originally posted by pigalot on 2026-11-29T13:03:16Z.
Review: APPROVED
Retested
ede53dcemerged overmain77d1ba4d. The merge is clean (tree52d8d667) andgit diff --cached --checkis clean.git range-diffagainst6e0bdf25shows the first four commits unchanged and one new commit,ede53dce.My blocking finding on
6e0bdf25is addressed. A carried mask is no longer dropped when an AND rewrites it.set(tracked) - writesand then adds the carried word, andaccum_carriedno longer returnsNonefor a destination that is already tracked. A rewritten word is therefore tracked again from the AND on.1a7e1b87 1a7e1b87 1b7e1c87 81801d85 1d020a7e): refused withbranch out of the block. It is in the test asACCUM_REPEAT_WORDS.1a7e1b87 1b7e1c87 1c7e1b87 1b7e1d87 81801e85 1e020a7e): refused. It is in the test asACCUM_REWRITE_WORDS.Leyukaka's changes request on
6e0bdf25names the same repeated-AND program, which is refused at this head. R0Y00's SCC-live AND finding on85e96f29stays addressed:ACCUM_SCC_WORDSis still refused, and forcingaccum_scc_deadtoTruefails the check.What I ran.
python -B tests/startup_gfx2hlsl_compute_check.py: exit 0.python -B tests/startup_tools_lint_check.py tools/startup: PASS.devandrelease, thenctest --test-dir out/build/<preset> --no-tests=error -j 6 -R '^startup_gfx2hlsl_compute_' -E 'startup_audio|_hardware$': 37/37 pass in each, no skips._hardwaredispatch tests, because no dispatch case uses these programs. I did not run thellvm-mcreassembly locally; CI'sAssemble and translate gfx1013 fixturespasses onede53dce. The words below are written from the fixture's own encodings, not assembled.050001d5050d6a00inACCUM_WORDSthat I tried at this head, all refused:s_cselect_b32(1a7e1b87 1a7e1b87 1a7e1b87 1b7e1c87 81801d85 1d020a7e);7e1a1b87 7e1a1b87 7e1b1c87 81801d85 1d020a7e);s_and_b32 s27, s27, exec_loof the carried word, thens_cselect_b32(1a7e1b87 1b7e1b87 81801d85 1d020a7e), and the same with a further carry into s28 (1a7e1b87 1b7e1b87 1b7e1c87 81801d85 1d020a7e);1a7e1a87 81801d85 1d020a7e);v_mov_b32 v5, s27after the repeat (1a7e1b87 1a7e1b87 040406bf 1b020a7e) and after a rewrite of s27 from s28 (1a7e1b87 1b7e1c87 1c7e1b87 040406bf 1b020a7e).v_cndmask_b32on s27 (1a7e1b87 040406bf 050001d5 050d6e00), and the same with the AND repeated.ede53dcepassed: judged no worse than themainbaseline.Mutants of
tools/startup/gfx2hlsl.py, each run againsttests/startup_gfx2hlsl_compute_check.py:ACCUM_REPEAT, line 1514)accum_carriedreturnsNonefor a tracked destinationACCUM_CARRY, line 1498)accum_carriedalways returnsNoneaccum_scc_deadalwaysTrueACCUM_SCC, line 1470)pair is NonedroppedACCUM_SECOND, line 1494)ACCUM_KEPT, line 1487)exec_lo, source not checkedexec_lono longer required inaccum_carriedRestored afterwards;
git diff --quietis clean.Notes on the survivors, all unchanged from my review of
6e0bdf25:v_mov_b32of a carried word is still refused with it, so this is a coverage note.execz_scalar_exitaccepts, and an AND of a tracked word withoutexec_lois already refused byper_lane_read.Non-blocking.
ACCUM_CARRY(trace(lanes, observe='scc') == [1] * 8, singletons[0, 0, 0, 1, 1, 1, 1, 1]), because a repeated AND with the same EXEC gives the same word.85e96f29.Verdict: approve
ede53dce. This supersedes my changes-requested review on6e0bdf25. The changes requests from R0Y00 (on85e96f29) and Leyukaka (on6e0bdf25) are still open on the PR; I am not merging it.Environment: Windows 11 25H2 build 26200.9974; MSVC 19.52.37029; Python 3.12.10; host-only translator checks and WARP, no hardware GPU tests.
CI:
Build and test on Windows,Assemble and translate gfx1013 fixturesandRun platform-independent Python checks on Linuxpass onede53dce.This reply was AI-assisted.
Imported from R0Y00/Xbox2Windows. Originally posted by Leyukaka on 2026-11-29T13:37:57Z.
Review: APPROVED
Review of
ede53dce, diff only.git range-diffagainst6e0bdf25shows the first four commits unchanged and one new commit. The three touched files are unchanged onmainfrom77d1ba4dto17b662a2, andgit merge-tree --write-treemerges cleanly.Asked on
6e0bdf25: the repeateds_and_b32 s27, s26, exec_lodropped s27 from the tracked set, so the SCC of the followings_and_b32 s28, s27, exec_lowas read unchecked.Fixed in
tools/startup/gfx2hlsl.py:accum_carried(:3506) no longer returnsNonewhen the destination is already tracked; the only source test left is:3522.nxt = set(tracked) - writes(:3484) and then adds the carried word (:3485-3486), so a rewritten word is tracked again from that AND on.With
tracked = {s26}: the first AND gives{s26, s27}; the second removes s27 as a write and adds it back as the carry; the third AND reads tracked s27, its SCC is live at thes_cselect_b32, andaccum_scc_dead(:3479) refuses. The new next set always contains the old one, so this commit can only refuse more than6e0bdf25did.Tests,
tests/startup_gfx2hlsl_compute_check.py:ACCUM_REPEAT_WORDS(:579) is the program from the changes request;ACCUM_REWRITE_WORDS(:592) is the longer chain. Both must be refused (:1513-1514).:1516-1530stubs the old rule (a tracked destination is not carried) and requires that both are then accepted, so the refusals depend on this change.:2836-2837assert both word strings against llvm-mc. I checked the new dwords against the fixture's own encodings.NIT, optional: the comment at
gfx2hlsl.py:3467still says "An AND into a fresh sX adds sX"; the destination no longer has to be fresh.Basis: reading of the diff, and CI on
ede53dce:Build and test on Windows,Assemble and translate gfx1013 fixturesandRun platform-independent Python checks on Linuxpass. I ran nothing locally.Verdict on
ede53dce: approve. This replaces my changes request on6e0bdf25. R0Y00's changes request on85e96f29is still open.Imported from R0Y00/Xbox2Windows. Originally posted by R0Y00 on 2026-12-02T23:25:11Z.
Review: APPROVED
Re-reviewed
4ce0542fon currentmainc42b7ce3; the merge is clean. My SCC-live finding is resolved. The walk refuses a whole-mask SCC read, follows the destination of a lane-preserving AND, and re-adds the carried word after its earlier definition is overwritten. The Windows Python compute fixture, startup lint, and docs-link check passed. LLVM 15llvm-mcindependently reassembled the fixture words, including SCC, second pair, chained AND, repeated AND, and rewritten-mask controls. Replacing only theaccum_scc_deadliveness condition withreturn TruemakesACCUM_SCC_WORDStranslate and fails the expected refusal. Restoring the check passes. This approves the current head and supersedes my change request on85e96f29.