Commit Graph
9397 Commits
Author SHA1 Message Date
Anees Iqbal 5c1a4aabe6 Translator: specialize gives a LocalSize mode beside the WorkgroupSize composite the composite's values
The pass refused any module that had a LocalSize execution mode beside its
WorkgroupSize composite. Such a module is valid: the WorkgroupSize built-in
"takes precedence over any LocalSize or LocalSizeId execution mode" (vkspec,
the WorkgroupSize built-in), and glslang writes both when a shader uses
local_size_x_id. rt's hand-made test kernels (tests/kernels.rs) are glslang
output of that shape. In check job m3-max-72835 the pass refused every one of
them, and 38 of rt's 714 lavapipe device tests failed with "specialize: a
WorkgroupSize ... beside a local-size mode". kernel_variants and the
compute-encoder tests were among them.

The one LocalSize mode now takes the composite's values, which is what the
precedence rule already makes the module run with. A module without a mode
still gets one after its entry point. A second LocalSize mode, or a LocalSize
mode of other than three sizes, is refused by name. The format fix the check's
fmt step asked for is in the same file.

Test: a_local_size_mode_beside_the_workgroup_composite_takes_its_values adds
a LocalSize 1 1 1 mode to the deep kernel. Specialized at 8x4x2, the module
must hold exactly one mode, LocalSize 8 4 2, and pass spirv-val under Vulkan
1.2 and 1.3. A copy with two modes must be refused by name. The next check
job runs it, with rt's lavapipe device suite.
2026-11-23 20:59:02 -08:00
Anees Iqbal 54aaeb556b Tests: the helper's code digest at HELPER_VERSION 2, and the signature table without From<Unmade>
The literal form changed the stage helper's code: it no longer reads or
applies specialization data, and HELPER_VERSION went to 2. The digest pin in
rt's tests/stage.rs now holds the new code's digest. Check job m3-max-72835
printed that digest in
an_ended_breach_holds_to_its_helper_version_and_is_a_miss_below_it
(left: (2, "c7b4dec4...")).

The same change deleted rt's private Unmade enum and its From impl on Error.
The signature table had recorded that impl because it is an impl on a public
type. Nothing breaks for a consumer: Unmade was crate-private, so no consumer
could name it. The table's line goes; the_public_signatures_are_the_committed_table
in job 72835 listed it as the only removal.
2026-11-23 20:59:01 -08:00
Anees Iqbal 0630c1d9a7 Translator: specialize refuses an instruction it would leave half specialized
pipeline::specialize copied every instruction outside its list as it was. An
OpExecutionModeId (a LocalSizeId mode among them) beside a WorkgroupSize
composite would leave the entry point with two sizes, and an OpDecorationGroup
could carry a SpecId the pass never reads, so that constant would keep its
default. The translator writes neither, so the pass now refuses both with an
Error::Internal that names the instruction. An OpSpecConstantOp of an opcode
outside SpecOp was already refused; its refusal now names the opcode.

Op::ExecutionModeId and Op::DecorationGroup move into every build, and
ExecutionMode::LocalSizeId into test builds. Both come through
scripts/regen-spirv-grammar's items.txt and a regeneration from Khronos's
grammar (vulkan-sdk-1.4.341.0); table.rs comes out unchanged.

Test: a_module_of_an_instruction_the_pass_does_not_specialize_is_refused takes
the deep kernel with an OpExecutionModeId LocalSizeId of its LocalSize
constants, with an OpDecorationGroup, and with an OpSpecConstantOp turned to
ISub. Each must be refused, and the refusal must name the instruction. The
next check job runs it.
2026-11-23 20:59:01 -08:00
Anees Iqbal fdeac08272 Translator: specialize reads its opcodes from a list of the library's own, not the test-only word conversion
The first check (job m3-max-72828) did not compile the library: Op::from_u32 and
Op::ExecutionModeId exist in test builds only (spv.rs, items.txt). The pass now finds each
instruction's opcode in the fifteen it reads, all of them library values, and no longer looks
for a LocalSizeId mode, which the translator never writes.
2026-11-23 20:59:01 -08:00
Anees Iqbal 737906832c Runtime: a compute pipeline's module reaches the driver with every specialization constant fixed, its workgroup size the entry point's LocalSize literals
Every compute VkPipeline rt makes is now created from a shader module of its own, made of the
kernel's words with each specialization constant the plain constant of its value and destroyed
once the create returns; the create names no VkSpecializationInfo. Vulkan defines specialization
as exactly this conversion (VUID-VkPipelineShaderStageCreateInfo-pSpecializationInfo-06849), so
what a kernel computes is unchanged; what changes is that no driver is handed a specialization
constant to size a workgroup or an array from.

- Translator: pipeline::specialize(words, values) (spirv::specialize). OpSpecConstant,
  OpSpecConstantTrue/False become OpConstant/OpConstantTrue/False of the given value or the
  default; each OpSpecConstantOp becomes the constant it computes (SpecOp::eval, now product code,
  and SpecOp::opcode, which the serializer shares); OpSpecConstantComposite becomes
  OpConstantComposite; the SpecId decorations go; a WorkgroupSize composite loses its BuiltIn
  decoration and the entry point takes its values as OpExecutionMode LocalSize. The translator's
  output is unchanged (no SEMANTICS_VERSION bump).
- rt: Kernel holds its words (Code::Module(Arc<[u32]>)) instead of a VkShaderModule made at
  Kernel::new; Kernel::make specializes per variant and makes, uses and destroys the module.
  Heavy kernels specialize the same way: the stage request carries the specialized words and no
  ids or data (WIRE_VERSION 3), and the helper compiles them as they are (HELPER_VERSION 2).
  Lowered::Failed and Unmade go: nothing creates a shader module at Kernel::new now.
- Tests: serializer tests specialize (a deep kernel's spec constants, its bool, two Workgroup
  arrays sized by OpSpecConstantOps: values given and defaults, spirv-val under Vulkan 1.2 and
  1.3); rt deep_threadgroups a_kernel_reaches_the_driver_with_its_workgroup_size_as_literals.
- Docs: API.md (section 3), rt README.
2026-11-23 20:59:01 -08:00
Anees Iqbal 3073230664 Tests: the flat-grid guard's arms store to a buffer of their own
The guard's kernel stored its arms' values at b0[p + 4096] and the
shuffle's result at b0[p]. With that store the kernel observes its
threadgroup partition, so its flat variant of the call's threadgroups is
refused on every committed and derived profile
(Unsupported{GpuEncodedIndirectCommands, NotRepresentable}, the
partition gate in pipeline/compile.rs; m3-max-72860 listed
all 45). No flat module reached the comparison, so the guard failed its
final count at the fix and at the parent alike (m3-max-72826).

