Commit Graph
3607 Commits
Author SHA1 Message Date
Anees Iqbal 984e49e455 Pass log: an execution's replay encoder notes nothing
The replay encoder of a render-command execution (render/executions.rs) is a RenderLowering of
its own and took no pass_notes, so the runtime did not build. It is no pass of the program's:
the executing encoder's line names the pass.

Verified: cargo fmt; the build runs on potluck after this commit.
2026-11-11 01:49:25 -08:00
Anees Iqbal 1032d39bd6 Pass log: a pass a frame repeats with other counts prints no line again
The pass log told its lines apart by their whole text, its draw-call and resident counts
included, so a pass a frame repeats with one draw more printed again and the 256-line bound
could fill before the pass that matters ran. A line is now keyed by the pass without those
counts; the line still prints them.

Verified: cargo fmt; tests::pass_log runs on potluck after this commit.
2026-11-11 01:49:25 -08:00
Anees Iqbal 5a21f6d3f3 METAL2VULKAN_LOG_PASSES: a default-off log of the render passes that name a watched texture
A diagnostic to find which pass draws the white at a widget's glass edges in the 27.0.1 guest:
the runtime sees every pass's attachments, which the consumer's own logs cannot name.

The switch's value is the textures to watch, a comma-separated list of FORMAT:WIDTHxHEIGHT
(the format as the notices print it or as Metal names it, `*` for any format or size). At the end
of each render encoder that renders into a watched texture, binds one to its fragment stage or
makes one resident, the device logs one line (id name metal2vulkan-passes, Info): the render area,
its Vulkan render pass instances and draw calls, each attachment (format, size, object ID, label,
whether it took its storage form, level, slice, load and store actions as the pass ends, its
stand-in and cause), the depth/stencil aspects' actions, the pipeline states its draws drew with,
the textures bound to the fragment stage at a draw, the watched resident textures with their
stages, and what it watched. A line the same as one printed before is not printed again; a process
prints at most 256. Off (unset, empty or 0, or a value it cannot read, said once on stderr), an
encoder notes nothing; no behaviour reads it.

- crates/metal2vulkan/src/env_vars.rs: the registry row and `log_passes()`, the raw value.
- crates/metal2vulkan-runtime/src/pass_log.rs: the filter, the notes, the line and its bound.
- render.rs: an encoder's notes, made where the log is on, noted at each draw call, logged at
  the pass's end once its store actions are settled.
- texture.rs: `Texture::took_storage_form`, which the line names.
- docs/API.md and the artifact test's list of the runtime's variables name it.

Verified: cargo fmt; the build, clippy and the tests run on potluck after this commit
(tests::pass_log: the filter's parse and refusals, an entry's match, the once-and-bound rule).
2026-11-11 01:49:25 -08:00
Anees Iqbal fc261c9f31 host_image_room: fill past two blocks of images at the one block size
The host-transfer image test (399e8d6d17) landed after the 64 MiB image
blocks (653060d6ee) and still named IMAGE_BLOCK_SLACK, which those removed:
the runtime's tests no longer compiled under m2v_cpu_icd or m2v_gpu
(round d0f0419800, lvp 2/4, gem10, job m3-max-14294, E0432). A block of
images is BLOCK_BYTES now, so two blocks past the heap are 2 * BLOCK_BYTES.

Test only; the runtime-sources pin is unchanged. Verified: cargo fmt; the
CPU-ICD and GPU builds are the next round's.
2026-11-11 01:48:19 -08:00
Anees Iqbal faa1b6ec7f Flat dispatch lane: one command queue for all four grids
PR #15's a_ragged_direct_dispatch_runs_each_thread_once_on_the_flat_variant
made a command queue for each of its four grids. On the RTX 5080 Laptop
(one VkQueue in the family, a plan of 14 queues) the second shared VkQueue 0
and the runtime announced metal2vulkan-queue-limits-reached, which the lane's
layer claim fails on (round d0f0419800, msi, job m3-max-14216, 5080 lane 1/2).
The queue limits are not what the test tests: one queue serves every grid.

Test only. Verified: cargo fmt; the 5080 run is the next round's 5080 lane.
2026-11-11 01:44:42 -08:00
Anees Iqbal e831b50ad6 FAST-PATHS: drop the 64 MiB image blocks' scroll claim the confirming block overturned
653060d6ee's row said 64 MiB image blocks matched the build before the 68 MiB
ones in a macOS guest's page scroll on a Hawk Point 780M, from reims's first
block (4 + 4 boots). Its mirrored second block (m3-max-14080) overturns that:
pooled over 8 + 8 boots, pin 36 with 64 MiB image blocks has 14 rAF gaps of
100 ms or more against pin 30's 8, with twice the ready thread's direct
compaction for the same block count. The row now says what the size choice is
and costs, and no scroll figure; the scroll regression is open and worked
apart. Docs only.
2026-11-11 01:43:37 -08:00
Anees Iqbal e8cc1b4cf4 RUNTIME_VERSION 2021: a host-transfer image keeps to its class's own memory types
vram3090 landed as ..70042c055a: memory::host_image_types returns only the
class's own types, never the types it overflows into, and an image that finds
no room there is made without host-transfer usage in device-local memory (its
CPU copies through submissions). On a GPU without resizable BAR (the 3090s:
a 246 MiB host-visible device-local heap) a Shared depth texture no longer
overflows into system memory while the device-local heap has room: what a run
places and announces (device-memory-overflow). RUNTIME_VERSION 2020 -> 2021;
the pin was re-pinned by land-pkt.sh (9d3c275ea8). Verified: pin-compute only.
2026-11-11 01:34:26 -08:00
Anees Iqbal 9d3c275ea8 Re-pin the runtime sources at the landing tip
The landed packet changed a runtime-sources input, so the committed digest no

longer described the sources and `the_runtime_sources_are_the_committed_ones`

