Skip to content

wave64_halves: a lane mask accumulated by lane-local defs is not stale (SHADER-821) - #4656

Open
sperm wants to merge 4 commits into
ItsNotRexed:mainfrom
sperm:shader-821-break-loop-lane-mask
Open

sperm wants to merge 4 commits into
ItsNotRexed:mainfrom
sperm:shader-821-break-loop-lane-mask

Conversation

@sperm

@sperm sperm commented Nov 23, 2026

Copy link
Copy Markdown

Claim: SHADER-821 (#4571 (comment)), from @shdann's finding.

What and why

stale_uses() treats a 64-bit lane mask in an SGPR pair as a scalar. In a compiler's break loop, the pair collects the lanes that left:

s_mov_b64 s[16:17], 0
loop:
  v_add_nc_u32_e32 v9, 1, v9
  v_cmp_ge_u32_e32 vcc, v9, v10        ; v10 differs per lane
  s_or_b64 s[16:17], vcc, s[16:17]
  s_andn2_b64 exec, exec, s[16:17]
  s_cbranch_execnz loop
s_or_b64 exec, exec, s[16:17]

The pair's in-loop def is control dependent on the loop's EXEC vote, so its reads were stale and the two EXEC writes tainted-exec: tier C. Each bit belongs to one lane, though. A v_cmp writes 0 for the lanes that are off, so OR-ing it in can't change an off lane's bit. A half that leaves the loop early therefore has the same bits for its lanes as the wave.

The rule (narrow on purpose)

  • Lane-local def (Analysis.lane_local_defs): s_or_b64 D, M, D (either order) or s_andn2_b64 D, D, M, where D is an SGPR pair and M is VCC or a pair that a v_cmp (not v_cmpx) wrote earlier in the same block, with no EXEC write in between.
  • Not stale: in stale_uses(), a read of D is not stale when every vote-dependent def that reaches it is lane-local and the read only uses D as a lane mask, either as an EXEC write or as the next lane-local def.
  • Unchanged: scalar uses of the same pair (s_bcnt1, s_cmp, data) are still stale. So is an OR with anything that isn't a fresh v_cmp result.

Tests (tests/semantic/test_wave64_halves.py)

  • test_a_break_loop_lane_mask: the loop above as a PS is tier A (tier C tainted-exec on main).
  • test_a_break_loop_lane_mask_runs_the_same: as a VS through the CPU wave interpreter, one 64-lane wave and two 32-lane waves write the same outputs (trip counts 1 to 4 per lane), and the tier is A.
  • Near misses that stay tier C:
    • test_c_break_loop_mask_read_as_scalar: s_bcnt1_i32_b64 of the pair is exported.
    • test_c_break_loop_or_with_a_non_compare_mask: OR-ing a copy of EXEC instead of a v_cmp result.

Corpus census (asked for by the item)

On my own 1.0.2.1 copy I translated the whole corpus at main (d0835dd) and with this change, then ran wave64_halves.py --census. Counts only.

main this PR
A / B / C (13,401 wave64 VS/PS/GS) 4,033 / 85 / 9,283 4,033 / 85 / 9,283
tainted-exec / stale-scalar 5,188 / 3,414 5,188 / 3,414

No shader changes tier. The shape doesn't occur in this corpus: none of the 25,734 listings narrows EXEC with s_andn2_b64 exec, …. The game's compiler narrows with s_and_b64 exec, exec, s[pair] (15,971 times) and loops with s_andn2_wrexec_b64 waterfalls. So this PR fixes the classifier for the LLVM-style loop in the finding, but it has no effect on 1.0.2.1's tiers. I'm reporting that plainly so the maintainer can decide whether the rule is worth keeping. If not, the census still answers the item's open question, and I'm happy to close this.

Tested

Touches tools/wave64_halves.py alongside #4619/#4620 (SHADER-819/820), but in stale_uses() and a new helper, not in put()/narrows.

AI-assisted (Claude Code).

🤖 Generated with Claude Code

@justr4mzi

Copy link
Copy Markdown
Contributor

Reviewed and tested at b4279edb on Windows 11 with AMD Radeon RX 6700 XT (RDNA2, gfx1031), LLVM_MC, SPIRV-Tools, and LEONIDA_VK_VALIDATION=1.

Tests Run

  • python -I tests/semantic/test_wave64_halves.py: 77/77 OK (2.495s).
  • python -I tests/semantic/test_wave64_halves_soundness.py: 30/30 OK (2.305s).
  • python -I tests/semantic/test_wave64_emulate_opt.py: 22/22 OK (6.603s).
  • python -I tests/test_shader_checks.py: 75/75 OK (1.621s).
  • python -I scripts/run_gpu_tests.py --build build --filter cs_w64 --require-pass (LEONIDA_VK_VALIDATION=1, RX 6700 XT):
    • Native wave64: 21 shaders: 21 translated, 21 pass spirv-val, 21/21 passed (0 validation errors).
    • Emulated wave64 (LEONIDA_W64_EMULATE=1): 21 shaders: 21 translated, 21 pass spirv-val, 21/21 passed (0 validation errors).
  • py_compile, scripts/check_no_game_data.py, and git diff --check: exited 0.
  • Note: tests/test_wave64_halves_fixtures.py was not run (pytest is not installed in this environment).

Code Review (tools/wave64_halves.py)

  • The tracking in lane_local_defs() and gating in stale_uses() look sound: zero_off is populated only from non-v_cmpx v_cmp* results, cleared on any exec write or overwritten pair member, and stale_uses() still catches scalar reads (s_bcnt1_i32_b64) or non-compare masks even when the accumulator is consumed by exec or another lane-local def.
  • Non-blocking nit: LANE_LOCAL_OPS at tools/wave64_halves.py:1025 is unused (lane_local_defs() checks op in ("s_or_b64", "s_andn2_b64") after base_op, which strips _e32).

AI-assisted (Gemini, Antigravity).

@sperm

sperm commented Nov 23, 2026

Copy link
Copy Markdown
Author

Thanks @justr4mzi, good catch. LANE_LOCAL_OPS was left over from a first draft: lane_local_defs() checks the two opcodes after base_op strips the suffix. Removed in 682d144. test_wave64_halves.py and test_wave64_halves_soundness.py still pass (107 run, OK), and git diff --check is clean. AI-assisted.

@Kam471 Kam471 left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Ran this at 682d14421 on Windows 11: tests/semantic/test_wave64_halves.py -> 77 tests, OK; tests/semantic/test_wave64_halves_soundness.py -> 30 tests, OK; git diff --check clean.

The lane mask accumulated by lane-local definitions is no longer treated as stale when a later read consumes it (SHADER-821), and the unused LANE_LOCAL_OPS list is dropped; the added cases cover the accumulated-mask and the rewritten-mask forms. Merge check: clean with #4619, #4620, #4624 and #4630; conflicts only with #4655 in tools/wave64_halves.py. No blocking issue.

Jacob and others added 2 commits November 23, 2026 18:02
…e (SHADER-821)

A compiler's break loop ORs a v_cmp result into an SGPR pair and narrows EXEC
with it. stale_uses() treated the pair as a scalar, so the loop was tier C
tainted-exec although each bit belongs to one lane. A def that ORs (or
AND-NOTs) a same-block v_cmp result into the pair leaves the off lanes' bits
alone; a read that only uses the pair as a lane mask (an EXEC write, or the next
such def) is no longer stale. Scalar uses (s_bcnt1, s_cmp) still are.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
…DER-821)