The arms now store to b1[p], a second buffer parameter, which the
lockstep analysis takes as an object apart from b0. The shuffle still
follows the merge of the parity selection.

Verified: cargo fmt only; the diagnostic and the check job follow.
2026-11-23 20:57:09 -08:00
Anees Iqbal 6a56458fdb Tests: the flat-grid guard's reading states its result type
0157be9ead left the closure's error type to inference through `?`, which
rustc cannot settle (E0282, m3-max-72858). The closure now
names `Result<(&'static str, Reconvergence, bool), String>`.

Verified: cargo fmt only; the diagnostic job follows.
2026-11-23 20:57:09 -08:00
Anees Iqbal bd2b63779f Tests: the flat-grid guard names each profile that refuses the flat variant
The guard counted the flat modules per mode and skipped a profile whose
flat variant the translator refuses without saying why; check
m3-max-72826 at b7d60720d2 failed its final count with no reason shown.
The flat variant's refusal now goes into the failure message, with the
profile's stem, and the doc no longer states a cause for the committed
profiles' refusals that no run showed.

Verified: cargo fmt only; the diagnostic and check jobs follow.
2026-11-23 20:57:08 -08:00
Anees Iqbal f7b83c7fe3 Tests: the flat-grid guard clears quad control with maximal reconvergence
VK_KHR_shader_quad_control requires maximal reconvergence, so a description listing quad control
without it is invalid (device::enables::check_invariants), and the guard's derived device failed
to build at 7dd248d489 (check job m3-max-72800). The derived descriptions now clear
shaderQuadControl with shaderMaximalReconvergence, and a description that still fails names
itself.
2026-11-23 20:57:08 -08:00
Anees Iqbal 45f7389c93 Tests: the flat-grid guard also derives each committed profile without maximal reconvergence
No committed profile without maximal reconvergence takes a flat variant of the call's
threadgroups (it needs device addresses and full subgroups), so the guard's last assertion, that
some profile without it compiled one, failed at 557798fc88 (check job m3-max-72785) though every
flat module it compiled stated the profile's mode. The guard now also derives each committed
description with shaderMaximalReconvergence cleared, and with it and
shaderSubgroupUniformControlFlow cleared, and asserts the flat module on each: MaximallyReconvergesKHR
and Guaranteed with maximal reconvergence, SubgroupUniformControlFlowKHR with ImplementationDefined
and DeviceReconvergence with only that, and no mode with ImplementationDefined and the note with
neither; and that each of the three kinds compiled at least once.
2026-11-23 20:57:08 -08:00
Anees Iqbal 7b3c33f94e Tests: the flat-grid guard's reading closure names its profile's type
The closure inferred its profile parameter's lifetime from its first call, so the loop's profile
did not live long enough (E0597 in check job m3-max-72780). It now takes &DeviceProfile.
2026-11-23 20:57:08 -08:00
Anees Iqbal a38145f53c Translator: a flat grid's tangled instructions take the profile's reconvergence mode, as the partial-threadgroups variant's do
A flat-grid module (LoweringInputs::flat_grid) returns its invocations past the grid before the
body (lower::dispatch::emit_entry), and under call_threadgroups it admits SIMD-group operations
(select.rs's flat call-threadgroups check). lower::simd::together excluded only
partial_threadgroups, so such a module's SIMD-group operation in a block the workgroup uniformity
proves uniform was stated Guaranteed with no mode, which SPIR-V does not support.

The words, SPIR-V 1.6 Revision 8:
- A threadgroup barrier is OpControlBarrier at Workgroup scope (3.3.20): "When Execution is
  Workgroup or larger, behavior is undefined unless all invocations within Execution execute the
  same dynamic instance of this instruction." A module whose past-grid invocations return early
  cannot hold one at all. The partial variant walks them predicated instead, and a flat
  call-threadgroups module refuses one. So this kind is unaffected.
- A SIMD-group operation or simdgroup barrier (OpGroupNonUniform*, 3.3.24; OpControlBarrier at
  Subgroup scope) acts on "the scope restricted tangle". Who is tangled is 2.2.5's rule:
  "Invocations will continue to execute the same dynamic instances as long as they follow the same
  control-flow path"; after a divergent branch, "Invocations may only resume executing the same
  dynamic instances when all invocations reach the same static instruction", and the merge rule
  ("Uniform Control Flow") needs control flow "uniform upon entry", which no longer holds once some
  invocations returned. Only SPV_KHR_maximal_reconvergence lets an invocation that ran OpReturn
  escape reconvergence.

A predicate on the AIR ("no divergent construct passed since entry") is not enough to keep a
narrower set. The lowering adds selections of its own, whose condition differs between
invocations, before a tangled instruction: the bounds-checked load (lower/access/psb.rs:660), the
guarded store (lower/access/emit.rs:411), an atomic's (lower/access/atomic.rs:1064) and a copy's
(lower/access/copy.rs:1343). So a module that returns past-grid invocations early has no tangled
instruction reached together. The partial-threadgroups variant's exclusion is unchanged.

No runtime or consumer path makes a flat-grid module today. `grep -rn 'flat_grid\|call_threadgroups'
crates/metal2vulkan-runtime/src`, tests excluded, gives 0 hits at 62e7af06e5. In the consumer's
checkout at 360eef13f, `git grep 'flat_grid\|call_threadgroups\|folded_groups' -- . ':!*.md'` gives
0 hits. So no guest module changes.

- simd::together: `partial_threadgroups || flat_grid` (returns_early). Its doc states the reason.
- The flat_grid and DeviceReconvergence doc comments, and docs/API.md's catalogue entry, state the
  same.
- New test a_flat_grid_s_shuffle_after_a_merge_takes_the_profile_s_mode, in
  engine_variant_reconvergence.rs. Our kernel holds a shuffle after the merge of a selection on
  the thread's parity. Its plain module is "none"/Guaranteed/no note on every committed profile.
  Its flat call-threadgroups module takes the profile's mode wherever it compiles: maximal and
  Guaranteed, else SubgroupUniformControlFlowKHR or none with ImplementationDefined and the note.
  At the parent the flat module states no mode on every profile, so the test fails there.
- SEMANTICS_VERSION 2300 -> 2301: a flat-grid module with a tangled instruction in a uniform block
  now states the mode or the note.
2026-11-23 20:57:08 -08:00
Anees Iqbal 849dfe67d7 Tests: a depth-tested draw's unchanged state and bias are checked as nothing to record, not by its cost
every_device_counts_a_depth_tested_draw_s_instructions held a draw whose
depth-stencil state and bias are set again unchanged to within a quarter of a
draw under a test set once. That bound held only while the validation layer's
per-call cost sat in the draw's base. On lavapipe without the layer
(METAL2VULKAN_TEST_UNVALIDATED=1, dotscheck's job m3-max-72849) the setters'
own ~850 instructions came to 4092 against 3220 and the test failed, though
nothing was recorded. A device suite run without the layer would fail the same
way.

The claim is now checked as the encoder states it. After a draw, the same
state and bias set again leave the encoder's marked dynamic states, the bits
its next draw records from (record_state), at none. The changed state and
bias leave them non-zero, which shows the check can see a change. It runs on
every device, before the instruction counter, so hosts without the counter
check it too. The instruction counts stay printed, held to no bound. The
accessor (RenderCommandEncoder::unrecorded) is test-only, beside pushed().
2026-11-23 20:47:10 -08:00
Anees Iqbal d16eb39e8f Tests: METAL2VULKAN_TEST_UNVALIDATED=1 runs rt's device tests without the validation layer, and says so
Every rt device test opens its instance through tests/validation.rs instance(), which fails
unless each device lists an active VK_LAYER_KHRONOS_validation. A Windows machine whose only
Vulkan pieces are its GPU driver and the loader it ships therefore cannot run the device suite at
all, and a machine of that kind is the only place some drivers are ever covered (AMD's
proprietary Windows driver: the lab has no AMD card under Windows).

The setting is test-only and off unless its value is 1; product code and the lab's runs, which
never set it, are unchanged. Under it, instance() enables nothing and checks the opposite: every
device lists no validation tool, so a run that says it is unvalidated is. No layer writes a log,
so the guard checks none. Each test process writes "M2V-UNVALIDATED unvalidated run: ..." once to
its standard error, past libtest's capture of a passing test's output, so the run's output says
it whatever passes. The test of the layer's log itself
(every_device_logs_a_deliberately_invalid_call_once) skips: without the layer its call is only
invalid.

The new device test the_setting_runs_the_device_tests_without_the_layer_and_says_so runs the
test binary's unvalidated_child in a process of its own under the setting, with VK_INSTANCE_LAYERS
and VK_LOADER_LAYERS_ENABLE removed, and requires it to pass and to print the line. Without this
change the child opens a validated instance (the layer is on VK_LAYER_PATH in every lab job) and
prints no such line, so the test fails; on a machine without the layer the child fails outright.

Docs: the setting in tests/validation.rs's module doc, docs/VALIDATION.md (the layer section),
CONTRIBUTING.md, and env_vars.rs's module doc, which now says the test suites' own
METAL2VULKAN_TEST_* variables are not in REGISTRY.
2026-11-23 20:27:07 -08:00
Anees Iqbal a7ae85b2fc Tests: the variant-reconvergence test passes its artifacts without an explicit deref
Clippy's explicit_auto_deref denied state(&*plain) and state(&*variant) in
a_simdgroup_barrier_s_variant_is_guaranteed_only_under_maximal_reconvergence (check job
m3-max-72773, cancelled after its first clippy step had reported the three errors); the
closure takes &FunctionArtifact, which &Arc<FunctionArtifact> coerces to.
2026-11-23 20:11:09 -08:00
Anees Iqbal b4aeaab757 Tests: a partial-threadgroups variant may add DeviceReconvergence on a device without maximal reconvergence
The rt test every_device_s_observers_answer_the_same_on_their_variant failed on the UHD 630's
Windows leg (job 72531) after 1b9ea536f6: for the engine's a27_a4_simdgroup_barrier the variant
records DeviceReconvergence and the plain module none. The translator is right and the test was
wrong. The variant's invocations past the grid return before the body, and SPIR-V states
reconvergence over all invocations, those that returned included (SPIR-V 1.6 section 2.2.5,
"Dynamic Instance": "Invocations may only resume executing the same dynamic instances when all
invocations reach the same static instruction"; "Uniform Control Flow" and the merge-block rule
speak of all invocations too). SubgroupUniformControlFlowKHR extends the same rule to each
subgroup and adds nothing for a subgroup that holds a returned invocation. Only
SPV_KHR_maximal_reconvergence lets an invocation that ran OpReturn escape reconvergence. So
lower::simd::together's exclusion of partial threadgroups stays, and the variant takes the
profile's mode, or ImplementationDefined with the note where the profile has no maximal
reconvergence.

- The rt test now allows exactly that exception: on a device without maximal reconvergence the
  variant may add DeviceReconvergence where the plain module has none. Every other answer, and
  the notes on a device with maximal reconvergence, must still be equal. It prints how many
  kernels took the exception.
- A new translator test, a_simdgroup_barrier_s_variant_is_guaranteed_only_under_maximal_reconvergence,
  guards the rule on every committed profile. The plain module is Guaranteed with no note. The
  variant is the same where the profile has maximal reconvergence, and ImplementationDefined with
  the note where it does not (nvidia-pascal-linux, runtime-floor).
- docs/API.md (section 6 and the note's catalogue entry), the DeviceReconvergence and
  partial_threadgroups doc comments, and together()'s doc state the exception and its reason.

No module changes, so SEMANTICS_VERSION is not bumped.

Verified: the reproduction (job m3-max-72749) failed the old equality on nvidia-pascal-linux at
1b9ea536f6's tree, with variant (ImplementationDefined, true) against plain (Guaranteed, false),
and passed at its parent 0a1c4d4a64. The check job named in the hand-in covers fmt, clippy
(plain and under --cfg m2v_cpu_icd), Rustdoc, the metal2vulkan lib tests and rt's lavapipe suite.
2026-11-23 20:11:09 -08:00
Anees Iqbal 3273227935 rt README: AMDVLK may put a run-time-indexed thread array in scratch where RADV keeps it in registers
A known gap under AMD's open Linux driver (AMDVLK 2025.Q2.1, LLPC) on the
Radeon 780M. One kernel's module came to 148 VGPRs, 528 bytes of scratch and
512 scratch instructions under AMDVLK, against 224 VGPRs and no scratch under
Mesa's RADV 26.2.6 on the same chip (m3-max-72775, per-dispatch stamps and the
drivers' pipeline executable statistics). Across that kernel's states, those
AMDVLK compiled with scratch ran 2 to 9 times as long per dispatch as under
RADV; those without ran at 0.86 to 0.93 times.

Probed and ruled out as forms of ours:
- the run-time index into the array's length-1 dimensions (rewritten to
  constant 0): no change in scratch or time (72775);
- the array's storage class (every such array a Function variable instead of
  Private): the same registers and scratch on every module (m3-max-72798);
- a register budget: modules at 39 to 74 VGPRs spill the same array while one
  at 174 VGPRs with the same 512-byte array does not (72798's kept views).

The row closes at rung 4 with this line.
2026-11-23 20:08:22 -08:00
Anees Iqbal 62e7af06e5 rt README: the host-memory texture copy's time follows a discrete card's link state
The known gap for a texture over a buffer in host memory's import (a whole
copy into an image of its own, because VUID-VkImageCreateInfo-pNext-01443
makes the image start undefined) gains the link figure the planner asked for
when it ranked the consumer's scroll-step read (SCROLLQ) and closed it as
this gap.

On the RTX 5080 Laptop GPU idling at P8 the driver keeps PCIe at Gen1 x8;
the runtime's own command buffers moved 553.5 MB in 362.4 ms (1.53 GB/s), so
one 10,240,000-byte copy-in takes about 6.7 ms. In the 30 s scrolling step
of guest walk m3-max-72689 the copies came to 534.8 MB in 52 copies of 20
textures, and 26 of the step's 50 GPU starts 8 ms or more after scheduling
fell in 50 ms intervals holding such a copy of 10.24 MB or more. Documented
Metal asks for no call before a CPU write to a Shared buffer reaches a
texture over it, so there is no call to hold the copy for.

Verified: the 26-of-50 count against the consumer's per-gap table for that
step; 553.5 MB / 362.4 ms = 1.53 GB/s and 10.24 MB / 1.53 GB/s = 6.7 ms.
The other figures are the consumer's reads of that walk. Docs only.
2026-11-23 19:25:56 -08:00
Anees Iqbal 0d4d5728d4 Golden tables: blessed at f8db87d844 (SEMANTICS 2298 -> 2300)
The golden hash table and the authored compile census, blessed at the
reconvergence-mode change (1b9ea536f6) on the M3 (job m3-max-72548:
inventory, golden, printouts, opened chains and census all exit 0).

The golden table moves the cells the change moves: on Linux (72447),
1,560 of 23,698 cells differ from 0a1c4d4a64's modules in the
reconvergence modes alone (MaximallyReconvergesKHR,
SubgroupUniformControlFlowKHR and their OpExtension) and none in
anything else. On the M3 (72521), 1,262 of the 21,061 macOS-only
.air.ll cells differ in the mode alone and none otherwise. The
quad-helpers cells due since 00fb3b3846 are blessed in the same pass.
The census changes only artifact hashes and the product fingerprint:
no row changes its outcome.
2026-11-23 17:44:55 -08:00
Anees Iqbal f8db87d844 rt README: a kernel that keeps the reconvergence mode is a known gap under AMDVLK
The two commits before this one drop the reconvergence mode where every group operation of an
entry stands in a block the pass proves uniform for the threadgroup, outside a re-entered loop.
A kernel whose SIMD-group operation stands in a block it does not prove uniform keeps the mode.
Five kernels of one recorded session do: each loops on a count loaded from a constant buffer less
a per-thread offset, which no fact about the 64-thread group decides (a card-free read of their
controlling conditions, m3-max-72465). AMDVLK runs them slower with the mode, so the line goes
where a user reads it, with its measurements. RADV runs that play in the same compute time with
the mode on such kernels alone as with it on every kernel (m3-max-72436).

Evidence for the change, base (development) against change, each with its job:
- Values, compare-plays with buffer dumps:
  - AMDVLK 2025.Q2.1, Radeon 780M: m3-max-72441, 24 command buffers to frame 349, 0 of 1,749
    buffers differ. m3-max-72445, the 10 command buffers of the barrier-only states first
    dispatched after 349, to 378: 1 of 68 differs (cb 173676, obj 168800). That buffer is the
    output of an atomic-append kernel (94cc#7) that writes 2 of each 12-byte record's 3 words at
    the index its atomic returns. Its record test, base against change, is m3-max-72491.
  - RADV (Mesa 26.2.6), Radeon 780M: m3-max-72436, 0 of 1,749.
  - NVIDIA 620.70.06, RTX 3090, Managed device copies read back: m3-max-72434. Base against
    change, and base against base2, show the same 3 atomic-append buffers apart and no other.
  - Intel Mesa 26.2.6, Iris Xe: m3-max-72460, 0 of 1,749.
- Timing: AMDVLK m3-max-72427, the play's compute to frame 349 166.52 s (base) to 59.22 s
  (change). Intel m3-max-72460: every window at or below the slower base arm (GT at 1500 MHz in
  every arm). NVIDIA m3-max-72402 and m3-max-72420: no effect at the card's resolution.
- Golden table, Linux: m3-max-72447, 23,698 cells, 1,560 differ in the reconvergence mode alone and
  0 in anything else. The macOS-only golden fixtures (the typed-pointer .air.ll ones, 580 SKIPPED
  rows on Linux) are unaudited here; they are audited on the M3 before the bless.
- Checks: m3-max-72446 on the change's two commits over 14c6cab653 (fmt, clippy, Rustdoc, nextest: only the golden
  table's bless due, 1,560 cells under SEMANTICS 2300 against the table's 2298). This commit's
  check is run at this commit.
2026-11-23 17:20:08 -08:00
Anees Iqbal 692aa326fd Tests: the reconvergence tests' kernels take the shapes they name, and region_k reads the rule
The re-entered loop's selection is on the trip's parity, so every thread takes the same arm and
the loop keeps its two latches: on the thread's parity, the loop's exit differs between threads
and the kernel's barriers take the predicated walk, whose loop one latch closes, so no loop was
re-entered and the rule rightly stated no mode. The test now also holds a shuffle there.

The shuffle after a merge inside a per-thread branch stores its result inside the branch: with
the store after it, the shuffle was hoisted to the entry (in the base as well), a uniform block.

region_k's shuffle stands in its entry block and its threadgroup barrier outside any loop, so
on runtime-floor it states no mode and records Guaranteed with no DeviceReconvergence; the old
expectation was the old rule's (any tangled instruction takes the profile's mode).