would fail. Recomputed over the same inputs and committed by land-pkt.sh.
2026-11-11 01:34:04 -08:00
Anees Iqbal 70042c055a host_image_room: read the depths back as 4-byte chunks (clippy chunks_exact_to_as_chunks)
What: round_trip reads the bytes get_bytes returned through as_chunks::<4>.
Why: clippy -D warnings under --cfg m2v_gpu and --cfg m2v_cpu_icd refused
chunks_exact(4) there (potluck m3-max-14208 on msi-laptop); plain clippy, fmt and
rustdoc -D warnings passed in that job. cargo fmt --all.
2026-11-11 01:33:24 -08:00
Anees Iqbal c6013d5f70 host_image_room: print memory flags in hex, and the types the fallback images lie in
What: ash here has no Debug for MemoryPropertyFlags, so the test's messages print the
flags' raw bits; its HOST-IMAGE-ROOM line names the type and flags of the host-transfer
images and the types the images made without the usage lie in.

Why: the gpucfg build of the runtime's lib tests failed (E0277, two sites) on
homelab-gem10-1 (potluck m3-max-14193); the default build compiles no device test, so
the msi run of the pure tests did not see it. cargo fmt --all.
2026-11-11 01:33:24 -08:00
Anees Iqbal 6cf939b71e Docs: the host-transfer image types' heap, said as it is now
What: the host_copy.rs module docs, the host_image_room test's module docs and the
memory test's doc comment state the RTX 3090's BAR heap and device-local heap as they
are, with no account of what the placement did before 597c6e3225.

Why: AGENTS.md, docs say what is true now. Comments only; cargo fmt --all.
2026-11-11 01:33:24 -08:00
Anees Iqbal 399e8d6d17 Runtime: a host-transfer image takes its class's own memory types, never overflow ones
What: Memory::host_image_types (now the pure memory::host_image_types, with
class_types beside it) returns the types of the image's class among those allowed,
in both of its branches, instead of every allowed type. A `Shared` or `Managed`
texture's image with host-transfer usage so never overflows into system memory: where
none of its class's types has room, its placement fails and host_placed_image makes the
image without the usage, which lies in device-local memory where that image has room
(and overflows only where none has, as any image does). The unused Memory delegates
host_cached_placement and host_incoherent go. Texture::placed_type and
Memory::type_and_heap are test-only accessors for the new device test.

Why: the RTX 3090 lanes (validation runtime_lane, round at 7d7085f9d0, gem10 and
um870) announced device-memory-overflow for `Shared` Depth32Float textures in six
tests. Those 3090s run without resizable BAR (NVIDIA 620.70.06, vulkaninfo on gem10:
heap 2, DEVICE_LOCAL, 246 MiB; nvidia-smi BAR1 total 256 MiB), and NVIDIA places a
host-transfer image in that BAR heap alone (type 5, its one device-local type for it),
beside system types 3 and 4. With 16 lane tests at once, each device's 68 MiB block of
such images fills the shared 246 MiB heap; the next process's depth texture then
overflowed into types 3/4 while heap 0 (24 GiB, type 1, which the image without the
usage takes) had room. Color textures there copy on the staging queue and take no
host-transfer usage, which is why only depth textures overflowed.

Tests: tests::memory::host_transfer_images_take_no_type_their_class_overflows_into
(pure; on the 3090's memory types the image takes type 5 alone, where the old answer
3..5 overflowed into [3, 4]); tests::host_image_room (device: on a GPU whose
host-transfer heap is at most 1 GiB, fills it with 16 MiB Shared Depth32Float
textures, none may overflow, all lie device-local, CPU copies round-trip). Docs:
host_copy.rs module docs, the FAST-PATHS device-gap row for the copies' submissions.
Builds, clippy and the 3090 runs go to potluck after this commit.
2026-11-11 01:33:24 -08:00
Anees Iqbal 6eeaa6ef80 RUNTIME_VERSION 2020 for lavapipe's small-float NaN fact; SEMANTICS_VERSION 2023 noted
bugs-a landed as 2566b388b5..2c0f3c25dc:
- driver_facts: lavapipe (MESA_LLVMPIPE, every vendor and device) stores
  small-float NaNs as Metal does (MetalSmallFloatNans), so a run on lavapipe no
  longer announces device-nan-encoding for them: what a run announces.
  RUNTIME_VERSION 2019 -> 2020; the pin was re-pinned by land-pkt.sh
  (af1591a4c1).
- 7aefa49b7f moved SEMANTICS_VERSION to 2023, not the 2021 its message names:
  its branch bumped 2020 -> 2021 on its base, and development held 2022 (the
  helper fences); the rebase's conflict was resolved to 2023 so the change under
  unchanged keys (a heap element's NaN notes gated by HeapNanFamilies) keeps its
  own version.
Verified: pin-compute only.
2026-11-11 01:31:43 -08:00
Anees Iqbal af1591a4c1 Re-pin the runtime sources at the landing tip
The landed packet changed a runtime-sources input, so the committed digest no

longer described the sources and `the_runtime_sources_are_the_committed_ones`

would fail. Recomputed over the same inputs and committed by land-pkt.sh.
2026-11-11 01:31:26 -08:00
Anees Iqbal 2c0f3c25dc driver_facts test: lavapipe on Apple's vendor takes MetalSmallFloatNans too
What: the_profile_takes_the_deviations_its_driver_is_measured_with's case of
another driver on Apple's vendor (lavapipe's driver-wide rows) now expects
MetalSmallFloatNans beside MetalFloatColorNans and MetalHalfStorageWrites.

Why: cd503e37b6 gave lavapipe its driver-wide MetalSmallFloatNans row and
updated the committed profiles' expectation, not this second one; the core
suite on gem10 at 67ee2eb24a (job m3-max-14066) failed it at line 359
(left: the three, right: the two).

