Commit Graph
3751 Commits
Author SHA1 Message Date
Anees Iqbal 9d4d178a7f ComputePipelineDescriptor::open_cl_mode_enabled: name the image behaviour
Its doc comment now says what the mode does with images: the format
queries read buffer 2's words 2t + 1 and 2t, and 1D images take the 2D
(array) textures of height 1 Apple's OpenCL binds, at row 0. Doc only.
2026-11-11 07:04:33 -08:00
Anees Iqbal 788e0846ed tests::opencl_images: fill the 2D write target's one layer, not two
The write test filled its 1D image's 2D binding (one layer) with two
layers of zeros, so the replace_region of layer 1 failed before the
kernel ran (RADV NAVI31, job m3-max-15725); the 2D array binding keeps
its two.
2026-11-11 07:04:33 -08:00
Anees Iqbal 1176b04d14 metal2vulkan-air api_surface: list HalfRounding, VectorData and VectorDataOp
The air crate pins its public names in tests/api_surface.txt; the vector
data family's three re-exports were missing (the_table_matches_the_source
failed in job m3-max-15714).
2026-11-11 07:04:33 -08:00
Anees Iqbal a4f6080b18 vstorea_half3: record the 5300M's write of the fourth half
The 5300M's vstorea_half3 writes the fourth half of each four (the half
after the three vloada_half3 read); the M3 Max and the UHD 630 leave it,
as the expansion does (probe job m3-max-15648 beside m3-max-15630). The
5300M and the 630 also read and write uchar3 and short2 at odd elements
as the M3 does. Docs only: canon::vector_data, tests::opencl_data,
docs/API.md.
2026-11-11 07:04:32 -08:00
Anees Iqbal 7f837c636d OpenCL C's native_/half_ functions and vector data loads and stores
Apple's OpenCL compiler spells OpenCL C's native_<fn> and half_<fn> of float
types air.native_<stem>.<type> and air.half_<stem>.<type>, and vload<n>,
vstore<n>, vload_half[<n>], vloada_half<n>, vstore_half[<n>][_<rnd>] and
vstorea_half<n>[_<rnd>] air.vload[a][_half].<space>.<type> and
air.vstore[a][_half].<space>[.<rnd>].<type>. None decoded, so pipelines of
real OpenCL workloads were refused as UnknownIntrinsic
(air.native_powr.v4f32, air.vload.global.v3i32,
air.vstore_half.global.rtz.f32).

- The math family reads native_ and half_ of the twelve stems Apple spells
  (cos, exp, exp10, exp2, log, log10, log2, powr, rsqrt, sin, sqrt, tan),
  f32 scalar and every vector width, as the function at Precision::Fast.
  Metal's devices answer native_powr apart (powr(100, 0.5): 0x1.400002p+3
  on the M3 Max, 0x1.4p+3 on the 5300M), so it is the device's fast form.
- A new family, AirIntrinsic::VectorData (VectorData, VectorDataOp,
  HalfRounding), decodes every address space and element type the
  compiler spells. canon::vector_data makes each call its element
  accesses before SCCP: lane i at element offset * stride + i, at the
  element's own alignment (stride 4 for vloada_half3 / vstorea_half3), a
  half widened by fpext or narrowed by fptrunc.
- vstore_half's rounding suffixes store as the device converts (nearest
  even): the 5300M and the UHD 630 store every suffix as _rte, word for
  word over 32 values, where the M3 Max honours them; agreed with main.
  docs/API.md records the row beside the convert entry.

Measured with an OpenCL-mode probe (owned kernels): vload3(i, g + 1) of
uint reads the 3 words that follow on the M3 Max, the 5300M and the 630;
vloada_half3 / vstorea_half3 step 4 halves, vload_half3 3, on the M3.

Public surface (api_signatures.tsv blessed): AirIntrinsic gains
VectorData; Query gains ChannelOrder and ChannelDataType (previous
commit); new types VectorData, VectorDataOp, HalfRounding. An exhaustive
match over AirIntrinsic or Query in a consumer breaks.