Verified card-free on msi (m3-max-72396, m3-max-72403, amd-780m-hawkpoint-radv, base
72a52c85e9 against cd405d0954): the two-latch loop's continue target is branched to from two
blocks and both base and change state MaximallyReconvergesKHR for the barrier and the shuffle;
the after-merge shuffle stays in the branch's merge block with the mode on both.
2026-11-23 17:10:25 -08:00
Anees Iqbal 1b9ea536f6 Translator: a threadgroup barrier, and a kernel's group operation in uniform control flow, state the reconvergence mode only in a re-entered loop
A program's threadgroup barrier, and a kernel's tangled instruction in a block the workgroup
uniformity proves every thread of the threadgroup runs together, now count as fragreconv counts a
fragment's derivatives: an entry whose tangled instructions are all such (or a fragment's
derivatives) states no MaximallyReconvergesKHR (or SubgroupUniformControlFlowKHR), records
Reconvergence::Guaranteed and no DeviceReconvergence, except where its emitted module holds a
tangled instruction, itself or through a call, in the construct of a loop whose continue target
two or more blocks of the construct branch to; there it takes the profile's mode and note as
before. An entry whose every group operation stands in a block the pass proves uniform for the
threadgroup, with no re-entered loop around it, states no mode and records Guaranteed. An entry
with any other tangled instruction keeps the mode; a kernel compiled for partial threadgroups
proves no block uniform, and the emulated tier keeps its own rule.

