Commit Graph
966 Commits
Author SHA1 Message Date
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 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 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 ac0fcfa7fd Docs: a texture over dma-buf pages bound at its texels' offset, where the driver answers another plane offset
What: HOWTO's dma-buf section and API.md's in-place and shadow-cause paragraphs say when a texture
over dma-buf pages takes an image of a plane at offset 0 bound at the texels' offset (a driver
that lays the explicit plane out at another offset, Honeykrisp's answer; an image that requires
no dedicated allocation, which RADV requires, and whose alignment divides the offset), counted in
WorkCounts::dma_buf_images_at_offset; WorkCounts::dma_buf_image_memories_live says such an import
is no dedicated one.

Verified: tests::dma_buf_plane_offset on RADV PHOENIX (requires a dedicated allocation: the
forced route is refused, the texture a shadow that reads its texels) and on lavapipe (Mesa
26.2.6: the forced route binds at offset 2048, in place, and reads its texels and the CPU's later
bytes).
2026-11-11 05:10:15 -08:00
Anees Iqbal 26440eaa22 Push set 0 on MoltenVK for a fragment stage that writes a set-0 storage buffer in its interlock
MoltenVK, binding through Metal argument buffers (the state device/argument_buffers.rs reads
from the limits; a device without them is refused at open), makes a bound set 0 one Metal
argument buffer, and marks each storage buffer a fragment stage reaches inside its interlock as a
member in raster_order_group(0). Metal leaves such a member unordered where the function also
reads another buffer member of the same argument buffer. A pushed set is discrete in either of
MoltenVK's modes, and Metal orders a discrete [[buffer(n), raster_order_group(0)]].

RuntimeDriverDefect::InterlockedBoundBuffersUnordered names it, on every MoltenVK GPU (keyed on
the driver, as the push holds however the device binds). There a render variant whose fragment
stage writes a storage buffer of set 0 inside its interlock pushes set 0, read from its words
(pipeline/interlocked_writes.rs: an interlock execution mode, a StorageBuffer variable of set 0
not decorated NonWritable). PushedBufferSizesUnset stays: such a variant pushes only where no
stage reads a buffer's length (OpArrayLength, OpUntypedArrayLengthKHR) and no binding of set 0
lists a stage the pipeline adds; otherwise it binds set 0 as before and announces the new
Degradation::InterlockedBufferOrder (`interlocked-buffer-order`, precision), as it does on a
device without the push command or with a set 0 no push layout takes. Nothing is refused.

Every other path is unchanged: the device now loads the push command on MoltenVK too (and primes
it), but pushes_set_zero there admits only those variants; runtime kernels stay bound
(OwnedKernel::pushed requires pushed sets that hold their sizes); every other driver decides as
before. No new DriverFact or WorkCounts field: the lane reads draws_pushing_set_zero.

Tests:
- tests::interlocked_writes: the translator's own modules of ipo_primitive_order for the
  committed MoltenVK profile (only ipo_rog_buffer's fragment stage interlocks with a writable
  set-0 buffer; no stage reads a length), and synthetic words for each fact.
- runtime_lane::interlocked_primitive_order: a RogBuffer draw must push set 0 where the device
  pushes it (draws_pushing_set_zero), and on a driver whose pushed sets lose their sizes no other
  draw may push; a_bound_set_of_interlocked_buffers_is_announced_once, the bound form with
  VK_KHR_push_descriptor withheld, the degrade site BOUND_INTERLOCKS.
- tests::driver_defects lists the defect for the MoltenVK profile; api_signatures.tsv blessed
  (two rows); docs/REFUSALS.md regenerated: unchanged. docs/API.md: section 5's pushed set 0 and
  the catalogue entry.

Evidence so far, Apple M3 Max, macOS 27.0.1, MoltenVK 1.4.2: Metal itself, our own MSL, 96 passes
each: a raster order group buffer member beside a buffer member the function reads lost writes in
96 of 96, with the width read elsewhere 0 of 96, a texture member 0 of 96, the member alone 0 of
96; MoltenVK's own Metal for the lane's stage 48 of 48, the same with the buffer discrete 0 of 48.
Through the runtime at 83d2d86519 (set 0 bound) the lane's RogBuffer lost writes in 96 of 96
passes (m3-max-14866); with every set 0 pushed (a probe arm) 0 of 96 (m3-max-14930). The fix's
own lane run is reported with the tip.
2026-11-11 04:57:58 -08:00
Anees Iqbal b4cd0f9f91 Regenerate docs/CONFORMANCE-COVERAGE.md for the XTX's ledger rows and read_through's notice
The coverage document counts the ledger's rows and lists each one's gap, and counts the modules
that declare a notice: the 27 RADV NAVI31 rows, the corrected text of the extended-range mipmap
rows, and read_through's `shared_memory_notice` (a module that declares a notice outright now)
move it. Written by `python3 -I scripts/conformance-coverage/coverage.py`; `--check` passes.

Found by the conformance suite's run at 0ef30d74db (potluck m3-max-14873, lavapipe on um790):
`the_conformance_coverage_document_is_what_the_sources_derive` failed, the only failure of 1043.
2026-11-11 04:10:13 -08:00
Anees Iqbal 0e4d2c225c Conformance: read_through and two footprint cases name the shared-memory notice the XTX announces
The round's replay on the RX 7900 XTX (RADV NAVI31, at 6898863f3f) read 15 cases divergent at the
notices site alone (case/notices, and for three of them case/notices/set and case/notices/counts),
unlisted: the runtime announced `shared-in-system-memory`, which none of them declared.

The placement is the runtime's rule, not a shortage of room: without unified memory a `Shared`
buffer prefers a host-cached memory type, then a device-local one (memory.rs `candidates`), because
the host reads uncached memory, resizable BAR included, slowly, and a discrete Mac's GPU reads a
shared resource across the bus the same way. So the notice is the venue's memory model and never a
wrong answer, and the suite's declaration for it is `replay::shared_memory_notice`, which every
other case that reads back through a `Shared` buffer carries. It loosens the notices site alone.

- read_through: all 13 cases bind their positions and output in `Shared` buffers; each declares it.
- format_footprints: one-plane-ycbcr and padded-wide-channels set `shared_texture_buffers`. The
  runtime now makes their formats' `Shared` texture buffers, as Metal does (the recordings hold
  `makes-texture` Ok for them, and the XTX run matches), which was not so when the 5080's replay
  measured only the plain stragglers announcing it.
- docs/FAST-PATHS.md: the replay paragraph no longer says a card without unified memory makes the
  comparison unreadable; it says how the cases declare the notice.

Verified by the XTX replay of this tip (job ids in the report).
2026-11-11 04:10:13 -08:00
Anees Iqbal 1f7b2a67cf No-copy memory with no dma-buf source is a copy on a device without VK_EXT_external_memory_host
On a device that imports no host pointer but imports dma-bufs (Honeykrisp
on Asahi lists no VK_EXT_external_memory_host), a no-copy buffer or heap
over memory with no source of dma-bufs was refused, naming the extension.
Metal makes such a buffer, and in place is impossible there, so it now
takes the copy a refused pointer with no source takes on RADV
(CopiedFor::DeviceRefused): announced as copied-host-pages, counted in
copied_host_buffers_device_refused, with every copy's coherence.