Tests: intrinsics decode tests for both grammars (and their refusals),
observed declarations, canon::tests::vector_data (element accesses at
folded indices), runtime device tests in OpenCL mode (tests::opencl_data:
vload3 past an unaligned pointer, uchar3/short2 at odd elements, half3
strides, vstore_half's suffixes, native_powr). SEMANTICS_VERSION stays
2030 (this branch's bump).
2026-11-11 07:04:32 -08:00
Anees Iqbal 6b717abcc3 Drop the imports inline_calls took from block_read and async_copy
The shared call-then-inline tail moved FastMath and TailKind out of both expansions; plain
clippy (job m3-max-15514) refused them as unused.
2026-11-11 07:04:32 -08:00
Anees Iqbal b2d50435c7 OpenCL mode images: format queries read the third hidden buffer, 1D images read their 2D bindings
A guest's OpenCL programs run as Metal compute pipelines of OpenCL mode. Two of their image
paths failed where Metal runs them:

- get_image_channel_order and get_image_channel_data_type compile to
  air.get_channel_{order,data_type}_texture_<kind>(tex), which decoded as unknown. They now
  decode as Query::ChannelOrder / ChannelDataType for the 1d, 1d_array, 2d, 2d_array and 3d
  kinds. canon::opencl reads each one of an image argument at a constant texture index t from
  the third hidden buffer (__image_order_data_type_table): word 2t+1 for the order, 2t for the
  data type. Outside OpenCL mode lowering refuses the query (Unsupported, Lowering(Texture)).
  Metal refuses an OpenCL-mode pipeline that queries a buffer or depth image ("Failed to process
  function bitcode(2) in plugin"), so those kinds stay undecoded.
- Apple's OpenCL binds a 2D texture of height 1 for an image1d_t and a 2D array texture of
  height 1 for an image1d_array_t, while the AIR declares texture1d / texture1d_array. The
  runtime declared 1D slots, the binder found the 2D textures incompatible and wrote neutrals,
  and the kernel read zeros. canon::opencl_1d (OpenCL-mode kernels only, before SCCP) makes each
  read, sample, write, get_width and get_array_size of a 1D texture the 2D operation, coordinate
  (x, 0), sampled coordinate (x, 0.5), offset (o, 0) or zero, through a built function inlined
  as block_read's are, so the slot is the 2D (array) texture the binder binds. Every other path
  is unchanged.

The call-then-inline tail block_read and async_copy each carried is inline::inline_calls,
shared by the three expansions.

Measured with a probe of our own OpenCL C kernels (Metal's OpenCL mode driven directly, the
hidden table word i = i*0x10000 + 0x1234) on an M3 Max (macOS 27.0.1, jobs m3-max-15462,
m3-max-15473) and a Radeon Pro 5300M (macOS 26.7.1, jobs m3-max-15469, m3-max-15475): each
format query answers its word as stated (q_1d, q_1da, q_2da, q_3d, q_w2d, q_w1d: 0x31234,
0x21234 for texture 1); the reflection states image1d_t as MTLTextureType2D and image1d_array_t
as 2DArray; over 2D bindings of height 1 every read, sample (integer, unnormalized, and
normalized linear at a border-clamped edge), write and size query answers the 1D image's value.
Two queries through one wrapper of the same kind answer one shared word on both GPUs (the M3
Max's and the 5300M's from different calls); here each answers its own image's. The AIR shapes
of both macOS versions' compilers are identical (declarations diffed).

Tests: canon::tests::opencl (the words read, the 2D operations and the (x, 0.5) pair, the
undecoded kinds), families_tests' observed declarations, the translator's engine_opencl_mode
(2D slot types in the mode, Lowering(Texture) without it), and the runtime's opencl_images
device tests (formats, reads and writes against the measured answers).

SEMANTICS_VERSION 2030.
2026-11-11 07:04:32 -08:00
Anees Iqbal a1031e9a5f 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 06:57:16 -08:00
Anees Iqbal 6e207cd292 RUNTIME_VERSION 2032: a dma-buf import that backs one buffer alone is retried dedicated to it 2026-11-11 06:56:37 -08:00
Anees Iqbal f345282a06 FAST-PATHS: the NVIDIA dma-buf gap names the 64 MiB chunk the RTX 5080 Laptop imports dedicated to nothing
Measured in b5080 entry hkhostmem-3-hk3-dedicated-064011 (615.71.09):
without_pointer_imports_a_ram_s_chunks_are_its_dma_bufs lists the RAM, imports
its 64 MiB chunk as one dma-buf dedicated to nothing, and its first page
dedicated to its buffer (dma_buf_buffer_imports_dedicated 1). Docs only.
2026-11-11 06:56:33 -08:00
Anees Iqbal a41f025ebd Runtime: a dma-buf import that backs one buffer alone is retried dedicated to it
NVIDIA's 615.71.09 (RTX 5080 Laptop) refuses an import of a small udmabuf
dedicated to nothing (ERROR_OUT_OF_DEVICE_MEMORY: one 4 KiB page refused,
64 KiB taken, measured by a probe) and takes the same page dedicated to its
buffer. Two device tests failed there: a guest RAM's use asked the driver
with its first page, the refusal was remembered for the device's life, and
every chunk was then copied; a no-copy buffer's 16 KiB window was copied.

- memory.rs: import_dma_buf takes what the memory backs (DmaBufFor): an
  image (dedicated to it), shared memory (dedicated to nothing), or one
  buffer alone for its life, tried dedicated to nothing in every type and,
  where the driver refuses each, dedicated to the buffer in every type.
  That is Vulkan's documented form for one buffer's memory; no driver name
  or size rule decides it.
- dma_buf.rs: chunks_buffer/import_chunks pass the buffer where the caller
  binds nothing else in the import and the buffer is not sparse: a no-copy
  buffer's own import (never a heap's), its residency re-import, a copy's
  list of a RAM's runs, and the page a RAM's use asks the driver with. A
  RAM's chunk or run is never dedicated: its objects' buffers bind in it.
- A RAM's dma-buf refusal is remembered only where it lasts
  (not_importable: the driver refuses the dma-buf itself, or no type takes
  it); memory that ran out is that import's alone.
- WorkCounts::dma_buf_buffer_imports_dedicated counts the dedicated retries.
- Tests: two stand-in driven device tests (a no-copy page refused
  undedicated takes a dedicated import; a RAM's page is asked dedicated and
  the RAM listed while chunk refusals for want of memory are not
  remembered); the three remembered-refusal tests use the lasting
  ERROR_INVALID_EXTERNAL_HANDLE; the two NVIDIA-failing tests print the
  dedicated count.
- Docs: FAST-PATHS's NVIDIA dma-buf gap, HOWTO, the counters' docs.

Verification: in the following jobs (3090, 5080, PHOENIX, clippy x3).
2026-11-11 06:56:33 -08:00
Anees Iqbal 1d97ad8347 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 06:44:09 -08:00
Anees Iqbal cd0e9dbc33 builder: number the shuffle's components without indexing
product_by_positive_zeros indexed its component mask, which the spirv module denies
(clippy::indexing_slicing; potluck job m3-max-15620's clippy). It zips the indices with the
mask instead.
2026-11-11 06:43:27 -08:00
Anees Iqbal 372094e4f9 serialize tests: the no-contraction families under the positive-zero product form
no_contraction_decorates_float_arithmetic matched ProductForm without the new
PositiveZeroFactors arm, so the crate's tests did not compile (potluck job m3-max-15615). The
form emits a product of two values no constant gives as an OpFMul, so its groups are
Multiply's; the test now runs it as a third form.
2026-11-11 06:43:27 -08:00
Anees Iqbal 22dda379a9 ANV: multiply by +0.0 and negate where a constant factor holds -0.0
ANV's compiler keeps one multiply for two f32 products of one value by constant zeros of
opposite sign in one block, so both answer the zero of the one it keeps. The authored case
float-operations-decided-by-a-bound-constant-precise (ef24dc06, the sfold_precise fixture)
mismatched Metal on the Iris Xe of RPL-P (Mesa 26.2.6) in the stated leg only: rows f[1] and
f[2], x * k_negzero, answered x * +0, 16 of 176 words, 3 of 3 runs. The SPIR-V is right in both
legs (OpFMul by a -0.0 vec4, NoContraction, SignedZeroInfNanPreserve 32, which ANV advertises).
INTEL_DEBUG=cs: NIR's final form keeps both fmuls (exact, preserve:sz,inf,nan); the brw backend
emits one `mul ... 0x00000000:f` and stores it for f[0], f[1] and f[2]. The robustness-off leg's
in-shader store checks put an if/endif between the two products, and there both muls stay and
answer right; lavapipe answers right in both legs.

A bare Vulkan program on the Iris (Mesa 26.2.6) bounds the defect: x*+0 then x*-0 in one block
answers x*+0 twice, x*-0 then x*+0 answers x*-0 twice; x*2 beside x*-2, x*-0 alone, and
-(x*+0) beside x*+0 (with the negation in either order, or as (-x)*+0) answer right. lavapipe
answers every variant right.

DriverWorkaround::OppositeZeroProductsMerged, keyed on ANV whatever its GPU, selects
ProductForm::PositiveZeroFactors: an f32 product (OpFMul, OpVectorTimesScalar) by a constant
with a -0.0 component multiplies by +0.0 there and negates that component (OpFNegate, an
OpVectorShuffle where only some components are). -(x * +0) is x * -0 for every x; no product
the driver compiles has a -0.0 factor beside a +0.0 one. Other profiles emit as before.

SEMANTICS_VERSION 2029 -> 2030: ANV profiles' modules with such a factor change words.
Tests: lower::arith::tests::a_product_by_a_negative_zero_factor_keeps_its_sign_in_every_form
(values in every form, and no -0.0 factor under the new form), device::tests::profile::
opposite_zero_products_merged_is_keyed_on_anv, tests::engine_zero_factors (the fixture on every
committed profile: none on ANV, the factor as given on the OpFMul profiles). api_signatures.tsv
gains the variant.
2026-11-11 06:43:27 -08:00
Anees Iqbal 37afe4ff62 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 06:17:00 -08:00
Anees Iqbal 813a5ac690 RUNTIME_VERSION 2031: a class's memory types and a pool's blocks made ahead are read in place 2026-11-11 06:16:15 -08:00
Anees Iqbal dd8038307e tests::memory_frees: the kept-block test reads the block the next buffer took, not the device's allocation calls
a_buffer_with_a_block_of_its_own_keeps_it_for_the_next_of_its_size failed on an RTX 3090 in the
round (6898863f3f, homelab-um870-1, job m3-max-14885): "the next buffer of its size took the kept
block", vk_memory_allocations 10 against 7. The test read the block taken as the device's
`vkAllocateMemory` calls between two readings, which count work beyond the buffer's own. The
second creation call keeps room in the device's pools (memory.rs's keep_room), which has the
ready thread (memory/ready.rs, "metal2vulkan-ready") make blocks ahead and may wait for one. A
probe build named each making's thread. In the failing runs it showed one to three calls in the
window: makings on the ready thread at memory.rs's make_as, failed ones included (the buffer made
at address_buffer and destroyed again on the allocation's error), and one on the test's thread.
In every failing run the kept block was taken all the same: empty blocks went down by one, a
dedicated block went live, and the device's allocated bytes did not grow by the buffer's
128 MiB. The made_ahead wait before the first reading could not cover it, since the makings
start in the second call.

The test now asserts that the second buffer's memory is the very VkDeviceMemory the first
buffer's was (Buffer::memory). The released block is still asserted kept: the allocator freed no
block as the buffer went. The made_ahead wait, the allocation-count assertion and the
empty-block counts, which the makings ahead also move, are gone.

Verified (the runtime's tests built with --cfg m2v_gpu at this tree, and the same tree with
development's memory_frees.rs as the base; kept.sh runs the test 10 times alone and 4 rounds of
12 copies side by side):
- RTX 3090 (nvidia ICD, homelab-gem10-1): base 0 of 10 alone, 21 of 48 side by side failed with
  "left: 10 / 8, right: 7"; this test 0 of 10 and 0 of 48 (m3-max-15265, m3-max-15267).
  tests::memory_frees, all three, pass.
- 780M PHOENIX (radeon ICD, 1002:15bf!): this test 0 of 10 alone, 0 of 16 side by side; the
  module passes; base the same (0 of 26).
- lavapipe (--cfg m2v_cpu_icd): this test 0 of 10 alone and 0 of 16 side by side, base the same;
  the module passes.
2026-11-11 06:16:11 -08:00
Anees Iqbal 07103eb809 Runtime: a pool's blocks made ahead are summed in place, so a creation call's keep_room allocates no list of them
Memory::keep_ahead, which a creation call's keep_room runs for a pool that grew lately or is
near its next block, read the pool's blocks made, being made and still to make as a Vec of their sizes
(memory/ready.rs's Readying::held) only to sum them. The heap's kept-block budget read the same
Vec through outstanding_bytes. outstanding_bytes now sums them under the readying's lock, and
both callers ask it. held is gone, and lacking takes the sum.

Why: once host_ab settles the device's checks before its workloads, each of the RTX 5080's
texture_256_shared calls found a pool growing (memory.rs's ready_if_growing) and read the list:
one allocation a call. texture_256_shared allocs went from 25.312 to 26.312 a call in every run
(bound 32). An allocation trace of the group's counted window
(base against the settled tree, 2 runs each) named held <- keep_ahead <- ready_if_growing <-
keep_room <- new_texture_now as the only site that differed, 1.000 a call.

Verified (release host_ab against development 58c3147007):
- RTX 5080 Laptop, 16 runs each: texture_256_shared allocs read 25.312 in every run, as at
  base (26.312 without this commit). Every row is the same as at base, apart from
  heap_texture_256 allocs (15.25 -> 12.25, the previous commit) and buffer_texture_256 (within
  its bound in 16 of 16 runs; base over it in 4 of 16).
- lavapipe: texture_256_shared allocs 31.312 -> 29.312 (base 32.312); every row within its
  bound, 6 of 6 runs.
- 780M PHOENIX: texture_256_shared 29.312 (base 30.312); no row moved up.
- tests::memory, tests::host_memory, tests::host_image_room, tests::device_memory_overflow,
  tests::blocks_ahead and tests::zeroed_start: RTX 3090 56 passed (2 ignored), PHOENIX 56 passed
  (2 ignored), lavapipe 57 passed.
- clippy (plain, --cfg m2v_gpu, --cfg m2v_cpu_icd) and rustdoc -D warnings clean on Linux.
2026-11-11 06:16:11 -08:00
Anees Iqbal 88a5b95f7a Runtime: a class's memory types are read in place, so a host-copied texture's making allocates no list of them
class_types, which host_image_types asks for every texture whose texels the host copies (since
399e8d6d17), collected candidates() into a Vec only to fold it into bits: one allocation per
texture made. On lavapipe, host_ab's percall texture_256_shared read 32.3125 allocations a call
at development, against its bound of 32, in 6 of 6 runs. An allocation trace of the call named
candidates <- class_types <- host_image_types <- placed_image_starting as the site, one a call.
That trace came from a host_ab build that recorded every allocation in one group's counted
window.

ranked() yields each usable memory type with its rank, in Vulkan's order, and collects nothing.
class_types folds it into bits. candidates collects it and stable-sorts it by rank as before, so
both answer the same types in the same order: the system-memory branch for unified Private and
Memoryless, and the required, preferred and avoided flags otherwise.

Verified (release host_ab at this tree, with the settle commit before it and the test commit
after it, against development 58c3147007, 6 runs each unless named):
- lavapipe: texture_256_shared allocs 32.312 -> 31.312 (base over its bound in 6 of 6 runs, this
  tree in 0 of 6), heap_texture_256 allocs 14.25 -> 12.25; every row within its bound.
- RTX 5080 Laptop (40 runs each): heap_texture_256 allocs 15.25 -> 12.25.
- 780M PHOENIX: texture_256_shared 30.312 -> 29.312, heap_texture_256 79.25 -> 75.25 (over its
  17.25 bound at both: the heap-tiled path, handed to the orchestrator).
- tests::memory, tests::host_memory, tests::host_image_room and tests::device_memory_overflow
  pass on the RTX 3090 and PHOENIX (47 each, 2 ignored) and on lavapipe (48).
- percall.rs's account of a heap texture's allocations now reads the counts measured here
  (lavapipe and the 5080, 12.25 a call). The M3 Max's was not measured at this tree.
- clippy (plain, --cfg m2v_gpu, --cfg m2v_cpu_icd) and rustdoc -D warnings clean on Linux.
2026-11-11 06:16:11 -08:00
Anees Iqbal f3aee27ec8 host_ab: the runtime's device's checks answer before any workload, so no call's window holds their work
host_ab's runtime side now opens the device, times the open, and then waits for the device's
in-place, submission and queue-switch checks (Runtime::settle_checks) before the first workload.
It reports that wait as `meta device_checks` (ms), apart from `meta device_open`. A check that
does not answer within 30 s is named on stderr, and the run goes on.

Why: the RTX 5080's percall failed about one run in three. Row buffer_texture_256 read
rt_vk_images_made_at_call and rt_vk_image_bindings_at_call at 1.0625 or 1.125 against their bound
of 1. The maker is the device's in-place check (in_place_check.rs, thread m2v-in-place-check).
On the 5080 the first texture over a buffer in exported memory starts it: buffer_texture_256's
first warm call, whose Buffer::new_texture over the group's buffer asks a pending verdict
(texture.rs's exported_takes). The check then makes and binds its probe images on its own thread
(in_place_image.rs) for as long as it runs. The device counts that work as its own
(Counted::AsTheDevice), so the group's counting window read it whenever the two overlapped. A
probe build that named the thread of every making off the program's threads, and marked each
window, showed the check's images inside buffer_texture_256's counting window in 5 of 8 runs.
Only some runs fail because it depends on where the check's run falls against that window.

host_ab's shader cache is a new directory each run, so the check ran in every run. A consumer's
device reads the verdicts from its cache's records as it is made and runs no check; settling the
checks first measures that device. The calls after the verdicts can take another path than the
calls before them. On the 5080, each texture_256_shared call then found a pool growing and
read the list of its blocks made ahead (memory/ready.rs's held), one allocation a call. A later
commit sums those bytes in place.

Verified (release host_ab, the same metallib, development 58c3147007 against this tree with the
later commits of this branch):
- RTX 5080 Laptop (nvidia ICD, three b5080 entries, base and this branch in turn in each):
  base failed 11 of 40 runs (buffer_texture_256 images and bindings 1.0625 to 1.125 a call).
  This branch failed 0 of 40: 24 runs without the held-bytes commit and 16 with it. Every
  other row was within its bound in every run.
- lavapipe and the 780M PHOENIX (radeon ICD, 1002:15bf!), 6 runs each: no row moved up, and
  every row is within its bound on both, except PHOENIX heap_texture_256 allocs. That row is
  over its bound at base and here (79.25 and 75.25 a call against 17.25): the heap-tiled path,
  handed to the orchestrator.
- device_checks: 5080 606 to 793 ms, lavapipe 532 to 2954 ms, PHOENIX 490 to 540 ms.
- clippy (plain, --cfg m2v_gpu, --cfg m2v_cpu_icd) and rustdoc -D warnings clean on Linux.
2026-11-11 06:16:11 -08:00
Anees Iqbal d95f5c099d 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 06:15:00 -08:00
Anees Iqbal 27b9cedd7a Pipeline creation log: a state's first line names its descriptor; METAL2VULKAN_DUMP_PIPELINES writes each pipeline's SPIR-V
A live pipeline the log names could not be made again from its library: the line names the
state's functions and its key, not the constant values the functions were made with, nor the
blend and write masks, nor which library's bitcode. A state's first line now names the descriptor
(`StateDescriptor::logged`): each function's name, the SHA-256 of its bitcode
(`FunctionInfo::air_hash`; a precompiled function's key) and its constant values by index and by
name as type and bytes, each color attachment's format, blend and write mask (the notices' words,
`blend_text`, which `draw_at` now shares), the depth and stencil formats and the raster samples.

METAL2VULKAN_DUMP_PIPELINES names a directory (made where missing) each device writes every render
pipeline's SPIR-V modules into, one file per module, `<hash>.spv`, the hash the line names it by,
each written once; a failed write is named in the line. Setting it turns the log on too. Both are
default-off diagnostics: no pipeline, key or path changes with them.

Test: tests::pipeline_dump (device test) runs a child process that makes one state with a
constant and a blended color: with the dump directory set and the log variable unset, the first
line names each function's bitcode hash, the constant's type and bytes, the color's format, blend
and mask, and every module a line names is in the directory as SPIR-V of the words the line
counts; with the dump variable empty and the log unset, no line and no file.
2026-11-11 06:14:20 -08:00
Anees Iqbal 22749e28d6 FAST-PATHS: the RADV plain-making hold's cause, size and why no allocation avoids it
What: the known gap "On RADV, a command buffer submitted while the runtime makes a block of
plain memory waits for that making" now states the hold's cause and size, and why the runtime
has no allocation route around it.
- Cause: the kernel fills a plain block's pages in runs of up to 4 MiB, and a 2 MiB run (the
  order amdgpu names beneficial) may reclaim and compact until it succeeds or fails, under the
  reservation every submission of the process takes (Linux 7.3.3 ttm_pool.c, amdgpu_gem.c's
  VM_ALWAYS_VALID create path).
- Size: beside a consumer's guest scroll on a Radeon 780M short of free memory, one making held
  the submissions 228 ms, 222 ms of it one compaction for one 2 MiB run; so no block size of
  2 MiB or more bounds the hold below one run's.
- No route: RADV (Mesa 26.2.6) makes every memory neither exported nor imported a local buffer
  object (radv_device_memory.c PREFER_LOCAL_BO -> VM_ALWAYS_VALID), and asks a dedicated
  allocation of every image made for an external handle type in other than linear tiling
  (radv_device.c), so blocks of optimal images or of the DRM_FORMAT_MOD_LINEAR images over
  padding-unobserved buffers can be neither exportable nor imported pages; a dedicated
  exportable allocation per image puts each in RADV's global BO list, which every submission
  names (about 1 us each); and Vulkan reports neither the carve-out's size nor its room.

Why: the consumer's 780M scroll traces (host ftrace + perf compaction events) put every long
submission wait on a block making's order-9 compaction under the VM root reservation; the
ledger said the making holds submissions but not how long, nor why no other allocation helps.

Verified: the 228/222 ms figures parsed from the traces' compaction events per making thread;
the kernel and Mesa statements read from linux-stable v7.3.3 and the mesa-26.2.6 tag; the
carve-out sizes read from sysfs on two 780M hosts (2 GiB full, 4 GiB). Docs only; cargo fmt.
2026-11-11 05:59:14 -08:00
Anees Iqbal 332e32b09b runtime_lane::discard_fetch_groups: the store-dropping defect's trigger shapes, kept-apart arithmetic in straight-line code, a discarded-only branch and an edge-helper-only branch
The lane drew one fetching function whose arithmetic is all fast math, so its module held no
`NoContraction` operation, which SPIRV-Cross writes as the `optnone` calls the defect needs: it
could not meet the defect with the workaround off either. Three more fragment functions compute
under `contract(off)` (as a module without the `contract` flag does): `sfd_line` in straight-line
code after the sample, `sfd_dropped` in a branch only the discarded fragments enter (the measured
trigger), `sfd_edge` in a branch only the helper invocations past a rectangle's edges enter. The
globals carry the cell's sides for `sfd_edge`. The lane prints each function's discard and helper
strategies and its `NoContraction` count.

Verified on the M3 Max (macOS 27, MoltenVK 1.4.2), job m3-max-15413, 512 passes per arm, every
pass clean in each arm: the workaround as it is (deferred discards; helper guard on sfd_dropped,
guard and 4 fences on sfd_edge), and, through probe arms never landed, the deferral off, the helper
guard and fences off, and both off.
2026-11-11 05:56:32 -08:00
Anees Iqbal cd5eca2f53 runtime_lane::discard_fetch_groups: does every live fragment's write land in a discarding fetch?
A widget's compositing fragment (in a guest) fetches its color, reads and
samples a texture, discards, samples again, takes a derivative and writes;
through the pixel interlock its write is a storage write at the entry's return.
On MoltenVK on an Apple GPU, Apple's compiler drops the storage writes of a
simdgroup's live threads (8x4 pixels) holding a discarded thread in some
shapes (DriverWorkaround::DiscardDropsSimdgroupStores), and the widget loses
pixels in 8x4 groups along its edges.

The owned fixture sfd_discard_fetch draws that shape of our own: sfd_fill,
then sfd_alpha over a fullscreen triangle or 32 rectangles whose edges cut
quads, discarding on a pixel pattern ((x + 3y) % 5 == 0) or never. The lane
checks every pixel (live: fetched + texel + 1; discarded or uncovered: the
fill), prints the live pixels lost by 8x4 groups and how many groups lost every
live pixel, and prints the fragment stage's discard, helper and interlock
strategies and precision notes as the device's compile profile lowers it.
split_fetch_order's readback helpers are shared.

Not yet run on a device.
2026-11-11 05:56:32 -08:00
Anees Iqbal f891a2d20b tests::engine_typed_clamp: the resources of a kernel that reads its grid position take a zero dispatch region
The new sized-array fixture test's kernel reads [[thread_position_in_grid]], so its
plan declares a DispatchRegion push field, which the shared resources helper
refused (the translator suite at 26d6ebe604 failed that test at the helper's
panic, before any run). Zero push bytes are one region at the grid's origin, as
engine_absent_value_arguments fills it.
2026-11-11 05:51:46 -08:00
Anees Iqbal e7a959befb Check a typed alloca's out-of-range index again: a store past its array is dropped, a load reads 0
The authored case loads-and-stores-past-a-thread-local-array (fixture
ob2_sized_array, case 877bd99b152c) matched Metal on all six venues at its rows'
build and mismatches on the 780M (RADV, Mesa 26.2.6) and lavapipe now: threads
2 to 6 store past their Frame's array[4] (indices 4, 11, -1, -4, 7), and the
store lands on array[3], a word Metal never writes (Metal's store lands past
the array, in the frame's other members); thread 3 then loads array[3] and
threads 4 to 7's declared out-of-bounds loads read array[3] where the
validation contract's read rule for a typed thread-local object is zero.

The change that moved it: b8dcbe21bc (development's packet of c033c6b7ce,
"Hold every plain static threadgroup array as a typed object, indexed by its
GEP's own operands and clamped by min", SEMANTICS 1805). For m2vbench's
threadgroup tiles it replaced the typed objects' check (select(idx < len, idx,
0) per level, select(ok, v, 0) on a load, if_(ok) around a store) with
min(idx, len - 1) on every typed object, threadgroup, alloca and constant
alike. Its message names ob2_sized_array in the golden drift and calls the
new answer contained undefined behaviour, not a speed-for-accuracy choice; the
validation side (the case's array words compared with Metal, ReadRule::Zero
for a typed object) was not changed with it. The CLI's translation of the
fixture for amd-780m-radv and lavapipe, built at each commit: at a81fe9a689
(its parent) no UMin, one OpBranchConditional (the store's guard), five
OpSelect; at b8dcbe21bc two UMin, no branch, two OpSelect; at this branch's
base the same as b8dcbe21bc.

A thread's own object takes the check again (TypedAccess::checked: a contained
access whose home is an alloca): a load past a level reads zero and a store
past one is dropped, so a store never changes an element it does not address.
Threadgroup and constant typed objects keep min(idx, len - 1), the form
b8dcbe21bc measured for the tiles; this change does not touch them.
memory::alloca's Clamps contract and lower::access::local's docs say both.

Tests: engine_typed_clamp's an_out_of_range_index_stays_inside_its_object (the
typed alloca's dropped store and zero load; the threadgroup and constant
answers unchanged) and the new
a_store_past_a_thread_local_array_changes_none_of_its_words (the fixture on
amd-780m-radv, lavapipe, moltenvk-m3 and vk12-floor through the CPU
interpreter: the array's words Metal's, the loads past it zero, no word before
or past it changed); engine_arena's typed_alloca_indices_are_clamped_under_isolation
and typed_allocas_index_nested_levels_dynamically back to the checked answers.
Each fails on the min form.

SEMANTICS_VERSION 2027.
2026-11-11 05:51:46 -08:00
Anees Iqbal 02dcb7cd1a Record amd-780m-radv and intel-irisxe-rplp-anv at Mesa 26.2.6, product 8d548d2c56a1
Rows and refusals recorded by one build (executor vulkan-engine-v182, product
8d548d2c56a199af1c1f15027409f596dc4d19a561e3d0a1daf40760a061f50e, semantics 2025,
oracle metal-literal-resources-v49), installed at abb7ee9845 by
scripts/rerecord-commit --no-commit in a potluck job (job m3-max-15328, every out
directory's --batch-report this_build=yes), its changed shards copied here. Only
candidate and refusal shards change, so the product, and every row installed here,
stays current.

- amd-780m-radv stated (Radeon 780M PHOENIX, um790): 2266 rows, 5 refusals
  (2025 match, 241 mismatch)
- amd-780m-radv robustness-off (Radeon 780M PHOENIX, gem10): 2266 rows, 5 refusals
  (2024 match, 242 mismatch)
- intel-irisxe-rplp-anv stated (Iris Xe RPL-P, ms01): 2262 rows, 9 refusals
  (1993 match, 269 mismatch); 2261 from the round at cf35d7a7ff and case
  0a0b12b81f56 from its retry at abb7ee9845 (the first run's pipeline creation
  took 5145 ms, past the 5 s ceiling; the retry matched in 2.7 s)
- intel-irisxe-rplp-anv robustness-off (ms01): 2262 rows, 9 refusals
  (1994 match, 268 mismatch)

Every row and refusal records its venue's identity at driverVersion 109060102,
driverInfo "Mesa 26.2.6-arch3.1"; no run recorded a device its venue does not
allow. The mismatches stay recorded as the mismatches they are.
2026-11-11 05:50:39 -08:00
Anees Iqbal 2a44c53833 Recapture the Hawk Point 780M's profile at Mesa 26.2.6
amd-780m-hawkpoint-radv (no venue names it) documents itself as the 780M of
Phoenix under another deviceID, captured under the same RADV build; with
amd-780m-radv now captured at 26.2.6 that held only after recapturing it too.
Captured on the cluster's Hawk Point 780M (1002:1900, radeon ICD,
MESA_VK_DEVICE_SELECT=1002:1900!): vulkaninfo reports "AMD Radeon 780M
Graphics (RADV PHOENIX)", driverInfo "Mesa 26.2.6-arch3.1", deviceID 0x1900;
packages mesa and vulkan-radeon 26.2.6, vulkan-icd-loader and vulkan-tools
1.4.363.0.

Regenerated with regen_device_profiles.py --offline from that capture and its
corpus-vulkan --capture-formats supplement (sources pinned in SOURCES). The
document changes only in its identity, provenance and the two fragment
shading rate limits the 780M's own recapture moved
(maxFragmentShadingRateCoverageSamples 32 -> 16, ...RasterizationSamples 8 ->
4), which no translation reads. Against the 26.2.6 capture of the Phoenix
780M, the Hawk Point capture differs in deviceID, the DRM minors, the PCI bus
and deviceUUID only; its formats supplement in device_id only.
2026-11-11 05:50:37 -08:00
Anees Iqbal 1d65ed0fa3 tests::one_intel_venue: the RPL-S's identity differs from the RPL-P's in its driver build too
The Iris Xe (RPL-P) capture is now ANV 26.2.6 while the UHD 770 (RPL-S) capture
stays at 26.2.4 (no RPL-S node is reachable to recapture it). A venue allowing
the RPL-P alone therefore stops the RPL-S on its name, device ID, driver version
and driver info; with both allowed, the RPL-S still proceeds (its identity is
allowed and both captures derive the venue's translation key).

Verified: the two committed profile documents differ only in identity fields and
maxMemoryAllocationSize (a JSON walk of both); the validation suite at cf35d7a7ff
(job m3-max-15075) failed only this test, on the last assertion's stop list.
2026-11-11 05:50:37 -08:00
Anees Iqbal 4db0484a9d Recapture the Iris Xe venue's profile at Mesa 26.2.6 and declare its identity
The cluster's Iris Xe (RPL-P, 8086:a7a0, homelab ms01) runs Mesa 26.2.6-arch3.1 now, so every
intel-irisxe-rplp-anv run was refused as a venue mismatch against the 26.2.4 profile and
identity.

intel-irisxe-rplp-anv.json is regenerated from a vulkaninfo --json capture and its
corpus-vulkan --capture-formats supplement taken on the venue's device (intel ICD; vulkaninfo
printed deviceName "Intel(R) Iris(R) Xe Graphics (RPL-P)", driverInfo "Mesa 26.2.6-arch3.1",
apiVersion 1.4.354; mesa and vulkan-intel 26.2.6, vulkan-icd-loader and vulkan-tools
1.4.363.0), and c3-venues.json declares the RPL-P's identity at driverVersion 109060102 and that
driverInfo. Against the 26.2.4 capture only the driver version and info and
maxMemoryAllocationSize (24955668480 -> 24950464512, sized from the host's memory, no profile
field) differ; the formats supplement is unchanged in content.

The venue's second device, the UHD Graphics 770 of RPL-S (intel-uhd770-rpls-anv), stays as
captured under ANV 26.2.4: no cluster host has that GPU, so it cannot be recaptured here. Its
capture still derives the venue's translation key (the only difference from the RPL-P's
description is still maxMemoryAllocationSize). The regen script's comment and the two-device
test's doc say which build each capture is of. c3::tests' driver-drift case declares a driver
the profile does not state (now 26.2.7 against the profile's 26.2.6).

Verified: check_device_profiles.py (19 profiles, 0 findings).
2026-11-11 05:50:37 -08:00
Anees Iqbal fc82c1def7 Leave a render pipeline's synthesized geometry stages out of its census
A vertex function whose [[viewport_array_index]] or [[render_target_array_index]] can differ
among a primitive's vertices stores it through the geometry stages link synthesizes, on every
device whose driver does not take Metal's first-vertex indices (all but MoltenVK): Vulkan takes
Layer and ViewportIndex only where every vertex of a primitive stores the same, Metal takes the
first vertex's. The executor's census (ModuleCensus::of_pipeline_modules_under) mapped every
linked module to a Metal stage and had none for GEOMETRY, so each such case failed with "the
linked module's stage VK_SHADER_STAGE_GEOMETRY_BIT has no authored stage" and recorded nothing:
on the Radeon 780M under Mesa 26.2.6, both legs, the four authored vertex cases
07f125464dac (constant-zero-position-observation), a013a2bcbe56 (the same over another AIR),
434e73e03189 (rotate-a-normal-in-a-vertex-stage-that-also-writes-a-clip-distance) and
7ce6dea0475e (clip-away-every-vertex-of-a-triangle-with-a-negative-clip-distance).

Metal has no geometry function, so a geometry stage is always one link made; the census now
leaves it out, as it leaves out a tessellation pipeline's synthesized vertex and control stages.

The executor's enables were checked first and are not the cause: its map names the same 166
features as the product's exposure table (device/enables.rs), shaderOutputViewportIndex and
shaderOutputLayer included, and the 780M rows record them enabled (output_viewport_index: true).
The stage is the product's own choice there (lower/stage_io/plan.rs own_index_store: an index not
uniform over a primitive goes through the stage unless the driver takes
MetalFirstVertexIndices), the one the runtime makes too.

ENGINE_EXECUTOR_ABI stays: no recorded row can observe the change, since every run of a
pipeline with a geometry stage failed before recording a row or a refusal (the constant's own
rule for a case kind no earlier executor ran).

Test: coverage::tests::a_render_pipeline_census_leaves_out_its_geometry_stages compiles the
owned fixture engine/rt6_first_vertex on the amd-780m-radv capture (vertex, three geometry
stages, fragment) and holds the census to the vertex and fragment modules; without the fix
of_pipeline_modules returns the GEOMETRY error and the test fails.
2026-11-11 05:50:37 -08:00
Anees Iqbal 6caa5a3924 Recapture the 780M venue's profile at Mesa 26.2.6 and declare its identity
The cluster's Radeon 780M (PHOENIX, 1002:15bf) nodes run Mesa 26.2.6-arch3.1 now, so
every amd-780m-radv run was refused as a venue mismatch against the 26.2.4 profile and
identity, and no row of the venue could be recorded.

amd-780m-radv.json is regenerated from a vulkaninfo --json capture and its
corpus-vulkan --capture-formats supplement taken on the venue's device (homelab
um790's 780M, radeon ICD, MESA_VK_DEVICE_SELECT=1002:15bf!; vulkaninfo printed
deviceName "AMD Radeon 780M Graphics (RADV PHOENIX)", driverInfo
"Mesa 26.2.6-arch3.1", apiVersion 1.4.354), and c3-venues.json declares the venue's
identity at driverVersion 109060102 and that driverInfo. Against the 26.2.4 capture
the profile differs in the driver version and info and in two fragment shading rate
limits (maxFragmentShadingRateCoverageSamples 32 -> 16,
maxFragmentShadingRateRasterizationSamples 8 -> 4 samples), which no translation
reads; the formats supplement is unchanged in content (240 queried, 169 stated).

The venue's rows of 26.2.4 now read stale_device; they are re-recorded on the device
in the commits that follow.

Verified: check_device_profiles.py (19 profiles, 0 findings), the regen script's 41
unit tests.
2026-11-11 05:50:37 -08:00
Anees Iqbal 9fdada1fd7 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 05:46:39 -08:00
Anees Iqbal 7a2221ccf7 NativeMinMax: state fast::median3's two-NaN answer in the recorded bound
What: the recorded bound of PrecisionNote::NativeMinMax (artifact.rs,
docs/API.md's catalogue, lower::arith's docs) now names the answer it left
out. A fast::median3 whose first two operands are NaNs and whose third is a
number answers the number. Metal's fast form answers the second operand, a
NaN. New test lower::arith::tests::specials::
median3_of_two_nans_beside_a_number_answers_the_number.

Why: the 780M venue re-record of nan-model-min-max-of-nan-operands-under-fast-math
(27f7c2fd) differed from the M3 Max in 50 of 1024 words under NativeMinMax.
42 fall inside the stated ties (two NaNs, signed zeros, a denormal). The 8
outside are median3 of two NaN operands beside +0: the device answers 0x0
where Metal answers the second NaN ([486] 0x0/0xffeaaaaa, [494]
0x0/0x7fc00001, ...). The 0 comes from the lowering's composition
min(max(c, min(a, b)), max(a, b)) of NMin and NMax, introduced by 9afdb1e150
(rule 1: the device's min and max). NMin and NMax answer the number beside a
NaN, so any composition of them answers c here; answering b would take a select
that emulates Metal's NaN pick, which rule 1 forbids. The answer is no
translator fold: it is precise median3's own answer on Metal (the twin
55bca0fd answers 0 at the same eight lanes), and MSL leaves a NaN operand
under fast math undefined (section 8.1), so Metal's fast NaN is one reading of
an undefined answer. The bound said "the one Metal answers but at three ties",
which these lanes broke. It now states the fourth difference.

Verified: the new test runs both forms on the interpreter over the four
two-NaN rows of MEDIAN3 and the case's eight lanes. Each answers the number,
which is precise Metal's answer. The table's fast answers are the second
operand in exactly the ten rows whose first two operands are NaNs.
2026-11-11 05:45:58 -08:00
Anees Iqbal 1e1a17581d FragmentSimdgroupGrouping: a discarding function's helper ballots over a quad, where Apple's GPU splits quads
What: a fragment function that discards, asks quad_is_helper_thread or
simd_is_helper_thread, and runs a group operation over other lanes now records
PrecisionNote::FragmentSimdgroupGrouping on every profile that does not take
DriverDeviation::MetalFragmentSimdgroups (lower::simd::finish,
discarding_quads_observed). The note's text (artifact.rs, docs/API.md, the
runtime's reason, C3's deferred bound, the comparison table, the deviation's
docs) now covers this case. SEMANTICS_VERSION 2028: these functions' artifacts
record the note.

Why: the 780M venue re-record (RADV PHOENIX, Mesa 26.2.6) differed from the M3
Max's Metal rows on four public cases with no note to explain it:
helper-threads-after-a-discard-over-full-quads (18/256 words),
-over-cut-quads (10/140), helper-threads-asked-before-a-discard (14/140) and
helper-threads-after-a-terminating-discard (10/140). The translation is right:
MSL 2.3+ and the MSL 2.2 discard followed by a quad operation demote, the query
is OpIsHelperInvocationEXT, and the entry declares RequireFullQuadsKHR
(engine_helper_threads pins the forms). The difference is in Metal's rows. On
the M3 Max (macOS 26.7 and 27.0.1 alike, and MoltenVK there word for word),
a function that discards has some 2x2 quads shaded as several partial quads
from the function's start, each run holding the quad's other covered pixels as
helpers. So a live pixel's quad_ballot of the helper query names covered
pixels as helpers: 3 of 16 quads at 8x8, 2 of 12 at 7x5 after the discard,
4 of 12 when asked before it. The same function without the discard
(helper-threads-in-a-fragment-function-*) runs every quad whole on Metal and
matches on the 780M. RADV shades a primitive's covered pixels of a quad as
one quad. Metal permits a partly occupied quad and does not fix which quads
it splits, so the device's answer is one Metal allows. Nothing in Vulkan pins
Apple's split, so no exact path exists. The note's existing family is
FragmentSimdgroupGrouping: which pixels Apple's rasterizer packs together,
gated by MetalFragmentSimdgroups, and deferred in C3. Its text claimed "a quad
is the same 2x2 pixels on every device", which these rows disprove for
discarding functions. A helper computes what its covered pixel would, so only
a helper query tells the runs apart. The predicate therefore needs the
discard, the query, and an operation over other lanes.

Verified: tests::engine_helper_threads::
a_discarding_function_s_helper_ballots_record_the_grouping_where_the_driver_is_not_metal_s
(the 780M's profile records it for all three discarding functions, MoltenVK's
for none; the no-discard function and the discard-with-query-but-no-quad-op
function record none anywhere).
2026-11-11 05:45:58 -08:00
Anees Iqbal 7693d56ba9 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 05:37:51 -08:00
Anees Iqbal 3cbc726b7e RUNTIME_VERSION 2030: a dma-buf import tries the dma-buf's other memory types after its class's
NVIDIA (RTX 3090, 620.70.06) answers a udmabuf's memoryTypeBits 0x11 and refuses the import into
the host-visible type 4 the Shared class asks (VK_ERROR_OUT_OF_DEVICE_MEMORY) but takes type 0;
the import now tries the class's candidates, then every other allowed type, so no-copy buffers and
a guest RAM's chunks lie in dma-buf imports there instead of copies.
2026-11-11 05:37:13 -08:00
Anees Iqbal addc45b2e1 Dma-buf imports fall back to the dma-buf's other memory types; NVIDIA imports a udmabuf as its type 0
On NVIDIA (RTX 3090, 620.70.06; RTX 5080 Laptop, 615.71.09) every
import of a udmabuf failed, so a no-copy buffer over sourced memory on a
device that imports no pointer was a copy ("their import failed"), and a
guest RAM's chunks there were never imported (the RAM not listed, its
objects copies): host_ram_dma_buf::without_pointer_imports_a_ram_s_chunks_are_its_dma_bufs
and no_pointer_import::without_pointer_imports_a_sourced_no_copy_buffer_lies_in_its_dma_bufs
failed on both GPUs in the round at b4cd0f9f91.