Why: 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), and an OpControlBarrier of Workgroup
execution scope is defined where every invocation executes the same dynamic instance of it,
which invocations resume only under those conditions (2.2.5, Dynamic Instance). Metal requires
every thread of the threadgroup to reach a threadgroup barrier, and a group operation in a block
every thread runs together sees every lane, so both are Metal's wherever SPIR-V reconverges,
which is everywhere but a continue target entered from several blocks. On the 780M under AMDVLK
the mode with the group operations of one kernel family costs 9.4-11.4x RADV on its own command
buffers, and 2.8-3.0x without the mode (m3-max-72248, m3-max-72261).

How: BarrierPlan::threadgroup records every threadgroup barrier; simd::finish defers an entry
whose tangled instructions are all a fragment's derivatives, threadgroup barriers or a kernel's
instructions in workgroup-uniform blocks (simd::together: partly_live's uniformity, or the same
analysis where it computed none) to SimdPlan::reentry; lower::simd::reentry (quad_loop, renamed)
settles it on the emitted module, its re-entered-loop test now over every tangled instruction
(derivatives, implicit-LOD samples, LOD queries, control barriers, group operations). The emulated
tier clears the deferral where it clears the mode. The simd module doc, the PrecisionNote and
Reconvergence docs and docs/API.md's Precision sentence and catalogue entry say the same.
SEMANTICS_VERSION 2300.