Verified: the same job's other driver_facts test passed; this one runs in the
next gem10 job.
2026-11-11 01:30:36 -08:00
Anees Iqbal 7aefa49b7f A float write through an argument buffer notes the half-float and small-float NaN only where the heap can name such a texture
What: lower::texture::stored_where gave a heap element one clause of no test, so a
`float` texel's write through an argument buffer recorded DeviceNanEncoding (and,
off MetalHalfStorageWrites, DeviceColorConversion) unconditionally, whatever the
command made resident. It now gives the clause the family the caller asks about:
may_store_half the 16-bit float family (bind::heap::NAN_SIXTEEN), small_float_storage
the packed small float one (NAN_SMALL), tested on SpecKey::HeapNanFamilies, which
the runtime reads at each draw or dispatch, as a `half` write's heap note already
does (half_write_nans). SEMANTICS_VERSION 2021: the notes change under unchanged
keys on every profile without MetalHalfStorageNans.

Why: with lavapipe's MetalSmallFloatNans row, runtime_lane::half_storage_writes::
every_nan_a_kernel_writes_to_a_small_float_texture_is_metal_s_where_measured failed
on lavapipe (gem10, Mesa 26.2.6, LLVM 23.1.4) in its argument-buffer form alone:
every one of 98,298 NaN fields was Metal's, yet the dispatch, whose only resident
texture is RG11B10Float, announced device-nan-encoding for the half-float family
the heap might have held. The same over-note as the reported one, through the
argument buffer's float write.

Test that fails without it: tests::engine_handles::a_heap_texel_write_is_the_devices_write
now requires a float texel's DeviceNanEncoding to hold only under HeapNanFamilies
clauses of NAN_SIXTEEN (profile without MetalHalfStorageNans) and NAN_SMALL (without
MetalSmallFloatNans); and the lane above on lavapipe.
2026-11-11 01:30:36 -08:00
Anees Iqbal f9d09e715d driver_facts: say what RADV and NVIDIA store for a small-float NaN
What: the MetalSmallFloatNans paragraph named both as keeping payload bits;
NVIDIA's 615.71.09 on the RTX 5080 Laptop GPU sets every bit of each NaN field
(0xFFFFFFFF where Metal stores 0xFC3F07E0, known-gaps.tsv's half-write-nans-rg11b10f
row), RADV on the 780M keeps the half's payload bits (0xFE7F07E0, its row).
Why: the docs say what was measured. Verified: doc only (cargo fmt).
2026-11-11 01:30:30 -08:00
Anees Iqbal 08ff006256 lavapipe stores small-float NaNs as Metal does: its MetalSmallFloatNans row, and the lanes that gate it
What: driver_facts::DEVIATIONS gains MetalSmallFloatNans for MESA_LLVMPIPE (every
CPU). A half or float texel's write that may reach an RG11B10Float storage image
on lavapipe then records no DeviceNanEncoding for it and requires
VkProperty::MetalSmallFloatNans, as on MoltenVK's Apple9 identity. Two lane tests
measure the deviation on every venue and gate it where a driver is listed:
half_storage_writes::every_nan_a_kernel_writes_to_a_small_float_texture_is_metal_s_where_measured
(32,766 float NaNs: every top-13 payload pattern, low bits clear and set, both
signs; write, read_write, texture buffer and argument buffer forms) and
half_write_nans::every_half_nan_written_to_a_small_float_texture_is_metal_s_where_measured
(all 2,046 half NaNs; write, read_write, held). Each requires every NaN field
Metal's canonical one and no device-nan-encoding where the profile takes the
deviation, and device-nan-encoding where any field differs elsewhere. half_write_nans'
stored() takes its texels. The existing half_write_nans lane's measured branch
no longer requires native-nan-encoding absent where the device's widening is
unmeasured (no MetalNanMoves): that note is the kernel making's, for its widening of
the half whatever texture it writes, and a 32-bit float store shows it.