Cause, from a probe on the 3090 (job m3-max-15245, branch
steelbrain/hkhostmem-2-probe, not for landing): vkGetMemoryFdPropertiesKHR
answers memoryTypeBits 0x11 for a udmabuf of a sealed memfd, types 0
(heap 1, no property flag) and 4 (heap 1, host-visible, coherent and
cached). The import into type 4 answers ERROR_OUT_OF_DEVICE_MEMORY with
or without a dedicated allocation and the device-address flag; into
type 0 it succeeds in all four forms, for one page and for 16. The
runtime asked only the class's types (Shared requires host-visible
coherent memory), so it tried type 4 alone.

Fix: import_dma_buf tries dma_buf_candidates: the class's candidates
first, unchanged, then every other type the dma-buf and the resource
allow that the runtime may allocate and that is neither protected nor
lazily allocated. The runtime never maps a dma-buf import (the CPU uses
the caller's mapping), so a type the host does not map serves it. On
drivers whose class types import the dma-buf (RADV, lavapipe, ANV) the
order and the result are as before.

The docs that said NVIDIA refuses every udmabuf now speak of a driver's
refusal; the tests' stand-in for one is unchanged.

Tests: tests::memory::dma_buf_imports_try_the_class_s_types_then_the_dma_buf_s_others
(the 3090's types). The two device tests are unchanged: they hold on
NVIDIA once its driver imports the udmabuf.
2026-11-11 05:37:06 -08:00
Anees Iqbal bcb2d3190e 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 05:19:32 -08:00
Anees Iqbal c7b385ad3a attachment_stand_in: the last taker's handle is CommandBuffer::finished (Finished), a name of its own
Completion is already command_buffer's completion module's type (E0255,
m3-max-15240).
2026-11-11 05:18:50 -08:00
Anees Iqbal cdc251d9a2 split_fetch_order: the fetching draw reads the second color, which holds each pass's own number; pooled takes counted by the taker's completion
The in-flight test could not see a race on the second color's pooled backing:
no draw read that color. sfo_filter now fetches it too and adds the number the
plane wrote there (the plane draw's base instance, a number per pass), so a
pass that reads what another pass left in a shared backing, or a zero, holds
other codes. The fixture is regenerated (regen-air-fixtures).

The pool's last-taker handle was a weak command buffer, which made the
queue -> pool -> command buffer -> queue type cycle deep enough that the
auto-trait checks overflowed compiling metal2vulkan-validation (m3-max-15228).
It is now the command buffer's completion gate (CommandBuffer::completion),
which holds nothing else.

Not yet run on a device.
2026-11-11 05:18:50 -08:00
Anees Iqbal cc0c2770c2 Count pooled backings taken, and those taken while another taker is in flight; run split passes in flight together
WorkCounts gains pooled_backings_taken (a pass handed a backing its queue
kept, beside pooled_backings_made for one made) and
pooled_backings_taken_in_flight (of them, those taken while another command
buffer that took the backing had not completed). attachment_stand_in's pool
keeps a weak handle on each backing's last taker to tell.

runtime_lane::split_fetch_order gains a test that runs the split passes in
flight together: each pass over a target, second color and stencil of its own,
its readback in its command buffer, committed with no wait between passes
(each as encoded, or all once encoded) on one queue or two, the targets new
(fetched through scratch) or already in their storage form (fetched in place).
Nothing orders one pass after another but the second color's pooled backing,
which the hazard tracker orders as any texture. Each round prints its passes'
wrong pixels beside the backings each was handed and took in flight; every
pixel must hold its code and the queues must have reused kept backings.

pass() is now encode_pass + encode_readback, shared by both tests.

Not yet run on a device.
2026-11-11 05:18:50 -08:00
Anees Iqbal b9b489f0f7 runtime_lane::split_fetch_order: a split pass's draws read the stencil and colors the draws before left
A device without rasterization-order color access fetches through the pixel
interlock, which leaves the fetched color out of the draw's subpass, so a pass
with plain draws around a fetching draw runs as several Vulkan render pass
instances. This lane draws one such pass of our own MSL (sfo_split_fetch): a
plane that sets the stencil, four draws of rectangles that increment it and
write codes, a fetching draw of overlapping rectangles tested on the stencil
(a map that does not commute), and a cover tested on the stencil, over a
loaded and stored BGRA8 color with a second color and a Stencil8 both
DontCare, private or memoryless, the target kept (storage form) or new each
pass (scratch), at 224x128 and 61x37. Every pixel must hold the code its
draws in order give; wrong pixels are printed with their 8x4 groups, and each
pass prints its split causes, storage forms, placeholders and memoryless
backings, and asserts a split where the fetch takes the storage form.

Not yet run on a device.
2026-11-11 05:18:50 -08:00
Anees Iqbal 58c3147007 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 05:13:15 -08:00
Anees Iqbal cf8467e140 RUNTIME_VERSION 2029: a fetch ordered between draws takes its barrier on every driver, no interlocked split
The MoltenVK race split (DriverFact::InterlockedDrawsRaceUnderLoad) now checks only interlocked
storage kinds; a framebuffer fetch ordered between draws takes its by-region barrier there too,
as on every other driver, instead of a new render pass instance per draw.
2026-11-11 05:12:37 -08:00
Anees Iqbal 871c5954e9 public fetch cases without an ordered form: a multisampled one may need sample-rate shading
public_framebuffer_fetch_cases_plan_input_attachments_without_an_ordered_form
failed on vk12-floor for per-sample-integer-read-modify-writes-at-4x. The
product refuses it as Unsupported{FramebufferFetch, AnyOf[[SampleRateShading]]}:
each invocation reads its own sample, which needs sample-rate shading, and
vk12-floor lacks the feature. That is the device's lack, so the test now
accepts this refusal for a multisampled case, and only where the profile
lacks SampleRateShading.

Verified: whole metal2vulkan-validation suite on lavapipe at this tip
(see the hkfbfetch-2 report).
2026-11-11 05:12:37 -08:00
Anees Iqbal 394da4cefb pipeline_selection: a fetch without an ordered form compiles, noted
The integration test a_fetch_without_an_ordered_form_is_refused expected
corpus-pipeline --profile vk12-floor --compile-only to refuse
exf_fetch_blend as FramebufferFetch. Since the between-draws form, the
product compiles it through input attachments and records
PrecisionNote::UnorderedFetchWithinDraw. The test, renamed
a_fetch_without_an_ordered_form_compiles_noted, now asserts the one row
is COMPILED and names the note. The --accept-unordered-fetch check is
gone: it guarded against a switch that compiled the fetch unordered, and
the unordered compile is now the device's only form, noted, with no
switch.

Verified: the whole metal2vulkan-validation suite on lavapipe at this tip
(see the hkfbfetch-2 report).
2026-11-11 05:12:37 -08:00
Anees Iqbal 4575273972 Fetch between draws: the barrier on every driver, and the executor's barriers
On the M3 (MoltenVK 1.4.2) the runtime lane's
fetches_between_draws_read_every_earlier_draw_and_note_the_draw_itself
counted 3 fetch barriers for 4 draws. The cause: the race split
(DriverFact::InterlockedDrawsRaceUnderLoad, held by MoltenVK on Apple's
GPUs) tested InterlockedStorage::meets, which since the between-draws form
includes the fetch kinds. So on the M3's withheld venue each draw after
the first went into a new render pass instance (Split::InterlockedWrites)
instead of after the barrier. The white write took no barrier at all, and
each later fetch took the split plus the new instance's BEGUN barrier.
That ordered the draws twice.

The race is the interlock's. The fact's measure is of interlocked storage
images, which MoltenVK encodes as raster order group 0 with no barrier
inside its Metal render pass. Input attachments ordered between draws are
not interlocked, and their barrier is by region with INPUT_ATTACHMENT_READ
in its destination. MoltenVK's MVKCmdPipelineBarrier::encode (v1.4.2, on a
tile-based GPU) ends its Metal render pass and begins another for exactly
that barrier. The split now tests only the interlocked kinds
(InterlockedStorage::meets_interlocked). The fetch kinds take the Whole
barrier on every driver: one barrier per draw, as on lavapipe and the
RX 550. The lane test now asserts (barriers, interlocked splits) = (4, 0),
(3, 0) and (1, 0). Without the fix the M3 gives (3, 3) in the first section.

The second fallout is the validation executor's planner test
a_framebuffer_fetch_case_plans_its_ordered_input_attachment. It expected a
device with neither ordered form to refuse the fetch, which the product no
longer does. The executor is a consumer of that contract
(GraphicsState::rasterization_order_attachment_access): a pipeline with
input attachments and no rasterization-order access must be ordered between
draws by a barrier of the subpass's dependency on itself.
- The executor's render pass self-dependency now covers both directions:
  color writes to input attachment and color reads, and fragment-shader
  reads to color writes (FETCH_SELF_DEPENDENCY).
- It records that barrier before each of its draws where
  fetches_between_draws holds, after the load operations too, as the
  runtime does.
- The planner tests now plan the neither device: input attachment 0, no
  rasterization-order access, neither ordered feature required, the note
  on the fragment stage. Every public fetch case on lunarg-2023 and
  vk12-floor plans the same way; a multisampled one may be refused as on
  every device.
- The executor's device test of the halving fetch expects one instance
  exact and three (one draw) each texel at some order's 2^-k on a device
  with neither form, where it used to expect the refusal.

Verified: see the hkfbfetch-2 report (M3 lane module, lavapipe whole
validation suite, RX 550 module and executor fetch test, clippy).
2026-11-11 05:12:37 -08:00