After the rebase onto main, the kill-exit test from cc4231d that expected a
conservative tier C for an exit whose live mask two kills define now gets A:
both definitions are `s_andn2_b64 D, D, vcc` after a v_cmp, so the mask is
lane-local. Run it on the emulator (64 lanes against two halves of 32, with
the halves leaving at different votes) and the words match. Keep a C control
where the second definition ORs in a scalar register.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
@kapitche

Copy link
Copy Markdown
Contributor

Tested 649260f merged with main 98fa503 on WSL Ubuntu, Python 3.12.16: pass

  • tests/semantic/test_wave64_halves.py: 107 tests, OK (CPU only; the Execution tests run on the wave interpreter).
  • Negative control, tools/wave64_halves.py checked out from main with the PR's tests: 4 fail (test_a_break_loop_lane_mask, test_a_break_loop_lane_mask_runs_the_same, test_kill_exit_shared_by_two_kills_invariant, test_shared_exit_of_two_kills_is_a), so the new tests need the fix. The two _stays_c / _c_ guard tests pass on both, as expected for conservative cases.
  • Read the diff; also ran the break loop with the accumulator initialised to 0, to a copy of EXEC (s[10:11]) and to -1: tier A and whole-wave vs halves outputs identical in all three. No issues found.
  • Not run on Windows: pure Python with no path or subprocess use.

