Commit Graph
1726 Commits
Author SHA1 Message Date
Anees Iqbal c4b38afdb8 rt and translator: a buffer slot's pushed word is its address less 2^31, and an access adds its offset plus 2^31, zero-extended
Under the identity domains a buffer slot aligned to its argument was reached as its pushed address
plus the access's 32-bit byte offset sign-extended to 64 bits. The sign extension is what keeps an
offset below the bind address exact, but a device cannot split a sign-extended offset into a
scalar base and a vector offset as it does a zero-extended one. Now rt pushes the slot's address
less 2^31, and an access adds its offset plus 2^31 (modulo 2^32) to that word, zero-extended. That
is the same address for every offset in [-2^31, 2^31), which the 2 GiB buffer cap guarantees, in
one 32-bit add that a device fuses with the index's shift. A unit index x + c with a constant c
folds c into the bias: (x + c) * s + 2^31 = x * s + (c * s + 2^31) mod 2^32. The builder notes
each u32 sum of a value and a constant for that; the note changes no emitted word.

One place on each side:
- rt: pipeline::address_word, used by the compute and render push writers for every
  BufferAddress field: a bound buffer, a setBytes copy, or the nil buffer.
- translator: lower::access::pointer.
  - biased_slot_address feeds the direct reach.
  - slot_address (the word plus 2^31) feeds every other reader: an access from the word below
    it, a pointer compare, ptrtoint, the memmove overlap's Metal addresses, and pulled vertex
    fetch.
  - The bias applies only under the identity domains and only where the word is pushed: a
    replay variant reads the true address from its root entry.

Unchanged:
- A texture's or sampler's resource ID and the parameter block's address are not biased.
- A pointer loaded from an argument buffer keeps today's form: the address the buffer holds.
- The default domains, which the old runtime and the golden tables use, take no new instruction:
  the readers there load and bitcast the field in the same order as before.

Argument-buffer pointers left in their form (planner's condition):
- They are 19.6% of the corpus's device and constant accesses.
- Time-weighted, they are 0.8% of accesses on the 780M stream gb-780m-u4 and 2.4% on the RTX 3090
  stream gb-3090-r5.
- Kernels with any such access take 1.9% and 8.4% of those streams' GPU time.

Slot pointers used as values, in the entry functions of the corpus's 11,580 kernels (census over
the local sources shards):
- 781 (6.7%) use one as a value: 14 convert one to an integer, 46 compare one, and 731 store one.
  Every such store but one writes private memory (a pointer cell); the one other writes device
  memory.
- 3,511 (30.3%) pass one to a non-inlined function.
- 33 pass one to an air.* call (command encoding, intersect).
A ptrtoint and a compare read slot_address. A pointer parked in a private cell or passed to a
function stays a fat pointer, whose accesses take the forms above. The one store to device memory
makes a wide pointer, which reads the root table, a field identity_admits does not admit. A new
engine test, a_slot_pointer_used_as_a_value_is_its_metal_address,
runs a kernel under the identity domains with biased pushes on the interpreter. It does a ptrtoint
to i64 and to i32, an address compare, and loads 4 bytes below a bind address and 20 above
another, and checks each against the true addresses.

Probe numbers (measured: one particle kernel run alone on RADV 26.2.6, us per dispatch, best of
forward and reverse; the module's two positions accesses changed by hand). Biased form against the
plain zero-extended offset (inexact below the bind address), at subgroup size 32 and at the
driver's 64:
- RX 7900 XTX: 33.6 vs 33.6, 30.8 vs 30.6; at 4x the grid 374.6 vs 374.0, 273.1 vs 272.9.
- PHOENIX 780M: 168.1 vs 168.3, 121.1 vs 120.5; at 4x 2521.9 vs 2522.8, 1744.6 vs 1752.8.
- HawkPoint 780M: 173.3 vs 173.2, 122.5 vs 122.7.
The sign-extended form it replaces measured, at 32:
- HawkPoint: 189.8 (same job), 9.5% slower.
- PHOENIX at 4x: 2735.3 (same job), 8.5% slower.
- XTX: 35.9 (another job), 6.8% slower.
The XOR form with a host-biased word (V7) measured 178.8 on HawkPoint: the add is the one that
fuses.

The tests:
- The identity engine tests push the biased word through engine_word_phases::slot_word.
- rt's three hand-made test kernels (ADD, STEP, WIDE) add 2^31 to each slot word. Their arrays
  are regenerated from the doc GLSL with glslangValidator --target-env vulkan1.2 and checked with
  spirv-val. Today's GLSL reproduced today's arrays exactly before the edit.

docs/API.md (sections 1 and 5), PushField::SlotGuestBase's doc and rt's README known gap on the
2 GiB cap state the word and the form.

SEMANTICS_VERSION 2186 -> 2188 and ARTIFACT_FORMAT_VERSION 544 -> 546. The identity nolockstep
lane holds 2187 and 545, unlanded; these take the next numbers so the two land separately.
2026-11-19 03:07:44 -08:00
Anees Iqbal f811bb4716 rt: a blit encoder releases an exported block to the other API, in its command buffer
The read direction of an export: another API (a video encoder) reads what a blit
wrote into an exported block. BlitCommandEncoder::release_to_external(&buffer),
which Metal has no counterpart of, records one buffer barrier into the encoder's
command buffer after every earlier command: the whole block's release from rt's
queue family to the acquire's other family (EXTERNAL for an opaque handle,
FOREIGN_EXT for a dma-buf), src ALL_COMMANDS / MEMORY_WRITE. No submission of its
own, nothing on the submit thread, no wait. It is a write use of the buffer for
the encoder's ordering: textures over a buffer in the block copy back first, and
since Vulkan ignores a release's second scope and only ALL_COMMANDS waits for it,
the barrier after it is owed (Building::release_command, beside owe_pass; the
flag owed_pass is now owed_all), paid by the next command or the command buffer's
end barrier. Counted in Metrics::external_releases and Metrics::barriers. A
buffer whose block is not exported is Refusal::NotExported (its doc and Display
now name the release too).

Release after release without an acquire is the spec's own case (7.7.6 NOTE: "It
is valid to never call the acquire operation after a release, and instead simply
start using the resource on any queue (even the releasing queue), but the
contents should be reinitialized before being read"), so the next frame's blit
needs no acquire. The README and the acquire's doc state the read direction's
contract: the other API reads from the command buffer's completion; from the call
until the consumer's next write through the runtime, the runtime reads nothing of
the block and the consumer encodes no read of it.

The export device test now releases through the call, twice in two command
buffers with no acquire between (fill, release, fill, release), and the second
device reads the second fill's bytes; a release of a buffer in a taken block is
NotExported; external_releases grows by 2. REFUSALS.md and the API signature table
regenerated; the replay's metrics name external_releases.

Verified: build and device legs follow (job ids in the lane's report).
2026-11-19 02:42:38 -08:00
Anees Iqbal 0ecac16dd3 rt: a render state answers Metal's imageblock sample and memory lengths; one imageblock gap
The consumer asked for RenderPipelineState's imageblockSampleLength and
imageblockMemoryLengthForDimensions:. Metal's render answer is not 0 without an explicit
imageblock: it counts the color attachments' texels (measured on an M3 Max and an M4, and kept
by the translator as metal::format::imageblock_sample_length: [R8Unorm, R32Float] is 8). rt makes
no state whose fragment function reaches an imageblock (RenderPipelineKind::Imageblock), so a
state's sample is its colors alone, computed once per content from the descriptor's color
formats; the memory length is that times the width, the height and the raster sample count, none
rounded, as the old runtime answers it from the same measurements. A color format with no
measured place in Metal's record answers the gap.

The gap is one variant for both states: Gap::ImageblockMemoryLength { dimensions } becomes
Gap::ImageblockLength, which the compute state answers for a kernel that declares an imageblock
it never reaches (or whose compile kept no reflection to tell) and the render state for an
unmeasured color format. The compute state's imageblock_memory_length_for_dimensions answers u64,
as the render state's does.

