Repository navigation
Conversation
…e is set A scalar lane-mask operation (s_and_b64 of a compare with EXEC, s_and_saveexec_b64, ...) sets SCC when its result is not zero. Branches already take that SCC per lane; any other read (s_cselect_b32, or s_cselect_b64 vcc, exec, 0 before a VCC branch, which structurisation turns into a uniform atom) stopped with "a lane mask read as data". It is now the wave's any-true of the result's lane bit (dx.op.waveAnyTrue), taken where the operation runs. That is exact when every lane with the bit set runs there, so structure records SCC values (Structured::any_lane) only for results that are clear outside EXEC there and clear in the lanes outside EXEC on entry: compares and carries write 0 for those, and, and andn2/andn1/or/xor with EXEC keep them clear, so s_xor/s_andn2 of a compare with EXEC qualify; s_not, s_orn2 or an XOR with -1 do not, and stay refused. Compute programs that read it declare the console's wave size, as for masks read as numbers. Pixel and vertex programs take the host wave's any-true, which means the same on any wave, as s_cmp_lg_u64 m, 0 already does there. Mesh programs are unchanged. Tests: a GPU test runs one wave32 of 32 and of 24 threads (8 lanes outside EXEC from the start) through s_and, the uniform-branch idiom, s_and_saveexec and s_xor with EXEC; pixel programs (wave64 and wave32) with each of s_and/s_xor/s_andn2 with EXEC now lower and validate, and s_not/s_orn2/XOR with -1 still refuse. Encodings from llvm-mc (gfx1030). Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
|
I ran an offline A/B comparison of Each run processed 26,503 containers and built IR for 26,084 native programs. All 25,889 listed outcomes matched by archive offset and shader stage. Both revisions validated 21,724 shaders, with zero validation gains or losses. The same 250 shaders still reported
The related For the synthetic check, I copied only the PR's two SCC test fixtures into a separate baseline checkout. The positive test reproduced AI use : Assisted by GPT 6.2 Sol. |
|
Thanks @rezioliver-collab, this is exactly the measurement the PR was missing ("Not measured" above). So the title never reads the SCC of a lane-mask operation as data: all 250 A change that unblocks nothing in the title isn't worth review time here, so I'm closing it. The parts that might matter later ( Written with the help of an AI (Claude Code). |
What
A scalar lane-mask operation (
s_and_b64of a compare with EXEC,s_xor_b64 …, exec,s_and_saveexec_b64, …) sets SCC when its result is not zero (RDNA 2 ISA, S_AND_B64:SCC = (D != 0); S_AND_SAVEEXEC_B64:SCC = (EXEC != 0)). Branches on it already lowered, per lane. Every other read stopped witha lane mask read as data, for examples_cselect_b32 s6, 1.0, 0, or the uniform-branch idioms_cselect_b64 vcc, exec, 0+s_cbranch_vccnz, whose select becomes a uniform atom.structurerecords such SCC values inStructured::any_lane, with the result's per-lane bit. It does so only when the result is set in no lane except those running there: it implies EXEC at that point, and it is clear in the lanes outside EXEC on entry. A newLanes::cleartracks the second condition (compare and carry results;and,andn2/andn1,or/xorwith EXEC keep it).s_not,s_orn2and XOR with -1 set bits for lanes that never ran, so they stay refused, and so dos_wqmresults.lowerreads such an SCC asdx.op.waveAnyTrueof the bit, taken where the operation runs.s_cmp_lg_u64 m, 0already does there.Relation to other PRs
#309 contains a compute-only version of this (its
mask_scc), as one hunk of the spill-forwarding change. This PR does not depend on spills and also covers pixel and vertex programs, which #309 leaves refused. It also checks the lanes outside EXEC on entry, so a complement of a compare (s_not_b64 s, vcc) at the top of a program is refused rather than counted wrongly, and it declares the wave size in compute. Whichever lands first, the other drops or rebases its version. It does not overlap #878 (s_bcnt1's SCC for branches), #1073 (mask/number joins), #298/#1074 (spilled masks), #1084/#585/#1221 (selects on untracked masks), #269 (mask set operations as numbers) or #434/#145 (ballot halves on 64-lane hosts).Tests
All words are assembled with llvm-mc (gfx1030); no game data.
valu_tests::the_scc_of_a_mask_operation_is_whether_some_lane_is_set(GPU): one wave32, with 32 and with 24 threads (8 lanes outside EXEC from the start), 10 (k, j) cases. It coverss_and+s_cselect, the uniform-branch idiom,s_and_saveexec's SCC, ands_and/s_xorwith EXEC inside a branch only some lanes take. It fails onmainwitha lane mask read as data. It is skipped on devices without 32-lane waves.lower::tests::the_scc_of_a_mask_operation_is_whether_some_lane_is_set: wave64 and wave32 pixel programs (s_and/s_xor/s_andn2with EXEC, both readers) lower and passdxil.dllvalidation. They fail onmain.lower::tests::the_scc_of_a_mask_holding_lanes_elsewhere_stays_refused:s_not_b64,s_xor_b64 …, -1,s_orn2_b64still refuse.Results:
cargo test --workspace --lockedon Windows 11 with an RTX 4060 Laptop as the default adapter: 345 passed, 0 failed, 6 ignored (victory-shader: 123 passed, 1 ignored).cargo clippy --workspace --all-targets [--all-features] --locked -- -D warnings: clean.cargo xtask policy: 154 files ok.Not measured
I did not run this on the title's shaders, so I can't say how many of the
a lane mask read as dataprograms it unblocks. Avictory translate --validatebefore/after would show it.Known limits
AI use: Claude Code (Claude Opus 5.5) chose the target after reading the open PRs, wrote the change and the tests, and ran everything above. Reviewed and re-tested locally before opening.
🤖 Generated with Claude Code