@CuteBooty

Copy link
Copy Markdown

Tested 649260f0 on NVIDIA GeForce RTX 3070 (32-wide subgroups), driver 617.14, Windows 11 25H2; llvm-mc 23.1.5; test programs built from the base 98fa503f (the PR does not touch runtime/).

GPU suite (build.py + check.py), head against base 98fa503f:

  • native: 153/188 pass, 35 skipped (wave64 on a 32-wide device)
  • LEONIDA_W64_EMULATE=1: 184/188 pass, 4 skipped (3 mesh fixtures, ps_w64x_readlane)
  • same result for every test, all 242 translated modules byte-identical, graphics tiers A/B/C 10/7/13 on both

So no regression on a 32-wide GPU. It also means none of the 242 fixtures build.py translates reaches the new rule: the C→A move for a break-loop lane mask has CPU coverage only (the 107/107 and the 4-fail negative control kapitche reported above reproduce on Windows), and nothing yet runs such a shader as tier A on 32-wide hardware.

AI-assisted (Claude Code).

@sperm

sperm commented Nov 23, 2026

Copy link
Copy Markdown
Author

Rebased onto main (98fa503), now at 649260f. AI-assisted (Claude Code).

Conflict: stale_uses() in tools/wave64_halves.py. main added the lane-spill read (v_readlane_b32 from a pure spill VGPR). I kept that and this PR's mask_use line next to each other. Both are independent reads, and neither changes the other.

One test on main changed with this rule: test_shared_exit_of_two_kills_stays_c (from cc4231d). Two lane-local kills share one exit. Each kill's s_andn2_b64 s[pair], s[pair], vcc is one of the lane-local defs this PR treats as not stale, so the shape is now tier A. I checked that it's sound before changing the expectation:

  • Through the CPU wave interpreter, one 64-lane wave and two 32-lane halves write the same outputs, with the second kill's limit at 20, 50 and 63.
  • The test is now test_shared_exit_of_two_kills_is_a, and test_kill_exit_shared_by_two_kills_invariant checks it end to end. Whole-quad mode keeps lanes 48 and 49 on, as expected.
  • A near miss still stays tier C (tainted-exec): in test_shared_exit_after_a_scalar_mask_stays_c, the second kill ORs in a scalar pair instead of a compare.

Census after the rebase: I translated my own 1.0.2.1 copy at main 98fa503 and at this branch, then ran wave64_halves.py --census. Counts only.

main this PR
translated / spirv-val valid 26,503 / 26,503 26,503 / 26,503
tier A / B / C 5,054 / 106 / 8,245 5,054 / 106 / 8,245
shaders whose index entry differs 0

As before, no shader in this corpus changes tier, so the rule only matters for the LLVM-style loop in the finding.

Tests: I ran the whole tests/semantic suite on Linux, CPU only (no GPU used): 6,251 tests. 3 failures and 2 errors, all in test_loop_ballot_barrier (the divergent-loop emulate tests). Exactly the same ones fail on main 98fa503, so this branch didn't cause them. test_wave64_halves passes.

@memorypressure

Copy link
Copy Markdown