How: host_window marks such pages pointerless (the device imports no
pointer, the memory is not dma-buf-only). buffer_over_host_parts no
longer takes the no-route refusal for them, so they reach
import_by_pointer, whose not_importable answer is the device's refusal;
a source that fails counts as the device's refusal there too, as on
RADV. Rebinds to such memory, a guest RAM with no source, and every
no-copy object on a device with neither route stay refused, naming the
extension. The in-place check no longer makes its pointer-class buffer
on a device that imports no pointer (it would be an announced copy now);
its verdict there stays lasting, as before.

Docs: the copied-host-pages detail, CopiedFor, CopiedBecause and the
counter, copied.rs, host_memory.rs, the no-copy buffer and heap calls,
imports_shared_host_pointers, host_ram/copy.rs, the runtime README, the
API catalogue and HOWTO section 6. docs/REFUSALS.md regenerated:
unchanged, as the extension's refusal sites all remain.

Verified by the device test in the previous commit (lavapipe and the
780M, see the hand-off).
2026-11-11 04:09:01 -08:00
Anees Iqbal aba3c0969c A render pass instance's first fetch between draws records after its load operations
On RADV on the RX 550 (Polaris, neither ordered fetch form of its own; job m3-max-14807) the first
fetch of a render pass instance read a load-cleared RGBA32Uint attachment as 0: the lane's three
exf_fetch_count draws stored (k + 1) * 13 for c * 27 + (k + 1) * 13, and
fetched_attachments_clear_as_the_load_action_does counted 7, 200, 13, 255 beside the tag for
10, 206, 22, 267. Each read after a barrier between draws was right. Vulkan orders the load
operations before every access of the instance through the attachment, but this driver did not
make the clear visible to the input attachment read; the barrier between draws, inside the
subpass's own dependency, does. So an instance begins with InterlockedStorage::BEGUN, the
fetch-after-writes kind alone set: the first draw that reads input attachments ordered between
draws alone records the barrier too. No draw of another device reaches that kind, so nothing else
changes.

The lane test now counts one more barrier in each pass (4, 3, 1) and states what a first read of
0 leaves. API.md, the runtime's framebuffer_fetch and InterlockedStorage docs and
WorkCounts::fetch_draw_barriers say the load operations are among the writes a fetch records
after. To be verified on the RX 550.
2026-11-11 04:01:36 -08:00
Anees Iqbal 1326854199 between_draws: the note is announced where the fetching pipeline is made
On llvmpipe with both ordered forms withheld (job m3-max-14744) the draws in order read 0.25 at
every texel with three barriers, and the test then found no unordered-fetch-within-draw notice:
the runtime announces a stage's precision notes where its pipeline is made (degrade_stages), as
it does every such note, and the test had taken the notices after making the pipelines and
dropped them. The test now asserts the note once at the first fetching pipeline's making and none
after the draws; the runtime's framebuffer_fetch docs, API.md's catalogue entry and the test's
module docs said it was announced at the first draw that binds the pipeline, and now say so no
more.
2026-11-11 04:01:36 -08:00
Anees Iqbal 3d18018dad A raster order group on a color read takes no interlock where fetch is ordered between draws alone
On a device with neither rasterization-order color attachment access nor the pixel interlock, a
color input reads its input attachment ordered between draws by the runtime's barriers. A raster
order group on that input (fragment_fetch's fetch_ordered), or on a color output of an attachment
the function reads, asks for the order of that read, which is the read's own form there; it no
longer interlocks the function, so such a function is no longer refused RasterOrderGroups after the
fetch itself stopped being refused. Its overlapping fragments of one draw stay unordered,
PrecisionNote::UnorderedFetchWithinDraw, which the read records. A group on a buffer, texture or
imageblock member still needs the interlock. Devices with an ordered fetch form keep their path
(rog::declared is unchanged where fetch::fetch_unordered is false).

The conformance cases that fetch (fetch_ordered, srgb_fetch: one fullscreen triangle a draw, so
every byte still compares exactly) name unordered-fetch-within-draw among their notice allowances,
so a venue with neither form (RADV on the RX 550) replays them against the M3's recordings.

Tests: the compile test draws fetch_ordered on lavapipe's description without either ordered form
(input attachment, neither feature required, noted) and with the interlock (interlocked, as
before); engine_dead_reads' live dfr_output on vk12-floor now compiles without an interlock,
noted (before, refused RasterOrderGroups). Docs: API.md's fetch paragraph and catalogue entry,
rog.rs's module docs, the note's doc.
2026-11-11 04:01:36 -08:00
Anees Iqbal 22a96f62d4 Docs: framebuffer fetch between draws, its note, REFUSALS and the API signatures
docs/API.md's framebuffer-fetch paragraph says what a device with neither
ordered form does, and the degrade-notice catalogue gains
unordered-fetch-within-draw. docs/FAST-PATHS.md's device-gap table gains its
row. docs/REFUSALS.md regenerated (FramebufferFetch loses the
unsupported_features and family-row sites). api_signatures.tsv blessed: the
PrecisionNote and Degradation variants and WorkCounts::fetch_draw_barriers.

Verified: refusal_surface.py (0 without reach mark or basis), signatures.py
--bless (3 added).
2026-11-11 04:01:35 -08:00
Anees Iqbal fcd4dfdc36 HOWTO section 7: what an opaque file descriptor's import names, in a shared block or not
What: docs/HOWTO.md section 7 says how CUDA and another VkDevice import export_memory_fd's
descriptor: ExportedMemory's allocation_size as the import's size, the dedicated flag only where
`dedicated`, the buffer at `offset` for `length` bytes, and that a buffer outside a dedicated
allocation lies at an offset in a block other exportable buffers share, which the import reaches
whole.

Why: the previous commits keep an exportable buffer out of a dedicated allocation where the
driver only prefers one, so on NVIDIA its export now answers dedicated false, a non-zero offset and
the block's size where it answered dedicated true, offset 0 (or the aligned byte's lead) and the
buffer's own size. ExportedMemory and Buffer::export_memory_fd already carried those fields and
said so; the guide showed only the dma-buf import. No API change.

Verified: docs only. cargo fmt --all.
2026-11-11 03:56:01 -08:00
Anees Iqbal d203c0b5f4 Runtime: an exportable buffer takes a dedicated allocation only where the device needs one
What: exportable_buffer's buffer is its own dedicated allocation where the device exports
such memory only so (DEDICATED_ONLY) or requires one (requiresDedicatedAllocation); a
driver's preference (prefersDedicatedAllocation) alone no longer makes one, so the buffer
lies in the block exportable buffers of its handle type share. Docs: exported_memory.rs
(module and Device::new_exportable_buffer), memory.rs (module, NoImage::Dedicated),
texture.rs, the runtime README and docs/HOWTO.md section 7 say the same.

Why: no image may be bound to a dedicated allocation (VUID-vkBindImageMemory-memory-10926)
and a texture over an exportable buffer is an image in its memory, so on NVIDIA (reims's
RTX 5080 Laptop, 615.71.09) every texture over the consumer's exportable caches was a
shadow, ShadowCause::Unchecked (2862 of 4112 IOSurface-plane shadows; 12.4 MB copied in per
plane use, 30 MB back per composite). The owner's rule: a texture over exported memory stays
in place even if slower; a shadow only where in place is impossible.