Tests (src/tests/engine_reconvergence_together.rs): a threadgroup barrier alone states no mode on
every committed profile; one in a loop two latches inside a selection re-enter keeps the mode;
a shuffle in a counted loop states no mode; a shuffle after a merge inside a per-thread branch,
and one in a loop with a per-thread exit, keep it.
2026-11-23 17:10:25 -08:00
Anees Iqbal 0a1c4d4a64 rt README: AMDVLK's 16 MiB allocation tail is a known gap of memory blocks
Under AMD's open Linux driver on a Radeon 780M, a 16 MiB allocation takes over
5 ms about one time in eight. In one 591-second guest desktop session at
7360a148bb, 60 of the block-maker thread's 502 allocations took over 5 ms (the
longest 129.1 ms), and 8 of the 62 made on a caller's thread (the longest
35.5 ms). Textures made in a burst take their blocks on the call: 49 of 350
texture blocks, the longest in 29.06 ms. Source: the consumer's exit counters of
job m3-max-72331, numbers only.

Two candidates were weighed and neither is built:
- A take waiting for the block-maker's allocation in flight would inherit that
  allocation's tail (up to 129 ms against 35 ms on the call), and the session
  holds no per-take times to show it is a gain.
- Making a class's missing unit before the maker's frees and releases would
  matter only if the maker was busy with them at those takes. rt keeps no time
  for the maker's frees, so nothing shows that.
More than one unit ahead would be memory held ahead, which the owner refuses.

The gap reopens on a named app stalling there, or on on-call makes of 16 ms or
more in two walks in a row.

Verified: README text only; development's docs check follows the merge.
2026-11-23 17:04:06 -08:00
Anees Iqbal 14c6cab653 Conformance coverage: regenerated with quad-helpers
scripts/conformance-coverage/coverage.py at 00fb3b3846 (job m3-max-72425):
the new case module and its recording, its fixture, and its one
tolerance source (the grouping declaration) are counted.

The same job, at 00fb3b3846: cargo fmt --check, clippy of
metal2vulkan-conformance plain and under --cfg m2v_gpu with -D warnings,
its Rustdoc with -D warnings, its suite (1033 of 1034 passed; the one
failure was this document, stale until this commit), quad-helpers' three
tests (17 recorded passes read as the model says;
the_grouping_loosens_what_a_wider_subgroup_moves_and_nothing_else
passed), the runtime's the_readme_states_the_floor, and quad-helpers
replayed on lavapipe (llvmpipe, Mesa 26.2.4, LLVM 23.1.1, 256 bits,
x86-64 AVX2): verdict announced, exit 0; 74 of its 86 allowances fired,
every differing element under fragment-simdgroup-grouping (qs_arith x9,
qs_bits x3, qs_votes x6 at each helper lane); the 12 that did not fire
are qs_bits elements that device's other lanes did not move.
2026-11-23 16:22:52 -08:00
Anees Iqbal 00fb3b3846 Conformance: quad-helpers keeps qs_bits' AND exact; no other lane can move it
The quad at (2, 2)'s four 11-bit words share no bit, so their simd_and
is 0, and no other lane's word can clear a bit of it. Only the OR and
XOR of qs_bits are within the grouping's reach; the declaration
loosened the AND too. Found by modelling the test's set equality in
Python before the Linux job: over the drawn quad beside the four helper
lanes of each other quad of the target, the AND never moved at any
helper lane.
2026-11-23 16:20:53 -08:00
Anees Iqbal 0af0c25684 rt README: AMDVLK's fragment SIMD-group helper row leaves the known gaps
The row said that under AMDVLK 2025.Q2.1 on the RX 7900 XTX and the
Radeon 780M a fragment function's SIMD-group operations leave out the
helpers of a partly covered quad, on the evidence of job m3-max-71001.
Two runs say that is not a difference from documented Metal:

- Helpers take part while a derivative still follows. In the
  conformance case quad-helpers, every quad and SIMD-group operation
  runs before a derivative of a value its answer feeds, so each helper
  still has a gradient to compute (MSL 4.1 sections 6.10.2 and 6.10.3).
  On the Radeon 780M, RADV and AMDVLK 2025.Q2.1 both give Metal's
  answers at all 17 sites (job m3-max-72406).
- 71001's sites all sat after the last derivative. Its SIMD-group
  functions (simd_masks, simd_firsts, simd_scans and simd_moves in
  BALLOT_READERS, c894c5b5b3, never landed) take no derivative and run
  no implicit-LOD sample, so a helper has no gradient left to compute
  when any of their operations runs. MSL 4.1 section 6.10.3 makes a
  helper inactive once it has computed its gradients, so whether it
  takes part there is not Metal's to state.

Nothing else in the tree cites the row or job 71001.
2026-11-23 16:19:23 -08:00
Anees Iqbal 50591b119b Conformance: quad-helpers declares a wider fragment subgroup's lanes under fragment-simdgroup-grouping
A device whose fragment subgroup is wider than the drawn quad plus its
helpers may fill the rest with lanes of its own. Measured on x86-64
lavapipe at its default 256-bit vectors (job m3-max-72400): the 8-lane
subgroup that shades the one-quad draw also holds the four helper lanes
of a quad the draw covers no pixel of, so the ballot of the helper query
counts 5 lanes where Metal's counts 1, the active mask 8 where Metal's
counts 4, and the sums, minimum, maximum and bitwise reductions take in
those lanes' words: 12 sites differed (qs_arith, qs_bits and qs_votes at
each helper lane). Which pixels share a fragment simdgroup is the
device's, which the runtime records as fragment-simdgroup-grouping on
every device.