Test: every_device_answers_a_state_s_metal_answers also makes a render state of R8Unorm and
R32Float colors: 8 bytes a sample, 512 for 8 by 8 pixels of one sample. README (render states;
the compute paragraph's gap name), api_signatures.tsv and REFUSALS.md regenerated.

Verified at this commit: cargo fmt only. The build and device legs run on the lane's tip.
2026-11-19 02:36:04 -08:00
Anees Iqbal c57b0436c8 rt: a compute state answers Metal's static threadgroup memory, execution width and imageblock length
The consumer counts each Metal answer rt holds but does not give. ComputePipelineState now
answers three more, each from its whole module's translation, kept per content (Answers):

- static_threadgroup_memory_length(): staticThreadgroupMemoryLength, the translator's
  ComputePipelineMetalInfo::static_threadgroup_memory_length (rounded up to 16 as Metal reports
  it); the threadgroup memory rt adds beside it is not counted.
- thread_execution_width(): threadExecutionWidth, the translator's thread_execution_width, 32 on
  every device (the old runtime answers the same value from the translator): a kernel that
  observes its SIMD group runs it 32 wide, and one that does not cannot tell its width.
- imageblock_memory_length_for_dimensions(dimensions): 0 for a kernel that declares no
  imageblock. rt makes no state for a kernel that reaches an imageblock (the translator records
  RuntimeFact::ImageblockSize on its first use, which the interface refuses as Gap::KernelInput),
  but the translator plans only used parameters, so a kernel that declares an imageblock it never
  reaches does get a state. For it, and where the compile kept no reflection to tell, the answer
  is the new Gap::ImageblockMemoryLength { dimensions }: no authored case measures Metal's length.
  Whether the kernel declares one is read once per content from the reflection its compile kept
  (ComputePipelineDescriptor::reflection over StageSource::Compiled, decoding nothing).

Test: every_device_answers_a_state_s_metal_answers (device cfgs): the harness's block_scan
answers 1024 bytes of static threadgroup memory (256 words), sample_down 0; both 32 wide and an
imageblock length of 0. README (compute states), api_signatures.tsv and REFUSALS.md (26 -> 27
gaps) regenerated.

Verified at this commit: cargo fmt only. The build (clippy of rt under both device cfgs) and the
device legs run on the lane's tip.
2026-11-19 02:36:03 -08:00
Anees Iqbal 8a8ce7f7cf Re-derive the generated documents at the landing tip
They are generated from the whole case set, and the set grew on `development`
while this branch was in flight, so the copy committed here counted a smaller
one.

Verified: regenerating at this tip leaves no change beyond the `Generated at`
stamp.
2026-11-19 02:32:26 -08:00
Anees Iqbal aaccee3ca8 conformance: copy-out-strides recorded on the M3 Max (macOS 27.0.1, m3-max-51024)
Metal's answer on all 14 sites is the stride model: each row at its offset plus the row index
times the stride, the bytes between and after the rows 0xcd. docs/CONFORMANCE-COVERAGE.md
regenerated (scripts/conformance-coverage/coverage.py).
2026-11-19 02:31:32 -08:00
Anees Iqbal 18c52e7a8c rt: a heap's resources take one id in the hazard sets, the heap's
What: every buffer and texture placed in one heap takes the heap's id in the compute encoders'
hazard sets, whatever its tracking mode and whatever bytes it reaches. A heap is the one at its
offset in its block (`HeapRange`); `HeapIds` maps each to an id that lives while a resource of the
heap does, the entries of gone heaps dropped once the map doubles (at least 64). Textures placed
by `new_heap_texture` take it at once. Buffers take it through the new
`Device::new_heap_buffer(heap, offset, length)`, `MTLHeap`'s `newBufferWithLength:options:offset:`
(a buffer past the heap's end is `Refusal::HeapBufferPlace`); a buffer placed by `new_buffer` is no
heap's and keeps its own id. Views take their parent's; a texture in place over a heap buffer takes
the buffer's. Only the hazard sets read it: the copies over buffers and a pass's attachments keep
naming resources by their own ids (`Accesses::each(interface, tracked)`). The player places a
stream heap's buffers with `new_heap_buffer` and a stream block's with `new_buffer`; the
conformance crate's heap buffers take `new_heap_buffer`.

Why: Metal tracks a heap's resources as one, "tracking is done at the granularity of the heap"
(MTLHeap.h, hazardTrackingMode), and the old runtime keys a heap buffer's and a heap texture's
hazard identity by its heap (metal2vulkan-runtime heap.rs, tracker.rs). rt keyed them by resource,
so inside one encoder, or after an encoder that only read, a write through one heap resource and a
use of another over the same bytes got no barrier.

Tests: `every_device_orders_a_heap_s_resources_as_one`: two heap buffers over the same bytes take
a barrier between a write and a use and the second sees the first's words; two apart in one heap
take one too; two heaps' none; a buffer past its heap's end is refused; 200 heaps that come and go
leave at most 64 entries. docs/REFUSALS.md and the API signature table regenerated (two records
added: the method and the refusal).

Verified: cargo fmt; refusal_surface.py and signatures.py --bless. Build, clippy and the device
suites on the check job named when the branch is handed over.
2026-11-19 02:17:05 -08:00
Anees Iqbal e9c324a8f4 conformance: the decode cases' bound loosens metal2vulkan-rt's run alone; the old runtime's rows are as they were
The planner's ruling on the twelve old-side RADV rows f1aa961e34 added: the frozen old runtime
takes no new ledger row, so the case's notice-justified bound is scoped to the new runtime and the
old runtime's side keeps what it had, which was no bound.

A new justification, Justification::NewRuntimeNotice (Justification::new_runtime_notice), holds
on metal2vulkan-rt's run as a degrade notice does, where the run announced it; on the old
runtime's run it holds nowhere and faults nothing (Unjustified::OldRuntime, which faults_the_case
excludes beside VenueCompresses), so the site compares as if the case loosened nothing. The venue
says which side ran (Venue::new_runtime: true on the rt side, false on the old runtime's and on
Metal's), and replay hands it to the comparison (Offered::on_new_runtime). compare's check that a
named justification exists treats it as it treats a notice.

The ten BC1 to BC5 decode cases loosen each round's texels by NewRuntimeNotice
(compressed-texel-decode). known-gaps.tsv is the ledger as it was before ae452ee883: the twelve
RADV rows go, and the 89 BC rows that commit's series removed (lavapipe 44, the RTX 5080 Laptop
40, RADV BC4 and BC5 5) and their comment are back, since the old runtime's sites differ again
as they did.

docs/API.md: the catalogue says the cases' bound is the new runtime's alone.
scripts/conformance-coverage: the justification vocabulary reads new_runtime_notice;
docs/CONFORMANCE-COVERAGE.md regenerated.

Test: tests::a_notice_scoped_to_the_new_runtime_leaves_the_old_runtimes_site_its_one_row (the old
runtime's site is its one divergence, unfired for OldRuntime; rt's announced; rt without the
notice faults).
2026-11-19 02:01:42 -08:00
Anees Iqbal 608e084db1 rt: Block::external_writes_done, the acquire of another API's writes into an exported block
A decoder writes a frame into an exported block through its import of the handle; the
runtime's commands may read it only after the block's ownership comes back from the other
API's queue family. Vulkan's external memory requires that transfer whatever the sharing mode
(section 7.7.6, "Resources shared with external APIs or instances using external memory must
also explicitly manage ownership transfers between local and external queues").

Block::external_writes_done() records the acquire: one buffer barrier of the whole block, from
VK_QUEUE_FAMILY_EXTERNAL for an opaque handle (same device and driver) or from
VK_QUEUE_FAMILY_FOREIGN_EXT for a dma-buf (another driver), to the runtime's family, visible to
every later command. It goes in the upload, as zero_block_range's fill does: submitted ahead of
every command buffer committed after the call, holding the block until it completes, with no
wait for the GPU. The consumer calls it after its own wait on the decoder. A dma-buf names the
foreign family, which VUID-VkBufferMemoryBarrier2-srcQueueFamilyIndex-09099 allows only with
VK_EXT_queue_family_foreign enabled; new_exported_block already refuses a dma-buf export where
it is not (Limit::ExportType { listed: None }), so every exported dma-buf block can name it.

No release back to the other API is recorded. Section 7.7.6: "If an application does not need
the contents of a resource to remain valid when transferring from one queue family to another,
then the ownership transfer should be skipped." A decoder that overwrites the whole block needs
nothing the runtime left in it, so only the decoder-to-runtime direction is a transfer. The
contract, in the rt README beside the two calls: between external_writes_done and the other
API's next write of the whole block, the other API does not access the block, to read or to
write. The old runtime records the same acquire and no release.

Metrics::external_acquires counts the acquires (each also one of Metrics::barriers); the
replay report prints it. A block that is not exported is Refusal::NotExported. memory::Own's
Export carries the handle, which names the family.

docs/REFUSALS.md regenerated; api_signatures blessed.

Tests (src/tests/export.rs, device cfgs): after the second device has read rt's bytes, it fills
the whole block and releases it to the external family; external_writes_done is counted, and a
blit then reads the second device's bytes. An acquire of a taken block is refused typed.

Verified at this commit: cargo fmt only. The lane's build and device legs run on the tip that
carries it.
2026-11-19 01:50:14 -08:00
Anees Iqbal ea9b65a972 rt: Device::new_exported_block, one dedicated exportable allocation per block
The consumer's video path shares decode surfaces with a hardware decoder: the decoder imports
rt's memory and writes decoded frames into it. Metal has no counterpart, as it has none of
presenting.

The form is one on every device: an allocation of its own in the Private memory type,
dedicated to the one buffer that spans it (VkMemoryDedicatedAllocateInfo), exportable as the
handle the consumer names, never a range of a pooled allocation. Vulkan lets a driver require a
dedicated allocation for an export (VK_EXTERNAL_MEMORY_FEATURE_DEDICATED_ONLY_BIT), so the
dedicated form is the one every driver takes, and what exportable memory costs each submission
falls on these allocations alone.

- ExportHandle: OpaqueFd (unix), DmaBuf (unix), OpaqueWin32 (Windows). A handle is offered
  where the device lists its extensions and vkGetPhysicalDeviceExternalBufferProperties says its
  buffers export it; elsewhere Limit::NoExport, before anything is allocated.
- A dma-buf's other side is another driver, which an ownership transfer names as
  VK_QUEUE_FAMILY_FOREIGN_EXT; without VK_EXT_queue_family_foreign that family may not be named
  (VUID-VkBufferMemoryBarrier2-srcQueueFamilyIndex-09099), so a dma-buf export there is
  Limit::ExportType { listed: None }. A buffer whose memory requirements do not list the
  Private type is Limit::ExportType { listed: Some(bits) }.
- Export carries the new handle (the consumer's to close), the allocation's size and its memory
  type, which an import of an opaque handle names again
  (VUID-VkMemoryAllocateInfo-allocationSize-01742, and the dedicated import of
  VUID-VkMemoryDedicatedAllocateInfo-buffer-01879).
- The extensions stay out of the floor: VK_KHR_external_memory_win32 and
  VK_EXT_queue_family_foreign join the optional list, enabled where listed.
- Gauges::exports counts exported blocks whose memory is not yet freed; the block-maker thread
  frees them as it frees imports (memory::Own).
- No image is made in an exported block's memory, which is dedicated to its buffer
  (VUID-vkBindImageMemory-memory-10926): a texture over a buffer in it takes the counted copy,
  as over an import, and a heap texture in it is Gap::HeapTexture.

docs/REFUSALS.md regenerated; api_signatures blessed; the rt README has the call, its
extensions and its known gap.

Tests (src/tests/export.rs, device cfgs): every offered handle exports, is written by rt,
released by the test's own barrier and read back through a second device's import of the
handle, with the gauge back after the free; every other handle is refused typed; an exported
block holds no image; and the submit cost with 64 live exports against none, printed.

Verified at this commit: cargo fmt only. The lane's build (clippy plain and under both device
cfgs, Rustdoc, signatures, refusals) and device legs run on the tip that carries it.
2026-11-19 01:50:13 -08:00
Anees Iqbal f1aa961e34 conformance: RADV's BC1 to BC3 sRGB rows on the old runtime hold the case's unjustified bound too
The old runtime holds DriverFact::ColorBlockDecodeIsMetals for the RX 7900 XTX and the Radeon
780M, so it announces no compressed-texel-decode there, and the decode cases' bound, justified by
that notice alone, justifies nothing: each of the twelve sRGB sites now differs twice, as the
device's sRGB decode (the row already listed) and as the case's loosening that nothing
justified. m3-max-50924's old-side XTX leg named the twelve; each gets its row beside the site's.
rt notes every block-compressed texture, so it announces the notice there and the sites are
announced (the same leg's rt side).

docs/CONFORMANCE-COVERAGE.md regenerated.
2026-11-19 01:40:30 -08:00
Anees Iqbal 260163301f conformance: the fresh-texture test counts the decode notice; the catalogue's cost stays the old runtime's words
m3-max-50899's suites named three things of ee0827889e.

fresh_contents' a_row_loosens_the_notices_site_and_a_private_texture_s_fresh_site counted a
texture row's allowances without the compressed-texel-decode declaration its block-compressed
rows now make: it counts it, and holds that only those rows make it.

The old runtime's catalogue test holds an entry's Cost to the words the kind announces, before
whatever more it says: the measured bounds go after the announced cost (the RTX 2080's, and ANV's
and the UHD 630's BC3 alpha 2/255 and BC4/BC5 1.4/255, signed 0.0134, each BC4/BC5 texel within
0.0001 of the specification's exact decode), and the cost is the old runtime's again.

docs/CONFORMANCE-COVERAGE.md regenerated: 89 ledger rows fewer.

Verified: the bcref decode of the per-element dumps (the 2080, the Iris Xe and the UHD 630).
Expected: the suites green on msi with this commit.
2026-11-19 01:40:30 -08:00
Anees Iqbal 3a6eac60d5 conformance: the decode cases' bound takes float rounding; fills and fresh textures declare the decode note; stale BC rows go
The whole-set replays of c83f9b0db1 on lavapipe named three things.

texture-fills-130, -134 and -152 and the fresh-texture-bc1-rgba rows make block-compressed
textures, which rt now notes as CompressedTexelDecode, and declared no such notice: both
families now declare it at the notices site (texture_fills.rs among the native notes it already
declares; fresh_contents.rs where the row's format is block-compressed). Neither loosens a value.

The old runtime announces compressed-texel-decode on lavapipe for BC1 to BC5, so with the
cases' bound justified by that notice its 40 llvmpipe rows (256 bits) no longer diverge, and the
replay said so. Those rows go, with the 128-bit lavapipe rows and the RTX 5080 Laptop rows
(whose recorded largest differences all lie inside the family bounds) and RADV's BC4 and BC5
rows (RADV holds no ChannelBlockDecodeIsMetals, so the old runtime announces there). RADV's BC1
to BC3 sRGB rows stay: RADV holds ColorBlockDecodeIsMetals, so the old runtime announces nothing
there.

Each texel is a float, rounded by up to half an ulp of a value below 1, so two codes exactly a
bound apart can read a few billionths past it (6/255 between 128/255 and 134/255 in float is
6/255 + 3e-8): the bound takes f32::EPSILON / 2 on top. The RTX 2080's BC3 reached
0.023529410362, 1.4e-9 inside 6/255, by that luck alone.

docs/API.md: the catalogue's measured bounds, from the per-element dumps on the RTX 2080
(620.70.06), the Iris Xe (ANV) and the UHD 630 (Intel's Windows driver): ANV and the UHD 630
reach BC3's alpha 2/255 and BC4/BC5 1.4/255 (signed 0.0134), past the 1/255 and 1.3/255
(0.013) it stated; the 2080's BC1 to BC3 3/255 and BC3's alpha 6/255.
2026-11-19 01:40:30 -08:00
Anees Iqbal ae452ee883 rt: a block-compressed texture carries the static note of its decode, CompressedTexelDecode
A read, sample or gather of a BC texel on metal2vulkan-rt is the device's decode of the texture's
own blocks, where Metal interpolates a block's endpoints with 6-bit weights. rt carried no note of
it, so the ten BC1 to BC5 decode cases read divergent on every Linux venue with no notice behind
them. The old runtime announces the same difference as compressed-texel-decode, gated by driver
facts; rt decides by the format class alone, on every device, RADV included.

- PrecisionNote::CompressedTexelDecode in the translator's public enum (codec, and
  ARTIFACT_FORMAT_VERSION 544; fast_paths' "elsewhere" list; validation allows it unbounded).
  No pipeline stage records it, so no translation changes.
- Texture::precision_note: Some(CompressedTexelDecode) for a texture or view whose own pixel
  format has a block extent (metal::format::block_extent: BC1 to BC7, ASTC, ETC2, EAC, PVRTC;
  rt makes the last four only where the device holds the format), None otherwise, as
  DepthStencilState::precision_note is shaped. Device test: a BC1, BC7, ETC2 and ASTC 4x4
  texture (where the device makes it) and its sRGB view carry the note; RGBA8Unorm and its sRGB
  view carry none.
- The old runtime's Degradation::from_precision_note maps the note to its existing
  compressed-texel-decode kind (one arm, which the exhaustive match requires).
- The conformance rt side announces the note of every texture it makes (one keep_texture helper,
  makes_texture, and the work runner's made resources).
- compressed-texel-decode leaves the suite's native notes: its catalogue entry states bounds, and
  a native note loosens nothing. The ten BC decode cases declare it and loosen each round's
  texels by the catalogue's largest bound for the family on any driver (BC1/BC2 4/255, BC3
  6/255, BC4/BC5 7.4/255, signed 0.065; an sRGB form the sRGB decode's largest step over
  4/255). The other families that make a compressed texture declare it at the notices site
  alone: the BC moves and views, ASTC, ETC2/EAC, the read-write tier tables and the usage
  table of the descriptor pairs.
- docs/API.md's catalogue entry covers both runtimes; rt's README states the note;
  api_signatures and CONFORMANCE-COVERAGE regenerated.
2026-11-19 01:40:29 -08:00
Anees Iqbal c9637b0d08 replay: a descriptor-form no-copy buffer is a pool buffer; only the bytes form imports
The planner ruled the mapping: the player plays every descriptor-form no-copy buffer
(newBufferWithDescriptor: with noCopy) as a pool buffer, a buffer of a recorded block where
its recorded range lies in one and a place of its own elsewhere, and imports only the bytes
form (newBufferWithBytesNoCopy:length:options:deallocator:, the host's own in the recordings).

The recordings do not tell the program's own no-copy memory (an import in the product) from
the host's pool buffers, so that memory plays as a pool buffer too: a known gap. The host's
recorder makes a buffer over the program's memory only with a pinnedGpuAddress and no
zeroFrom (zeroFrom and unpinned buffers are always the host's own), so the report's gap line
bounds the gap by those outside every block, with their bytes. REPLAY-STREAM.md states the
mapping and the gap.

The test plays three descriptor-form buffers outside every block (one pinned with no
zeroFrom, one unpinned, one pinned with zeroFrom), a texture over the first read through a
blit, and checks the counts line, the gap line's bound of 1, and that the imported side
counts only the bytes-form buffer's texture copy.
2026-11-19 01:07:23 -08:00
Anees Iqbal 2fe8ac55c1 matrix: a host-time row past its limit by less than old's own move is VOID for the round
The frozen arm's second rule, beside FROZEN_DRIFT (the planner's ruling of 2026-11-19, reading
(a)): a row judged by its host time, and not by re-timed pairs, whose excess over its limit
(ratio over limit, less 1) is smaller than its own old time's move from the base in the round
is VOID, since the old runtime's drift alone could carry it there. GPU-time rows and rows judged
by their re-timed pairs are never voided by it. Neither rule makes a row red; the paired re-time
judges a red row.

harness_budget parks such a row as VOID with its excess and the move; the report's table reads
VOID for it (over_lines, through excess_voids); each leg's lines name the rows each rule voided
(print_leg). docs/VALIDATION.md states the rule.

The venue-wide reading was withdrawn: the frozen arm's largest moves sit on cold creation rows
(create_4KiB/device_first +88% on one leg of 7cda47f536) and would void nearly every host-time
row.

Verified: test_a_host_time_row_past_its_limit_by_less_than_old_s_own_move_is_void, in the
matrix unit job named in the next commit or the landing message.
2026-11-19 00:58:05 -08:00
Anees Iqbal c8e65bd9cb REPLAY-STREAM.md: the report's textures over buffers line 2026-11-19 00:49:43 -08:00
Anees Iqbal 01d40ad5fc replay: a descriptor-form no-copy buffer inside a recorded block is a buffer of it; others import
The product's no-copy buffers are not all imports. A newBufferWithDescriptor: with noCopy whose
recorded address and length lie inside a live block's recorded range (m2v.newBlockWithLength:
storageMode:) is the program's buffer in that block's storage, a pool buffer on rt; it now plays
as a buffer of that block at that offset, as m2v.newBufferInBlock:offset:length:options: does
(the in-block buffer path is one method both use), its bytes at its making put there first. Only
a descriptor-form one outside every block (the program's own no-copy memory) and the bytes form
(the host's own buffers in the recordings, never the program's) go through the import.

The backend keeps each live block's recorded range (imports::NoCopies) and counts the three
kinds; the report's no-copy buffers line replaces the no-copy imports line. REPLAY-STREAM.md says
which plays how. The no-copy device test adds a block recorded at an address and a
descriptor-form buffer recorded inside it: it reads the bytes written into the block there, and
the line counts it in the block, beside one descriptor-form and one bytes-form import. Verified
so far: nothing; the build and tests run in the check job.
2026-11-19 00:49:42 -08:00
Anees Iqbal 4521865fe5 rt: a stored slot bound to a texture with no storage element is Gap::StorageElement
A draw or dispatch whose function writes a texture slot, or reads one through
its storage image (access::read_write), bound to a texture made for shader
writes that has no storage element, dropped the writes and read zeros. Such a
texture is one whose format the device does not store through a storage image
without a format (the 8-bit sRGB formats, RGB9E5Float or BGR10A2Unorm where the
device lacks their storage), or holds through a view of another (A8Unorm in
red, the extended-range formats).

That draw or dispatch is now refused with Gap::StorageElement { slot,
pixel_format }, found where the swizzled read_write gap is found: at the
dispatch's bind check and at the draw's Facts::find. Which slots count is the
bound function's own access (a write, or a storage read), not the texture's
ShaderWrite usage bit. A texture made without ShaderWrite (and not of Metal's
unknown usage) is outside documented Metal when written, and is not refused.
A texture an argument buffer reaches by its resource ID is not seen at the
bind; its writes stay dropped, recorded in the runtime README's known gaps.

The refusal stands until the alias storage element lands: a view of the
nearest format whose storage Vulkan requires of every device, with the
translator's conversion.

docs/REFUSALS.md regenerated; api_signatures gains the variant.

Test: storage_element::every_device_refuses_a_stored_slot_bound_to_a_texture_
with_no_storage_element binds a 2x2 RGBA8Unorm_sRGB texture to a write slot
and a read_write slot, and expects the gap exactly where the device's optimal
tiling lacks STORAGE_IMAGE with STORAGE_WRITE_WITHOUT_FORMAT, a dispatch
elsewhere, and a read slot dispatching everywhere.
2026-11-19 00:48:41 -08:00
Anees Iqbal 5250b8dd7b rt: the over-copies over imported blocks are counted on their own side
Metrics::over_copies_imported and Metrics::over_copy_bytes_imported count the copies between a
texture over a buffer and its image of its own where the bytes shaders reach are in an imported
block (host memory or a dma-buf), beside over_copies and over_copy_bytes, which still count every
such copy; the rest are over the runtime's own blocks, where the device's linear image does not
take the texture. One mechanism: OverCopy carries whether its buffer's bytes are imported, and
Counters::over_copied adds the imported side where it is. A first-boot report can then read the
imports' copies alone, and a play the pool buffers' copies (total less imported).

The api_signatures rows, the doc lines (Metrics, over.rs, the README) and the player's per-frame
counters carry the two. Tests: copy_over's device test asserts its texture over a buffer in a
taken block moves neither imported counter; the import test asserts every copy of its texture
over an imported block counts on the imported side, its texels' bytes each; the player's no-copy
device test asserts its one copy is imported. Verified so far: signatures.py --check; the build
and tests run in the check job.
2026-11-19 00:45:36 -08:00
Anees Iqbal 324cfb72cf replay: the new runtime's player imports no-copy buffers' memory; rt counts over-copy bytes
Both no-copy creators (newBufferWithBytesNoCopy:length:options:deallocator:, and
newBufferWithDescriptor: with noCopy) now make their buffers over zeroed host pages of the
player's own, each imported as a block of its own through rt's import_host_memory, as the
product imports the program's pages; the import's release frees the pages once the runtime has
freed the import. A texture over such a buffer is then the runtime's counted copy, so a play's
frames count those copies. A device without host-memory import refuses a no-copy buffer by name.
Two-copy forms keep their second copy: the import holds the CPU's copy where the runtime keeps a
GPU copy, and the copy shaders reach where the player keeps the second copy itself. Release and
command-buffer use tracking now cover a buffer with no place of its own but a device copy or an
aside.

rt gains one deterministic metric, Metrics::over_copy_bytes: the bytes of the copies between a
texture over a buffer and its image of its own, still counted in bytes_copied
(Counters::over_copied adds all three; the now unused Metric::OverCopies is gone). The player's
per-frame counters carry it, its drop gauges and live gauges carry rt's imports gauge, and its
report gains a no-copy imports line.

Tests: rt's copy_over device test checks each copy adds the texture's bytes to both byte
metrics; a new rt_replay device test plays both creators, a texture over the first, a blit of
the texture checked against the stream's bytes, one over-copy of 64 bytes, the imports line and
the imports gauge at zero at device drop. Verified so far: signatures.py --check passes; the
build and tests run in the check job.
2026-11-19 00:14:01 -08:00
Anees Iqbal 4a393990fa rt: a presenting command buffer is scheduled once its submission passed vkQueueSubmit2
What: the planner's change to the presenting design, and its additions.
- Scheduled means, for a command buffer that presents a drawable, that its submission has passed
  vkQueueSubmit2: the submit thread no longer schedules it as its last segment joins the group
  (the group goes at once anyway), but in submit(), between queue_submit2 and
  core.done.submitted, which is where the completion thread first learns of the batch
  (complete.rs, Done::submitted). Its status, kernel times, scheduled handlers and
  wait_until_scheduled all follow the call, with no window and no wait across threads, and its
  scheduled handlers still run before its completed handlers. A failed submission schedules
  nothing: its handlers run as it retires, as an ended command buffer's do. The split wait
  (CbState::signal_unsubmitted) is gone.
- A present from the command buffer's own scheduled handler is valid now; the docs still say to
  present from the consumer's thread, as the handler runs on the submit thread.
- Several drawables in one command buffer each signal their own semaphore; the same semaphore
  twice is Refusal::DrawableSemaphoreRepeated (new), the same drawable twice
  Refusal::DrawableNotAcquired.
- The Safety texts of the three unsafe calls name the Vulkan rules the runtime cannot check (the
  image is that swapchain's; `ready` unsignalled with no signal or wait pending; the swapchain not
  destroyed while in use).
- The README's "Destroying a swapchain": which completions and drops come first
  (VUID-vkDestroySwapchainKHR-swapchain-01282); views may outlive the image, as Vulkan's object
  lifetime rules let a child of the device outlive the image it views.

Tests: the render test's second frame presents from the scheduled handler, the first and third
from the test's thread beside a handler that sleeps 100 ms; both drawables' teardowns follow the
guide, destroying the stand-in image before the views go; a new test presents two drawables from
one command buffer and checks the two refusals. Not yet run: potluck jobs next.
2026-11-19 00:08:46 -08:00
Anees Iqbal e5157492d7 rt: drawables' textures over a swapchain's images, their acquire, and a present that signals the consumer's semaphore
What: the two presenting pieces the new runtime lacked, so a consumer can present on the
runtime's own device.
- Device::new_drawable_texture (unsafe): a texture over an image of the consumer's swapchain,
  checked against the swapchain's create info (2D, one level, its extent and one layer; the format
  the runtime holds the pixel format in; usage holding the texture's, transfer included). Its home
  layout, views, set 1 elements and hazards come from the existing plan (form()). The image is
  never destroyed by the runtime: Backing::Drawable, and the reaper frees only the views.
- Texture::drawable_acquired (unsafe): re-arms the existing homing, so the upload of the next
  submission moves the image home ahead of every later commit; from UNDEFINED the first time and
  from PRESENT_SRC_KHR after a present (texels kept).
- CommandBuffer::present_drawable (unsafe): at commit the last segment's end barrier also moves the
  image home -> PRESENT_SRC_KHR, and that segment's submit info signals the consumer's binary
  semaphore beside the progress semaphore; the group goes at once, as an event signal's does.
- wait_until_scheduled of a presenting command buffer returns once its submission passed
  vkQueueSubmit2: rt marks a command buffer Scheduled, and runs its scheduled handlers, before the
  submit, so a present made after the wait could otherwise wait on an unsubmitted binary signal
  (VUID-vkQueuePresentKHR-pWaitSemaphores-03268), on the shared and on the reserved present queue.
- Refusals with their basis: DrawableDescriptor, DrawableFormat, DrawableUsage, NotDrawable,
  DrawableAcquired, DrawableNotAcquired. docs/REFUSALS.md regenerated, api_signatures blessed
  (9 records added, none removed or changed). The README's presenting section replaces the
  "not built yet" lines, with its known gaps (no acquire semaphore; no present from the presenting
  command buffer's own scheduled handler; a presenting command buffer that never runs leaves the
  image acquired).

Tests (src/tests/present.rs, device cfgs, validation layer): an image made as a swapchain's
stands in for one; three frames of acquire, pass, present and a stand-in present that waits on
the semaphore on the presenting queue and copies the image out of PRESENT_SRC_KHR, for a
render-target and a shader-read drawable; the presenting command buffer's sleeping scheduled
handler must have returned before wait_until_scheduled does; each refusal. Not yet run: built
and run in potluck jobs next.
2026-11-19 00:08:18 -08:00
Anees Iqbal 7cda47f536 matrix: an owned row fails only 3% past its owned ratio; a one-pass outlier is timed again
An open record in status.tsv now names the ratio its row was owned at (the new `owned` column,
filled for the existing entries from the matrix note of b0c08e51b5). The harness budget names a
row past its limit that an open record holds and fails nothing while the ratio it is judged by,
after its re-time, is within 3% of the owned ratio (results.OWNED_WORSE); more than 3% worse, the
row fails its leg again. A known gap's row fails only past a ceiling a ruling gave it
(HARNESS_CEILINGS), as before; one without a ruled ceiling is listed and fails nothing. The
report's table shows the owned ratio and whether the row is within it, and after the table names
every open record and gap whose rows are within their limits on every leg of their card that
timed them, for removal (results.entries_within).

A cross-GPU outlier of a harness row's time on the new runtime no longer fails a leg from one
pass: once every leg is in, the legs with one have their harness timed once more (Run.retime: a
node's legs in turn, the nodes at once, each job holding its node alone), and an outlier fails
only where both passes agree (results.time_outliers with the first pass); one that only one pass
has is parked and named. Outliers of other records fail at once, as before.

Verified: the matrix's unit tests (test_results.py, test_matrix.py), run from scripts/matrix in
a potluck job; new tests cover the owned verdicts (within, worse, re-timed, a first take), the
gaps with and without a ruled ceiling, the removal list, the two-pass outlier rule and the
re-time's jobs.
2026-11-18 23:45:49 -08:00
Anees Iqbal 2db8331d56 command-replay: the new runtime's gauges at device drop go out as the matrix's lines
After the play, the new runtime's backend ends its device (NewRuntime::end) and now hands back
what it read once the device dropped (Ended: every rt::Gauges field by name, threads as the
slots still held, whether all read zero, whether it quiesced). command-replay writes one line per
gauge into the report, "M2V-MATRIX gauge replay-rt/device/GAUGE@drop N", the matrix's own record
form (scripts/matrix/results.py's RECORD pattern; its rule fails a gauge not 0 at @drop), so any
play job's output can be checked by that rule. The teardown error now names only the gauges not
at zero. The old runtime's counts end with its device, so its plays print none.

Tests: a unit test of the lines' form and the error's naming; the rt device test of a play that
ends with a command buffer held asserts every line is "M2V-MATRIX gauge KEY@drop 0". The stream
guide's report section says so. Checked by the lane's check job (named in the report to main).
2026-11-18 23:41:05 -08:00
Anees Iqbal feec58e2f5 rt: a texture over a buffer in an imported block is the counted copy, on every device
replay's census C: the window server (b3) makes 425 textures over its no-copy buffers, and every
no-copy buffer is now an import, so refusing them (Gap::TextureOverBuffer in d335594515) would
refuse the window server's textures. They take rt's existing copy form instead: an image of its
own, which the device copies the buffer's bytes into before the submissions that use it and back
after a command writes it, counted in Metrics::over_copies. The buffer stays the import itself.

The runtime makes no image in imported memory. Such an image would be made for the import's
handle (VUID-vkBindImageMemory-memory-02728), so in the undefined layout
(VUID-VkImageCreateInfo-pNext-01443). An acquire from VK_QUEUE_FAMILY_FOREIGN_EXT is not used: it
needs a matching release (7.7.6), which host writes do not make (host memory imported by its
address is shared with the host as host access), and it leaves an aliasing resource's contents
undefined (7.7.6). Whether an in-place form exists stays open with the planner until the copy's
cost is measured.

- check_over answers the copy for a buffer in an imported block; Gap::TextureOverBuffer's doc
  goes back to its old cases; new_texture's doc and the README say how such a texture is made,
  and the README records it as a known gap.
- Tests: the import device tests run on every platform (host memory from std::alloc; the
  shared-file mapping test unix-only), so the Windows UHD leg runs them. A texture over imported
  host memory is copied on every device, reads the host's own bytes, its writes reach the host,
  and both copies count in over_copies.
- REFUSALS regenerated for the import limits (the rebase took development's at d335594515).

Verified: nothing yet; the check job and the device legs follow.
2026-11-18 23:38:06 -08:00
Anees Iqbal bc6dc40a14 player: the old runtime plays a recorded heap as its buffers and its textures apart
On the old runtime's player, a heap with a recorded range is now made by what the stream places
in it (read ahead), whatever its type:
- its buffers go in a heap at the recorded address and of the recorded size, each at its
  recorded offset, never laid out again (a pinned span never grows);
- its textures go in a heap outside the pinned space, laid out for the runtime's sizes as the
  texture-only rule did. It is one heap, so textures placed at one offset still share.
Buffer-only = the pinned heap alone, texture-only (or nothing placed) = the outside heap alone,
mixed = both. Backend::holds_no_buffer becomes Backend::split_heap(heap, HeapSplit); the old
backend holds a split heap as Object::Heap(buffers' heap, textures' heap), and useHeap: uses
both. A buffer the runtime refuses at its recorded offset in its heap now stops the play typed
(PlayError::Unpinned with the runtime's reason) instead of as a Runtime error.

Why: u4's old arm stopped at f1033 on mixed heap #188906 (4 MiB placement, 2600 buffers and 1000
textures over its life): the relayout grew it for the runtime's texture sizes, and the pinned
heap's grown span met #188909, recorded 0x8968 bytes past the heap's Metal span. u2 and u3 carry
the same heap twice each, u4 again at f1059.

The report line becomes "pinned N of N; K heaps' textures outside; S textures whose recorded
range (by the runtime's texture sizes) met a live buffer's". S comes from the read-ahead: a
texture's range is the heap's recorded address plus its offset for the runtime's size answer
(the stream holds no texture size), a buffer's its recorded range; reported, not a stop. The
heap code moves to replay/heaps.rs (relay, placement helpers, HeapSplit, Overlaps).

Safe by census (jobs 50282-50286, every stream on five nodes, 29 names): every heap is a
placement heap; no call takes a heap as receiver except the placements, none names a heap as an
argument, and no heap or size getter is recorded; the only calls on heap resources are
m2v.privateBytes on heap buffers and texture views of heap textures, neither compared. The
automatic-heap half rests on its unit test, as REPLAY-STREAM.md now says.

Tests: unit tests for the three shapes (textures alone, buffers alone with an alignment that
would move them, mixed with a larger texture and a met buffer) and for automatic heaps; a
lavapipe device test of a mixed heap whose texture the runtime makes larger, with a buffer
pinned right past the heap's recorded span that keeps its address. The negative control (no
split told, the whole heap relaid) must fail them; the check job and its inner codes are named
in the report to main.
2026-11-18 23:34:38 -08:00
Anees Iqbal b28b4975b5 matrix: the GPU legs run the replay player's stream device tests; status rows lose closed owners
The GPU legs' archive held metal2vulkan-rt alone, so the replay player's
stream device tests (metal2vulkan-validation's runtime_lane::replay_streams,
17 on the old runtime, and runtime_lane::rt_replay, 24 on the new) ran on
lavapipe only. A break in the player or a runtime's stream path that only a
GPU shows waited for a lane's play of a recorded stream to find it, as the
old arm's pin stop did. The archive now holds the validation crate too, and a
leg runs the runtime's tests and those two modules (DEVICE_TEST_FILTER). The
Windows leg is unchanged until the validation crate is shown to build there.

status.tsv, by the planner's ruling of 2026-11-18:
- 10de:1e87 frame_5cb is a gap row: the runtime guide's known gaps carry it
  (crates/metal2vulkan-rt/README.md, NVIDIA's latency per submission).
- 8086:a7a0 frame_5cb and 10de:2204 create_state/first are within their
  limits; their closed lanes' names are cleared (a row gets an owner when it
  goes over).
- identity's rows wait for their card's native table, the guest-visible test;
  "Iris swing unresolved" was stale.

Verified: see the check job named in the landing message (unit tests of the
matrix script, the archive built with both packages under --cfg m2v_gpu, the
filter's selection listed, and the selected tests run on a GPU).
2026-11-18 23:14:02 -08:00
Anees Iqbal 1ee16e6a0f command-replay: every report line, the frame lines among them, goes to the standard error too
identity's scripts lost 50152's record when they deleted the job's temporary directory, where
report.txt lay. The planner ruled that the player prints each report line and each frame-end line
to stderr as well as to report.txt, so no script can lose them.

ReportFile, the one writer of report.txt, now implements Write. Each write goes to the file and
then to stderr, and the player's frame lines go through it (with_frame_lines takes the report
rather than its file). A failed stderr write never fails the file's. REPLAY-STREAM.md section 10
and the binary's docs say where the lines go.

Test: the range test's helper runs command-replay and asserts that its stderr carries every
report.txt line, in order. All its plays stop before a device opens, so no device is needed.
2026-11-18 22:53:43 -08:00
Anees Iqbal 331ff7bcba player: the old runtime makes a heap the stream places no buffer in outside the pinned space
glbench-3090-r4's old arm stopped at f198: buffer #22759, pinned at 0x4020086d8000 (32 KiB past
heap #22754's recorded end), met the span the old runtime held for #22754. #22754 is a placement
heap that holds six RGBA16Float textures and no buffer. The player lays placement heaps out again
for the runtime's texture sizes, and grew it from 2 MiB to about 2.5 MiB; pinned at its recorded
address, the grown heap held #22759's pages. In Metal the two never meet.

The rule (the planner's): on the old arm a heap is pinned only where the stream places a buffer
in it. A texture has no address and a heap answers none, so no address the program holds lies in
a heap without buffers, and pinning it buys nothing. The read-ahead finds those heaps from the
stream alone, never from the runtime's size answers or what the space holds, so the old arm's
address layout is the same on every card. The player tells the backend before the making
(Backend::holds_no_buffer). The old backend makes the heap outside the space, and the address map
keeps its recorded range at its recorded address, so the address census is unchanged. A heap that
holds a buffer keeps its recorded address and the typed stop where its grown span meets another
pin.

The report's pinned line now says "pinned N of N; K heaps without buffers outside: ...".
REPLAY-STREAM.md sections 5, 9 and 10 say so.

Tests:
- a_heap_without_buffers_is_made_outside_the_recorded_addresses (player, no device). The test
  backend pins. A texture-only heap is told and made outside; a heap with a buffer, and its
  buffer, are made at their recorded addresses. A word into the outside heap's range is still
  counted, and no word moves.
- a_heap_without_buffers_leaves_the_next_pin_its_address (old runtime, device). A 64-KiB pinned
  heap holds only a 256-KiB texture, and a buffer is pinned at the first granule past the heap's
  recorded span. Without the fix the grown heap's span holds the buffer's and the play stops.
2026-11-18 22:52:47 -08:00
Anees Iqbal a3ff94f510 replay: the escape note (m2v.bufferEscaped) and a stop on a written word into a noted buffer
The recorder will note a buffer whose address may escape into the program's memory: once in the
buffer's life, at the first gpuAddress read (kind 0), argument-encoder write (1), gpuResourceID
read of a texture over it (2) or residency-set add (3); the whole buffer escapes. No stream
carries the note yet.

The player now reads m2v.bufferEscaped: the receiver must be a made object and the one argument
a kind from 0 to 3, else the stream is invalid. Once a buffer's note is read, a written word that
looks like an address (the census's aligned words) whose value lies in that buffer's recorded
range stops the play with PlayError::NotedWord {target, offset, value, buffer, kind}. Moving such
a word is not built: no stream exercises it, and the move gets built with the first stream that
does. AddressMap::noted_word finds the word at any nesting level. The lookup runs only once a
note was read, so a stream without notes pays nothing for it.

The report counts the notes (Report::escape_notes); the addresses line ends "the stream predates
the escape note" where there are none, "escape notes N" otherwise.

Test (unit, a synthetic stream): a note, then a write of a word into the noted buffer stops,
naming the word; the same kind of word into a buffer with no note played as written before it;
a kind past 3 and a note of an unmade object are invalid streams. docs/REPLAY-STREAM.md section 5
holds the record and the stop, section 10 the line.

Verification: the replay checks run as a potluck job on this commit.
2026-11-18 22:02:15 -08:00
Anees Iqbal d2834389c7 replay: written words play as recorded on both runtimes; a census counts the address-looking ones
The player rewrote every 8-byte word of written bytes whose value lay in a live recorded range.
On a stream recorded before the escape note a word's value cannot tell an address from data,
and on u4 that rewrote two 32-bit indices of an index array into an address of the play, which a
kernel later read through out of bounds (the rewrite-off control played u4 whole with no fault).

Now no written word moves on its value, on either runtime:
- The address map's word pass is a census that writes nothing (AddressMap::census). It counts
  address_looking_words (aligned 8-byte words in a live range) and misaligned_address_words in
  the same bytes as before: writes, copied contents, guest-RAM copies and Private bytes before a
  dispatch into objects that answered a gpuAddress, and set*Bytes data. Both are stream-fixed,
  equal on both runtimes.
- What moves are typed address arguments (tag 8), through the map: relocated_words now counts
  only those that moved, so it is zero on the old runtime, whose ranges are at their recorded
  addresses.
- unrelocated_writes is deleted: no written word is relocated anywhere, so it meant nothing.
- A Private range's bytes after a dispatch are compared as recorded.
- The report's relocation line becomes "addresses address_looking_words=N
  misaligned_address_words=N address_arguments=N relocated_words=N differing_ids=N: written
  words play as recorded; the stream predates the escape note".

Tests:
- unit: written words play as recorded and are counted; a typed address argument moves with its
  object (and one in no range stays); guest-RAM copies and copied contents play as recorded;
  the census counts by alignment.
- device, rt: a data word in a live range plays as written (sha check); the census is the same
  on the old and new runtimes (and the old pinned both objects).
- The rt granule test read the runtime's addresses through relocated words; it now checks the
  places line's slack (each place spans its length rounded up to its recorded granule).
docs/REPLAY-STREAM.md sections 5 and 10 and docs/VALIDATION.md say the new form.

The escape note (m2v.bufferEscaped) and the stop on a word into a noted buffer follow in their
own commit.

Verification: the replay checks (clippy in three configurations, replay unit tests, the replay
device tests on lavapipe, rustdoc) run as a potluck job on this commit.
2026-11-18 22:02:15 -08:00
Anees Iqbal 43ef0ce7de conformance: tessellation-rendered-patches, triangle patches drawn into a target
The suite's tessellation cases read the tessellator's domain points with
rasterization off; none renders a patch. This case draws the owned fixture
tess_rendered_patches (a triangle patch of three control points fetched per
patch control point, a colour fetched per patch and passed flat) into an
8 by 8 RGBA8Unorm target under a recorded stream's patch-draw state
(fractionalOdd up to 64, factors per patch, counter-clockwise), with the
factors 8 bytes into their buffer. Two passes: `drawn` draws patches 0 and 1
(patch 1's zero edge factor culls it), then patch 3 alone from patch start 3;
`back-culled` culls back faces and draws all four, where patch 3 is patch 2
mirrored. Every texel is 0 or 255 per channel and no slanted edge meets a
texel centre, so the answer is exact whatever the tessellator's inner
points.

Recorded on the M3 Max (macOS 27.0.1) in job m3-max-49694, with its times;
a test holds the recorded texels to the module's description of Metal's
answer. The case lands without a cost record: a cost record is a whole-set
measurement, and `cost --alone` folds into one that does not exist yet.
docs/CONFORMANCE-COVERAGE.md regenerated.
2026-11-18 22:00:55 -08:00
Anees Iqbal 16f750a424 replay: the old runtime's player makes every recorded range at its recorded address
The player's old backend made each object where the runtime had room and relocated every
8-byte word that lay in a live recorded range. A data word whose value happened to lie in one
(two 32-bit indices in a pixel-sized index array) was rewritten into an address of the play,
and a later kernel read through it out of bounds.

Now the old backend makes every object that answered a gpuAddress at that address
(AddressPlacement::At): device buffers of every making form, blocks and heaps, the
descriptor's pinnedGpuAddress aside, so heaps take their answer too. Every other object, and
the player's own staging, readback and host buffers, go Outside ([2^47, 2^48), past every span
a pin can take). A refused pin, or an object made at another address than it recorded, stops
the play with PlayError::Unpinned naming the object; no other placement is tried. The address
map still runs, with each range's base its recorded address, so it moves no word, every
address argument plays as recorded, and relocated_words and the other stream-fixed counts stay
equal across runtimes. The report adds "pinned N of N".

The new runtime's backend is unchanged (Backend::places_at_recorded defaults to false).

Tests (device, old runtime): the pointer-chain test now also asserts its four objects pinned;
a data word in a live range plays as written; a pin inside another's span stops typed.
docs/REPLAY-STREAM.md sections 5 and 10 describe the form and the report line.

Verification: the replay checks (clippy in both cfgs, the replay unit tests, the replay
device tests on lavapipe, rustdoc) run as a potluck job on this commit.
2026-11-18 21:52:44 -08:00
Anees Iqbal 2e1b543f1b rt: patch draw device tests; the address form reads no word past the factors; the player gives the recorded tessellation state (work in progress)
The address form read one word past a patch's factors where they start at a
multiple of 4; it now reads the first word again there, so every word it
reads holds a factor's byte (the interpreter test trapped on the over-read).

The players gave the recorded tessellation state only where the vertex
function's patchType was not None. The glbench streams' patch functions
answer None (their container has no TESS tag) while their AIR is
post-tessellation, so the state was dropped and the translator drew their
patches under Metal's defaults. The state now goes to every pipeline where it
differs from the defaults; the translator decides from the AIR and ignores it
for a plain vertex function, as Metal does.
2026-11-18 21:04:27 -08:00
Anees Iqbal 4454b23eb4 rt: patch draws in the player, README and refusals (work in progress) 2026-11-18 21:04:27 -08:00
Anees Iqbal 4196a258ec Re-derive the generated documents at the landing tip
They are generated from the whole case set, and the set grew on `development`
while this branch was in flight, so the copy committed here counted a smaller
one.

Verified: regenerating at this tip leaves no change beyond the `Generated at`
stamp.
2026-11-18 20:11:45 -08:00
Anees Iqbal f6d308a628 rt tests: the indirect-place and given-back tests read the pool's one VkBuffer per allocation
What:
- compute::every_device_reads_indirect_arguments_only_at_a_multiple_of_4_of_their_block expects
  Refusal::ArgumentPlace's place as the arguments' byte of the block's allocation (the block's
  offset there plus their place in the block). Vulkan reads indirect arguments at a multiple of
  4 of the VkBuffer, which now spans the allocation, so that is the byte the check reads. The
  refusal's docs, dispatch_threadgroups_with_indirect_buffer's and draw_indexed_primitives' say
  so; docs/REFUSALS.md regenerated.
- large::every_device_takes_no_block_an_encoded_uncommitted_command_buffer_holds asserted that
  the next take of a given-back length gets that range again. The pool takes a zeroed range
  first, so it need not. The test now asserts what it is for: the pool does not hold the block
  while the encoded command buffer holds it, and holds it once the command buffer is dropped.

Why: both expected the per-block VkBuffer that 96340f0f9d deleted. The legs on 96340f0f9d's
archives failed exactly these two on lavapipe (49447), the Iris (49459), the 2080 (49460), the
3090 (49462) and the M3 (49463); nothing else of the pool failed there.

Verified: nothing yet for this commit; its check and legs follow.
2026-11-18 19:17:44 -08:00
Anees Iqbal 2efe8b1582 translator: the fractional-spacing note's measured drivers include ANV
PrecisionNote::TessellationFractionalSpacing's doc and its API.md entry
listed ANV among the drivers not measured. A consumer's tessellation pixel
test (its render_tess_bump device test) passed on its Iris Xe (ANV) leg,
so ANV's fractional partitions matched Metal's answers in that test's
cases. The note now lists RADV (780M, RX 7900 XTX), NVIDIA Turing, ANV
and MoltenVK, and says factors past the device's range are not measured:
no test sets one.

Docs only; no behaviour changes. Verified: cargo fmt --all.
2026-11-18 19:10:23 -08:00
Anees Iqbal f940151891 translator: a fractional partition on the device's tessellator carries a static note
Vulkan leaves where a fractional spacing places its vertices to the implementation ("Tessellator
Spacing": the two shorter segments' length need only fall monotonically with n - f, and their
place on the edge is the implementation's), where Metal's tessellator places them by its own rule.
No note said so: rule 1 wants a static note on an operation whose answer can differ from Metal's.

PrecisionNote::TessellationFractionalSpacing is now recorded on the evaluation stage of every
pipeline of a fractionalOdd or fractionalEven partition drawn through the device's tessellation
stages (Control::notes); the emulation, Metal's tessellator, records none. Its documentation
states the measurement: equal to Metal's by a consumer's device tests on RADV (Radeon 780M, RX 7900
XTX), NVIDIA Turing and MoltenVK; other drivers, ANV and lavapipe among them, are not measured.

The old runtime takes it as a note kind (tessellation-fractional-spacing), validation allows it
unbounded, codec and ARTIFACT_FORMAT_VERSION 542, SEMANTICS_VERSION 2184 (the evaluation stage's
notes change), fast_paths' list, API.md's catalogue; the tessellation engine test expects it on
the fractional cases and on no emulated stage. api_signatures regenerated.
2026-11-18 19:10:23 -08:00
Anees Iqbal 28f2735f52 translator: the tessellation winding's vertex order is measured, on four drivers
Metal's clockwise output winding maps to VertexOrderCcw and its counter-clockwise one to
VertexOrderCw. The control stage's docs, PrecisionNote::TessellationWinding and API.md called
that an unobserved reading of MoltenVK's mapping. A consumer's device test,
tessellation_states_tessellate_as_metals, now matches Metal's bytes (recorded on the M3 Max) for
both windings on RADV (Radeon 780M, RX 7900 XTX), NVIDIA Turing and MoltenVK; the docs say so,
and that other drivers are not measured. The note stays: it is still recorded on every
tessellation pipeline. Docs only.
2026-11-18 19:10:23 -08:00
Anees Iqbal 4df69ca062 rt: generateMipmapsForTexture:, the device's linear blit of each level, under a static note
web3d calls generateMipmapsForTexture: once in each stream, which the player skipped and counted
(mipmaps 1). It is built as Apple defines the call: each level below the texture's first made
from the level above it, over each slice, a view's levels and slices its own.

- BlitCommandEncoder::generate_mipmaps: one vkCmdBlitImage a level with VK_FILTER_LINEAR, the
  first level read and the rest written whole (their old contents discarded) behind the copy's
  first barrier, one barrier between each level and the next, and the last bringing every level
  home, the last level's writes visible to every later command. A texture of one level records
  nothing.
- Refusal::MipmapFormat for a format Apple defines no mipmaps of (a depth or stencil, compressed,
  YCbCr or integer one: not colour-renderable and filterable); Gap::MipmapFilter where the
  device's format query lacks blits from and to the image's format or its linear filtering,
  where the image holds the pixel format through a conversion, and for a view in another format
  than its image's, whose blit would filter the image's.
- PrecisionNote::DeviceFilteredMipmaps, the static note BlitCommandEncoder::GENERATE_MIPMAPS_NOTE
  carries: the filter is the device's, where Apple states none. The old runtime announces it as
  its existing device-filtered-mipmaps kind; validation allows it unbounded; codec and
  ARTIFACT_FORMAT_VERSION 541, fast_paths' list, API.md's catalogue entry.
- The conformance rt side plays Step::GenerateMipmaps and announces the note; the replay player
  plays the call and its skipped_mipmaps counter is gone (REPLAY-STREAM.md).
- Test: an 8x8 RGBA8Unorm texture of four levels, each level below the first within one code of
  the box of the four texels it halves in the level above as the device left them, its first
  level kept, one submission and the chain's four barriers besides the segment's end; one level
  records nothing; RGBA8Uint is Refusal::MipmapFormat. REFUSALS and api_signatures regenerated.
2026-11-18 19:10:22 -08:00
Anees Iqbal 899270a674 rt: the pool is free ranges with a zero mark; hooks per allocation; one VkBuffer per allocation
What:
- One mechanism. A block given back is a free range of its allocation at once. The kept list, the
  returned fast path, unkeep and the take's wait for the block-maker thread are deleted.
- A take is the first free range that fits whose bytes are all zeroed, else the first that fits,
  in the order the allocations were made. It runs under the pool's lock, with no Vulkan call and
  no hook (Metrics::takes_from_free_ranges).
- A long allocation, which a take longer than 16 MiB made for itself, serves only takes of exactly
  its length. Metrics::shared_long_reuses and private_long_reuses count such takes after the
  first. Gauges::shared_long_reused_bytes and private_long_reused_bytes count the bytes of long
  allocations that hold one.
- The block-maker thread zeroes free Shared bytes that are not clean in 256 KiB steps, the
  allocations in the order they were made (Metrics::free_bytes_zeroed, free_zeroing_nanos). It
  starts no step while a consumer memset runs (Pool::fill, Metrics::zero_steps_held), the rule of
  76c6f5d071.
- Metrics::zeroed_bytes_used counts the bytes of zeroed Shared buffers that a zero mark covered,
  so the buffer's memset skipped them: the block-maker thread's zeroing that a buffer used,
  against Metrics::bytes_zeroed, the consumer's thread's. Per stream, the two decide whether the
  thread's zero steps are worth keeping.
- The hooks are per allocation:
  - BlockMappings::map(&AllocationInfo) runs before any block of an allocation goes out, outside
    the pool's lock: in Device::new for each class's first, on the block-maker thread ahead of
    need (Metrics::allocations_mapped), and inside a take that made its own
    (Metrics::allocations_mapped_on_takes).
  - A refusal frees the allocation, hands out none of its blocks and fails the take with
    Limit::AllocationNotMapped (Metrics::allocation_map_refusals).
  - BlockMappings::unmap(AllocationId) runs before vkFreeMemory, outside the lock. Quiesce and
    teardown go through it.
  - The per-block hook, BlockMappings::unmap(BlockId), is deleted. Its consumer, reims-vgpu,
    promises (its merge batch 232):
      "reims-vgpu's pool calls release_block only after the block's piece is out of the guest's
      address space (the host answered pool_removed; at the device's release the host has
      removed every piece first, as the API requires) and no thread of the device holds it, and
      it never touches the block afterwards, so the runtime may free any block it gets back at
      once, with no call into the consumer."
- BlockInfo carries its allocation's number and its offset there.
- One VkBuffer per allocation:
  - a block's commands reach it through Memory::range(offset), which gives (allocation buffer,
    base + offset);
  - the block's address is set at carve, with no Vulkan call;
  - the per-block VkBuffer, texture blocks' included, is deleted.
- The reserve: the newest idle 16 MiB allocations with free bytes that keep 8 MiB free. With no
  kept blocks, an idle allocation's bytes are all free, so the reserve is one 16 MiB allocation of
  each class at most.
- The README states the contract: the pool's allocations are in the guest's range whole, free
  ranges included; the consumer hands the guest blocks only; a guest kernel that writes a free
  range damages only its own later buffers.

Why: the planner's pool ruling. Each allocation costs a VMM ask once:
- WHPX: about 0.55 ms to map and 0.8 ms to unmap per 16 MiB;
- HVF: 3 us to map and 71 us to unmap;
- KVM: 116-124 us of BQL per ask.
A take from an allocation already made costs no Vulkan call and no VMM ask. The kept list held
blocks by exact length for the device's life and gave their bytes back only through an unkeep.

Tests (memory::on_device):
- each allocation mapped before its blocks go out, on the thread that made it, and a take not
  mapped refused, its allocation freed;
- zeroed bytes taken first, given-back bytes taken as written;
- a long allocation taken again at once, counted;
- idle frees, oldest first, the first fit taken again;
- the long allocation never the reserve;
- the zero mark on a long allocation's free bytes, in steps, and a zeroed buffer over it counting
  the mark's bytes as used;
- the zero hold beside a consumer memset;
- seeded takes with every block's allocation mapped.
The command tests' quiesce and teardown check each allocation mapped is unmapped once, on the
right thread.

Verified: nothing yet; the check job, the device legs and the measures follow.
2026-11-18 19:07:15 -08:00
Anees Iqbal 4cb685e075 matrix: frame rows on a node whose CPU clock follows the load are judged by instructions per frame
On the Ryzen 7 7840HS nodes the cores' mean clock tracked the frame rows' pass time (r = -0.88
over twelve passes of one build on the Radeon 780M, job m3-max-49287), so the host time of a
frame row measures the clock its passes found, and the legs there read VOID or venue unstable on
it. The planner's ruling: on such a node the frame rows of every card it hosts are judged by the
new runtime's instructions per frame, their time kept as a cross-GPU outlier check.

results.CLOCK_FOLLOWS_LOAD lists the CPU by potluck's cpu_model fact, which the leg's note now
keeps (`cpu`). There, harness_budget names a frame row's time and judges nothing on it (the
instructions gate judges it; a latency from idle row by its workload's count), the leg re-times
none of them (RETIME_SELECT's skipre, results.retime_skip), base_spread leaves them out, and
over_rows lists only their counts. time_outliers is unchanged and still judges their time
across GPUs. The verdict line names the rule that judged each row. docs/VALIDATION.md states it.

Verified: PYTHONDONTWRITEBYTECODE=1 python3 -m unittest discover -s scripts/matrix, 70 tests OK
(new: the budget, re-time, spread and over-table reading on and off the listed CPU; the verdict
line's rules; the harness job's skip pattern).
2026-11-18 19:03:54 -08:00
Anees Iqbal a75366dccb rt: the compute encoder pushes the stage-in region a kernel reads
set_stage_in_region (setStageInRegion:) accepted the region and changed nothing, on the reading that no kernel rt dispatches reads it. That reading missed [[grid_origin]] and [[grid_size]]: they read the region without a [[stage_in]] argument. A recorded stream makes a compute state whose kernel reads both, and the old runtime plays it; rt refused the state (Unsupported{IdentityDomains}) until the translator admitted the field. The encoder now keeps the region as its push field's 32 bytes, the origin and the size each a uvec4 with a zero w, as the binder writes them. Every later dispatch writes those bytes where the kernel's StageInRegion field sits (FieldValue::StageInRegion). The interface takes RuntimeFact::StageInRegion. A dispatch of a kernel that reads the region on an encoder that set none is the new Gap::NoStageInRegion: what Metal's kernel reads then is not established, as the binder's MissingStageInRegion says. A [[stage_in]] fetch stays Gap::KernelInput.

The player plays setStageInRegion: on rt. The conformance rt side sets each direct region before its dispatch; the indirect form stays unavailable.

README, the gap's docs, api_signatures and docs/REFUSALS.md updated.

Only a kernel that reads the region copies it into its parameters; any other dispatch passes the encoder's region by reference and copies nothing.

Test: translate's every_device_pushes_the_stage_in_region_a_kernel_reads runs engine/kernel_stage_in's stage_in_region_short. A dispatch before any region is set is Gap::NoStageInRegion. Two dispatches under two regions each store their own origin and size at every thread, and nothing past the grid. The sampling device test still sets a region its kernel ignores. compute's every_device_counts_no_instructions_for_a_stage_in_region_a_kernel_does_not_read counts the user-space instructions of a dispatch of a kernel that does not read the region, with no region set and with the setter called before each, less the setter's own: they agree within 2% and 16 instructions.

Verified: check 49270 (msi): the clippy, rustdoc and host suites above clean; rt's device suite on lavapipe 294/294 (3 skipped), each dispatch reading the region set before it. From its archive, the two stage-in device tests on the RTX 3090 (49414) and the Iris Xe (49415) pass with no validation error; user-space instructions a dispatch of a kernel that does not read the region (a debug build): 3090 40190 with no region, 44013 with the setter before each, of which the setter alone 3942 (so 40071); Iris Xe 36082, 40057 and 4058 (35999).
2026-11-18 18:57:24 -08:00
Anees Iqbal 8f720744ce replay: render encoders' sampler binds with LOD clamps play through the runtime
The runtime binds a sampler state with LOD clamps whose samples read as its own (b7ef04ae97:
each clamp held to [0, 15] equals the state's own held the same way) and answers any other with
Gap::LodClamps, binding nothing. The player now plays the four render clamp selectors (vertex
and fragment, one sampler or a range) through set_vertex_sampler_state_with_lod_clamps and
set_fragment_sampler_state_with_lod_clamps. A bind the runtime answers with the gap is skipped
and counted (skipped_clamped_samplers), and draws are skipped while the slot holds it.

Every clamp bind the census found (both web3d streams: the sampler's own (0, FLT_MAX) and
(0, 1000) over (0, FLT_MAX)) reads as its own, so they all bind. Before this, the player refused
setFragmentSamplerStates:lodMinClamps:lodMaxClamps:withRange: (web3d-780m-r1 stopped at frame
391, web3d-3090-r2 at frame 0); the probe players carried a stopgap that skipped any clamp other
than the sampler's own, which this replaces. The compute encoder's clamp selectors stay refused:
no stream calls them.

Test a_sampler_bound_with_lod_clamps_plays_where_the_runtime_takes_them: (0, FLT_MAX) and
(0, 1000) bind and the draw is checked green; (0, 2) is the gap, counted, its draw skipped.
2026-11-18 18:52:40 -08:00
Anees Iqbal 8cb034077c replay: a compute encoder's setStageInRegion: plays on the new runtime
The runtime's compute encoder takes setStageInRegion: (59bb3634d1): it changes nothing a dispatch
of a kernel without a stage-in argument does, the only kernel it builds. glbench-780m-r1's all8
play (m3-max-49209) stopped at frame 438, call 593644, on the player's refusal of the selector;
the census found 158,349 such calls there and 300,832 in glbench-3090-r2, every one on a kernel
with no stage-in argument. The new runtime's backend now plays it through
ComputeCommandEncoder::set_stage_in_region; the old runtime still refuses it.

Test a_stage_in_region_plays_on_a_compute_encoder: an encoder's region plays, nothing skipped.
2026-11-18 18:52:40 -08:00
Anees Iqbal 39e9e52726 replay: an index is owed only to command buffers that named its object while it held the index
Reims's read of glbench-780m-r1 (frame 381): the guest gives index 1459 to one swizzled view
after another, and the host releases each about 700 records after the next took the index, so
two views are live at 1459 for that span. The player took an object's index from the placement
alone and kept it until the object's release, so a command buffer that named a displaced view
owed 1459, and the placement of view #71001 waited for (then counted) command buffer #70944,
which names no object holding 1459.

Indices now records, per command buffer not yet committed, the index each named object holds at
the naming (it is the object placed there last), and owes those indices at the commit; a command
buffer released uncommitted owes nothing. The released-object bookkeeping (pending users) goes:
a naming already holds its index. The backend's users map keeps buffers only, the one thing
still read from it (Places).

Tests: the Indices unit test gains two live objects at one index (a naming of the earlier one
owes nothing, of the later one owes); device test
a_command_buffer_naming_an_object_after_a_later_one_took_its_index_owes_it_nothing plays the
shape (two live holders, release after reassignment) and expects no wait and no count.
2026-11-18 18:52:40 -08:00
Anees Iqbal 1fe1d69fc0 replay: an ID's low word is compared with the recording's, its high word with the documented word
The planner's ruling on resource IDs: the new runtime's layout stands (index | word << 32,
docs/RESOURCE-ID.md). A recording made on the old runtime holds that runtime's high word, so a
whole-ID comparison reported every texture whose word is not 0 as differing.

Backend::resource_word gives the high word RESOURCE-ID.md's own functions give the descriptor the
backend made the object of: TextureWord::of(pixel format, swizzle) for a texture, SamplerWord::of
for a sampler state. Where a backend gives one (the new runtime's), the player compares the ID's
low word with the recording's and its high word with that word, never with the recording's high
word. Where it gives none (the old runtime's), the whole ID is compared as before. A differing
ID's line carries the word: 'id #N RECORDED PLAYED word WORD'.

Test a_resource_id_s_high_word_is_checked_against_the_documented_word: an ID with the recorded
index and the word passes over a recorded high word of 0 or 1; another index or another high
word is reported with the word.
2026-11-18 18:52:39 -08:00
Anees Iqbal 72152b3d29 rt: pixel-format views over mutable images that list Metal's formats
newTextureViewWithPixelFormat: and its forms of another pixel format were a
gap. glbench makes 1,524 (780M stream) and 2,970 (3090 stream)
BGRA8Unorm_sRGB textures' BGRA8Unorm views; Metal views a texture as its sRGB
sibling with no usage asked (MTLTextureUsage.pixelFormatView: "Don't set this
option if your texture view only converts between linear space and sRGB"), and
with PixelFormatView usage as any colour format of the same bit length
(makeTextureView(pixelFormat:)).

The translator states Metal's rules: metal::format::srgb_sibling (srgb_raw_twin
both ways, ASTC's LDR and sRGB forms, the extended-range pairs),
views_without_usage (itself, the sibling, a combined format's stencil) and
views_with_usage (those, and uncompressed colour formats of the same bytes a
texel by byte_format).

An image lists, its own format first, the formats Metal views its texture as
that the device holds for the usage in a viewed form of the image format's
compatibility class: the sibling always, and with PixelFormatView every such
format. Such an image is MUTABLE_FORMAT with a VkImageFormatListCreateInfo, in
its creation, its format queries (optimal and linear) and its heap size query;
any other image is unchanged. plan() splits into form() (what a texture holds
in its views) and the image's own part, so a view takes form() alone, with no
image query.

A view of another format is built where the image lists it, else
Gap::TextureView{PixelFormat}; a format Metal does not view the texture as is
Refusal::TextureViewFormat, which no longer refuses the sRGB sibling of a texture
without PixelFormatView usage. Its image views take the image's usage that the
view format's features hold (VkImageViewUsageCreateInfo,
VUID-VkImageViewCreateInfo-usage-02274/02275/08931): it has a storage element
only where the image has storage usage, and renders where its format holds an
attachment, else Gap::TextureFormat at the pass.

Tests: the translator's sibling is mutual over every format and its view rules
take and refuse as Apple's pages say; on devices, an sRGB view of a texture
without PixelFormatView usage and an R32Uint view of one with it each read
their parent's bytes, and R16Float and BC1 views are refused.
2026-11-18 18:36:50 -08:00