Why: lavapipe announced device-nan-encoding on every RG11B10Float half write of
runtime_lane::half_write_nans (write, read_write and held) with 0 of 25 lanes
differing from Metal's (msi, Mesa 26.2.4, LLVM 23.1.1, at 7d7085f9d0), and the
conformance case half-write-nans-rg11b10f differed only in its notices. The note
fires because the profile lacked the deviation, not because the store differs:
llvmpipe packs a small float in its shader code and writes every NaN as the
field's quiet NaN with its sign dropped, which is Metal's. RADV and NVIDIA keep
payload bits, so they stay unlisted. No SEMANTICS_VERSION bump: the deviation is
an enabled property the profile fingerprint hashes, so lavapipe's keys change
(golden_hashes' lavapipe cells re-key; re-blessed on development).

Test that fails without it: device::tests::driver_facts::
the_profile_takes_the_deviations_its_driver_is_measured_with now expects
MetalSmallFloatNans on lavapipe, gate-lavapipe and gate-lavapipe-x86_64.
Verified: the lavapipe, PHOENIX and M3 runs in the branch's report.
2026-11-11 01:30:29 -08:00
Anees Iqbal 2566b388b5 Lanes: withhold the features the vk12-floor tests rest on, not the profiles layer
What: runtime_lane::barycentric_weights'
on_vk12_floor_the_weights_are_metal_s_or_refused_needing_either_way becomes
with_neither_way_the_weight_functions_are_refused_needing_either: the device is
made with fragmentShaderBarycentric and geometryShader withheld
(DeviceOptions::withheld_features) and the test asserts the weight functions are
refused as needing either. runtime_lane::absent_reads'
on_vk12_floor_a_removed_arguments_read_marks_through_the_status_binding becomes
without_buffer_device_addresses_a_removed_arguments_read_marks_through_the_status_binding:
bufferDeviceAddress withheld, the kernels mark the status through its binding (the
existing test withholds shaderInt64, the other half of the address condition).
lane_restriction, LaneRestriction and profiles_layer_installed, which only these
two tests used, are deleted.

Why: VK_LAYER_KHRONOS_profiles is not installed on gem10 or the M3, so both tests
printed 'SKIPPED: VK_LAYER_KHRONOS_profiles is not installed' there and passed
having run nothing. 0144468c54 fixed the same shape for color_groups with an
option. Each test's claim rests on the features the floor lacks, which the
runtime's own withholding gives on every device, so the tests now run everywhere.
The restricted 4-storage-buffer limit of the floor is no longer exercised on
device; the planner's acceptance under vk12-floor stays covered offline by the
translator's profile tests.

Verified: see the branch's report (lavapipe, PHOENIX and the M3 runs of the two
modules).
2026-11-11 01:30:29 -08:00
Anees Iqbal d0f0419800 Cost coverage: vertex-fetch-past-4gib-small-buffer carries its record now
The whole-set re-bless before this paid it, so AFTER_THE_LAST_RUN is empty
again (the test holds the list in both directions).
2026-11-11 01:18:37 -08:00
Anees Iqbal 58c65fb510 Re-bless the cost records at 9b046a7cf8
A whole-set cost --runs 8 --write on the M3 Max, then --alone --runs 8 --write
over the cases it changed (their contrast). The records follow the inline
first-instance passes (fewer command buffers, encoders and secondaries; pass
kinds counted inline) and the argument-buffer border texels, and pay
vertex-fetch-past-4gib-small-buffer its first record (dv-m3c).
2026-11-11 01:18:36 -08:00
Anees Iqbal a01abd4b17 Re-bless the golden tables at 9b046a7cf8
The engine inventory, the AIR printouts and the golden hashes follow
SEMANTICS_VERSION 2021 (the flat grid's 32-bit count). Blessed on the M3
(s37-pl.sh bless, dv-m3c).
2026-11-11 01:18:36 -08:00
Anees Iqbal 7bfc094585 Re-bless the authored compile census at 9b046a7cf8
Its product fingerprint follows development's versions at 9b046a7cf8. Blessed on the
M3 (s37-pl.sh censusbless --bless, dv-m3c).
2026-11-11 01:18:35 -08:00
Anees Iqbal b85e8e2b0e RUNTIME_VERSION 2019: images' blocks at 64 MiB, the creation log's helper-fence field
A run of an unchanged artifact and plan now does otherwise:
- a pool of images makes its blocks of 64 MiB, as every pool, not 68 MiB
  (653060d6ee): what a run allocates and how many textures share a block;
- the pipeline-creation log (METAL2VULKAN_LOG_PIPELINES) carries the
  helper-fence field (widgetedge, 79ba8d9b78): what a run announces.
RUNTIME_VERSION 2018 -> 2019. The runtime-sources pin was re-pinned by
land-pkt.sh at 8ab78eb17a over the same sources. Verified: pin-compute only.
2026-11-11 01:17:53 -08:00
Anees Iqbal 8ab78eb17a Re-pin the runtime sources at the landing tip
The landed packet changed a runtime-sources input, so the committed digest no

longer described the sources and `the_runtime_sources_are_the_committed_ones`

would fail. Recomputed over the same inputs and committed by land-pkt.sh.
2026-11-11 01:17:40 -08:00
Anees Iqbal 653060d6ee Memory: a pool of images' blocks are 64 MiB, as every pool's
930e3aa49e made a pooled block of images a sixteenth larger than every other
pool's (68 MiB, IMAGE_BLOCK_SLACK), so that four images of a quarter block
fit in one past the driver's metadata. On the consumer's 780M scroll gate
those blocks were pin 36's regression against pin 30. Pin 36 with images'
blocks at BLOCK_BYTES (probe e674b9c87d) matched pin 30 over 4 + 4 boots in
ABBA BAAB order (um870 Hawk Point 780M, x86 macOS 12.7.6 guest, page scroll,
job m3-max-13952): rAF gaps of 100 ms or more 8 against 8, of 50 ms or more
22 against 24, presents 29.0/s against 29.3/s; its ready thread made 72 blocks
of 64 MiB a boot and none of 68 MiB.

Every pooled block is now Memory::block_bytes: IMAGE_BLOCK_SLACK,
Memory::image_block_bytes, BlockMaker::image_block_bytes and the two
pooled_bytes lookups that existed only to tell images apart go; their callers
read block_bytes.

tests::blocks_ahead: the packing test now holds that a pool of images' blocks
are BLOCK_BYTES (fails at 68 MiB) and that textures pack as many to a block
as the driver's own placed bytes and alignment fit (three 2048x2048 RGBA8 on
RADV and ANV, four on lavapipe), instead of four to a block.

docs/FAST-PATHS.md: the NVIDIA, blocks-ahead and RADV plain-blocks rows say
64 MiB for images too, with the scroll A/B above.

Owed on development: RUNTIME_VERSION and the pin (block sizes change what a
run allocates), and the cost records of the two cases whose
device_memory_allocated read 71303168 (shared-creator-extended-range-samples,
shared-creator-padded-format-storage) at the next whole-set re-bless.
2026-11-11 01:16:55 -08:00
Anees Iqbal 812c30a980 SEMANTICS_VERSION 2022: the helper fences and the flat grid's count are two changes
PR #15 (e324732128) and widgetedge (06d8645d29, landed as its rebase) each
bumped SEMANTICS_VERSION 2020 -> 2021 on their own bases, so the rebase merged
the identical edit silently and development kept 2021 for both. An artifact
cached at 31358fc93c..580ef6ac56 (the flat grid's 32-bit count, no helper
fences) would then be taken for one with the fences. 2022 makes it miss.

What changed under unchanged keys since 2021: on a device with the
DiscardDropsSimdgroupStores defect and a fragment-stage subgroup shuffle, each
optnone call only helper invocations may make before a storage write is
followed by an identity simdgroup shuffle of its result (census
fragment.helper-fence). Verified: pin-compute only.
2026-11-11 01:13:11 -08:00
Anees Iqbal 38b6b95977 Re-pin the runtime sources at the landing tip
The landed packet changed a runtime-sources input, so the committed digest no

longer described the sources and `the_runtime_sources_are_the_committed_ones`