The case now declares that difference itself, scoped by its cause, not
by a venue: an unchecked allowance under the grouping notice at each
element such lanes can move (grouping_elements), at each covered pixel
the three reductions of qs_arith and qs_bits and the two counts of
qs_votes, and nowhere else. The vote, the dfdx channel and every texel
the draw leaves at the clear value still compare exactly on every
device, so a device whose simdgroup leaves the helper out still differs
(its vote reads 2), and the five quad passes loosen nothing. A test,
the_grouping_loosens_what_a_wider_subgroup_moves_and_nothing_else,
models the drawn quad beside the four helper lanes of each other quad
of the target and checks that the elements that move are exactly the
loosened ones.

The two refused rows (KosmicKrisp on the M3 Max and the UHD 630's
Windows driver, no shaderQuadControl) are dropped from
known-gaps-rt.tsv: the refusal is typed (SubgroupOperations, needing
ShaderQuadControl) and the runtime README records it under its known
gaps, and the matrix after the merge reads those venues. No ledger row
names quad-helpers now.
2026-11-23 16:19:15 -08:00
Anees Iqbal f041278676 Golden printout: quad_helpers, under the pinned LLVM 21
The typed-IR printout of the new engine fixture quad_helpers, blessed by
bless_engine_goldens with llvm-as 21.1.8 on Linux (job m3-max-72411).
In the same job engine_fixtures_match_their_golden_printout, the eight
public_fixtures_engine::llvm_as parts and
inventory_lists_every_fixture_in_order passed.
2026-11-23 16:19:01 -08:00
Anees Iqbal d421fee0b0 Conformance ledger: quad-helpers is refused where the device lacks shaderQuadControl
KosmicKrisp on the Apple M3 Max and the UHD Graphics 630's Windows driver report no
shaderQuadControl. A fragment function with a quad or simdgroup operation that reads,
combines or counts other lanes needs it, so quad-helpers' first state, qh_any's, is refused
there, as discard-quad-sum-placement's first state is. Expected from the translator's refusal;
the matrix's runs on those venues have not been read yet.
2026-11-23 16:08:38 -08:00
Anees Iqbal 198f9876fd Conformance: quad-helpers' fixture companions and Metal's answer, recorded on the M3
quad_helpers.ll, quad_helpers.air.ll and the TOOLCHAIN line were compiled by
scripts/regen-air-fixtures (Metal 32023.922, SDK 27.2, the pinned LLVM 21). The recording is
`conformance record quad-helpers` followed by `conformance times --runs 8 --write quad-helpers`
on the reference M3 Max (macOS 27.0.1), at 326213f839, job m3-max-72398.

The inventory rows are written as gsm2_helper_threads' fragment functions read; the gate has not
checked them yet.
2026-11-23 16:02:40 -08:00
Anees Iqbal 326213f839 Conformance: quad-helpers, a fragment's quad and simdgroup operations over quads with helpers
The owned fixture quad_helpers and the case quad-helpers. Five quad functions (quad_any and
quad_all of the helper query, quad_ballot of it, quad_is_first, quad_active_threads_mask) are
each drawn over 64 small triangles, one in each 8 by 8 cell of a 64 by 64 target, whose edges
cross quads. Three simdgroup functions (sum, min and max; and, or and xor; any, all, and the
lane counts of the ballot and the active mask) are each drawn over one triangle that covers
three pixels of a single quad, once for each quad lane the helper can take. Those are the draw's
only fragments, so the simdgroup holds that quad alone and no answer names a lane.

Each function runs its operations first, in control flow uniform over the draw, and then takes
a derivative of a value the answers feed. A helper therefore still has a gradient to compute when
the operations run, and MSL 4.1 sections 6.10.2 and 6.10.3 make it an active thread of each.

A translator test, a_fragment_simdgroup_operation_keeps_the_mode, checks that a fragment entry
with a simdgroup operation, with or without a derivative beside it, states
MaximallyReconvergesKHR on every maximal-reconvergence profile.

The fixture's companions and Metal's recording follow from the M3.
2026-11-23 16:00:37 -08:00
Anees Iqbal 72a52c85e9 Golden tables: blessed at the pin V 7360a148bb (SEMANTICS 2297 -> 2298)
The golden hash table last blessed at ff2b13cb96 under SEMANTICS 2297,
and the authored compile census at 7024d568df (SEMANTICS 2294). This
commit is the pin's bless of both at 7360a148bb.

Golden hash table (crates/metal2vulkan/tests/golden_hashes.tsv):
- 2,132 cells in 164 entries of 86 fixtures changed under unchanged
  keys, every one a fragment entry (air.fragment in its fixture's
  metadata): 1,079 .ll cells, compared on every host, and 1,053 .air.ll
  cells, compared on the Mac. Cause: 7360a148bb states the
  maximal-reconvergence mode on a fragment only in a loop a back edge
  re-enters from inside a selection (SEMANTICS 2298).
- 4 new rows, 28 entries, 420 cells: the reconverge_sample and
  reconverge_select fixtures (.ll and .air.ll) of the reconvergence
  conformance cases (62ab49b966).
- No vertex, kernel or mesh cell moved; no key changed; no row went.

Authored compile census (corpus/authored-compile.tsv), 92 rows, 418
cells:
- 5 cases go from not_supported{unsupported:not_implemented
  IdentityDomains} to compiled on all 9 profiles (45 cells less the
  equal ones): ed4b0ecd76 lowered storage textures read or written at a
  run-time level, after the census's last bless.
- The rest are compiled cells whose artifact hash moved with the
  translator changes since 7024d568df (SEMANTICS 2294 -> 2298).