Verification pending (parked for the 780M regression): tests::export_dedication on the
3090 at c63787840b (the measurement and negative control) and at this commit; clippy and
the 5080 entry still to run. cargo fmt --all.
2026-11-11 03:56:00 -08:00
Anees Iqbal 02a64274c5 Pages with no route of their own may still lie in a guest RAM's chunk
On a device that imports no host pointer, an object over a guest RAM the device uses
(HostMemory::with_runs) with no dma-buf source of its own was refused by host_window before its
runs were routed to the RAM's chunk, so tests::host_ram_dma_buf::
without_pointer_imports_a_ram_s_chunks_are_its_dma_bufs failed on the Radeon 780M (RADV) and on
lavapipe (jobs m3-max-14705 and m3-max-14707): "HostMemory needs ExtExternalMemoryHost" at the
object, after the RAM was taken.

host_window no longer refuses; HostWindow::no_route is the refusal of pages with no route of their
own (not their pointer, no usable source, no copy), the same as before: naming
VK_EXT_external_memory_host on a device without it, not_importable elsewhere. A no-copy buffer,
heap or rebind with no runs is refused with it at once, as before; one with runs is refused with it
only where its pages lie in no chunk and an import of its own is needed. On a device that imports
pointers, by_pointer holds wherever the import alignment covers the range, so nothing changes
there; only where it does not (an alignment past the host page) may such an object now bind in a
chunk instead of being refused.

Docs: the no-copy buffer and heap refusals and HOWTO section 6 say a chunk-bound object needs no
source of its own.
2026-11-11 03:34:56 -08:00
Anees Iqbal 12a8a907bc No-copy buffers on a device without VK_EXT_external_memory_host take the dma-buf route
On a driver that lists no VK_EXT_external_memory_host but imports dma-bufs (Honeykrisp on Asahi, as
the consumer reported: a macOS guest's newBufferWithDescriptor answered nil, "HostMemory needs
ExtExternalMemoryHost", 704 times in one boot), every no-copy buffer, heap and guest RAM was
refused: Importer::new refused before the dma-buf route was looked at, and the importer held the
host-pointer extension's functions unconditionally.

The importer now holds the pointer import as an option (host_memory.rs's PointerImport: its
functions, page and minImportedHostPointerAlignment, and memory_types). Importer::new refuses only
where the device imports neither pointers nor dma-bufs (the pointer's refusal, naming the
extension, as before); a device with dma-bufs alone gets an importer whose pointer refusal stands
for every pointer (Importer::pointer_import). Every pointer-import site takes a PointerImport, so a
device without one never makes a host-allocation object: buffer_descriptor.rs (import_by_pointer,
import_pointer, import_pointer_again, import_backing), host_shared_pointers.rs (false there),
fresh_pages.rs and the page-buffer blocks (none there), the submission checks (unchecked there),
host_ram.rs's chunk import by pointer. The unit an import's pages round out to is
Importer::unit: the host page and the import alignment where the device imports pointers, the host
page alone where it imports dma-bufs. Every device that imports pointers keeps the same calls.

On a device that imports no pointer:
- a no-copy buffer, heap or rebind over memory with a source is bound in imports of its dma-bufs;
  memory with none is refused, naming VK_EXT_external_memory_host (host_window), as it was;
- memory of Metal's private option bit 24 that the runtime copies anyway (no read-only view on
  Linux) is no longer refused for lack of an import route, on any device;
- a guest RAM with a source is taken and listed (its chunks its dma-bufs, imported on demand), the
  pointer never tried; one with no source is refused, naming the extension, as it was;
- supportsResourceDetachBacking answers whether the device makes no-copy buffers (it has an
  importer), not whether it lists the extension.

Docs: the runtime README, HOWTO section 6 and the RAM copies' refusal, RUNTIME-PORTING, the
module docs of host_memory.rs, dma_buf.rs and host_ram.rs, HostBacking::ImportedAsDmaBuf, and the
refusal lists of the no-copy buffer, heap, RAM and RAM copy calls. docs/REFUSALS.md regenerated
(the HostMemory refusal's sites: PointerImport's and no_pointer_refusal).

Verified: the next commit's device tests (RADV on the Radeon 780M, lavapipe), which fail at the
base with the refusal; job ids in the branch's report.
2026-11-11 03:34:56 -08:00
Anees Iqbal b39d22516f Four runtime messages are said once per device and kind, each later one counted
What: metal2vulkan-heap-texture-refused (Info, a placement heap's texture not
made at an offset inside it), metal2vulkan-twin-decode-failed (Error, a decoded
twin's failed CPU decode), metal2vulkan-late-reservation (Warning, an ignored
late reserve_resource_ids call) and metal2vulkan-queue-limits-reached (Info,
each placement or queue-sharing read the queue limits changed, at device
creation, per queue made and per report) were said at every occurrence. They
now go through the degradations' once-per-device record: Announced keeps a
bit per kind of a closed vocabulary of messages that are no degradation
(degradation::Told), and Device::tell says a kind's first message on the device
(through its sink, else stderr) and counts each later one, without making its
text, in the kind's new WorkCounts field: heap_texture_refused_withheld,
twin_decode_failed_withheld, late_reservation_withheld,
queue_limits_reached_withheld. Device::inform_once is the informational form.
Every refusal and answer is as before; only the messages' rate changes.

Why: the owner's rule (11-11): a degradation, fallback or refusal message is
logged once per kind and device, later occurrences counted, never logged per
call. reims's sweep at ef7af82fe4 found these four firing per occurrence.

Tests: tests::told_once (each kind said once and its later one counted on
one device, said again on another; a second late reservation counted, not
said); tests::heap_refused_notice (the second refusal on a device counted, not
named; another device names its own first); tests::queue_limits_device (the
first case met is sent, every later one counted; a second read of the sharing
counts one more). api_signatures.tsv takes the four fields; the docs of the
four messages (texture.rs, resource_ids.rs, DeviceOptions::queue_limits, the
runtime README, docs/API.md) say the rate.

Verified: see the branch's report.
2026-11-11 02:45:22 -08:00
Anees Iqbal 3811e1c184 air.convert's rounding and .sat suffixes: the conversion the types name, as x86 Metal answers
The exact emulation of the directed roundings, the integer .sat clamp, float-to-int pre-rounding,
the RoundingModeRTE plan and PrecisionNote::NativeConversionRounding are removed; they stay in
history at 540011dd49. The parser accepts the suffix and the lowering is the plain conversion:
Metal's compilers disagree on the suffixes, and the owner's 11-07 rule takes the cheapest answer
inside the envelope where real Macs disagree.

Measured per form, 64 threads of the fixture's edge values, one kernel per intrinsic (probes
m3-max-14380 Radeon Pro 5300M and m3-max-14381 UHD Graphics 630, macOS 26.7.1; m3-max-14382 M3
Max, macOS 27.0.1):

  form                         M3 Max                 5300M            630            now
  float->int .rte              nearest even           truncates        no pipeline    truncates
  float->half .rtz/.rtp/.rtn   .rtz as named,         nearest even     as named       nearest even
                               no pipeline rtp/rtn
  float->int .sat              unsigned keeps a       8-bit not        no pipeline    clamps
                               negative's wrap, long  clamped, long
                               of inf is 0            clamped to int
  int->float/half any mode     .rte nearest even,     nearest even     nearest even   nearest even
                               no pipeline directed
  int->int .sat                no pipeline            wraps            wraps          wraps
  float->int .rtp/.rtn         no pipeline            truncates        no pipeline    truncates