would fail. Recomputed over the same inputs and committed by land-pkt.sh.
2026-11-11 01:12:59 -08:00
Anees Iqbal 79ba8d9b78 Creation log docs: rewrap the paragraph the helper-fence field lengthened
Doc comment only; no code change.

Verified: cargo fmt.
2026-11-11 01:12:17 -08:00
Anees Iqbal 972ebfd66e No-shuffle helper test: only the functions whose source needs no fragment subgroup operation
With SHUFFLE taken out of moltenvk-m3's fragment subgroup model, rch_tangle_quad_before's
quad_sum is refused (SubgroupOperations, needs SubgroupStage(Fragment)) before any fence is
decided, so the test holds the note to rch_tangle_sample_before and rch_tangle_unread, whose
tangled instruction is an implicit-LOD sample.

Verified: cargo fmt; the test runs on potluck after this commit.
2026-11-11 01:12:17 -08:00
Anees Iqbal 87bc39d464 Helper fence tests count the fenced calls, a structure's members or a half blend's alike
helper_fences counted the shuffles of an OpUMulExtended's members, two a call, so a module that
fences a NoContraction half sum or product (rch_helper_branch_loop's blend) counted otherwise
than its census. It now counts the optnone calls whose result, or a member of it, an identity
shuffle at SubgroupLocalInvocationId reads, and the tests hold it equal to the census's
fragment.helper-fence uses.

Verified: cargo fmt; the touched tests run on potluck after this commit.
2026-11-11 01:12:17 -08:00
Anees Iqbal 04bf17db16 Fence each optnone call only helper invocations may make before a storage write with an identity simdgroup shuffle
What: on a driver whose compiler loses a simdgroup's texture writes after an `optnone` call that
only its helper invocations make (DriverWorkaround::DiscardDropsSimdgroupStores: MoltenVK on an
Apple GPU), a call the helper guard cannot keep the helpers away from exactly (an arm with a
derivative or subgroup operation, a loop the helpers repeat alone) and that no tangled
instruction reading its result follows was left as it was, with
PrecisionNote::HelperBranchDropsSimdgroupStores recorded. Now spirv::helper_branches fences each
such call: an OpGroupNonUniformShuffle of its result at SubgroupLocalInvocationId (a
MulExtended's structure member by member, put together again) follows it, and every use reads
the shuffled value. Each invocation, a helper too, reads its own lane, so no answer changes and
no lane reads another's; the shuffle is the simdgroup operation after the call, reading what it
computes, that the M4 probe found keeps the writes. The fences are placed once every analysis of
the module has run (compile.rs, before the verifier): those analyses would read a shuffle as a
move between lanes.
- guard_for returns the Fences beside Guarded (Guarded::fences counts them); plan lists every
  bare call (Facts::bare, which any_bare was) and no longer stops at the first function with one.
- The census names the fences `fragment.helper-fence`; the runtime's pipeline creation log
  prints `helper-fence <stage>`.
- The note stays where no shuffle can follow: no fragment-stage subgroup shuffle on the profile,
  or a 64-bit or bool lane, or an 8- or 16-bit one without shaderSubgroupExtendedTypes.

Why: the weather widget's glass edges in the 27.0.1 guest on the M3 draw white 8x4-pixel blocks
along the primitive's edges (solid strips in some boots, a comb in others, at every pin since 30),
and the guest's run announces helper-branch-drops-simdgroup-stores for a fragment function.

Tests: engine_fragment's helper guard tests (rch_helper_branch_loop and rch_helper_tangle's
`before` and `unread` functions fenced, census and shuffles counted, no note, L3), a new test that
the note stays with the fragment shuffle taken out of the profile, and the runtime lane
helper_tangle, which now requires the fence and no lost write where the fragment stage shuffles.
SEMANTICS_VERSION 2021.

Verified: cargo fmt; the build, the touched tests and the M3 lane follow.
2026-11-11 01:12:17 -08:00
Anees Iqbal 580ef6ac56 RUNTIME_VERSION 2018 and the pin, for the device-loss answers landed from bugs-b
A run of an unchanged artifact now answers otherwise on a device loss:
- a MoltenVK loss relayed before any fence was read (DeviceRemoved from the
  relay's fail-all) leaves the recovery's answer standing, so the culprit reads
  GpuHang and the others GpuRecoveryVictim, not a relayed victim answer (67510b5aca);
- the submission checks stop at a device loss and submit and record nothing
  again (c60041daa5).
RUNTIME_VERSION 2017 -> 2018; the runtime-sources pin is recomputed with
pin-compute.py. Verified: pin-compute only.
2026-11-11 00:44:44 -08:00
Anees Iqbal e943504a8f Re-pin the runtime sources at the landing tip
The landed packet changed a runtime-sources input, so the committed digest no

longer described the sources and `the_runtime_sources_are_the_committed_ones`

would fail. Recomputed over the same inputs and committed by land-pkt.sh.
2026-11-11 00:44:15 -08:00
Anees Iqbal 36ce4b8fb3 Submission checks' loss test: one use of the queue counts the relay's mark too
On the M3 Max (m3-max-14032, MoltenVK, whose queues' failures are relayed) the test read 2 calls
from the hold: one submission and the relay's mark after it, which the checks' calls count
(device/relay.rs, By::Checks). A hold before a merge round's apart form would read MERGED + 1 there,
past the bound of MERGED; the bound is now one use of the queue, its calls and its mark.
2026-11-11 00:43:30 -08:00
Anees Iqbal c60041daa5 Submission checks stop at a device loss: nothing submitted again, nothing recorded
With the relayed loss fixed (the hang answers GpuHang), the M3 Max's lane test
a_gpu_fault_fails_its_command_buffer_and_the_queue_runs_on went on to its next claim and failed
there (m3-max-13972, m3-max-13988): under MVK_CONFIG_RESUME_LOST_DEVICE off the validation layer
reported VUID-vkQueueSubmit-fence-00064 and VUID-vkQueueSubmit-pCommandBuffers-00071, both on the
m2v-submit-check thread (a diagnostic run printed the backtraces: submit_check::measure -> tax ->
submit_one -> submit -> vkQueueSubmit). The device was lost while its submission checks ran: a
wait for the checks' fence or a submission answered the loss, the check took it as a refused call
(Unchecked, which a record keeps), and the next check submitted the same fence and command buffer
again on the lost device, which the layer reads as still pending. A record of verdicts from a lost
device would also have kept Unchecked for the driver's release, so later devices run no check.

Now a VK_ERROR_DEVICE_LOST from a submission or a wait stops the checks as the device's teardown
does (None): nothing is submitted again, the tax releases the imports it holds first, the checks'
objects go, and nothing is recorded (what had not answered reads Unchecked for the device's life).
The loader word's step is ended before the stop as before a refused call. Another refused call
or failed wait answers as before.

Test: tests::submit_check_device::a_loss_stops_the_checks_with_nothing_submitted_again_or_recorded
holds the checks at a step, injects a lost-device answer at their next fence wait
(SubmitChecks::lost_at_wait, a device-test hook), and holds them to one submission's calls from the
hold, no run to their end, no Pending verdict and no record. Fails without the fix (the checks go on
submitting). Evidence in the report to the orchestrator.

submit_check.rs is bugs-a's area; the change is the loss path of submit()/wait() and the tax's stop.
2026-11-11 00:43:30 -08:00
Anees Iqbal 67510b5aca Device loss relayed before any fence could be read: the recovery's hang and victims stand
Under the program's own MVK_CONFIG_RESUME_LOST_DEVICE off, MoltenVK marks the device lost before
it reports the failed Metal command buffer. The relay then reads no fence (the wait answers the
loss), so it gives every batch in flight the loss's code (DeviceRemoved, 11). The completion's
failed wait then runs the recovery's answers (completion.rs: the oldest incomplete command buffer
as the hang, GpuHang, the rest as its victims) and names that command buffer the hang in the
device-recovered notice and against its queue; but CommandBufferShared::complete_seen let the
relayed code win over that answer, and DeviceLost on a recovering line reads GpuRecoveryVictim. So
the command buffer the notice named the hang answered GpuRecoveryVictim: the M3 Max's lane test
a_gpu_fault_fails_its_command_buffer_and_the_queue_runs_on read it in 25 of 25 runs (m3-max-13699),
where the runtime's README and the test say GpuHang, and Metal fails the command buffer that faulted
with its own error, never as a victim.

The test's expectation is the documented contract, so the runtime changes: a relayed DeviceRemoved
leaves a recovery's answer (GpuHang or GpuRecoveryVictim) as it is; every other relayed code is
still Metal's answer for its batch's work. The relay's loss is one named step (Relayed::lost), which
a device test injects (CommandBuffer::relay_loss).

Test: tests::device_recovery::a_relayed_loss_leaves_the_recovery_s_hang marks the loss with the
relay's code on the busy command buffer in flight, fails what is pending as a failed wait does,
recovers, and holds the command buffer the notice names the hang to GpuHang. Fails without the fix
(GpuRecoveryVictim). Evidence in the report to the orchestrator.
2026-11-11 00:43:30 -08:00
Anees Iqbal 6cbae4e537 host_ab percall: a held count a device's path never moves reads zero there, and rows are checked by name up front
On the RTX 5080 the per-call table stopped at texture_256_shared ("rt_vk_images_made_at_call is
held to at most 1, but the group moved no such count, so the row holds nothing"), so
heap_texture_256 and every later row went unmeasured there. HELD's rows are upper bounds measured
on the M3 Max, and hold() also failed any row of a bound above zero whose count the group did not
move, as its guard against a misspelled count. A Shared texture's image is made at the call where
the device copies its texels on the host (texture/host_copy.rs: the M3 Max), and taken from the
images an earlier window's textures parked where it stages its copies on another queue
(texture/staging_copy.rs: NVIDIA's copy engine): that path makes no image, binds none and starts
none on the host, so the count does not move, and the guard read the cheaper path as a
misspelling.

The guard now checks names, not movement: before any group runs, on the side that keeps counts,
check_held() fails a row whose group TIMED does not name or whose count is neither `allocs` nor
`rt_<count>`, `rt_<count>_at_call` or `rt_<count>_at_commit` of a count the side keeps
(Gpu::work_counts lists every one whatever its value). hold() then reads a count the group did
not move as zero, on every device. A row holds the staged path's cost too: texture_256_shared
takes at most one parked image a call (rt_images_recycled_at_call <= 1).

Verified: the 5080 and a 3090 run of `host_ab --side runtime --only percall` (evidence in the
report to the orchestrator); every HELD count name resolves against the runtime side's
work_counts list (47 rows).
2026-11-11 00:43:30 -08:00
Anees Iqbal 9b046a7cf8 Conformance: lavapipe's row for vertex-fetch-past-4gib-small-buffer, its fixed-function fetch wrapping at 2^32
Replayed on lavapipe (llvmpipe, LLVM 23.1.4, homelab-um790-xtx-1, job
m3-max-13976), both policies: case/out differs in 24 elements, the largest
difference 27, and nothing else in the case. The 24 are the four slots of the
six far draws at strides 4 and 12, the layouts the runtime leaves to the
device's fixed-function vertex input. The first differs at byte 32 (Metal 0,
ours 0x10, word 0: element 2^30 at stride 4, displacement 2^32 read mod 2^32),
and 27 is word 11 (0x1b), element WRAP_12 + 3 at 2^32 + 44 read at byte 44. The
pulled stride-6 draws read zero as Metal does. llvmpipe reports
robustBufferAccess2 (vulkaninfo in job m3-max-14015), under which a vertex input
past the bound range reads zero, so the wrapped word is lavapipe's own fetch.

The same case replays exact on RADV (AMD Radeon 780M, RADV PHOENIX, job
m3-max-14015) and on MoltenVK on the M3 Max (m3-max-13932), under both policies.

The row is scoped to llvmpipe and names what is open on our side: pulling an
attribute whose draw may fetch past 2^32 bytes of its bind offset on a device
whose fixed-function input wraps, which no device check finds today.
docs/CONFORMANCE-COVERAGE.md counts the row (3584 ledger rows).

Verified: coverage.py --check "as derived" locally; the Linux conformance suite
and the lavapipe replay of the case at this tip.
2026-11-11 00:34:10 -08:00
Anees Iqbal c92dcb77fc CONFORMANCE-COVERAGE: count vertex-fetch-past-4gib-small-buffer's recording
scripts/conformance-coverage/coverage.py over the tree with the case's
recording: 1277 committed recordings, 853 cases running a committed shader
fixture, 1193 metal_run answers, and vertex_fetch_reach's row reads one case,
one recording, 110 compared fields. The other rows move only where the
module joins the lists of families that call an item.

Verified: coverage.py --check reads "as derived" at this commit (locally);
the_case_set_is_the_recordings_the_document_counted in the Linux
conformance suite at this tip.
2026-11-11 00:34:10 -08:00
Anees Iqbal d6c0255084 Record vertex-fetch-past-4gib-small-buffer on the M3 Max, with its times
The case was merged with no recording (155b4cd5e0), which put four tests
of the Linux conformance suite red on development at 555b13d57e:
no_recorded_message_holds_an_address, no_recorded_site_shares_its_name_with_a_sibling
and every_case_carries_its_timing each stopped at the missing
recordings/vertex-fetch-past-4gib-small-buffer.json, and
the_case_set_is_the_recordings_the_document_counted named it as the one
case with no recording.

conformance record, then times --runs 8 --write, of the case on the M3 Max
under macOS 27.0.1 (26A434), job m3-max-13932: three runs, one outcome.
Metal's answer is what the case says it asks: every control element reads
its own bytes (stride 4: 0x10..0x13; stride 12: 0x10, 0x13, 0x16, 0x19;
stride 6: 0x10, 0x120000, 0x13, 0x150000), and every far element, per
vertex and per instance at strides 4, 12 and 6, from a vertex start, a base
vertex, an index or a base instance past 2^30, reads zero with its ids
(0x40000000.., 0x15555556.., 0x2aaaaaab..) intact. So Metal's displacement
does not wrap at 32 bits, where a 32-bit one would have read the buffer's
own words back. The validated leg complains only of the case's five
redundant setRenderPipelineState calls, as 34 other recordings do.

Times: 1 within 10x, recorded at a one-minute load average of 33.24 (the
records say so; times are reported, never gated). The cost record stays
owed: cost --write takes only a whole-set run, so the case stays in
every_case_carries_a_cost_recording's AFTER_THE_LAST_RUN until the next
whole-set re-bless.

Replayed in the same job on MoltenVK 1.4.2 (Apple M3 Max): exact under
both the exact and the default policy.
2026-11-11 00:34:10 -08:00
Anees Iqbal 55779f2671 vertex-fetch-past-4gib-small-buffer: the module doc names WRAP_12 and WRAP_6 by value, not by private link
The module's table linked the private consts WRAP_12 and WRAP_6 as
intra-doc links, which rustdoc::private-intra-doc-links fails under
RUSTDOCFLAGS='-D warnings' (cargo doc --workspace --all-features
--no-deps, exit 101 on development at 7d7085f9d0). The table now
writes them as code spans with their values, 357 913 942 and
715 827 883.

Verified: the rustdoc command on Linux at this commit.
2026-11-11 00:34:10 -08:00
Anees Iqbal f287ca164e Flat grid docs: the structural reason alone, no app or lab timings
PR #15's comments named an app's shader as the flat variant's motivating
case and carried its lab timings. AGENTS.md keeps docs to what is true now
and the tree names no app; the measurements stay in the PR's commit messages.

The doc comments of KernelDecl::flat and divmod_64_by_32, the 64/32 division
test and the ragged-dispatch lane now say the structural reason only: a device
without a 64-bit divider (Intel's) lowers each 64-bit division to a software
sequence per invocation, and ANV (Mesa 26.2) compiles a kernel holding 64-bit
OpUDiv/OpUMod at SIMD8. The lane's grid is described by its size.

Comments only; no code changes. The runtime-sources pin follows if the digest
covers these files (it hashes their bytes; no RUNTIME_VERSION bump, nothing
runs otherwise). Verified: cargo fmt clean; pin recomputed with pin-compute.py.
2026-11-11 00:33:14 -08:00
Anees Iqbal 31358fc93c Merge PR #15: a flat grid counts in 32 bits when the dispatch fits
Merges steelbrain/metal2vulkan#15 (e324732128, four commits on 555b13d57e)
into development as a merge commit, on the owner's request (11-11) that GitHub
count the PR as merged; the PR's commits keep their ids.

The change: the flat compute variant's invocation index and position are
counted in 32 bits wherever the workgroup's indices fit (a first-row
workgroup from its id alone, or any workgroup of a dispatch of at most 2^32
invocations), and in 64 bits past that, divided by a 64/32 restoring loop
instead of 64-bit OpUDiv/OpUMod. Exact in every arm; devices without a 64-bit
divider (Intel's) stop paying a software division per invocation.
SEMANTICS_VERSION 2020 -> 2021 (the PR's own bump).

Merged cleanly. The runtime-sources pin is recomputed over the merged tree:
it digests the translator's cache/mod.rs, whose SEMANTICS_VERSION moved. No
RUNTIME_VERSION bump: an unchanged artifact runs as before, and a changed
module is a new artifact under the new SEMANTICS_VERSION.

Verified here: the merge and the pin only. Build, clippy, the suites and the
golden re-bless run on development after the merge.
2026-11-11 00:32:09 -08:00
Anees Iqbal cfe05d0655 Merge PR #13: a draw recorded again draws through its own scissor rectangles
Merges steelbrain/metal2vulkan#13 (54cc4f817c, two commits on 963f0e64f1) into
development as a merge commit, on the owner's request (11-11) that GitHub count
the PR as merged; the PR's commits keep their ids.

The fix: render/reroute.rs's Held, the encoder's state kept for a draw recorded
again into a new pass instance, carries the encoder's scissor rectangles
beside EncoderState and swaps them in and out with it. Without it a rerouted
pass's earlier draws took the encoder's latest rectangles.

Conflicts resolved: RUNTIME_VERSION is 2017 (development held 2016; the PR's
1776 bump was against its 11-05 base), and the runtime-sources pin is
recomputed over the merged tree (pin-compute.py).

Verified here: the conflicts and the pin only. Build, clippy and the runtime
suites run on development after the merge.
2026-11-11 00:27:04 -08:00
Anees Iqbal 7d7085f9d0 Remove the host GPU locks: the validation batch's run lock and device-lane's --wrap
GPU work now runs under the cluster scheduler's exclusive GPU hold, which already gives a job
the GPU to itself, so the repo's own cross-process GPU locks only duplicated it.

- vulkan_batch: delete run_lock.rs, the ~/.cache/m2v-gpu/run.lock + run.turn flock that made
  GPU batches on one host take turns run by run, and its two tests. A GPU batch already runs
  one executor at a time (it refuses jobs != 1), and it still reads the hang tripwire before
  every run and writes it on a hang; the tripwire is a stop, not a lock, and stays.
- scripts/device-lane: drop --wrap, which existed to put each shard under a host GPU lock and a
  memory cap; the report's "wrapped" column and totals become the run's.
- docs/VALIDATION.md: the device-lane section says to run it under the host's exclusive GPU
  hold instead of a --wrap lock.
- Comments that told the reader to run probes under `maclock` or spoke of "the Mac's GPU lock"
  now say the run has the GPU to itself (Metal probes, recording.rs, stage-input-split, two
  runtime test modules, which are outside the runtime-sources pin).

Checked on a Linux node before landing: cargo clippy -p metal2vulkan-validation --all-targets
--all-features (plain and --cfg m2v_gpu) -D warnings, the vulkan_batch tests, and the
runtime-sources guard (the pin is unchanged).
2026-11-10 23:19:57 -08:00
DaniellandClaude Opus 5.5 e324732128 Bump SEMANTICS_VERSION 2020 -> 2021 for the flat grid's 32-bit count
What changed under unchanged keys: a flat variant's SPIR-V now tests once per dispatch whether
the grid's thread count fits in 32 bits and, if so, derives its index and position with 32-bit
arithmetic; past 2^32 threads it keeps the 64-bit arm, and a 1-D workgroup counts from its id.
The results are the same; the module is not, so an artifact cached under the old version must
miss.

The golden table is re-blessed on development, not here.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
2026-11-11 00:14:50 +00:00
DaniellandClaude Opus 5.5 6be6d61a66 the flat variant stays SIMD16 and counts a 1-D workgroup from its id
The flat variant's index math gets three arms, each chosen by workgroup-uniform values:
a workgroup of the first row and layer whose last index is below 2^32 counts in 32 bits
from wx*N (no NumWorkgroups read, which ANV merges per invocation); any other workgroup of
a dispatch of at most 2^32 invocations counts in 32 bits as before; past that the 64-bit
index is divided by a compact 64/32 restoring loop instead of 64-bit OpUDiv/OpUMod. The
position is derived once, for the guard and thread_position_in_grid.

On Arrow Lake (Mesa 26.2) the four lowered 64-bit divisions in the unexecuted arm made
the Simulator's masked blit compile at SIMD8 (2801 instructions); it now compiles at
SIMD16 (346). Apple's metallib through the runtime, 10 paired rounds against the 32-bit count alone in
both orders: p50 1.88 -> 1.54 ms, min 1.50 -> 1.40 ms, faster in 10 of 10, outputs
byte-identical. The bare kernel in the lab shows no difference (p50 1.17 vs 1.21 ms,
inside the spread).

Tests: interpreter test of the 64/32 division over edge dividends and divisors; GPU lane
for a dispatch past 2^32 threads in 105-thread groups, where the 32- to 64-bit switch
lands inside a row.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
2026-11-11 00:14:50 +00:00
DaniellandClaude Opus 5.5 bd2626a764 a flat dispatch past 2^32 threads keeps its 64-bit count
New lane: a ragged direct dispatch of 65,536 x 65,601 threads (65 rows past 2^32) runs on the
flat variant, which then takes the 64-bit arm; every thread of the last column and the last row
runs once at its own position. A mutant that always takes the 32-bit arm fails it (rows 0-64
counted twice), so the lane guards the fallback. 8 s on Arrow Lake.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
2026-11-11 00:14:50 +00:00
DaniellandClaude Opus 5.5 5da1c16d82 a flat grid counts in 32 bits when the dispatch fits
The flat variant's invocation index and its divisions by the grid were 64-bit for every
dispatch. Intel GPUs have no 64-bit integer divider, so each of the six 64-bit div/mod became
a long software sequence per invocation. The Simulator's masked blit (SimStreamProcessorObjects
blit_texture_to_texture_with_mask, 1206 x 2622 in 32 x 32 threadgroups, one per frame) spent
about 3.6 of its 4.9 ms there on Arrow Lake.

Now a dispatch-uniform test (nx*ny*nz*N <= 2^32, each product checked before the next can
wrap) selects a 32-bit arm; past it the previous 64-bit arm runs unchanged. Lab on ARL
(Mesa 26.2.4): the captured kernel 4.85 -> 1.13 ms, Apple's metallib through the runtime
p50 5.0-5.6 -> 1.6-2.0 ms with byte-identical outputs.

New lane: a ragged direct dispatch (the 1206 x 2622 screen, 3-D grids) runs on the flat
variant and each thread runs once at its own position, checked against a CPU expectation.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
2026-11-11 00:14:50 +00:00