Verified: bless job m3-max-72253 on the M3 at 7360a148bb (inventory,
golden, printouts, opened chains and the census, each exit 0); this
commit is its patch, applied unchanged. The tip's suites (m3-max-72242)
failed only golden_hashes_match_the_table, the bless due named here; the
quick check (m3-max-72240) passed every step. The planner named
7360a148bb pin V on that quick check.
2026-11-23 15:00:13 -08:00
Anees Iqbal 7360a148bb Translator: a fragment's derivatives state the reconvergence mode only in a loop a back edge re-enters from inside a selection
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.
2026-11-23 14:19:33 -08:00
Anees Iqbal 62ab49b966 Conformance ledger: the reconvergence rows on the Iris Xe
The Iris Xe (RPL-P, Mesa ANV; job m3-max-72186) answers the four
trilinear sites of reconvergence-handle-choices exactly as every AMD
venue does: 1128, 1136, 2240 and 490 elements, each one step of a half,
on the second source only. Everywhere else it matches Metal, so four
rows are scoped to "Iris(R) Xe". The llvmpipe diagonal rows now list
every GPU replayed that answers Metal's there. CONFORMANCE-COVERAGE.md
regenerated.
2026-11-23 13:59:31 -08:00
Anees Iqbal 17802357be Conformance ledger: the AMD trilinear rows hold on every AMD venue
The four trilinear rows of reconvergence-handle-choices were scoped to
the 780M. The RX 550 (POLARIS12, job m3-max-72170) and the RX 7900 XTX
(NAVI31, job m3-max-72171) under RADV answer the same four sites with the
same counts (1128, 1136, 2240 and 490 elements, each one step of a half)
as the 780M under RADV and AMDVLK, and match Metal everywhere else. So
the rows are now scoped to "AMD Radeon", which every one of those venue
names holds. The RTX 2080 (job m3-max-72171) matches Metal on both cases.
CONFORMANCE-COVERAGE.md regenerated.
2026-11-23 13:59:31 -08:00
Anees Iqbal baae603de4 Conformance ledger: the llvmpipe diagonal rows say what differs, and point at nothing private
The two level-and-pair rows on llvmpipe (rc_loop, rc_break) pointed at
a bug list outside the repository. Each now says, on its own, what
differs: the fine pair along the full-screen triangle's diagonal
x + y = 62 to 63, the same with and without MaximallyReconvergesKHR. It
also says where it was measured (LLVM 23.1.1, 256 bits, AVX2) and which
drivers answer Metal's. Only the text field changed, so neither row's
identity (case, verdict, site, answer) moved. CONFORMANCE-COVERAGE.md,
which quotes the rows, was regenerated.
2026-11-23 13:59:31 -08:00
Anees Iqbal 957961d8d5 Conformance: reconvergence's module doc states its loops' real bound
rc_break runs up to 6 + 2 = 8 iterations, so "a data word below 7" was
wrong. Every loop in the fixtures runs at most eight iterations.
2026-11-23 13:59:31 -08:00
Anees Iqbal 2a8cfdec04 Docs: CONFORMANCE-COVERAGE.md regenerated for the reconvergence ledger rows and declarations
The doc derives from the ledger and from each module's declarations as
well as from the recordings. It went stale at dbcc0a89df (the
reconvergence module stopped declaring notices: modules declaring a
notice 43 -> 42) and at 853a406696 (18 ledger rows, 7969 -> 7987).
884a70ab0d's body says coverage.py --check still passed there. That is
wrong: the check failed there, for these two causes. It passes at this
commit.
2026-11-23 13:59:31 -08:00
Anees Iqbal c505deb3be Conformance: Metal's times for the reconvergence cases, kept in their recordings
`conformance times --runs 8 --write reconvergence-constructs
reconvergence-handle-choices` was run on the reference M3 Max (job
m3-max-72159). It added one time record to each recording and changed
nothing else, which a comparison of the JSON keys before and after
confirmed. Without it, times::every_case_is_timed failed (gate
m3-max-72143). coverage.py --check still passes.
2026-11-23 13:59:31 -08:00
Anees Iqbal 12f2440aff Fixtures: reconverge_sample's and reconverge_select's golden printouts
Written by tests::air_input::bless_engine_goldens under the pinned LLVM
on msi-laptop at dbcc0a89df (job m3-max-72157). These are the only two
files it changed. Without them, engine_fixtures_match_their_golden_printout
failed (gate m3-max-72143).
2026-11-23 13:59:31 -08:00
Anees Iqbal 9a2f2b81a9 Conformance ledger: the reconvergence cases' rows on llvmpipe and the 780M
Replayed at dbcc0a89df/7bb5681381 with the carried conformance binary:
- RTX 3090 (m3-max-72150): both cases compared and matched; only native notes differ.
- RTX 5080 (m3-max-72151): the same.
- M3 Max under KosmicKrisp (m3-max-72149): the same.
- 780M under RADV (1002:1900, m3-max-72150; 1002:15bf, m3-max-72156)
  and under AMDVLK v-2025.Q2.1 (1002:15bf, m3-max-72156):
  reconvergence-constructs matches; reconvergence-handle-choices differs
  only in the trilinear site of its four draws. Each sample of the second
  source (values 21 + n) is one step of a half from Metal's. The counts
  are the same on both drivers and both parts, so the rows are scoped to
  780M.
- llvmpipe (LLVM 23.1.1, 256 bits, x86-64 AVX2; m3-max-72151): the
  trilinear site of every draw differs (rule 1, device-sampling). The
  level-and-pair site differs only on rc_loop (14 elements) and rc_break
  (17 elements), along the diagonal x + y = 62 to 63. That is lavapipe's
  diagonal, which the lane earlier saw the same with and without
  MaximallyReconvergesKHR (job 72077) and on no GPU. Its row points at
  the development bug list's row.

No level-and-pair difference on any GPU. The Iris Xe replay waits for
ms01's hold.
2026-11-23 13:59:31 -08:00
Anees Iqbal dc8d05b37b Conformance: reconvergence declares no notice
device-reconvergence and quads-split-by-clipping fired on no venue: the
M3 (KosmicKrisp, m3-max-72149), the RTX 3090 and the 780M under RADV
(m3-max-72150), and the RTX 5080 and llvmpipe (m3-max-72151). Every
other notice those runs announced is one of the suite's native notes.
2026-11-23 13:59:31 -08:00
Anees Iqbal 0c21266c14 Conformance: reconvergence's hash model lives in its tests, the one place that reads it
The release build of the library warned that hash was never used (job
m3-max-72147): only the tests' model calls it.
2026-11-23 13:59:31 -08:00
Anees Iqbal 1680e7ffd1 Conformance: Metal's answer for reconvergence-constructs' eight draws, recorded on the M3
Recorded on the reference M3 Max (macOS 27.0.1, 26A434) by
`conformance record reconvergence-constructs` at 2cf4666ddc (job
m3-max-72146, after the build m3-max-72145). It ran 3 times with 1
distinct outcome, and the validated leg ran.

A script over the recordings checked Metal's nearest samples against
the module's hash model: all 4096 pixels match on every draw of both
cases, as does the fine pair on the rc_pick draws (896 pixels for the
small triangles).

docs/CONFORMANCE-COVERAGE.md was regenerated after the drop. It is
byte-for-byte what 7ad44c4561 committed, because the counts it derives
(modules, recordings) did not move, and coverage.py --check passes at
this commit.
2026-11-23 13:59:31 -08:00
Anees Iqbal 03b0e094f4 Conformance: reconvergence holds only constructs Metal defines; rc_return and rc_continue dropped
The suite compares only what Metal defines: where MSL leaves a
derivative undefined, Metal's answer is no contract, and a recorded
match would make a device's luck a contract. The class rule says a
derivative is undefined after an early return inside a selection, after
a break or continue to a construct around the innermost one, and inside
a construct a quad entered diverged. Draw by draw:

