A fragment entry whose only tangled instructions that depend on reconvergence take derivatives
(dfdx, dfdy, fwidth, implicit-LOD samples, LOD queries) no longer states MaximallyReconvergesKHR
(or SubgroupUniformControlFlowKHR), records Reconvergence::Guaranteed and carries no
DeviceReconvergence, on every device, except where its emitted module holds such an instruction,
itself or through a call, in the construct of a loop whose continue target two or more blocks of
the construct branch to (a continue from inside a selection, or two latches). There it takes the
mode the profile gives a tangled entry, and the note where the profile has no maximal
reconvergence. Entries with group operations or barriers keep today's behaviour.
Why: MSL 6.11.1.1 leaves derivatives undefined within nonuniform control flow, and an implicit
level or LOD query is the derivative of its coordinate, so such an instruction is Metal's only
where the quad reaches it together. Without a mode SPIR-V reconverges invocations at the merge of a
construct they entered together and all leave by it (2.2.5, Uniform Control Flow); only the
continue target of a loop entered from several blocks needs SPV_KHR_maximal_reconvergence to
rejoin the quad for the next iteration. AMDVLK 2025.Q2.1 miscompiles a large fragment function
under the mode (an 8x8-cell grid on the 780M, blockiness 9.15 against RADV's 2.87; the same play
with the mode stripped reads 2.92, job m3-max-71921), and the note logged on every device without
the feature for a case Metal leaves undefined.
How: SelectCx::derivatives marks the derivative and implicit-LOD tangled values; simd::finish
defers a fragment entry with only those to SimdPlan::quad_loops; lower::simd::quad_loop::settle
decides on the emitted module, before verification, and declares the mode with
TypedModule::declare_modes where it applies. The PrecisionNote and Reconvergence docs, the
docs/API.md catalogue entry and its Precision sentence, and the simd module doc say the same.
SEMANTICS_VERSION 2298.
Verified:
- Metal-defined reconvergence cases with the mode stripped equal them with it, and Metal, on the
780M under AMDVLK 2025.Q2.1 and RADV (m3-max-72068), the RTX 5080 (m3-max-72069), the RTX 3090
(m3-max-72071), the Iris Xe (m3-max-72070) and lavapipe (m3-max-72077): 0 of 4096 pixels differ
from Metal either way. Each entry under this change reads one of the two.
- The lettering play on the 780M under AMDVLK to frame 4016 (m3-max-72116, this change against
its base ff2b13cb96): blockiness 2.92 against the base's 9.15 and RADV's 2.87. In the same job
under AMDVLK, the runtime's device suite (717 tests, one process each) reads 714 passed and the
same 3 failed for base and change, 0 verdicts differing; `conformance replay --gpu` gives
identical verdicts and lines.
- Lowering diff, card-free (m3-max-72134), on every committed profile over five recordings,
base against change: only fragment-stage modules differ (22514 of 43708 render states, from
906 fragment entry points); 0 vertex modules and 0 of 16160 compute modules differ; on
nvidia-pascal-linux and runtime-floor no module differs and only the reconvergence and the
note move. The golden table's 1079 changed cells are 83 fragment entries (!air.fragment) on
the 13 profiles with maximal reconvergence (m3-max-72117); its bless is due at the next pin.
- Reach (m3-max-72028, m3-max-72101, m3-max-72194): on the 780M RADV profile, standing for the
13 maximal profiles, 229 fragment entry points of the lettering recording, 906 of five other
recordings and 3108 of fifteen more lose the mode; none still states it.
- Timing, base / change / base, each play from empty caches, GPU busy against the base mean:
the 780M under RADV, 4017 frames (m3-max-72164), +0.07% whole play, +0.06% from frame 250, at
most +0.96% in any 250-frame window after it; the RTX 3090, 751 frames (m3-max-72163), +0.82%,
+1.08%, at most +1.71%, clocks alike per arm; the Iris Xe, 751 frames (m3-max-72202), -0.07%,
-0.04%, at most -0.01%. The RTX 5080's run (m3-max-72128) read noise: its base arms' GPU
busy stood 3.0-8.5% apart in four of five windows.
- Release translation of the largest row, the 357,837-word lettering fragment module, through
the command line with spirv-val: 0.28 s and 43.6 MiB, as the base's 0.29 s and 43.5 MiB
(m3-max-72178). The slowest single pipeline of a recording compiles in at most 0.5 s on a loaded
host, and its process peaks at 436 MiB (m3-max-72169, m3-max-72177); five recordings' batch,
75 runs a side interleaved, takes 0.44% longer than the base's (m3-max-72134).
- Tests (engine_quad_loops): derivatives in selections, after merges, after a loop and in a
one-latch loop state no mode and no note on every committed profile; a two-latch loop around a
sample or dfdx takes the profile's mode and, without maximal reconvergence, the note; a
fragment quad operation keeps the mode. With the routing switched off,
derivatives_outside_a_re_entered_loop_state_no_mode_and_no_note fails and the other two pass
(m3-max-72117). Gate at this commit (m3-max-72200): fmt, clippy in every configuration, Rustdoc,
the suites, the doctests and lavapipe's quad_control pass, but for the golden table's bless;
`conformance replay --cpu` on lavapipe, reconvergence cases included, reads the same as on
62ab49b966 line for line, and holds the ledger.