The last three rows are no difference: every Mac that creates the pipeline answers the plain
conversion. OpenCL on all three GPUs (not Metal) answers the exact IEEE roundings. The M3's
compiler service exits (XPC_ERROR_CONNECTION_INTERRUPTED) on the forms it does not compile.

- metal2vulkan-air: Convert::parse takes `.<rte|rtz|rtp|rtn>` and then `.sat` (to an integer
  only), between numbers; the module doc carries the measurement. Test: every suffix parses to
  its plain form.
- Engine test: 24 forms with every rounding (and .sat to an integer) compile on lavapipe and on
  moltenvk-m3 without shaderInt64 to the plain conversion's module words and notes, and pass L3.
- Fixture: kernel_convert_rounding_apple_gpu now calls only the forms the M3 compiles and
  answers plainly, for a case qualified there.
- docs/API.md accepted differences: the table above.
- SEMANTICS_VERSION 2024 (development is at 2023); ARTIFACT_FORMAT_VERSION back to 500, with no
  codec change.

Verified: not yet run (dispatched next).
2026-11-11 02:42:04 -08:00
Anees Iqbal 2bc702f4b4 air.convert roundings: drop the double paths AIR cannot name; fix the tests' first run
air.convert names no double (the AIR element types stop at f32), so the directed double
narrowings, the double results and the 64-bit RTE width were unreachable: removed. The nearest-even
plan is now a flag for a float result, and narrow::rte_modes decides 32 bits and the widths the
device's independence ties to it. The engine test reads the interpreter's buffers directly, pins
the RTE widths of the venue profiles (lavapipe and RADV 32, ANV 16/32/64, MoltenVK and the floor
none) and the parse test names a float narrowing instead of a double one.

Verified: the first test job (m3-max-14044, homelab-ms01-1) failed on the double case in the parse
test and a compile error in the engine test; both fixed here, rerun next.
2026-11-11 02:41:51 -08:00
Anees Iqbal 9f4590f124 air.convert with a rounding suffix: parse it and lower each form
Apple's OpenCL compiler spells every convert_* it emits as an air.convert with a
rounding after the types (.rte, .rtz, .rtp, .rtn) and, to an integer, .sat after it
(convert_float4_rte(uchar4) is air.convert.f.v4f32.u.v4i8.rte, convert_int_sat(float)
is air.convert.s.i32.f.f32.rtz.sat; the forms are read from the OpenCL runtime library
the macOS 27.2 Metal toolchain ships). Convert::parse took exactly four tokens, so each
such name was an unknown intrinsic and the pipeline was refused.

- metal2vulkan-air: Convert gains `rounding: Option<ConvertRounding>` and `saturate`;
  a rounding is accepted between numbers only (no bool, no 8-bit float) and .sat only
  after one, to an integer. Static folding leaves the saturating and the directed forms
  alone.
- Lowering (lower/arith/rounding.rs):
  - float to integer: RoundEven / Ceil / Floor first (rte / rtp / rtn; rtz is the
    conversion's own truncation), then the saturating conversion every air.convert to an
    integer takes; the NaN test reads the operand itself. Denormal notes as rint / ceil /
    floor take them.
  - integer to integer: plain; .sat clamps to the range both types share (SClamp/SMax/SMin
    of the sign extension, masked, or UMin; pairs on the wide path).
  - integer to float and float to narrower float, nearest even: the plain conversion. Where
    it can round to f32/f64 the entry declares RoundingModeRTE for the width and the widths
    the device's independence ties to it (narrow::rte_modes); a device that cannot declare
    them records the new PrecisionNote::NativeConversionRounding.
  - toward zero or an infinity: no Vulkan conversion rounds so per instruction, so the
    result is computed exactly by integer arithmetic: the magnitude's dropped bits with an
    increment where the lane rounds away (f32, f64 from 64-bit, the wide path through its
    sticky 32-bit fold), f32 to half on the bits (normal, overflow, subnormal, inf, NaN),
    double to float by stepping the device's faithful conversion, double to half through
    the round-to-odd f32. A conversion that cannot round is the plain one.
- PrecisionNote::NativeConversionRounding (native-conversion-rounding): codec, runtime
  Degradation, comparison table (unbounded), fast_paths ledger class, docs/API.md.
- SEMANTICS_VERSION 2021, ARTIFACT_FORMAT_VERSION 501 (the codec gains the note);
  api_signatures and the air api_surface blessed.
- Fixture kernel_convert_rounding_modes (owned MSL, air-rename to 64 suffixed intrinsics).

Unverified at this commit: build and tests follow in potluck jobs.
2026-11-11 02:41:50 -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 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 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 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 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 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 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 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 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
Anees Iqbal 555b13d57e RUNTIME_VERSION 2016, the runtime-sources pin and the coverage doc for the triage-c and 720 branches, merged as-is
What: on the owner's word (11-10 ~06:35, "stop tests, merge as-is into development"), with no further check:
- steelbrain/triage-c (8): the vertex_fetch_reach fixture, its AIR and the conformance case
  vertex-fetch-past-4gib-small-buffer (no Metal recording or cost record yet); InstanceShadows::holds by binary
  search; the GPU-fault lane prints its notices; the color-groups lane's four-color option
  (DeviceOptions::color_attachment_limit, doc-hidden) in place of the profiles layer, and the dropped re-exports.
- steelbrain/triage-a-720 (2, marked WIP/UNVERIFIED by their author): merge verdicts recorded only clear of load
  and repeated (CHECK_VERSION 6); the paths test's relay condition.
RUNTIME_VERSION 2015 -> 2016; the pin and docs/CONFORMANCE-COVERAGE.md follow.
Known state: the vertex-fetch case lacks its Metal recording and cost record; 720's after-fix counts never ran.
Not in pin 36 (ef7af82fe4). Verified here: pin-compute, generators, api-signatures --check clean only.
2026-11-10 06:57:53 -08:00
Anees Iqbal 131be007fa A half write through an argument buffer notes its NaN only where the heap can name a family the device stores its own way
What: a `half` texel's write to a heap element recorded `PrecisionNote::DeviceNanEncoding`
unconditionally ("a heap element may be any format"), so on MoltenVK on the M3 Max a write
through an argument buffer into an RGBA32Float or RG11B10Float texture announced the note
though the store is Metal's there (0 of 25 lanes differ, job 13458's lanes128.log). A new key,
`SpecKey::HeapNanFamilies(Stage)`, gives from the command's heap members the families whose
texels may hold a NaN a `half` write stores (`lower::texture::nan_family`, the same classes
the slot path tests of a bound format: 1 a 16-bit float format, 2 a 32-bit one, 4 a packed
small float one, 8 a float format of none of those; normalized, sRGB, extended-range,
integer and stencil formats none). `half_write_nans` now records the heap write's note under
one clause per family whose deviation the profile lacks (`MetalHalfTexelWrites`,
`MetalNanMoves`, `MetalSmallFloatNans`) and the no-family bit, requiring the property of each
family it takes, as a slot's write does.