Verified at the PR head: tests/semantic/test_wave64_halves.py passes 107/107 under python -I, and the translator-use guard, soundness and fixtures suites are clean. The lane-local-def rule reads correctly (v_cmp's zeroed inactive bits make the accumulated mask half-invariant). The head merges cleanly with current main; sequencing note: #4655 edits the same tool and semantic test — land in some order and re-run after each. AI-assisted: yes. Tested on Linux (RTX 5080 host, CPU-only run).

@cxchhh

cxchhh commented Nov 23, 2026

Copy link
Copy Markdown
Contributor

Tested 649260f0 on Tesla V100-SXM2-32GB (Volta, subgroup 32..32), NVIDIA 580.95.05, Ubuntu 24.04 (kernel 6.14.11), Python 3.12: pass.

Scope: the 32-wide half only (NVIDIA Volta). The AMD / 64-wide half still needs someone with an AMD GPU. (The change is in tools/wave64_halves.py, a CPU analysis. The GPU suite only confirms that nothing else moved.)

Setup: the PR diff applied to main 98fa503f (applies cleanly), Linux Vulkan test programs built from that tree, compared against untouched main 98fa503f built the same way. llvm-mc 23.1.6, SPIRV-Tools 2026.4.

  • scripts/run_gpu_tests.py: native 161/217 passed, 56 skipped; emulated + barycentric fallback 194/217 passed, 23 skipped; the same as main.
  • tests/semantic/test_wave64_halves.py: 107 OK (main: 101). This PR's test file against main's tools/ gives 4 failures, which are the new tier-A cases.
  • python -m unittest discover -s tests/semantic: 6251 tests; the only failures are the five test_loop_ballot_barrier cases that also fail on main here.

No game files. AI-assisted (Claude Code); I ran the commands above and checked the numbers against the logs.

@465d6a0eac

Copy link
Copy Markdown
Contributor

Census (TEST-1006) of 649260f0, from my own 1.0.2.1 copy, counts only: no change on the corpus.

Setup. I merged the PR onto main d974c88a (clean merge) and compared it with my 0db7fed5 run. tools/ differs between the two only in exe_checklist.py, gdk_runtime_calls.py and saves.py. Native mode, the 13,405 wave64 VS/PS/GS (picked by the FSSM wave-size flag and the carve-index stage), WSL Ubuntu, Python 3.14.4, llvm-mc 21.1.8, SPIRV-Tools v2026.1, CPU only.

Result. Both sides translate all 13,405, and all 13,405 pass spirv-val. The .spv files are byte-identical. The tiers are A 5,054 / B 106 / C 8,245 on both sides (VS 1,455 / 79 / 702, PS 3,404 / 27 / 7,543, GS 195 A), and no shader's reason set changes. Tier C stale-scalar stays at 3,487.

So no wave64 VS/PS/GS in the game has a stale-scalar finding that comes only from a lane mask built up by lane-local defs. The compiler break loops that this rule frees, if the corpus has any, carry other tier C reasons as well.

AI-assisted (Claude Code). Part of TEST-1006 on the coordination issue.

@shdann

shdann commented Nov 23, 2026

Copy link
Copy Markdown
Contributor

AI-assisted review (Claude Code). No game files; hand-written listings; CPU wave interpreter only (Windows 11, Python 3.14.7).

Head 649260f0, and the same head merged with main 561b65a8 (the merge is clean). I ran 15 hand-written vertex listings as one 64-lane wave and as two 32-lane waves, with the analyser of this head and of main.

One defect: a pattern moves from tier C to tier A, and the two runs differ.

The rule says that a v_cmp writes 0 for the lanes that are off, so the accumulating definition cannot change the bit of a lane of a half that left. That is true only if these lanes are off at the v_cmp. The rule does not check it: lane_local_defs() clears zero_off at an EXEC write after the compare, but an EXEC write before the compare can switch the lanes on again.

v_cmp_gt_u32_e64 s[16:17], 0, v0          ; the pair starts as the empty mask
v_cmp_eq_u32_e32 vcc, 2, v0               ; v0 = lane number: only lane 2
s_and_saveexec_b64 s[12:13], vcc
s_cbranch_execz 3                         ; the second half has no lane and skips
s_mov_b64 exec, s[10:11]                  ; the run side restores the launch mask
v_cmp_gt_u32_e32 vcc, 64, v0              ; true in all 64 lanes of the wave
s_or_b64 s[16:17], vcc, s[16:17]          ; "lane-local" for the rule
s_mov_b64 exec, s[10:11]                  ; the join
s_and_b64 exec, exec, s[16:17]
v_add_nc_u32_e32 v6, 1, v6
s_mov_b64 exec, s[10:11]
  • main 561b65a8: tier C tainted-exec.
  • This head: tier A, no reasons.
  • One 64-lane wave exports v6 = 1 in lanes 32 to 63. Two 32-lane waves export 0 there (32 lanes differ).

The s_andn2_b64 spelling does the same (s_mov_b64 s[16:17], exec at the start and s_andn2_b64 s[16:17], s[16:17], vcc as the definition: 0 against 1 in lanes 32 to 63). The controls without the s_mov_b64 exec, s[10:11] in the run side are tier A with equal results, so the rule is correct when EXEC stays narrowed.

To reproduce, from the repository root at this head:

# python -I repro.py
import sys
sys.path.insert(0, "tests/semantic")
from test_wave64_halves import meta_of, vs, run_cut, out_param
body = ["v_cmp_gt_u32_e64 s[16:17], 0, v0", "v_cmp_eq_u32_e32 vcc, 2, v0", "s_and_saveexec_b64 s[12:13], vcc",
        "s_cbranch_execz 3", "s_mov_b64 exec, s[10:11]", "v_cmp_gt_u32_e32 vcc, 64, v0",
        "s_or_b64 s[16:17], vcc, s[16:17]", "s_mov_b64 exec, s[10:11]", "s_and_b64 exec, exec, s[16:17]",
        "v_add_nc_u32_e32 v6, 1, v6", "s_mov_b64 exec, s[10:11]"]
(tier, reasons, _), asm = meta_of("vs_lane_local_widened", vs(body))
whole, halves = out_param(run_cut(asm, 64)), out_param(run_cut(asm, 32))
print(tier, reasons, whole[32][:1], halves[32][:1])      # this head: A [] (1,) (0,)

Proposal: accept the definition only when EXEC at the compare is inside the EXEC of the vote that the block depends on. The dataflow has the facts: the EXEC token at the instruction (st["x"]) and ancestor(). A simpler condition that is sufficient for the loop of this pull request: between the vote and the compare, on each path, the only EXEC writes are narrowings (s_and_b64 exec, exec, ..., s_andn2_b64 exec, exec, ..., s_and_saveexec_b64, v_cmpx).

What passed. Tier A here with equal results: the break loop of the description; the same definition (s_or_b64 and s_andn2_b64) in a skip region that stays narrowed; a loop whose body restores the launch mask before the compare (equal for this input). Tier C here, as on main: an OR with a copy of EXEC, and s_bcnt1_i32_b64 of the pair (the two runs differ).

…te (SHADER-821)

@shdann on ItsNotRexed#4656: an EXEC write between the vote and the v_cmp (the run side
restoring the launch mask) switches the lanes of a half that skipped back on,
so the compare sets their bits and the wave and the halves differ in lanes
32..63. lane_local_defs only cleared at an EXEC write after the compare.