Kept (defined):
- rc_if: after an if/else that closed; every lane of the quad arrives.
- rc_loop: after a loop of the pixel's own trip count, exited through
  the loop's own merge.
- rc_break: after a break to the loop's own merge.
- rc_switch: after a switch of one label per case that closed.
- rc_discard: after a discard, which Metal runs as a demote, so the
  discarded lane stays a helper for the quad's derivatives.
- rc_grid: inside selections and a loop uniform over 8x8 blocks, so
  every quad runs them together.
- rc_continue_quad: the continue goes to the loop's own continue target,
  not to an enclosing construct; the sample is in the next iteration,
  which every lane enters together after the loop's back edge.
- rc_latches: after an if/else whose two arms both end the iteration;
  the sample is in the next iteration, as above.
- rc_select, rc_select_quad, rc_pick, rc_pick_cells: inside a selection
  uniform over 8x8 blocks; only the texture chosen differs per pixel or
  per 4x4 block, and MSL's default allows a non-uniform choice.

Dropped (undefined):
- rc_return: after a callee's early return inside a selection.
- rc_continue: after a continue from inside a switch to the loop around
  it, which is a continue to an enclosing construct.
Both matched Metal on every card the lane ran; that stays lane evidence.
rc_return_entry and rc_diverged were already left out for the same rule.

The earlier count of 15 counted the cases where the Metal-defined bar
applied as the lane first reported them. Under the class rule the suite
holds 12 draws: 8 constructs and 4 handle choices.

reconverge_sample drops the two entries and the callee rc_return used,
recompiled by scripts/regen-air-fixtures; its four inventory rows go too.
reconvergence-constructs' recording is removed here, and a new recording
comes in the next commit. reconvergence-handle-choices' inputs did not
change, so its recording stays.
2026-11-23 13:59:31 -08:00
Anees Iqbal 5216a5cde1 Conformance: Metal's answers for the reconvergence cases, recorded on the M3; coverage regenerated
reconvergence-constructs and reconvergence-handle-choices were recorded
on the reference M3 Max (macOS 27.0.1, 26A434) by `conformance record`
at a1ffe24d32 (job m3-max-72140, after the build m3-max-72139). Each
case ran 3 times with 1 distinct outcome, and the validated leg ran.

A script over the recordings checked Metal's nearest samples against
the module's hash model, and rc_pick's fine pair too: every draw
matches. That is 4096 pixels for each full-screen draw and 896 for
rc_pick over the small triangles. The module's test makes the same
check in Rust.

docs/CONFORMANCE-COVERAGE.md was regenerated by
scripts/conformance-coverage/coverage.py.
2026-11-23 13:59:31 -08:00
Anees Iqbal 148ad25af0 Conformance: reconvergence binds pick only for the draws whose fragment reads it
Metal's API validation stopped the handle-choices case's validated leg
at render: "unused fragment binding in render encoder at Buffer index 1"
for rc_select and rc_select_quad, which declare no buffer 1. Each draw
now says whether it binds pick, and the draws input fingerprints that.

Seen in the first recording on the M3 (job m3-max-72137). In that
recording Metal's nearest samples, and rc_pick's fine pair, match the
module's hash model on all 14 draws (checked by a script over the
recording; 896 pixels written by the small triangles).
2026-11-23 13:59:31 -08:00
Anees Iqbal 4ba24d6e23 Conformance: reconvergence, implicit-LOD samples and a fine pair after each construct a fragment reconverges from
Two cases over the owned fixtures reconverge_sample and reconverge_select.
Each fragment writes (the nearest sample, dfdx(v), dfdy(v), the
trilinear sample) over a 64x64 RGBA16Float target cleared to -1.
reconvergence-constructs draws ten fragments: if/else, a loop of the
pixel's own trip count, a break, a switch, a discard, a callee's early
return, a continue from a switch, block-uniform selections and a loop,
and the two uniform-loop iteration cases. reconvergence-handle-choices
draws three handle ternaries (per pixel, per 4x4 block, by a constant
the draw shares), the last also over 64 small triangles.

Each draw's row has two sites over its texels. level-and-pair holds the
nearest sample and the fine pair, which is what reconvergence decides.
trilinear holds the trilinear sample, whose bits are the device's filter
(rule 1), so a venue whose filter answers other bits gets a ledger row
for that site alone. The module's tests check the recorded nearest
samples (and rc_pick's pair) against the fixtures' hash model, and read
recordings only.

Not recorded yet: Metal's answers come from the M3 next.
2026-11-23 13:59:31 -08:00
Anees Iqbal 0f87d64fb7 Fixtures: reconverge_sample and reconverge_select, implicit-LOD samples and a fine pair after each construct a fragment reconverges from
reconverge_sample: ten fragment entries and one covering vertex function.
Each fragment writes (the nearest sample, dfdx(v), dfdy(v), the
trilinear sample) of an r16_float 1024x2 source of 11 levels, level n
holding n + 1, at a coordinate whose scale is 2^q texels per pixel for a
quad-uniform q, so the nearest sample reads level q exactly. The
constructs: an if/else on data, a loop of the pixel's own trip count, a
break to the loop's merge, a switch of one label per case, a discard, a
noinline call that returns early in a selection, a continue from a
switch, selections and a loop uniform over 8x8 blocks, and a uniform
loop's second iteration after one pixel per quad ended the first early
(by a continue, or by an if/else at the body's end).

reconverge_select: the same tail through a texture a ternary on two
texture handles chooses (the second source's level n holds 21 + n),
inside a selection uniform over 8x8 blocks: per pixel, per 4x4 block,
and by a constant the whole draw shares; rs_cells draws a small triangle
in each 8x8 cell of a 64x64 target.

Two shapes Metal leaves undefined (an early return of the entry, and a
selection a quad entered diverged) are not included.

Compiled by scripts/regen-air-fixtures with the pinned LLVM 21. The
inventory rows say ok on every profile; the gate has not checked them yet.
2026-11-23 13:59:31 -08:00
Anees Iqbal 9633841114 rt test: the loop-flag test compares the flags' raw values
ash's PipelineCreateFlags is not Debug under the features the runtime takes, so assert_eq! on the
flags themselves did not compile under --cfg m2v_gpu (landing build m3-max-72091, E0277 at
tests/draw.rs:3036). The test compares their raw values instead; what it checks is unchanged.

Verified: the gate and the device runs follow on this commit.
2026-11-23 13:11:44 -08:00