Measured, before the change (`runtime_lane::half_write_nans`, argument-buffer writes):
- M3 Max, MoltenVK (job 13458): 16-bit float formats 15 of 25 lanes differ (signalling NaNs
  stored 0x7e00); 32-bit float and RG11B10Float 0 differ. The note now holds there only where
  the heap can name a 16-bit float texture (or one of no family).
- lavapipe (job 13553): 16-bit 8 differ, 32-bit 15 differ, RG11B10Float 0 differ. lavapipe
  takes none of the three deviations, so its note keeps every family's clause.

Runtime: `degrade_bound_values` reads the clause at each draw or dispatch (generic; no
runtime code changed). The lane `half_write_nans` now holds argument-buffer writes to the
measured rule as it holds slot writes: on a device with the family's property, 0 lanes differ
and nothing is announced.

Public API: `SpecKey` gains `HeapNanFamilies(Stage)` (a `#[non_exhaustive]` enum; no
consumer breaks); api_signatures.tsv blessed.

Tests: heap::a_heap_half_write_s_nan_note_follows_the_families_its_command_can_name (the
clauses and required properties on every committed profile with a heap; plan values 1/2/4/0
for R16Float, RGBA32Float, RG11B10Float, RGBA8Unorm and R32Uint residents and the note held
under them).

SEMANTICS_VERSION 2019, ARTIFACT_FORMAT_VERSION 500 (a SpecKey tag; both renumbered at
landing).

(cherry picked from commit 8f6f24055459c9143f3473da8ab60e6532b30676)
2026-11-10 06:13:23 -08:00
Anees Iqbal 199f9a99a2 A half sample of a 32-bit float texel records no half-texel note where the device's half is Metal's
What: half_texels' clause for a sample of a 32-bit float texel (Bound & BicubicTexels::LINEAR,
'Metal rounds toward zero, saturating') is no longer added on a profile that takes
DriverDeviation::MetalHalfConversion; the module then requires VkProperty::MetalHalfConversion
(TexturePlan::storage_properties), as half_texel_nans' NaN clauses do since 782da3582b. Elsewhere
the clause stays. The unmeasured-class and 16-bit normalized clauses are unchanged.