widened_after_vote() is a forward dataflow: once a vote has run on a path, an
EXEC write other than a narrowing (EXEC AND/AND-NOT a mask, the and-saveexec
family, v_cmpx, or the run side's s_mov_b64 exec, <vote mask>) stops later
v_cmp results from counting as zero for the off lanes. Regression tests: both
of @shdann's listings (tier C, and the wave and halves differ), and the
narrowed control (tier A, equal).

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
@sperm

sperm commented Nov 23, 2026

Copy link
Copy Markdown
Author

Thanks @shdann, that's a real hole, and the repro made it easy. lane_local_defs cleared its "zero for off lanes" fact only at an EXEC write after the v_cmp. The s_mov_b64 exec, s[10:11] before it, in the same block, switched the skipped half's lanes back on.

Fixed in b3933dc with the sufficient condition you proposed. widened_after_vote() is a forward dataflow over the CFG. Once a vote has run on a path, any EXEC write that isn't a narrowing stops later v_cmp results from counting as lane-local. The narrowings are:

  • EXEC AND or AND-NOT a mask;
  • the and-saveexec family;
  • v_cmpx;
  • the run side's s_mov_b64 exec, <vote mask>, which vote() already requires to be inside EXEC.

The rule now rejects a join's restore inside a loop as well. That's conservative, and the EXEC-token / ancestor() refinement you mention could win those back later if the corpus ever needs them.

  • Your listings: both spellings (s_or_b64 and s_andn2_b64) are now tier C tainted-exec, as on main. They're added as regression tests: Classification.test_c_lane_local_def_after_exec_widens_again, and Execution.test_lane_local_def_after_exec_widens_differs_and_is_c, which checks that the wave and the halves really differ. Your narrowed control is test_lane_local_def_while_exec_stays_narrowed_is_a (tier A, equal).
  • Negative control: with the old tools/wave64_halves.py, those three tests fail (3 failures). With the fix, test_wave64_halves passes 110/110, test_wave64_halves_soundness 30/30, and test_valu_trig_f32, test_valu_fma_f64 and test_valu_permlane16 pass.
  • Census (my own 1.0.2.1 copy, counts only): b3933dc gives 26,503 translated, and 0 index entries differ from main 98fa503 or from this PR's earlier head. A/B/C stays 5,054 / 106 / 8,245. No shader in the corpus uses the widened shape, so this closes the soundness gap without moving anything.

AI-assisted (Claude Code). Linux, CPU only; no game files posted.

@shdann

shdann commented Nov 23, 2026

Copy link
Copy Markdown
Contributor

AI-assisted review (Claude Code). No game files; hand-written listings; CPU wave interpreter only (Windows 11, Python 3.14.7).

I tested the new head b3933dcc with 20 listings (one 64-lane wave against two 32-lane waves). tests/semantic/test_wave64_halves.py (110 tests) and test_wave64_halves_soundness.py (30 tests) pass.

Correct now. The listing of my review is tier C. These widenings in the run side before the compare are tier C also, and the two runs differ for each: s_mov_b64 exec, s[10:11], s_or_b64 exec, exec, s[12:13], s_xor_b64 exec, exec, s[12:13], s_or_saveexec_b64, s_nand_saveexec_b64, s_andn2_b64 exec, s[12:13], exec, s_cselect_b64 exec, ..., s_orn2_b64, s_not_b64, s_xnor_b64, s_mov_b64 exec, -1, a write to exec_hi, a widening in an earlier block of the run side, and a vccz vote whose run side narrows and then widens. The controls are tier A with equal results: the break loop, the definition in a region that stays narrowed, and a v_cmpx before the compare.

Two instructions are still accepted as a narrowing, and they are not.

s_andn2_saveexec_b64 D, S and s_andn2_wrexec_b64 D, S set EXEC to S & ~EXEC. With the saved mask as S, that is the set of lanes that were off: the switch to the "else" lanes.

v_cmp_gt_u32_e64 s[16:17], 0, v0          ; the pair starts as the empty mask
v_cmp_eq_u32_e32 vcc, 2, v0               ; only lane 2
s_and_saveexec_b64 s[12:13], vcc
s_cbranch_execz 3                         ; the second half skips
s_andn2_saveexec_b64 s[14:15], s[12:13]   ; EXEC = s[12:13] & ~EXEC: all lanes but lane 2
v_cmp_gt_u32_e32 vcc, 64, v0
s_or_b64 s[16:17], vcc, s[16:17]
s_mov_b64 exec, s[10:11]                  ; the join
s_and_b64 exec, exec, s[16:17]
v_add_nc_u32_e32 v6, 1, v6
s_mov_b64 exec, s[10:11]

Tier A with no reasons at b3933dcc. One 64-lane wave exports v6 = 1 in lanes 32 to 63, two 32-lane waves export 0 (32 lanes differ). s_andn2_wrexec_b64 s[14:15], s[12:13] in the place of the fifth line gives the same result. To reproduce, use the script of my first comment with the fifth line replaced.

Proposal: count only s_and_saveexec_b64, s_andn1_saveexec_b64, s_and_wrexec_b64 and s_andn1_wrexec_b64 as narrowing SAVEEXEC forms (the list that exec_write() has in narrowing).

@CuteBooty

Copy link
Copy Markdown

Tested b3933dcc with the fixture of #4870 rebased onto it, on NVIDIA GeForce RTX 3070 (32-wide subgroups), driver 617.14, Windows 11, llvm-mc 23.1.5: two break loops in a row are tier C again.

  • ps_w64_a_break (GPU fixture ps_w64_a_break: a break loop's lane mask in an SGPR pair is tier A (SHADER-821) #4870) is tier A at 649260f0 and tier C, tainted-exec, at b3933dcc. tests/test_wave64_halves_fixtures.py (1 failed, 8 passed) and test_ps_w64_fixtures in tests/semantic/test_wave64_halves.py (110 run, 1 failure) fail on that fixture only.
  • Cause: the first loop ends with its restore, s_or_b64 exec, exec, s[16:17]. That is an EXEC write after the loop's vote which is not a narrowing, so the second loop's v_cmp no longer counts and its pair s[18:19] is an ordinary def.
  • Each loop alone, with its restore, is still tier A at b3933dcc (I built both cut-down variants). Only the sequence changes tier.
  • The shader itself is the same in a wave and in halves on hardware: the 64-against-32 runs on GPU fixture ps_w64_a_break: a break loop's lane mask in an SGPR pair is tier A (SHADER-821) #4870 at 05ee55e6 gave equal images (RX 9070 XT on AMD's Windows driver, Radeon 610M on RADV). So this is the rule being conservative, as you wrote, not a wrong tier A before.
  • Rendering here is unchanged: build.py 243/243, check.py 153 of 188 pass, 35 skipped, w64_graphics.py 16 ok, 12 skipped.

So the restore that b3933dcc now rejects is not only a join inside a loop: it is also the one behind every break loop, which stops the rule for any later loop in the same shader. If that is the intended scope for now, I will cut #4870 down to one loop so it stays tier A on this head. If you would rather win the two-loop case back, the fixture covers it as it is.

AI-assisted (Claude Code).

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.

9 participants