Why: on MoltenVK over the M3 Max a half sample of RGBX32Float through a runtime sampler (the
consumer's rgbx_sample_half) announced half-texel-conversion ('where it binds texture 0 bound as
RGBX32Float') while every value was Metal's. The deviation's measurement covers the half result
of a read, sample and gather of every float word of RGBA32Float (half-texel-nans-rgba32f,
m3-max-13447: every value Metal's), and RGBX32Float is held in that twin.

Test: runtime_lane::rgbx_textures::rgbx_half_samples_are_metals (the previous commit): nearest and
linear runtime samplers, edge and border, shared and private, RGBX32Float and RGBA32Float; on a
profile of MetalSampler and MetalHalfConversion no half-texel-conversion may be announced.
Docs: the note's rustdoc and API.md's catalogue entry. SEMANTICS_VERSION 2019.

Verified: the M3 run of the control and of this commit follows.
(cherry picked from commit bb5662fd6d9bb512bc8d185c85a5d7098b1f2d9d)
2026-11-10 05:50:50 -08:00
Anees Iqbal 6ead79e1bb Runtime: make plain blocks by their own allocation alone, no exportable fill first
What: remove "Blocks filled exportable first". The device computes no fill types;
Memory::fill_plain_blocks and its state, Fills, the FILL_* constants, the fill branch of
BlockMaker::make_as and BlockMaker::fill_first, Block::filled and Fill go, with the
public counters WorkCounts::plain_block_fills_saved, plain_block_fills_missed and
plain_block_fills_skipped (api_signatures.tsv re-blessed), tests::block_fills, the Fills
unit test, the fill parts of memory/making_parts.rs and the reclaim bench's unfilled arms
and fill printouts. DriverFact::PlainAllocationsHoldSubmissions stays as a measured fact;
its docs say the runtime makes such blocks by their own allocation on every driver.
docs/FAST-PATHS.md drops the fill's row; the plain-makings-hold-submissions known gap says
the runtime does not fill first and why.

Why: on the Radeon 780M most fills miss under memory pressure (saved/missed per scroll
1/7, 7/20, 2/7, 2/8), so the kernel compacts order-9 pages for both the fill and the
block. The consumer's scroll gate traces: all 11 rAF gaps of 100 ms or more overlap one
ready-thread direct-compaction episode of 46-164 ms inside one block making; on pin 35, 6
of 9 gaps sit in a fill making (68M+68M makes, 134-162 ms of compaction), most of it
between the fill's free and the block's create. Their no-fill A/B (fill_plain_blocks(0)):
0 gaps of 100 ms or more, against pin 30's 6 and pin 33's 11.

Verified here: scripts/api-signatures/signatures.py --check passes after --bless (only the
three counters left the table); refusal_surface.py regenerated docs/REFUSALS.md unchanged;
cargo fmt --all. Builds, clippy, rustdoc and the runtime's memory tests run on potluck
after this commit.

(cherry picked from commit c11bf907bced149e81301c6319d3fab1d615061c)
2026-11-10 05:49:16 -08:00
Anees Iqbal 83e5e06789 DescriptorError::ColorAttachment carries Metal's answer: nil with an NSError, or the process ends
A layer that answers as Metal does needs to know, per refused pipeline, whether Metal returns nil
with an NSError or its descriptor validation asserts and ends the process. ColorAttachment now
carries `metal: MetalAnswer` (NilWithError | EndsProcess), set at each of its 17 sites from plain
Metal's answer on an Apple M3 Max under macOS 27.0.1 (probes/color_attachment_answers.m, no
MTL_DEBUG_LAYER, job m3-max-13738):

- EndsProcess (SIGABRT, "Render Pipeline Descriptor Validation"): blending on a bfloat attachment,
  with a function, a fetching function or none ("... MTLPixelFormatRGBA16Bfloat for this render
  target is not blendable."); alpha to coverage over an integer attachment 0, rasterizing or not
  ("... alphaToCoverageEnabled requires a float/unorm pixel format ..."). The link's doc said the
  second was unmeasured with rasterization off; it is measured now.
- NilWithError (code 3, domain AGXMetalG15X_M1): an output of another numeric class (half4, float4
  and int4 into RGBA8Uint; uint4 into RGBA8Unorm and RGBA8Sint; a fetching uint4 of RGBA8Unorm);
  a color input of another class (uint4 of RGBA8Unorm, BGR10_XR, A8Unorm); fewer output components
  than channels (with and without fetch); a blend of the second source without the second output,
  or without the first (with and without fetch); a color input without an attachment; a tile
  function's imageblock member without a format ("Invalid pixel format for render target 1").
- A `Compiled` tile function compiled under another format than the descriptor's has no Metal
  counterpart (Metal compiles the function for its pipeline) and answers EndsProcess, the answer
  of an unmeasured case; under no format it answers Metal's NilWithError.

Public API: the new `error::MetalAnswer` and the changed variant are in api_signatures.tsv and the
api_surface table. Refusals are not serialized in any cache, and translation output is unchanged,
so neither ARTIFACT_FORMAT_VERSION nor SEMANTICS_VERSION moves. docs/REFUSALS.md regenerates
unchanged (descriptor errors are not in it). docs/API.md states the two answers.

Tests: each existing test of a ColorAttachment refusal now names its answer (bfloat blends,
alpha to coverage, a tile function compiled for other formats: EndsProcess; output class and
components, the second source, unattached inputs, unformatted tile members: NilWithError), and a
new unit test holds the storage form's class refusal to NilWithError for reads and writes.

(cherry picked from commit cd17476e5a4ae2b9fbf8118453ad089691adaba2)
2026-11-10 05:40:38 -08:00
Anees Iqbal 84db1b3675 FAST-PATHS: the ANV binding-table pool gap with the passes inline and the barriers bounded
The known gap now counts command buffers begun (barrier command buffers took blocks too), names
the passes that still take a secondary, the 2,048 planned barrier command buffers a batch begins
at most, and what ms01's Iris Xe (Mesa 26.2.6) measured: 10,000 passes beside a cleared depth in
one command buffer run in 12,049 command buffers (tests::many_passes); passes inline encode to
16,173; passes with a secondary fail at the end of the 8,087th; with the targets' first clears in
the submission 14,000 passes ran and 14,300 crashed in the driver, recorded as the open part.

Verified: the numbers are the probe runs' (jobs m3-max-13726, -13731, -13643).
(cherry picked from commit 67f1d8710d78adf21768002c82a86e739721e271)
2026-11-10 05:25:14 -08:00
Anees Iqbal f0b1976e58 Queue sharing: a command buffer whose VkQueue waits on the GPU for another's work counts that wait in its long mark
The Adaptive long mark read a command buffer's own GPU timestamps alone. A batch that waits on the
GPU for another VkQueue's work (an MTLEvent's signal pending there, the tracker's wait for another
VkQueue's writes, new resources' first work there) writes its start timestamp only once that wait
is met, so a queue of short command buffers, each waiting for another queue's 30 ms one, never went
long: it kept sharing its VkQueue, and every command buffer the queues sharing it committed behind
each wait waited for the other queue's whole long command buffer.

Now submit_batch notes, at the first batch whose VkQueue it hands such a wait (an event wait whose
signal is pending on another VkQueue or is the caller's, EventTimeline::waits_across; a tracker or
first-work wait on another VkQueue), the host time its submission was called (Times::waited_across).
place_gpu_times marks the queue long also where more than LONG_HEAD ran from then to the command
buffer's GPU end, placed in the host's time. A command buffer with no such wait is timed as before,
by its own timestamps, so the host-view false marks the module docs describe stay out.

The device test a_compositor_beside_a_queue_waiting_on_the_gpu_for_long_work_keeps_its_latency now
also asserts that the waiting queue goes long (WorkCounts::queues_gone_long >= 2). The QueueSharing
notice's cost, docs/API.md's catalogue entry and the FAST-PATHS row name the wait.

Verified: cargo fmt; unit test a_wait_crosses_queues_where_its_signal_is_pending_on_another; the
build, clippy and the 5080 device run are dispatched.

(cherry picked from commit 6391625634472fb158b6477dfad36340956ae2dd)
2026-11-10 05:16:05 -08:00
Anees Iqbal ff45556bcc An argument buffer's sample filter note holds only where its heap can name a filtered raw texture
What: a heap sample the function emulates (`sampler::heap_raw`) recorded
`PrecisionNote::BicubicFilterArithmetic` whatever the command's heap held: unconditionally
through a constexpr linear sampler, and under the bound sampler's word through a runtime
slot. A command whose heap holds no raw texture samples through the device's own sampler,
and a bfloat form's sample reads the nearest texel, so neither filters by the device's
arithmetic. `SpecKey::HeapRawTextures`' value now carries two bits, which the plan gives
from the command's heap members (`slots::heap_raw`): `heap_raw::HELD` (1, a raw-held
texture: the decode's `DevicePackConversion`, unchanged) and `heap_raw::FILTERED` (2, a
raw-held texture of a form the function filters: not a bfloat one). The filter note's
clauses each test `FILTERED` (beside the bound word's test through a runtime slot).

Runtime: `degrade_bound_values` reads the clause at each draw or dispatch, so a command
whose heap holds only RGBA8Unorm or RGBA16Bfloat textures no longer announces
bicubic-filter-arithmetic for a linear heap sample; one holding a BGRA10XR texture still
does. No runtime code changed (the path is generic).

Tests: heap::a_heap_sample_s_filter_note_follows_the_raw_texture_and_the_bound_sampler_word
(artifact clauses on every committed profile), heap::a_heap_sample_s_filter_note_holds_where_its_command_can_name_a_filtered_raw_texture
(plan values 3/1/0 and the notes bound under them), the decode-note plan test's values
(3 for BGRA10XR, 1 for RGBA16Bfloat), engine_sampler's argument-buffer stage check, and the
lane heap_extended_reads::a_heap_sample_s_filter_note_is_announced_where_its_command_can_name_a_filtered_raw_texture.
Docs: SpecKey::HeapRawTextures, the note's rustdoc, API.md.

SEMANTICS_VERSION 2018 (renumbered at landing).

(cherry picked from commit dbc8a2781ef6170f797d5b7a7a83b46264c5e4e2)
2026-11-10 04:45:12 -08:00
Anees Iqbal 24025b3866 Argument-buffer textures read through a sampler: border texels from the handle-table entry
What: a Metal 4.1 read(sampler, ...) of a texture held in an argument buffer now hands back
Metal's border texel of the resident texture, its pixel format's through its swizzle, for every
sampler: a constexpr one of any border colour, a runtime [[sampler(n)]] and an argument buffer's
sampler (the colour from the sampler's word).
- The binder writes each texture's border texels (metal::sampler::border_texels of its format
  and swizzle, the layout of a slot's BorderTexels specialization) in its handle-table entry's
  flags, bits 3 to 14 (memory::handles::FLAG_BORDER_TEXELS); handle_entry_flags carries them, so
  a consumer's own table of every ID gets them too.
- A module with such a read searches the table in a new indexed form (Lookup::Indexed): the
  handle is the element with the found entry's index in its top 16 bits (HANDLE_ENTRY). The read
  loads the entry's border texels by it (handles::border_texels); every use that reads another of
  the entry's flags (texel class, red-blue order, out-of-bounds alpha) loads them from the entry
  into the flagged handle's layout (handles::flagged_handle), through one typed value
  (texture::emit::HeapFlags) so no reader sees the entry index in those bits.
- through::finish selects the border texel for slots and heap elements alike; a heap member read
  by its raw texels (an extended-range form) takes its border and its zero past the level or
  layer from its own image's addressing inside the raw arm, not the float array's neutral's.
- The old heap path, which selected the out-of-bounds texel (transparent black, unswizzled) and
  refused every other border colour and runtime sampler NotImplemented(ArgumentBufferTextures),
  is gone, with ReadSampler::transparent and the forced alpha flag of such reads.

Why: the M3 runs all three (conformance cases read-through-heap-border, read-through-heap-sampler,
and read-through-rgba8-swizzled's rt_heap_zero, where (G, R, 1, 0) reads (0, 0, 1, 0) past the
edge and we read (0, 0, 0, 0)). A 32-bit heap handle had no room for 12 border bits beside the
element, class, red-blue and alpha fields; the entry does (bits 3 to 14 were unused).

SEMANTICS_VERSION 2017 (translation output changes). ARTIFACT_FORMAT_VERSION unchanged: no
encoded type changed. RUNTIME (for the orchestrator's bump): the runtime's handle tables
(heap_sets.rs, through bind::handle_entry_flags) now carry the border-texel bits.

Ledger: the three rows of these gaps go; llvmpipe's rt_heap_zero row of the swizzled case keeps
only llvmpipe's 8-bit unorm conversion. FAST-PATHS known gap removed; REFUSALS.md,
CONFORMANCE-COVERAGE.md regenerated (METAL-COVERAGE.md unchanged).

Verified: not yet built (next: Linux build, clippy and the touched tests).
(cherry picked from commit bc000fa475e572131248b908541dbe29f1f5996c)
2026-11-10 04:45:05 -08:00
Anees Iqbal 7b41681b7e Regenerate CONFORMANCE-COVERAGE.md after triage-a's ledger rows
The llvmpipe 3D mirror rows' text and the RADV row of pass-bytes-srgb-decode-all-bytes
(the two commits before this one) change what the coverage document derives.
Verified: scripts/conformance-coverage/coverage.py regenerated it.
2026-11-10 04:15:23 -08:00
Anees Iqbal 5e51dc6023 METAL-COVERAGE names the macOS 27.2 SDK its table was checked against
coverage.py's SDK line still said the macOS 27.0 SDK (Xcode 27.0, 27A266a),
while the M3 has Xcode 27.2 (27B52) and its MacOSX27.2.sdk; the generated
enum tables already name 27.2. The table needed no row change: on the M3,
coverage.py --sdk against MacOSX27.2.sdk answered 'coverage.tsv names every
SDK item (2135)', rc 0 (potluck job m3-max-13567). docs/METAL-COVERAGE.md
regenerated (coverage.py), coverage.py --check current.

(cherry picked from commit ca8424427caaa8636587eb5593e7b91b68afe9b1)
2026-11-10 04:15:05 -08:00
Anees Iqbal 2c31428f3c Measure a texture's first CPU copies after a runtime suspend; the known gap is the device's resume
The XTX's first get_bytes after the GPU idled into runtime suspend took 4.7 to
5.2 s. A run decides whose that is: any first submission after the suspend
pays it, so it is the kernel's resume of the device, not our staging queue.

tests::cpu_copy_times gains an ignored measurement, run by name: per size
(1920 x 1080 in a pooled block, 4096 x 4096 in a block of its own) it makes a
Shared BGRA8Unorm texture, copies it awake once, then for three sequences,
each twice, waits for the PCI function's power/runtime_status to read
suspended and times each step: replace_region then get_bytes; get_bytes then
replace_region; a fill command buffer on the program's queue (commit timed
apart from its wait) then both copies. It prints the status after each step
and the staging submissions made.

Evidence, RX 7900 XTX on gem10 (Mesa 26.2.6, autosuspend delay 5000 ms),
job m3-max-13545, two runs, 24 suspends:
- the program queue's command buffer: commit 0.12 to 0.52 ms, its wait 4.83
  to 4.86 s;
- the staging queue: replace_region returned in its awake time (0.48 to 12.74
  ms at 1080p, 5.02 to 5.58 ms at 4096^2) with the device still suspended,
  and the get_bytes after it, the first staging submission, took 4.73 to
  4.79 s; get_bytes first took 4.76 to 4.88 s;
- after the command buffer woke the device, get_bytes took 3.2 to 4.0 ms
  (1080p) and 18.7 to 20.8 ms (4096^2).
The kernel's log of the run's last resume: SMU resumed at :09, "Wait for DMUB
auto-load failed" at :10, 16 "DMCUB error" lines to :13, "Cannot find any crtc
or sizes", then the rings: the card has no display attached.

Paying it ahead off the caller's path: a commit already hands its batches to
the scheduler thread and returns in under a millisecond, so only a wait or a
synchronous read waits. A wake started when a replace_region queues its copy
would win only the time between that call and the next submission (none in
the measured sequences) against a 4.8 s resume, and the program's queue and
the staging queue pay alike, so no queue choice avoids it. A keep-alive is
out. No runtime change.

docs/FAST-PATHS.md's known gap is rewritten with these numbers; its 86 ms
and 73 ms first replace_region of the host path no longer apply on the XTX,
whose Shared textures copy on the staging queue (replace_region now
returns in its awake time after a suspend).

(cherry picked from commit 112b405a9167666407ae15cd08b7bdf76d09d038)
2026-11-10 03:33:55 -08:00
Anees Iqbal 445d410eda An extended-range sample's filter note through a runtime sampler follows the bound word
What: a sample of an extended-range or padded texture that the module filters itself
(`sampler::extended`, through the slot's variant, and `sampler::heap_raw`, through an
argument buffer's raw element) recorded `PrecisionNote::BicubicFilterArithmetic`
unconditionally through a runtime sampler slot. It is now specialized on the word of the
sampler bound at that slot (`NoteOn::BoundSampler`, `SpecKey::BoundSamplerWord`), with the
two tests `linear::filtering_word` gives, as the YCbCr filter note does: a linear
minification or magnification filter, anisotropy or a cubic filter (any of those bits), or
a linear mip filter. The level blend of a word-stated mip filter holds on the linear mip
test alone. A constexpr sampler keeps its rule (linear: unconditional; nearest: none).

Runtime: the clauses test a bound value, so `Device::degrade_bound_values` reads them at
each draw or dispatch of the variant (no runtime code changes: the path is generic, and
`slots::record_noted` already records the word for a noted key). A nearest runtime sampler
over such a texture no longer announces bicubic-filter-arithmetic; a filtering one still
does.

Why: a nearest sample is the decoded texel at Metal's position (no filter arithmetic), yet
it announced the note, so the conformance suite's nearest cases
(`rgb10a2-srgb-samples-nearest-*`, the eight `xr-two-plane-samples-*-n*-*`) declared it.

Tests: engine_extended_range::samples::a_runtime_sampler_s_filter_note_holds_only_where_the_bound_word_filters
(every form, half and float, runtime / constexpr linear / constexpr nearest, on lavapipe,
moltenvk-m3 and the RTX 5080 profile: clauses hold for linear, linear min, linear mag,
linear mip, anisotropic and cubic words, not for nearest or nearest-mip ones; bfloat forms
record none) and heap::a_heap_sample_s_filter_note_follows_the_bound_sampler_word. The
rgb10a2_srgb lane now checks its nearest samples announce no filter note. The conformance
allowances of the rgb10a2 sRGB and two-plane sample cases name the note for the linear
cases only. Docs: the note's rustdoc and API.md's catalogue entry.

SEMANTICS_VERSION 2016: an artifact's notes change.

(cherry picked from commit fd5212bee216b823ba18d3c5ba5e5a74a4b12073)
2026-11-10 03:17:33 -08:00
Anees Iqbal 6be4be9791 Keep the predicted plain half arm in a key's general form: a creation makes one pipeline, not two
What: on a device that samples through Metal's own texture unit (MoltenVK), a texture slot a
function converts to `half` declares SpecKey::PlainHalfTexels and SpecKey::UnmeasuredTexels.
The general form (render/residual.rs) zeroed both, so a state's creation made its predicted
key's general form (the class routine's arm, PlainHalfTexels 0) and handed the predicted key
itself (the plain arm, 1, as an unbound slot takes) to the pool right after. Every draw of a
plain class takes the predicted key, so the general form served a draw only while the
predicted key was still being made; the conformance cases render-then-sample-magnified-nearest
and -linear made it and no draw took it (cost.rs named it an open bug). PlainHalfTexels is no
longer a constant of the general form: a key keeps the plain arm its binding gives it. The
predicted key is now its own general form, and the creation makes that one pipeline.

What still takes a general form: a draw binding a class whose `half` conversion is not
measured (BC4 to BC7, the linear ASTC formats) keys UnmeasuredTexels 1, which no instruction
reads; its general form is the predicted key, made at creation, so it draws at once and runs
its own key's instructions while its own is made on the pool, as before. A draw binding a
YCbCr field on the grid 8192 (PlainHalfTexels 0) makes its own key at its draw, as any key the
creation did not predict; on a device whose memory is the host's such a slot reads its planes
in place in a variant of its own (VariantKey::ycbcr_in_place), which no creation predicts
either.

Tests: tests::general_form now expects the plain arm kept ([1,1,1,5,3] -> [0,1,0,5,3], an
unmeasured plain class's key -> the predicted key, a YCbCr class keeps the routine's arm); the
made_at_creation lane expects one making at creation on every device (it expected two on
Metal-sampler devices) and the unmeasured-class draw to take the predicted key as its general
form; ycbcr_textures' and runtime_lane's comments follow. Docs: residual.rs, predicted.rs,
WorkCounts::residual_form_draws, API.md's general-form bullet, and cost.rs's open-bug
paragraph (the recordings read 3 made until the rows' next measurement; WASTED_BY_CLASS's
draws ceiling can then drop by 2).

Verified on the M3 Max (MoltenVK 1.4.2), the same diff at 3e0db77c6f over 6f7bb169d2:
- conformance cost --runs 8 --show, each case, in order and alone (jobs m3-max-13511,
  13518): render-then-sample-magnified-nearest and -linear read creation_pipelines_made 2,
  creation_render_pipelines_made 2, variant_pipelines_made 2 (the record holds 3 of each),
  creation_pipelines_drawn 2 (the record's 2): the pipeline no draw took is gone, every
  pipeline made is drawn.
- conformance replay, the whole set (70 s): exit 0, "the 391 row(s) above are exactly the
  open gaps known-gaps.tsv expects on this venue": no case's answers moved.
- 77 touched tests under --cfg m2v_gpu passed: made_at_creation, ycbcr_textures' creation-made
  slot, pipeline_creation's pool draws, draw_work, general_form, uniform_bind_offsets,
  draw_again, draw_shape_notices.

(cherry picked from commit 56ddedfc3498c9376384a3ad4b57e7607d78594a)
2026-11-10 03:07:56 -08:00
Anees Iqbal e14253045b CONFORMANCE-COVERAGE.md regenerated for the extended-range mipmap cases and their ledger rows
Regenerated by scripts/conformance-coverage/coverage.py in job m3-max-13466 at 94a89c5273
(gem10, lavapipe cfg): two more recordings (1265), 23 more ledger rows (3484), and the
blit_encoder_commands family's case count (11). The conformance crate's tests passed against
it there (1050 of 1050).

(cherry picked from commit 0bbbd5f379db297f84df60b129b15a4e6e1222d5)
2026-11-10 03:00:00 -08:00
Anees Iqbal 782da3582b A half read of a 32-bit or small float texel records no NaN note where the device's half is Metal's
On MoltenVK on the M3 Max (m3-max-13447, default policy) half-texel-nans-r32f, -rgba32f,
-rg11b10f and -rgb9e5f answered every value as Metal does and still announced
device-nan-encoding; runtime_lane::half_texel_nans read 0 differing half lanes. The profile takes
DriverDeviation::MetalHalfConversion, whose measurement covers the half result of a read, sample
and gather of every float word of RGBA32Float (NaNs among them) and 16,384 random words each of
RG11B10Float and RGB9E5Float.

half_texel_nans now records DeviceNanEncoding on such a profile only where the bound class is a
half-float one (packed field 0) or of no family, and requires VkProperty::MetalHalfConversion;
elsewhere it keeps the one clause of TexelFormat::NAN_FREE. The 16-bit float formats keep the
note: no deviation records their NaN payloads as measured.

Test: engine_texture's half-read test checks both forms per committed profile (clauses, formats
that hold, the property) and that a profile of the deviation ran. Docs: the note's rustdoc,
API.md's exemptions, the storage_properties doc. Under the branch's SEMANTICS_VERSION (2015).

(cherry picked from commit b03555f8c9f05e382f744593cfaa01f2dc3bbb20)
2026-11-10 02:59:43 -08:00
Anees Iqbal 85b896a7e1 Mesh pipelines: a required object size answers as Metal's first compile, as the mesh stage's does
Metal's answers here depend on what its compiler compiled before, which it keeps across processes
keyed on the function's AIR. With the probe's salt now in the AIR (d49370d732), an M3 Max under
macOS 27.0.1 answered, twice over, each sequence one fresh salt (m3-max-13430):

- required-object-32-max-64: refused on a first compile ("Kernel specified max total threads per
  threadgroup (32) must match compute pipeline specified max total threads per threadgroup (64)"),
  refused again, and again after required-object-32x2 or plain; made only after
  required-object-64-max-64. required-mesh-32-max-64 the same, made only after
  required-mesh-64-max-64. The object stage was made here because an earlier compile let it be.
- A required size gives its stage its threads on a first compile: required-object-32x2 answers an
  object maximum of 64 (we answered 1024), required-mesh-16x2 a mesh maximum of 32, and a
  required 32 beside a function's [[max_total_threads_per_threadgroup(64)]] 32 in either stage.

So the object stage now refuses a required size of other threads than its maximum
(MaxThreadsDiffer { stage: Object }), as the mesh stage already did, and each stage's thread
limit is the least of the descriptor's maximum, the function's, the required size's threads and
1024. RUNTIME behaviour: new_mesh_render_pipeline_state refuses an object maximum beside a
required object size of other threads, and maxTotalThreadsPer{Object,Mesh}Threadgroup answer a
required size's threads. The translator's mesh answers change, under the branch's
SEMANTICS_VERSION bump (2015).

Tests: engine_mesh's refusal test adds the object cases (32 and 16x2 under 64) and makes 64
under 64; its answers test checks a required size alone in each stage and below a function's
maximum; the runtime lane's mesh test does the same on a device. docs/API.md's accepted
difference, the error's and the getters' docs and the probe's measurements say the first-compile
rule and what later compiles answer.

(cherry picked from commit 3b05b274aec46c172fd0a38276c5ca45a1ade4ca)
2026-11-10 02:59:31 -08:00