Commit Graph
516 Commits
Author SHA1 Message Date
Anees Iqbal ed4b0ecd76 rt: storage textures written or read at a run-time level, through runs of set 1's level elements
What: under the identity domains a storage slot written, read or size-queried at a level other
than the constant 0 indexes a run of set 1's storage-image array instead of being refused as
Unsupported{IdentityDomains} ("an encoder value the function reads as TextureLevels(S)"). The
translator pushes the bound texture's level count (PushField::TextureLevels) and the run's first
element (the new PushField::TextureLevelBase, beside it), states no StorageTextureLevels or
StorageTextureLevelViews fact, and an access at level l takes element
first + min(l, max(n, 1) - 1) of the array, NonUniform, inside l < n. A texture of one level
pushes its own index, nil 0 with count 0.

The runtime's binding 1 grows by 65,536 level elements past its 65,536 textures, 4,096 runs of 16
(floor::LEVEL_ELEMENTS, floor::LEVEL_RUN). The first dispatch or draw that binds a texture of more
than one level to such a slot (the encoder's checks, compute and render stages alike) gives it a
run: a single-level storage view of each level, of its storage element's type (a cube's level as
the 2D array of its faces, a view's from its own first level), written at the run's elements. A
later bind takes the texture's lock and pushes the same two words: no Vulkan call. The run goes
back through the pool and reaper once the texture is released and its work retired: elements null,
views destroyed (Gauges::level_elements). Every run held, or a texture of more than 16 levels, is
the new Limit::LevelElements { max: 4096 }, and the dispatch or draw does not run. The floor's
storage-image limits and both totals rise by 65,536: storage 196,608, per-stage resources 327,688,
pools 351,680; every lab device's profile is far above (llvmpipe 1,015,808 storage, the least).

SEMANTICS_VERSION and ARTIFACT_FORMAT_VERSION bump in the branch's last commit (a new PushField).

Why: 17 guest kernels in 6 libraries were refused at state creation by this form.

Docs: REFUSALS.md and the signatures table regenerated, RESOURCE-ID.md (binding 1 past 65,536),
API.md (storage levels under identity), the runtime README (Set 1, the floor table, the known-gap
line replaced by the Limit), the runtime-floor profile's limits, and the conformance ledger's
level-sizes-storage row removed.

Checked by: engine_texture_levels' identity test and the runtime's storage_levels device tests
(red at 6ad1c33124: jobs m3-max-70886 and m3-max-70892 on lavapipe), engine_identity's
a_storage_slot_written_at_a_run_time_level_is_an_element_of_its_run; the lane's jobs report the
runs per card.
2026-11-23 09:04:38 -08:00
Anees Iqbal 312f2866a9 rt: a shader-write texture whose own format does not store takes the storage usage for its views of a format that does
A texture made for shader writes in a format the device does not store (the 8-bit sRGB formats on
every committed Vulkan profile), written through a view of a listed format the device does store
(its unorm sibling), was Gap::StorageElement, case Absent: the image never had the storage usage,
so the view had no storage element. Metal writes it.

The texture's image now takes the storage usage for those views, with
VK_IMAGE_CREATE_EXTENDED_USAGE_BIT (Vulkan 1.1: a usage "supported for at least one of the formats
a VkImageView created from the image can have"), where the device's image format query makes that
image. The decision is the image's, at its creation, from the existing queries alone:

- plan() plans the texture extended where its usage has shader write, it is not multisampled, its
  own format does not store and a format it lists for its views does (view_formats now says so);
  it keeps the extended plan only where the query made it with exactly the plain plan's usage plus
  the storage usage and the same resolves, attachment reads and cube flag (Plan::keeps), else it
  makes the plain plan, as before;
- in place over a buffer (check_over), the linear image is extended where the linear query makes
  it and each listed format's linear tiling holds what storage keeps of its optimal tiling; where
  the plain linear image holds but the extended one does not, the texture stays in place, plain,
  and no copy is made for it. The counted copy form, where a texture over a buffer already took
  it, takes the plan the optimal query took;
- an extended image is at home in the general layout (a storage view's), and its own format's
  views take the usage that format holds (VkImageViewUsageCreateInfo,
  VUID-VkImageViewCreateInfo-usage-02275), so the texture's own sRGB views carry no storage usage;
- a surface plane's image keeps the surface's own rule and is never extended.

What the storage usage costs these images, where the query can say: nothing. Plan::keeps takes the
extended image only where the query keeps every other usage, flag and sample count, so no usage is
ever dropped for it; the test prints each device's image usage. What the query cannot say
(compression or a slower layout for the general home on a given driver) is unaudited.

Where the device does not make the texture extended (optimal query plainly, or in place where the
linear query refuses the extended image and the plain one holds), the texture is made as before and
the dispatch is still Gap::StorageElement, now with the new case StorageElementCase::Unextended in
place of Absent: the view's format is one the device stores and the image lists it, so the gap is
the image's missing extension, not the format's storage. A consumer log then tells "the device
made no extended image" from "the format has no storage on this device". Absent stays for the
texture's own views and for views of formats the device does not store; a surface plane's view is
never Unextended (its image is made by the surface's rule).

The test every_device_writes_an_srgb_texture_through_its_unorm_view now names
StorageElementCase::Unextended in its refused arm. docs/REFUSALS.md (the sites' function renamed
plan -> planned) and the API signatures table (the new variant) regenerated; the runtime README's
view-format and storage-element entries describe the rule.
2026-11-23 04:27:21 -08:00
Anees Iqbal f3bb94275b rt: a bind of a texture reached through its views alone to a texture slot is TextureWithoutIndex
A texture made with no index although its usage reaches shaders (Device::new_texture_for_views,
Device::new_heap_texture_for_views, a surface's or a Direct3D 11 surface's plane made with no
index) is reached through its views, each with an index of its own. Bound directly to a
function's texture slot, a dispatch or draw pushed its resource id, index 0, set 1's null
descriptor, so every read answered zero with no refusal (the consumer saw a D3D11 luma plane read
0.0 for every texel this way). ComputeCommandEncoder::set_texture and RenderCommandEncoder's
set_vertex_texture and set_fragment_texture (the runtime's only texture-slot binds) now refuse it,
binding nothing: Refusal::TextureWithoutIndex { index }, the slot's index. The check reads the
texture's own stored facts at the bind (no index, and its descriptor's usage reaching shaders by
the creation rule); nothing is looked up and nothing runs per draw or dispatch.

A texture no shader reaches (a depth or stencil target whose usage asks neither shader reads nor
writes) also has no index, and still binds: Metal binds it, its usage asks no shader read, and a
read of it answers the null descriptor. The previous commit's test expected that case refused;
it now expects it bound, so a guest's bind of such a texture to a slot its function does not read
meets no refusal.

Texture::gpu_resource_id says what an index-free texture's id is (index 0) and that a shader
reading it from bytes (an argument buffer) reads the null descriptor; nothing refuses that, as
the call returns a ResourceId. ResourceId's encoding is unchanged. The runtime has no argument
encoder, no texture-slot range call and no indirect-command texture bind, so the binds are the
whole Result-returning surface; an attachment read of an index-free texture is already
Gap::Draw (FetchedAttachment).

REFUSALS.md and basis.rs regenerated; the runtime README's texture and compute-encoder entries
updated.
2026-11-23 02:54:00 -08:00
Anees Iqbal eb275a1e87 rt: Refusal::TextureWithoutIndex, and a test that binds a texture made without an index (red)
A texture made without an index (Device::new_texture_for_views, a surface or Direct3D 11 plane
with no index, a depth or stencil target no shader reaches) bound to a function's texture slot
pushes resource id 0, set 1's null descriptor, so every read answers zero with no refusal. This
commit adds the refusal the binds will return, its basis line, REFUSALS.md and the signature
table, and the device test bind_without_index, which binds such textures to compute, vertex and
fragment slots and expects the refusal with the slot's index. The binds do not refuse yet, so the
test is red here; the next commit makes them refuse.
2026-11-23 02:54:00 -08:00
Anees Iqbal f17e07ad07 rt: StorageElement names its case and backing; PartialThreadgroups and ThreadgroupMemory name their site and static bytes
A refusal's sentence stays as it was (the known-gaps ledger keys on it); the new facts are typed
fields.

- Gap::StorageElement gains `case` (StorageElementCase: Absent, WriteWithoutFormat,
  ReadWithoutFormat) and `backing` (TextureBacking: Texture, Buffer, SurfacePlane, D3d11,
  Drawable; a view answers its parent's). TextureObject::storage_gap computes both at the four
  sites, and use_resource keeps it for a declared write. SurfaceImage's `general` flag, which only
  a Direct3D 11 import set, is named `d3d11`, and a surface plane's image keeps it.
- Gap::PartialThreadgroups gains `site` (PartialThreadgroupsSite): VoteWord { static_length, max }
  where the translator refused the variant for its vote word, Translator for its other refusals,
  SimdGroups { width } where the threadgroup is not whole SIMD groups of the variant. The cache
  directory keeps why with the refusal (m2v-refused-vote beside m2v-refused), so a warm boot names
  the site too.
- Limit::ThreadgroupMemory gains `static_length`, the state's staticThreadgroupMemoryLength.
- The translator's vote-word refusal is built through Unsupported::needs_any_of, so the refusal
  table derives its basis.

docs/REFUSALS.md and the api_signatures table are regenerated. Tests: the scan test's shape (i)
at 32,768 reads Limit::ThreadgroupMemory with static_length 0 and the limit; shape (ii) reads
PartialThreadgroups at the VoteWord site with its 32,768 static bytes against the limit; the
vote-word test reads the static length; storage_element, texture_buffers and read_write_tier read
the case and backing. Not yet run.
2026-11-23 02:31:24 -08:00
Anees Iqbal 80187ce5d1 Refusals: the three program-scope shapes Metal was measured to take declare metal-takes
ProgramScopeResource, ProgramScopeSharedSlot and ProgramScopeLinked are refusals Metal does not
make: an Apple M3 Max under macOS 27.0.1 runs each (potluck jobs m3-max-70268 and m3-max-70306).
Each declares it as its doc comment's last line, so the refusal surface counts them under
metal-takes (3 translator rows, from 0). ProgramScopeRead stays derived (ours): Apple's compiler is
not seen to write such a read. docs/REFUSALS.md regenerated; refusal_surface.py --check passes.
2026-11-23 00:51:11 -08:00
Anees Iqbal 058fd25a7b Translator: MSL 3.2 program-scope buffer bindings become buffer parameters; other shapes refused apart
What: `!air.global_bindings` decodes into `AirAbi::global_bindings` (`GlobalBinding`: the
global, and its node's role, type information and name, read by the parameter-node decoder;
the node's index is -1). Canonicalization (`canon::global_binding`, beside the global
built-ins) makes each plain load of a bound buffer's pointer (device or constant space, one
stated slot) a read of a parameter: the entry's own parameter of the binding's role and type
where it takes one, else one appended, shared by the bindings of one role and type. Lowering
then binds it where a `[[buffer(n)]]` parameter binds; the runtime binds nothing new.

Why: the whole module was refused as ProgramScopeBinding (78 functions in 1 library of the
private corpus on runtime-floor and gate-lavapipe: kernels, one constant struct buffer each,
read only by plain loads of its pointer). Metal fills a bound global from the executing stage's
own argument table. Measured on an Apple M3 Max under macOS 27.0.1:
- m3-max-70268: a kernel's globals read and write the buffers bound at their indices;
  reflection lists each as a binding at its index; a parameter and a global of one type at one
  index, and two globals of one type at one index, read the one buffer; a vertex and a fragment
  function reading one global each read their own stage's buffer at its index.
- m3-max-70306: Metal also takes a bound texture and sampler, bound threadgroup memory, a bound
  sampler array, and a linked visible function of another library that reads a bound buffer.

What stays refused, each a refusal of its own (docs/REFUSALS.md regenerated):
ProgramScopeResource (a texture, sampler or threadgroup memory, one or an array),
ProgramScopeSharedSlot (a binding at a slot an entry parameter or another binding binds with
another role or type), ProgramScopeLinked (bindings in a linked or dynamic-library module),
ProgramScopeRead (a read of a bound buffer other than a load of its pointer, which
`xcrun metal` 32023.922 does not write). ProgramScopeBinding is gone: a consumer's exhaustive
match on Feature breaks, and a consumer's AirAbi literal needs the new field (git grep of the
consumer's checkout at aed8655a62: 0 hits for ProgramScopeBinding and for `AirAbi {`).

Tests: the ABI decode of a binding (a node with a parameter's index, or a global that is not the
externally initialized undef constant, is malformed); canonicalization over a kernel with three
bound buffers (two appended parameters, one shared with the entry's own) and the refused
shapes; linking and dynamic-library refusals.
2026-11-23 00:51:10 -08:00
Anees Iqbal 3c86a2a45f Translator: a vertex function's slice and viewport index are stored as it writes them
Metal requires the same [[render_target_array_index]] and [[viewport_array_index]] at every
vertex of a primitive ("If values differ, the behavior and value passed to the fragment function
are undefined.", the Metal Shading Language specification), and Vulkan asks the same of Layer and
ViewportIndex (VUID-VkPipelineShaderStageCreateInfo-stage-02596 and -02597). The translator stored
an index only where the function's structure showed it the same among a primitive's vertices
(uniform_varyings over the raw index varyings) and refused every other one,
NotImplemented(LayeredRendering), on every device. A program that keeps Metal's rule keeps
Vulkan's with the index stored as written, and one that breaks it has no Metal answer to match,
so plan::index_store now stores the index to its builtin wherever the device stores it from a
vertex function (shaderOutputLayer, shaderOutputViewportIndex, both in the floor), whatever the
structure shows; a device without the output is refused needing it, as before. The store keeps
index < count ? index : 0 against the pushed length and viewport count, and an index never written
is still stored as 0. uniform_varyings now lists user varyings alone (the raw index keys decided
nothing else), and uniform_index is gone.

Where a program breaks Metal's rule the layer or viewport is the device's choice: the runtime
README's layered line and docs/API.md (section 4 and section 10's accepted differences) say so in
one sentence, the viewport paragraph and set_viewports no longer name a geometry stage, and
docs/REFUSALS.md is regenerated (LayeredRendering is now a device refusal alone). The runtime's
layered device test draws rt6_per_primitive's three triangles into slices 1, 1 and 2 through
viewports 0, 1 and 1 of a 2D array, checking every texel, in place of the refusal it asserted.

SEMANTICS_VERSION 2283: modules for such functions instead of the refusal, and uniform outputs
without the raw index keys.
2026-11-23 00:13:45 -08:00
Anees Iqbal 29e54794ca Runtime: a sampler state bound with LOD clamps of its own samples with them
A bind's LOD clamps (setSamplerState:lodMinClamp:lodMaxClamp:atIndex:, its
vertex and fragment forms and the range forms) that read otherwise than the
state's own were Gap::LodClamps. Metal takes the call; on the M3 Max
(conformance cases sampler-bind-lod-clamps-kernel and -fragment) the pair
replaces the state's clamps, a lower bound above the upper reads at the upper's
level, and a plain bind afterwards reads the state's own clamps again.

How: such a bind takes the state's variant of the pair, the state's descriptor
with the pair as its clamps, its device samplers from the shared sampler table,
placed at a variant element of set 1's sampler arrays. The three sampler arrays
grow from 4,000 to 8,000 elements in the runtime's layout; elements 4,000 to
7,999 are the variants'. Shaders declare the heap arrays unsized, so the
translator is unchanged: a slot's sampler index is the runtime's push, and an
argument buffer's sampler index of 4,000 or more still reads element 0, so no
program-written ID reaches a variant. A state keeps its 16 most recently bound
variants; a new one past them takes the place of the least recently bound one
no command buffer holds, and where work holds all 16 the new one is held by its
command buffer alone. Past 4,000 live variants a bind is
Limit::LodClampVariants { max: 4000 }. The lod_clamp_variants gauge counts the
live variants. A NaN bound, which Metal documents no answer for, binds the
state as it is.

The floor's sampler limits rise to 24,000 (maxPerStage and maxDescriptorSet
UpdateAfterBindSamplers) and 286,144 (maxUpdateAfterBindDescriptorsInAllPools);
the lab's least are 500,000 (MoltenVK on the M3 Max) and 1,048,576 (Intel UHD
Graphics 630 on Windows), and Vulkan requires 500,000 of each with
descriptorIndexing.

Gap::LodClamps goes; REFUSALS.md, basis.rs, the signature table, the Metal and
conformance coverage pages regenerate. The validation replay plays clamped
binds (no skipped_clamped_samplers). The ledger drops three rows the clamped
binds now answer (compute-plural-texture-and-sampler-binding steps 11 and 14,
render-state-unread-slots). The compute single clamp form's coverage row named
set_sampler_state; it names set_sampler_state_with_lod_clamps.

Tests: a kernel samples through the binds as Metal reads them; a state's 16
kept variants filled past that; the 4,000 variant elements filled past their
capacity; the gauge flat across a bind and retire loop and zero at device
drop. Verified: see the lane's report (jobs named there).
2026-11-23 00:11:19 -08:00
Anees Iqbal afbcfec9a7 Runtime: the compute encoder's imageblock size; a kernel's explicit imageblock is dispatched
ComputeCommandEncoder::set_imageblock_size is Metal's setImageblockWidth:height:. The encoder
keeps the size, 1 by 1 until a call sets one (Metal's size for an encoder that never sets one),
and a dispatch of a kernel that reaches an explicit imageblock runs at it: the translator's
SpecKey::ImageblockWidth and ImageblockHeight are specialized per VkPipeline (Constant::Imageblock),
as a threadgroup memory length is. The dispatch's refusal (Gap::KernelInput naming
RuntimeFact::ImageblockSize) goes.

- encoder: Sizes carries the encoder's threadgroup memory lengths and imageblock size to decide()
  and threadgroup_memory(); Lengths holds the imageblock size for a kernel that reaches one (0 by
  0 otherwise, so other kernels keep one pipeline whatever the encoder set), and its cells
  (w x h x cell bytes, rounded to 16) count in Limit::ThreadgroupMemory with the lengths.
- pipeline: Variant keeps its Lengths (the key is ([u32; 3], &Lengths, bool)); an imageblock
  kernel has no main pipeline, as a kernel that takes a threadgroup memory length has none;
  keeps_plain counts the imageblock as encoder-sized memory.
- Refusal::ImageblockSize: a side that is not a power of two (0 included) or more than 1024
  cells, whatever the state's maxTotalThreadsPerThreadgroup, as Metal's validation layer stops
  them at the call (probe crates/metal2vulkan-conformance/probes/imageblock_size_rules.m, job
  m3-max-70002, M3 Max, macOS 27.0.1).
- prepare_dispatch and dispatch_variant take the imageblock size as a fourth argument ([1, 1]
  where the encoder set none); a size the encoder would refuse makes nothing and answers None.
  The consumer's two call sites take the argument (planner, through main).
- Validation: the engine candidate sets a case's explicit imageblock size and passes it to
  prepare_dispatch; KernelImageblock narrows to a tile pass's implicit imageblock (the runtime
  builds no tile function). No executor ABI bump: no recorded row ran an explicit imageblock
  case, which the requirement refused. The replay player plays setImageblockWidth:height:, and the
  pre-pass passes each dispatch's size.

Form (step 0, jobs m3-max-69983, m3-max-69984): Metal compiles nothing for a new size (a new
size's first dispatch 202-312 us median against 205-228 us second use and 222 us at the control
size, a state's make 15-20 ms); a pushed size would size the Workgroup arena at Metal's 1024
cells on every dispatch. A new size here is one VkPipeline make at its first dispatch, a known gap.

Tests: tests::imageblock (replacing tests::kernel_input): a dispatch never sized runs 1 by 1; one
encoder runs 4 by 2 and 4 by 4, each read back, two first-use variant waits and no main
pipeline; the setter's refusals.
2026-11-23 00:09:50 -08:00
Anees Iqbal aae58c6acb Runtime: an upload into a 32-bit float depth is the device's copy, under a static note
What: replace_region, upload_region and the blit's copy_from_buffer(_with_options) into a
32-bit float depth (Depth32Float, or Depth32Float_Stencil8's depth) no longer answer
Gap::FloatDepthUpload, which is gone: each is the plain vkCmdCopyBufferToImage into the depth
aspect, on every device, and carries Texture::FLOAT_DEPTH_UPLOAD_NOTE
(PrecisionNote::RestrictedDepthUpload, metal2vulkan-degrade-restricted-depth-upload). A value
within [0, 1] is copied exactly; one outside it is the device's, as
VUID-vkCmdCopyBufferToImage-pRegions-07931 leaves it without VK_EXT_depth_range_unrestricted,
which the runtime enables nowhere. No byte is read and no query chooses anything.

Translator: the new note's variant, codec tag (ARTIFACT_FORMAT_VERSION 592), validation's
allowance (unbounded), the conformance degradation (not native, as restricted-depth-range is
not) and docs/API.md's catalogue; RestrictedDepthRange's docs name the upload note.

Conformance: the rt side announces the note at each upload into a 32-bit float depth; the
compare cases declare it; heap_sizes' round trip writes depths within [0, 1] for Depth32Float.
2026-11-22 22:40:56 -08:00
Anees Iqbal bbb3d53484 Runtime: a compute state's visible-function tables call the functions their entries hold
A compute pipeline state answers functionHandleWithFunction: for its linked
functions (the translator's FunctionHandle words), makes visible-function
tables (newVisibleFunctionTableWithDescriptor:) whose words sit in a Shared
block the runtime takes, writes their entries (setFunction:atIndex:,
setFunctions:withRange:) and answers each table's gpuResourceID. The compute
encoder binds a table at a buffer index (setVisibleFunctionTable:atBufferIndex:)
through its buffer path, and the command buffer keeps the words until it
retires. The device answers supportsFunctionPointers YES. An entry past a
table's size is Refusal::FunctionTableIndex and writes nothing.

The translator's bind module makes the table's header and entry offsets
public, so the runtime writes the layout the shader reads.

Tests: function_tables (device cfg) dispatches through tables of two orders,
a null entry, no entries, an unbound slot and an entry set after encoding,
and compares every word; the conformance rt side runs the compute
visible-table cases. Evidence is in the lane's jobs.
2026-11-22 22:11:28 -08:00
Anees Iqbal c358d9afd7 Runtime: a copy between buffers takes any offsets and size, as plain Metal copies them
A guest's blit copy of 62,302 bytes at offsets 0 and 0 met Refusal::BufferCopyUnaligned. Apple's page
for copyFromBuffer:sourceOffset:toBuffer:destinationOffset:size: asks for multiples of 4 on macOS,
but plain Metal does not stop or round such a copy: it copies every byte of the range and no other.
vkCmdCopyBuffer has no alignment rule for its regions, so the copy is its one region at the
offsets and size the call names, and the refusal is gone.

Measured with probe crates/metal2vulkan-conformance/probes/blit_buffer_copy_unaligned.m, one
universal binary (built in m3-max-69612), copies (source offset, destination offset, size) =
(0,0,62302) (0,0,1) (0,0,3) (1,0,8) (0,2,8) (3,5,4097) and the controls (0,0,64) (4,8,4096),
each between two Shared, two Managed and two Private buffers, every destination byte read back:
- Apple M3 Max, macOS 27.0.1 (26A434), job m3-max-69613: 24 of 24 exact with validation off
  (AGXG15CDevice), 24 of 24 exact under MTL_DEBUG_LAYER=1 (MTLDebugDevice), which printed only
  its banner and took every copy.
- AMD Radeon Pro 5300M and Intel UHD Graphics 630, macOS 26.7.1 (25G241), job m3-max-69614:
  24 of 24 exact on each, validation off.
Every command buffer completed with no error.

The variant, its basis line, its REFUSALS.md rows and its api_signatures.tsv line go; the runtime
README says what Metal measured. The conformance ledger's overlapping-copies row now holds the
overlap refusal its first copy meets (the alignment check ran before it). The consumer's checkout
names the variant nowhere (git grep BufferCopyUnaligned at reims-vgpu 6d83a5d4f8: 0 hits).

Test: every_device_copies_between_buffers_at_any_offset_and_size copies the six ranges between
two Shared buffers and reads every byte back; it fails without the change (the refusal).
2026-11-22 21:06:39 -08:00
Anees Iqbal da020e5d7b Runtime: a compute kernel that reaches an explicit imageblock gets its state; its dispatch is refused
A compute pipeline state whose kernel reaches an explicit imageblock was refused at its make as
Gap::KernelInput of KernelInputKind::RuntimeFact naming ImageblockSize, which every arm64 macOS
guest boot meets once. The state is now made, and what stays refused is the dispatch, where Metal
reads the extent setImageblockWidth:height: set, which the compute encoder does not have:

- interface() takes RuntimeFact::ImageblockSize, keeping its cell bytes as Interface::imageblock,
  and leaves SpecKey::ImageblockWidth and ImageblockHeight at the module's default (0 by 0)
  instead of refusing them as a specialization it does not set.
- encoder::decide, which the dispatch, prepare_dispatch, dispatch_variant and the main pipeline's
  key all go through, refuses a kernel with an imageblock first, as Gap::KernelInput of
  RuntimeFact naming the fact (RuntimeFact::name). So no VkPipeline of such a kernel is made:
  finish_pipeline has no main key, and a pre-pass gets no key. A dispatch of such a kernel that
  writes no memory records nothing and is not refused, as for any kernel without effects.
- imageblock_memory_length_for_dimensions keeps its typed answer, Gap::ImageblockLength, for a
  kernel that declares an imageblock: the one recording of Metal's answer for such a kernel
  (conformance pipeline-facts-compute-imageblock, M3 Max, 256 bytes at 8 by 4 by 3) settles no rule.

The translator is untouched. Gap and KernelInputKind keep their variants; the docs of
Gap::KernelInput, KernelInputKind::RuntimeFact and Specialization, Gap::ImageblockLength (and its
basis line), the dispatch and the state's make say where the refusal now is. docs/REFUSALS.md,
docs/METAL-COVERAGE.md (setImageblockWidth:height:'s note) and docs/CONFORMANCE-COVERAGE.md are
regenerated. The runtime README's state facts and its known gap are re-worded, with the counts and
jobs kept. The conformance ledger's pipeline-facts-compute-imageblock row moves from case/state to
the facts' label and device (the consumer's own, as for every state) and imageblock_memory_length
(Gap::ImageblockLength). Validation's KernelImageblock requirement doc and its acceptance test's doc
name the dispatch's refusal and the renamed device test.

Test: tests::kernel_input::an_explicit_imageblock_kernel_is_made_and_its_dispatch_refused_as_its_named_runtime_fact
(replacing an_explicit_imageblock_kernel_is_refused_as_its_named_runtime_fact) makes a4_imageblock_extent's
state, reads its imageblock length as Gap::ImageblockLength, gets no dispatch_variant key, and has
one 4 by 2 threadgroup's dispatch refused as Gap::KernelInput of RuntimeFact { fact: "ImageblockSize" }.
2026-11-22 20:15:34 -08:00
Anees Iqbal a916e61185 Runtime: a kernel's [[stage_in]] is fetched; the three forms not built are Gap::StageIn by kind
A compute pipeline state whose kernel reads [[stage_in]] attributes was refused at its creation as
Gap::KernelInput of KernelInputKind::StageIn, which a guest met (a descriptor-form compute state, the
app's context closed right after). The translator already fetches every attribute in the shader from
the buffer slot at its layout's bufferIndex, through that slot's pushed address, by the stage-in and
dispatch regions the encoder already pushes. Two things stood in the way, both in the runtime:

- interface() refused any kernel whose PipelineInterface::stage_in is non-empty. The line goes.
- The thread-position fetch's reach check reads SpecKey::StageInReach, which the runtime's constant
  loop refused as a specialization it does not set. The runtime now leaves it at the module's default
  (true): one pipeline, the check kept for every dispatch.

What stays refused is a typed refusal naming its own form, Gap::StageIn of a new StageInKind:
- IndirectRegion: setStageInRegionWithIndirectBuffer:indirectBufferOffset:, now the method
  ComputeCommandEncoder::set_stage_in_region_with_indirect_buffer, which always refuses (the
  conformance rt side calls it in place of its own Unavailable);
- DynamicStride: an attribute the kernel reads through a thread-position layout of
  MTLBufferLayoutStrideDynamic (the compute encoder has no attributeStride setter), at the state's
  creation, before the translator's IdentityDomains refusal of StageInStride;
- IndexedStepRate: an attribute it reads through an indexed step at a step rate past 1, at the
  state's creation.
Both creation checks read the descriptor narrowed to the attributes the kernel reads
(kernel_inputs_read), so an attribute it never reads, and a constant step of a dynamic layout,
refuse nothing.

KernelInputKind::StageIn is deleted. Consumer search: `git grep -n 'KernelInputKind'` in the
reims-vgpu checkout at c8201ec2ba: 0 hits (nor any for `StageIn` as a refusal kind).

Tests: the device test every_device_fetches_stage_in_by_each_step_function dispatches
engine/kernel_stage_in's stage_in_fetch under ThreadPositionInGridX at rates 1 and 2,
ThreadPositionInGridXIndexed and Constant, and checks every thread's four attributes (threads past
the region read its last element); without the change the state is Gap::KernelInput.
every_device_refuses_each_unbuilt_stage_in_form_by_its_kind holds the three kinds and the two
states that are made. kernel_input's refusal test of StageIn goes; lowered and the harness's gap
test take Slot. The conformance case stage-in-region-clamps carries on past a refused row (probe,
as attribute_formats does), so its 27 other rows compare where the indirect one is refused. The
ledger drops the 82 rows of the old refusal (stage-in-region-clamps 1, attribute-format-fetches 29,
attribute-format-class-crossings 16, stage-in-unread-attributes 36), takes the indirect row's new
refusal, and the four compute attribute-stride rows' DynamicStride refusal. The validation
requirement KernelStageInput stays: the engine's run through the runtime passes no stage-input
descriptor or region. README, REFUSALS.md, METAL-COVERAGE.md, CONFORMANCE-COVERAGE.md and the
signatures table regenerated.
2026-11-22 13:07:16 -08:00
Anees Iqbal 10f83b636d 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-22 10:16:32 -08:00
Anees Iqbal a7dd2e846e Translator: the binder's plan goes, with everything only it reaches, and the TexelRows and YCbCrInPlace forms
The runtime never made a plan (it binds each draw and dispatch by the pipeline's interface), and
since the census digests each pipeline's content alone (two commits back) nothing in the tree calls
one. What only the plan reached goes with it:

- bind: BindState, BindShape and their shapes, BindingPlan and its instantiation
  (DispatchCommands, DrawCommands, push, descriptor and root-table templates and writes),
  plan.rs and plan/ (compute, resources, slots), instantiate.rs, resident.rs, the neutral
  resources' plan side, the heap's member planning and table bytes, the mesh arguments pass
  (MeshArguments, MeshArgumentsForm, fold_object_grid, metal_object_grid), ExecutionStatus and
  StatusBits as public items, TextureShape::Buffer, IndirectRef with the four indirect call
  variants (Dispatch::ThreadgroupsIndirect, DrawCall::Indirect, PatchesIndirect,
  MeshThreadgroupsIndirect) and IndexBufferRef::fetch_end. Dispatch, DrawCall and IndexBufferRef
  stay: validation states its cases' calls with them.
- error::BindError leaves the public surface; a crate-private BindError of three variants stays
  as the error of the heap's view derivation, which lower::texture::slot's storage-read check
  reads (bind::heap::tier_read_gaps). That check keeps only the storage view's format: the
  sampled-view branch and ImageViewDesc were reached by the plan alone.
- vk::DrawCommand, the plan's draw output.
- pipeline: ComputePipeline::plan, RenderPipeline::plan; cache: VariantKey::covers and
  large_buffer_form.
- The TexelRows form (bind::texel_rows, LoweringInputs::texel_rows, RuntimeFact and PushField
  TexelRows) and the YCbCrInPlace form (bind::ycbcr_in_place, lower/sampler/in_place.rs,
  LoweringInputs::ycbcr_in_place and ycbcr_planes_sampled, RuntimeFact and PushField
  YCbCrInPlace, PrecisionNote FloatSampleFilter and HalfSampleFilter, Routine::Quad). Only the
  binder set those inputs.
- The tests of the deleted items, and the plan halves of mixed tests. Of 6810 tests (`#[test]`
  functions in the workspace) 309 leave and 11 come in their place: the lowering halves of mixed
  tests, kept without the plan (the heap layout, the stage-in stride and region facts, the
  emulated-simdgroup and bicubic facts, the iris-xe storage classes), and the kept tests of the two
  renamed files. 50 others are edited to drop a plan half or a deleted item (the api_surface round
  trips; the simd_emulated, extended-range, recursion, dynamic-root, handles, heap-storage-read
  and mesh lowering cases). 6512 remain. engine_graphics_binder.rs and engine_heap_binder.rs keep
  one and two tests and are renamed engine_unattached_colors.rs and engine_heap_groups.rs.
- The runtime guard test's list of files the runtime inputs reach without being inputs drops the
  seven no input reaches since the cut: cache/digest.rs, lower/simd/divergent.rs,
  lower/simd/workgroup.rs, pipeline/artifact.rs, pipeline/layout.rs, pipeline/stage_io.rs and
  pipeline/vertex.rs; three of its reasons that named the plan or the binder say what reaches the file now.

559 public items leave (api_signatures.tsv: 55 structs, 26 enums, 140 variants, 245 fields,
52 methods, 24 associated constants, 7 constants, 5 functions, 5 impls). Consumer search, the
consumer's development at 92ffbed817, `git grep -w NAME` of each of the 112 removed names: 0 hits
for 105; the others are the consumer's own items: TessellationFactors 4 (its
Bound::TessellationFactors), YCbCrMatrix 3 (its own string and doc), texel_rows 2 (its own fn),
ThreadgroupsIndirect 6 (its own Dispatch enums and rt::Dispatch::Indirect), DrawIndexed 1 (a doc
naming MTLIndirectCommandType values), covers 109 and plan 105 (generic words; the `.covers(`
calls are its Extent's, the `.plan(` calls its video encoder's rate.plan). Its one import of
metal2vulkan::bind is the argument-buffer layout types, which stay.

The forms' audit. A texture over a buffer: the runtime's
tests::over::every_device_holds_a_texture_over_a_buffer_in_place. A two-plane YCbCr sample: no
runtime test; the runtime makes no texture of a two-plane YCbCr format (Gap::TextureFormat, the
runtime README's "A format is made where the translator's format table maps it" row), the
conformance cases ycbcr_gathers and ycbcr_textures record Metal's answers, and
known-gaps-rt.tsv lists the runtime's refusals (ycbcr-gathers-*, ycbcr-texel-reads-420v).

Versions:
- RUNTIME_VERSION 2550: it covers plan instantiation and the binder's run-time data. Nothing calls
  those since step 2: the runtime never used the binder, and the own-context executor is gone. A
  run of an unchanged artifact does nothing different, so the guard hash (runtime-sources.sha256)
  moves alone, and the RUNTIME_VERSION doc is rewritten to name what it still covers.
- SEMANTICS_VERSION 2273: no output changes for any input that still exists. The TexelRows and
  YCbCrInPlace forms, their facts, push fields and the two notes were reachable only through
  LoweringInputs::ycbcr_in_place, ycbcr_planes_sampled and texel_rows. Only the binder set those;
  the runtime sets none. The function key appended each of them only when set, so every surviving
  key hashes the same bytes. Two type declarations stay where they were, so module words do not
  move: bool in the bicubic types, uvec4 in the bicubic routines. Byte-identical modules are
  expected, not verified here; the 252-row hash probe is the check.
- ARTIFACT_FORMAT_VERSION 591: the codec tags enum variants by name. The removed RuntimeFact,
  PushField and PrecisionNote variants leave their tags unused, which cache/mod.rs's rule says
  needs no bump: an old entry holding one fails to decode, which is a miss. No codec_struct field
  is removed. That is why SamplerDesc.ycbcr stays.

The guard hash (crates/metal2vulkan-validation/runtime-sources.sha256) moves for the bind/
sources this deletes and edits and for vk/draw.rs, which leaves its list. No run of an unchanged
artifact changes: what stays in bind/ computes what it did (the heap's tier check takes the same
storage format; its removed sampled branch had no caller).

Docs: docs/API.md (section 5 is the interface; the binding and plan sections go), README.md,
docs/ARCHITECTURE.md, docs/HOWTO.md, docs/VALIDATION.md, the runtime README's DrawInput and
identity-domain rows, docs/REFUSALS.md (regenerated; the binder's section goes),
api_reference.md, api_signatures.tsv (blessed: removals only), tests/api_surface.rs, the
signatures floor (5000), the bind modules' own docs, and the public field docs of PushField,
RuntimeFact and SpecKey that named BindState, BindShape or BindingPlan. AGENTS.md: the project
table names pipelines and their interfaces, not binding plans; its "core lives in" line stays
true (bind/ still holds what the lowering reads).

Verified on 31692939d4, this commit's tree (steelbrain/cutbinder-probe-6): job m3-max-68107,
fmt, signatures, refusal surface, clippy -D warnings (workspace plain, --cfg m2v_gpu,
--cfg m2v_cpu_icd; the translator with no feature and with each alone; the AIR crate alone),
workspace Rustdoc -D warnings, each crate's private intra-doc links at 0, api-docs; job
m3-max-68109, the product, validation and conformance suites, doctests, and on lavapipe the
validation and runtime suites under --cfg m2v_cpu_icd, the conformance replay and the public
cases' qualification.
2026-11-22 10:15:34 -08:00
Anees Iqbal d9077dfa0d Push window: each device's maxPushConstantsSize sizes it, up to 256 bytes (rule 2's ninth form)
What: the push window is one value per device, `DeviceProfile::push_window`, the description's
maxPushConstantsSize up to 256 bytes, decided in the profile `Device::from_queries` derives
(device/profile.rs:115). Every window reads it: push placement (`lower::push::window`, `place`,
`spills` and `check_floor` take its bytes; lower/select.rs, lower/access/mod.rs and
lower/access/table.rs pass it), and in the runtime the one pipeline layout's push range
(device.rs:688), the kernel and render pipelines' push checks (pipeline.rs:2119, render.rs:1043)
and the encoder's push bound (encoder.rs:1759). With W that value, a kernel pushes in [0, W), a
vertex function in [base, W - 8) and a fragment function in [base, W); object and mesh functions
keep 0..32 and 32..64. A stage's fields past its window spill to its parameter block, whose
address the window holds, as they did past 256. `from_queries` refuses a maxPushConstantsSize
below 128, Vulkan's least, only (`Unsupported{PushWindow}`, required 128), and the runtime's
floor no longer lists maxPushConstantsSize (floor.rs: its row and PUSH_CONSTANT_BYTES go; the
layout's range was a constant 256). There is no constant 128 path, no switch and no environment
gate: the limit query is the only input. Ported from the held branch steelbrain/amdfloor-window
(d6880ca16b) onto today's development, every line reference confirmed against this tree.

Why: the owner's word choosing option B. A device reporting 128 bytes was refused by the floor;
it now runs with a window of 128.

AGENTS.md rule 2 takes the owner's authorized text: "for eight only" becomes "for nine only",
and the push window joins the list after run-time texel offsets.

Known gap (runtime README, Known gaps of indirect command buffers): in a window of 128 bytes a
command reaches 9 vertex slots, and 8 where the vertex function spills, against 25 and 24 at 256
((W - 8 - 16 - 28) / 8; from code: lower::push's
an_indirect_draw_s_vertex_function_pushes_25_or_9_slot_words). A kernel pushes 8 buffer
addresses beside its dispatch region at 128 bytes against 24 at 256, the rest from its ring.

Caches: a device of 128 and one of 256 share no cached artifact and no pipeline. The profile's
fingerprint hashes every ProfileFields field by Debug (device/profile.rs:312, :327), the limits
included (:346, maxPushConstantsSize at :625); `function_key` hashes the fingerprint
(pipeline/compile/key.rs:182, :189; passed at pipeline/compile.rs:2973), as does
`queried_render_descriptor_key` (key.rs:546); a cached artifact or pipeline loads only under an
equal fingerprint (cache/artifacts.rs:71, :204, :238; cache/envelope.rs:142); and the runtime's
enables digest, which the stage keys check, hashes it (metal2vulkan-runtime/src/device.rs:1533).

SEMANTICS_VERSION stays 2273: no module changes under an unchanged key. Every device
`from_queries` accepted before reports 256 bytes or more (it refused below 256), so its window is
256 as before and its modules are the same bytes; a device of fewer bytes was refused, so it
holds no artifact to go stale, and its modules are new under its own fingerprint. The golden
test at this tree found 0 cells changed under an unchanged key over the 15 committed profiles,
and 1855 under a changed profile fingerprint, runtime-floor's column alone (m3-max-68089; the rows
whose assembler Linux lacks are not observed there).

Golden table: runtime-floor.json and its generator drop the floor block's maxPushConstantsSize
of 256, so the profile reads Vulkan 1.3's least, 128, and its fingerprint moves. Its cells are
re-blessed on development (the bless needs macOS's assembler).

Validation: runtime-sources.sha256 is rewritten (d4a8dbf2...), since device/derive.rs and
device/profile.rs are runtime inputs the guard hashes.

Docs: the runtime README (the floor's limits note and table, compute Parameters, the render push
range, the indirect command buffers' known gaps), docs/API.md section 5 and the from_queries
paragraph, PushWindow's doc, reach.tsv and docs/REFUSALS.md (regenerated; the PushWindow row
only), the device profiles' README, and api_signatures.tsv (DeviceProfile::push_window). The
api_surface table is unchanged: no public type is added.

Tests: lower::push's placement at 256 and 128; from_queries (each committed profile's window is
its limit up to 256, runtime-floor's 128; 128 derives, 64 is refused with required 128); the
tessellation control range, the engine identity and spill tests in each profile's window; and
the runtime's push_window, patch and indirect token tests in two arms each, the device's own
limit and the limit held at 128 by the tests' device shim (tests/command.rs push_window_128,
DeviceOptions::described).

Verified:
- m3-max-68088 (this tree): fmt, the signatures table, the refusal surface, clippy -D warnings
  plain, --cfg m2v_gpu and --cfg m2v_cpu_icd, workspace Rustdoc -D warnings: each exit 0. The
  runtime suite on lavapipe (--cfg m2v_cpu_icd): 647 passed, 3 skipped. Its push lines read
  "push_window: the push window is 256 bytes", "push_window_128: the push window is 128 bytes",
  "window 128, 12 buffers: 3 ring writes and 3 pushes over 3 dispatches", "icb_tokens: ... the
  push window 256 bytes, 25 slot words", "icb_tokens_128: ... the push window 128 bytes, 9 slot
  words", and draw_patches_full_range at 256 and _128 at 128.
- m3-max-68089 (this tree): the core crates 3881 of 3882 passed, 24 skipped; the one failure
  is the golden table, stale under runtime-floor's moved fingerprint (1855 cells, one per row
  observed on Linux, 0 new, 0 gone, 0 under a changed source, 0 changed under an unchanged key).
  Validation 1314 passed, 3 skipped. The translator's push tests print each committed profile's
  window: runtime-floor 128, the vertex function ending at 120, 9 inputs; the 14 others 256.
- m3-max-68067: the whole runtime suite on lavapipe at an earlier tree of this change
  (a98af765ad, before the rebase onto 91fed9449c and the options alias) with a probe commit that
  holds every device's limit at 128 in Device::open (steelbrain/amdfloorb-probe128, never landed):
  647 passed, 3 skipped; the conformance replay exited 0; every push line read 128 bytes.

No card under 256 ran it; the 128 form ran on lavapipe with the limit held at 128.
2026-11-22 10:14:23 -08:00
Anees Iqbal 0702b43baf Translator: a kernel's partial-threadgroups variant that cannot be made is refused as PartialThreadgroups
Every refusal of the partial-threadgroups variant (LoweringInputs::partial_threadgroups) named
Feature::GpuEncodedIndirectCommands, the feature of indirect command buffers a kernel encodes,
which none of them is. A new feature, Feature::PartialThreadgroups (NotImplemented), names them
all:
- lower/select.rs (finish): the kernel's simdgroups run on the emulated tier (its profile's
  subgroups, its lockstep order or its pinned widest mode give it that tier), whose exchanges
  are not walked past the grid. This is the one a SIMD-group or quad-group kernel meets on a
  device whose subgroups are narrower than 32 (lavapipe, and the Iris Xe in the equality test).
- lower/simd/divergent.rs (barriers): a kernel whose uniform barriers need a vote word its
  stage's workgroup memory cannot hold beside its static arena.
- lower/mesh/mod.rs (plan_partial_groups): a tile function, a kernel that reads a stage-input
  region, one with compute derivatives or a cooperative imageblock slice write.
- pipeline/compile.rs (analyze_one): the input beside flat_grid, folded_groups, replay_bindings
  or emulated_simdgroups. Its condition was one with the folded and call-threadgroups
  combinations, which stay GpuEncodedIndirectCommands; it is split in two.
Today the four sites build the same refusal with no symbol, so no text tells the causes apart,
and none is added.

The flat variant's refusal at lower/select.rs:1715 (flat_grid with call_threadgroups, on the
emulated tier or with a workgroup synchronization) stays GpuEncodedIndirectCommands: it refuses
the flat variant, not the partial-threadgroups one, with the flat variant's other refusals
(lower/access/mod.rs plan_replay, pipeline/compile.rs analyze_one); the runtime never sets
flat_grid (no hit in crates/metal2vulkan-runtime/src).

The runtime's test of a refused variant (pipeline.rs, the non-observer's lowering) matches the
new feature, so a variant refused now is still kept as a refusal and its state runs the plain
module. A refusal kept in a device's cache directory before this commit still reads: the
marker (cache.rs REFUSED) holds no feature, and it is found by the variant's key
(function_compile_key), which this commit does not move.

No version moves. No persisted outcome records the moved refusals' class:
- the runtime's cache directory: the marker above, under an unchanged key;
- the golden tables (golden_hashes.tsv, 77 GpuEncodedIndirectCommands cells;
  public_fixture_expectations_engine.tsv, 96): every subject compiles under no inputs, where
  partial_threadgroups is false, and every moved site is reached only under it;
- the authored compile census (corpus/authored-compile.tsv): no GpuEncodedIndirectCommands
  cell;
- the committed observations, cutover lists and conformance recordings: no hit
  (git grep -c over corpus/, cutover/ and crates/metal2vulkan-conformance).
The runtime guard's inputs do not change: every file edited here is outside them or on the
guard's list of compile-time files.

The consumer: git grep -n 'GpuEncodedIndirectCommands' cae6d420df in its checkout gives 0
lines (and 0 for PartialThreadgroups).

docs/REFUSALS.md is regenerated (scripts/refusal-surface/refusal_surface.py), with the new
row's reach mark in reach.tsv (app: a dispatchThreads grid that is not whole threadgroups), and
the signatures table (api_signatures.tsv) has the new variant (signatures.py --bless); the
api_surface table lists Feature as an enum, not its variants, so it does not change. docs/API.md
section 5 and the partial_threadgroups input's doc name the new feature. The translator's
partial-threadgroups tests assert it.
2026-11-22 07:17:41 -08:00
Anees Iqbal bcc88a43cf 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-22 04:03:16 -08:00
Anees Iqbal bda5ed08e9 rt: a resolve into a texture in place over a buffer whose linear image cannot render goes through a resolve image
For the consumer: a pass that resolves into a texture in place over a buffer of the runtime's
own memory, whose linear image takes no colour attachment usage, is no longer refused with
Gap::RenderPass{ResolveUsage}. It resolves into the texture's resolve image, and the pass's end
copies the render area into the buffer at the texture's pitch. This is the guest's 600 x 600
BGRA8Unorm_sRGB ShaderRead texture over a Managed buffer, on every NVIDIA host and on KosmicKrisp:
their linear tiling features hold COLOR_ATTACHMENT for no format (count jobs m3-max-67031 and
m3-max-67032), and a pitch of the row rounded up to the alignment answer (128 and 16) lies in place.
It also covers a texture whose subresource reaches past its own rows or its buffer (the render-reach
rule), on every device. Additive public items: Metrics::resolve_copies and resolve_copy_bytes (in
bytes_copied too), Gauges::resolve_images and resolve_image_bytes. Still refused: a texture in place
over a dma-buf's import (an imported surface's memory) and a view of a texture in place.

Why this form: owner's rule 3 allows "where a format query offers no linear image for the format and
usage, a counted copy", the sentence OverCause::LinearFeatures and RenderReach already rest on for a
render target over a buffer. This is the smallest such copy: one per resolve, of the render area
only, and nothing on later uses. The texture stays in place, so shaders keep reading the buffer's
bytes through its linear image. The planner chose it over moving the texture to the copy form at
its first resolve (2,880,000 bytes per resolving pass, then a copy in every submission that uses
it).

How:
- texture.rs: the in-place texture's Image keeps a Resolving where it lies in the runtime's own
  memory (Laid::Own), its linear image took no attachment usage, and its plan's optimal image does
  (Plan::resolves, the image format query that already made it with COLOR_ATTACHMENT). The first
  resolve makes the resolve image from the texture's plan (Plan::resolved, Bind::Pooled) and a 2D
  identity view of it. Every later resolve reuses them, and they are freed with the texture
  (Free::Resolved, the resolve images gauges). resolve_attachment returns the attachment and, for a
  resolve image, a ResolveCopy: the VkBuffer of the bytes shaders reach and the region at the
  texture's pitch. That is Named::region, the region copied_over already built, now shared. A level,
  slice or layer count past the texture's one is Refusal::AttachmentPlace, as attachment_view
  refuses it.
- pass.rs: Resolve carries the copy. Its image's home is TRANSFER_SRC_OPTIMAL and it renders in
  ATTACHMENT_OPTIMAL. Resolve::from moves it away from UNDEFINED: the pass resolves every texel of
  its render area and copies only those, so nothing it held earlier is kept.
- render_encoder.rs: after the pass's back barrier (which moves the image to TRANSFER_SRC_OPTIMAL),
  end() records vkCmdCopyImageToBuffer of the render area (Pass::reach) into the buffer at the
  texture's pitch. It counts the copy and owes the pass's barrier, so the next command, or the
  segment's end, orders the copy before later work. bufferOffset is a whole number of texels, which
  check_over already requires (VUID-vkCmdCopyImageToBuffer-srcImage-07975; the multiple-of-4 rule,
  07978, is depth and stencil only). The block's buffer has TRANSFER_DST.

Readable through the linear image: the copy writes the buffer, and a later pass reads the same
memory through the texture's linear image. Vulkan 12.11 Memory Aliasing says "If two aliases are
both host-accessible, then they interpret the contents of the memory in consistent ways, and data
written to one alias can be read by the other alias". Buffers, and linear image subresources in
GENERAL or PREINITIALIZED, are host-accessible. The in-place form already rests on that sentence:
its linear image starts preinitialized and stays GENERAL through every use, copies included
(Image::copy_layout, "so that it and the buffer are aliases that interpret their bytes alike
(Vulkan's memory aliasing)"). The order between the copy and the read is the owed barrier, a memory
barrier from every command to every command.

Docs: RenderPassKind::ResolveUsage, the resolve texture's doc, resolve_attachment's and resolve()'s
docs, and the pass module say what resolves through the resolve image and what is still refused.
The runtime README's two Render encoders paragraphs and its counters list are updated, the card
names under "measured on". docs/REFUSALS.md is regenerated (two more AttachmentPlace sites, in
resolve_attachment), and so is the signatures table (the four new fields).

Test: every_device_resolves_a_loaded_pass_into_a_shader_read_texture_over_a_buffer runs the
guest's shape over a Managed and over a Shared buffer, at 2,400, at the row rounded to the alignment
answer, and at 2,560. On an in-place row whose linear image took no attachment usage, it asserts:
- the first resolve makes exactly one image;
- one resolve copy of 1,440,000 bytes, and bytes_copied equal to it;
- the buffer reads the clear within one code, with 0 bytes past the texels changed;
- a pass after it in the same command buffer reads the texture at each pixel (own_pixel_fragment
  into a 600 x 600 target), its centre texel (299, 300) the clear within one code;
- a second resolve, in a command buffer of its own, makes no image and no allocation
  (image_creates, consumer_allocations), and the resolve images gauge does not grow.
The other rows are unchanged: in place with the usage, 0 copies; copied, counted copies. Every
gauge is zero at device drop (each_device). Without this change, the RTX 3090's in-place row at
2,432 is refused with ResolveUsage (job m3-max-67081 on the resolve fix's tree).
2026-11-22 04:02:28 -08:00
Anees Iqbal 0aab6200fb rt: a Managed buffer's device copy placed in an exported block is refused
Device::new_managed_buffer took a device copy in any Private block the consumer held, an
exported block included. The copy's zero fill and its copy-ins at Managed events write the block
through the runtime's own commands, and nothing marks those writes for the textures over the
block (over::ExportedOvers), so they wrote the block unseen. Metal has no way to ask for that
placement: it places a Managed buffer's second copy itself, so no Metal program puts it in memory
another API shares.

The consumer at reims-vgpu 0ec951ecaf makes no such placement.
- `git grep -n 'new_managed_buffer' 0ec951ecaf -- '*.rs'` gives 2 calls, both in
  rt_platform/buffer.rs:
  - At :1463 (own_managed) the copy is in a Private block taken for it.
  - At :1625 (range_of) the copy is in a block taken the same way, or at the `copy` known_at()
    found: a known block of class Private that holds the pin.
- `git grep -n -F '.know(' 0ec951ecaf -- '*.rs'` gives 7 lines. The known blocks come from
  take_block (pool/rt_blocks.rs:121, rt_platform/heap.rs:648 and :907), from page imports
  (rt_platform/buffer.rs:2429) and from tests (buffer.rs:3082, :3083 and :3635).
- None of these is an exported block. The one exported make (rt_platform/export.rs:208) is never
  made known.

The placement is now Refusal::ManagedCopyExported { block }, checked after
ManagedCopyNotPrivate, on a device that keeps a device copy. No existing kind fit:
ManagedCopyNotPrivate says the block is not Private, and an exported block is. Wiring the copy's
writes into ExportedOvers would need a mark at its zero fill and at each copy-in; one check is
smaller. The refusal is a public call's own
check of its arguments, so it holds on every device; on a device with unified memory the copy is
refused before it as ManagedCopyOnUnified.

With the placement gone, a Managed buffer's device copy is no longer one of the routes by which an
exported block's address goes out. The runtime README's exported block rule and the ExportedOvers
doc drop it. The README's Managed buffer paragraph and new_managed_buffer's Err list name the new
refusal. docs/REFUSALS.md, error/basis.rs and the signatures table are regenerated.

Test: every_device_places_a_managed_buffer_s_device_copy_where_the_consumer_says. On a device that
keeps a device copy, it also places one in an exported block of the first handle the device
exports, and asserts ManagedCopyExported naming that block. Before this commit that call returned
a buffer, so the test fails without the change (read from code: no check stood between the Private
class test and the buffer's make).

Verified (tree 3b87fced96, the same tree as this commit):
- Compile job m3-max-66867: signatures and refusal-surface checks, fmt, clippy (plain,
  --cfg m2v_gpu, --cfg m2v_cpu_icd), workspace Rustdoc -D warnings and scripts/api-docs all exit 0.
  The runtime suite on lavapipe: 642 tests run, 642 passed, 3 skipped. Lavapipe is a CPU device,
  so it keeps no device copy and does not reach the new check.
- The m2v_gpu archive is from job m3-max-66876. Each card ran the test, then the runtime suite:
  - RX 550, job m3-max-66896 (a rerun of m3-max-66891, whose log filter dropped the printed line):
    "managed placed: ...: a copy in a OpaqueFd exported block refused"; 644 passed, 3 skipped.
  - RTX 3090, job m3-max-66922: "managed placed: ...: a copy in a OpaqueFd exported block
    refused"; 644 passed (1 slow), 3 skipped.
2026-11-22 02:35:40 -08:00
Anees Iqbal 85aa6c8dee rt: an exported block's BlockInfo states no device address, so its make hands none out
API change for the consumer: BlockInfo::gpu_address becomes Option<u64>. It is Some for every
taken, imported and sparse block, as before, and None for an exported block
(Device::new_exported_block). BlockInfo stays Clone + Copy. The only way to an address of an
exported block's memory is now Buffer::gpu_address of a buffer in it, which marks the block and
counts it in Metrics::exported_blocks_addressed as be1b2cfe46 built it. The consumer's reads of
the field fail to build until each one is reviewed. At reims-vgpu 095001ddc6,
`git grep -n -F '.gpu_address' 095001ddc6 -- 'crates/reims-vgpu-vulkan/src/rt_platform/*.rs'
'crates/reims-vgpu/src/pool/rt_blocks.rs' 'crates/reims-vgpu/src/platform/rt.rs' | grep -v
'gpu_address('` gives 39 lines. Some of them are the consumer's own structs; their types were not
checked one by one. The rt BlockInfo reads among them include:
- rt_platform/buffer.rs:793, the known-block map's key;
- pool/rt_blocks.rs:118 and :170;
- rt_platform/diag.rs:716;
- rt_platform/fault.rs:1405;
- platform/rt.rs:149.

Why: be1b2cfe46 counted the public make itself as handing the address out, because the Block
handle derefs to BlockInfo and BlockInfo's pub field stated the address. The consumer calls
new_exported_block for every buffer-form video cache (rt_platform/export.rs:208 at 095001ddc6). So
every such cache's textures stayed in the over-copy class from their make on. With no address in
the info there is nothing to read by accident. A bookkeeping read (a map keyed by address, a
diagnostics line) now fails to build instead of silently turning the bound off. The Option says
"this block has none", as contents: Option<NonNull<u8>> already does.

How:
- Memory::info() gives None where the memory is exported.
- new_exported_block no longer marks its block at the make. Its body was the crate's
  exported_block(), which only the copy form of new_exported_surface called, and the two are now
  the same; the wrapper is gone and the surface calls new_exported_block.
- No product code read the field. The runtime's tests and the validation crate's replay player
  read it only for taken and imported blocks, and now read the Option.

Docs: the field's doc and new_exported_block's doc, the exported_blocks_addressed doc, the
ExportedOvers doc, and the runtime README (Exported blocks, the address contract in Known gaps,
the exported block's rule in Textures over a buffer). The signatures table and docs/REFUSALS.md
(whose site column named exported_block) are regenerated.

Test: an_exported_blocks_texture_is_copied_in_once_a_change. The block's handle states no address
and the make counts 0. Then a new row on the block's own texture: three submissions that each read
it and then write through an address into another buffer copy it in [0, 0, 0], with 0 blocks
addressed. After Buffer::gpu_address on the buffer the texture is over, the count is 1, and three
more such submissions copy [0, 1, 1]. The surface row follows, with the store_through kernel's
state and buffers now made once for both rows.

Verified:
- Without the change: the base 015ece4929 product with this row printing instead of asserting, on
  lavapipe, job m3-max-66854. It printed "addressed at the make 1, rows [0, 1, 1] (addressed 1),
  then after the buffer's address [1, 1, 1] (addressed 1)". So the row fails without the change.
- Compile job m3-max-66851 (tree a9636bbcf8, the same tree as this commit): signatures and
  refusal-surface checks, fmt, clippy (plain, --cfg m2v_gpu, --cfg m2v_cpu_icd), workspace Rustdoc
  -D warnings and scripts/api-docs all exit 0. The runtime suite on lavapipe: 642 tests run, 642
  passed, 3 skipped.
- The m2v_gpu archive is from job m3-max-66852. Each card ran the test, then the runtime suite:
  - RX 550, job m3-max-66873: 644 passed, 3 skipped, peak 0.96 GiB.
  - Iris Xe, job m3-max-66874: 644 passed, 3 skipped, peak 3.72 GiB.
  - RTX 3090, job m3-max-66875: 644 passed (1 slow), 3 skipped, peak 2.44 GiB.
  Each card printed "OpaqueFd block: copies in a submission that writes through an address, the
  block's address not out: [0, 0, 0], then out: [0, 1, 1]; blocks addressed 0, then 1". Lavapipe
  printed the same line in m3-max-66851.
2026-11-22 02:29:05 -08:00
Anees Iqbal 4c21ead93c bind: the items nothing outside bind/'s own tests reached go, with the tests of them alone
What goes: every item of the translator's bind/ that no product code, no other crate of the
workspace and no consumer reaches, by rustc's own dead-code answer with bind/'s items made
crate-private (no table is trusted), and the tests that test only them. Six files go whole
(acceleration, chroma_decode, rate_map/regions, replay/rules, sample_interleave, tile_map), and
with them replay/draws, replay/generated, fan_out's tests, the device replay's preprocess and the
host replay (replay.rs keeps the merged draw's reads), the heap element and raw-form readers, the
resident set, the mesh arguments module, the rate-map regions, the sparse tile map, the chroma
decoders and the sample interleave modules. Also the empty `impl Device {}`, and the three Device
calls nothing in the tree made: render_descriptor_key, mesh_descriptor_key and
compile_function_with_report (compile_function keeps its body). The old-key test
(the_old_render_descriptor_key_keeps_its_value) goes with render_descriptor_key: one bless item
fewer at every pin.

What stays: what anything reaches. The consumer-reached ArgumentBufferLayout family, the merged
draw's reads (replay/merged and the helpers replay.rs keeps), ycbcr_convert's and
mesh_arguments' reached items, and every bind item validation, conformance, the runtime, the
harness or the examples name. A CPU oracle, accessor or constructor that only tests call, and
whose tests check kept behaviour, becomes #[cfg(test)] test support where it is (812 lines: the
argument layout's `argument`, the YCbCr read model, YCbCrPlanes and YCbCrInPlace's constructors
and accessors, the rate map's accessors and constructors, FunctionTableWords and the snapshot's
bytes, the ASTC and ETC texel formats and block values, heap_classes and image_classes). The
public types without a constructor (TexelRows, YCbCrInPlace, IndirectRef, ViewMapping,
TileThreadgroupMemory, TileThreadgroupArgument, ArgumentFunctionTable, ResidentRange,
BoundAccelerationStructure) stay: a public field or parameter of the library takes each.

Lines (from the batch's tip): product 9,219 removed and 728 added; test 7,758 removed and 381
added. 137 test functions or helpers outside the deleted ones are edited off a deleted item, the
largest by 22 lines. Validation, conformance, the harness and the runtime change only in doc
comments that named a deleted item.

Docs: docs/API.md says what is true now (no replay, no heap element reader, no has_shape, the
texel-buffer parts rule stated inline), docs/REFUSALS.md regenerated, api_signatures.tsv blessed
(522 records out), the api_surface table drops 79 bind names.

Consumer hits at its development (git grep -n -w ITEM development -- '*.rs'). The consumer
imports from metal2vulkan::bind only ArgumentBufferLayout, ArgumentDescriptor,
ArgumentLayoutError and ArgumentType, with no glob, and the runtime re-exports only
bind::SamplerDescriptor; every non-zero count below is a generic word whose hits are the
consumer's own items (none of their lines names metal2vulkan; its 22 `.argument(`/`.place(`
calls are on its own types).

Device::render_descriptor_key 0, Device::mesh_descriptor_key 0,
Device::compile_function_with_report 0.

Deleted public top-level items (93):
ARGUMENT_BYTES 0, bit_index 0, bit_set 0, ChromaDecode 0, draw_merge_module 0, draw_replay_draw 0,
draw_replay_indexed 0, draw_replay_merges 0, draw_replay_module 0, draw_replay_preprocess 0,
draw_replay_primitive_type 0, draw_replay_slots 0, draw_replay_state 0, draw_replay_vertex_layouts
0, DRAW_REPLAY_WRITES 0, DrawMergeModule 0, DrawReplay 0, DrawReplayLayout 0, DrawReplayModule 0,
DrawReplayPreprocess 0, DrawReplayRule 0, extent_of 0, FORMAT 5, GeneratedLayout 0, GeneratedReplay
0, GeneratedVariant 0, geometry_flags 0, GEOMETRY_NO_DUPLICATE_ANY_HIT_INVOCATION 0, GEOMETRY_OPAQUE
0, geometry_table_offset 0, handle_entry_flags 0, HANDLE_TABLE_CAPACITY 0, heap_element 0,
heap_raw_form 0, HeapElement 0, HeapElements 0, InheritedBytes 0, instance_record 0, InstanceRecord
0, interleave_merge_modules 0, interleave_split_module 0, InterleaveMergeModules 0,
InterleaveSplitModule 0, level_extent 0, MAX_DRAW_REPLAY_TYPES 0, MAX_REPLAY_DISPATCHES 0,
MAX_REPLAY_REGIONS 0, MAX_REPLAY_SLOTS 0, MAX_REPLAY_VARIANTS 0, MAX_SEGMENT_COMMANDS 0,
merge_fragment_typed_module 0, MERGED_CHUNK 0, MERGED_HEADER_BYTES 0, MergedLayout 0, MergePhase 0,
mesh_arguments_module 0, MeshArgumentsModule 0, MeshGridRule 0, MetalInstance 0,
NEUTRAL_HEAP_ELEMENT 0, NO_HOLE 0, PARAMS_BYTES 0, PlanesCopy 0, primitive_wrap 0, RateMapRegion 0,
RateMapRegions 0, REGION_BYTES 0, RegionError 0, RegionLimits 0, replay_preprocess 0,
replay_preprocess_generated 0, replay_preprocess_module 0, ReplayExecution 0, ReplayLayout 0,
ReplayPreprocess 0, ReplayPreprocessModule 0, ReplayVariant 0, resident_view 0, ResidentSet 0,
ResidentView 0, resolve 179, SCRATCH 0, SLOT_TABLE_BYTES 0, SOURCE 7, SparseTileMap 0,
split_typed_module 0, STATUS 42, TEMPLATE_HEAD_BYTES 0, texel_buffer_parts 0, TileMapError 0,
TileMapping 0, typed_module 0, VARIANT_BYTES 0

Deleted public methods and associated items (126; the count is of the member's name):
ArgumentFunctionTable::at_address 0, BindingPlan::heap_elements 0, BindingPlan::instantiate_replay
0, BindingPlan::relisted_sampler_tables 0, BindingPlan::sampler_tables 0,
BindingPlan::unit_axes_variant 0, BindState::has_shape 0, BindState::has_shape_beside_used 0,
BoundBuffer::same_shape 0, ChromaDecode::ALL 62, ChromaDecode::BLOCK_BYTES 0,
ChromaDecode::block_extent 0, ChromaDecode::decode 2087, ChromaDecode::decode_into 26,
ChromaDecode::of 20774, ChromaDecode::TEXEL_BYTES 0, ChromaDecode::texel_format 0,
DrawMergeModule::HEADER_PUSH 0, DrawMergeModule::LOCAL_SIZE 0, DrawMergeModule::PUSH_BYTES 0,
DrawMergeModule::push_constants 0, DrawMergeModule::STATUS_PUSH 0, DrawReplay::new 9170,
DrawReplayLayout::argument_offset 0, DrawReplayLayout::fragment_table_offset 0,
DrawReplayLayout::params_offset 0, DrawReplayLayout::vertex_table_offset 0,
DrawReplayModule::LOCAL_SIZE 0, DrawReplayModule::PUSH_BYTES 0, DrawReplayModule::RECORDS_PUSH 0,
DrawReplayModule::RESIDENT_PUSH 0, DrawReplayModule::STATUS_PUSH 0, EtcDecode::block_extent 0,
ExecutionStatus::WORDS 7, GeneratedLayout::count_offset 0, GeneratedLayout::dispatch_offset 0,
GeneratedLayout::INDEX_OFFSET 0, GeneratedLayout::max_sequences 0, GeneratedLayout::PUSH_OFFSET 0,
GeneratedLayout::sequence_offset 0, GeneratedVariant::new 9170, HeapElements::element 103,
ImageViewDesc::new 9170, InstanceRecord::bytes 7067, InstanceRecord::BYTES 29,
InterleaveMergeModules::SET 43, InterleaveMergeModules::WIDE_BINDING 0,
InterleaveSplitModule::LOCAL_SIZE 0, InterleaveSplitModule::SET 43,
InterleaveSplitModule::SOURCE_BINDING 0, InterleaveSplitModule::WIDE_BINDING 0,
MergedLayout::draw_offset 0, MergedLayout::group_count 0, MeshArguments::ARGUMENT_BYTES 0,
MeshArguments::new 9170, MeshArguments::OBJECT_RECORD 0, MeshArguments::scratch_bytes 0,
MeshArgumentsModule::PUSH_BYTES 0, MeshArgumentsModule::SCRATCH_BINDING 0, MeshArgumentsModule::SET
43, MeshArgumentsModule::SOURCE_BINDING 0, MeshArgumentsModule::STATUS_BINDING 0, MeshGridRule::of
20774, MetalInstance::new 9170, ObjectFold::bytes 7067, PlanesCopy::ALL 62, PlanesCopy::format 3896,
PvrtcDecode::BLOCK_BYTES 0, PvrtcDecode::block_extent 0, PvrtcDecode::decode 2087,
PvrtcDecode::decode_rows 0, PvrtcDecode::level_bytes 0, PvrtcDecode::linear 144,
PvrtcDecode::TEXEL_BYTES 0, PvrtcDecode::texel_format 0, RasterizationRateMap::regions 39,
RateMapRegion::scissor_extent 0, RateMapRegion::scissor_offset 0, RateMapRegion::viewport 45,
RateMapRegions::admits 17, RateMapRegions::admits_planned_layers 0, RateMapRegions::MAX_REGIONS 0,
RateMapRegions::physical_size 4, RateMapRegions::precision 24, RateMapRegions::regions 39,
RegionLimits::new 9170, ReplayExecution::new 9170, ReplayFaults::ACTION 4, ReplayFaults::BARRIER 2,
ReplayFaults::BUFFERS 0, ReplayFaults::ENCODING 0, ReplayFaults::GROUP_COUNT 0,
ReplayFaults::PIPELINE 11, ReplayFaults::RANGE 0, ReplayFaults::RECORD 15, ReplayFaults::REGIONS 0,
ReplayFaults::VARIANT 0, ReplayFaults::VERTICES 0, ReplayLayout::argument_offset 0,
ReplayLayout::params_offset 0, ReplayLayout::region_offset 83, ReplayLayout::table_offset 0,
ReplayPreprocessModule::PUSH_BYTES 0, ReplayPreprocessModule::RECORDS_PUSH 0,
ReplayPreprocessModule::RESIDENT_PUSH 0, ReplayPreprocessModule::STATUS_PUSH 0, ReplayVariant::flat
30, ReplayVariant::new 9170, ReplayVariant::with_imageblock_size 0, ResidentSet::bytes 7067,
ResidentSet::holds 3097, ResidentSet::is_empty 1066, ResidentSet::len 4763, ResidentSet::with 6328,
RootTable::resident_ranges 0, SparseTileMap::byte_len 0, SparseTileMap::is_mapped 4,
SparseTileMap::new 9170, SparseTileMap::tile 141, SparseTileMap::to_bytes 6, SparseTileMap::update
185, StatusWord::ALL 62, TexelRows::elements 50, TexelRows::new 9170, TexelRows::size 3417,
TypedModule::requirements 11

Out of the public API into #[cfg(test)] test support (41; the count is of the last name):
ArgumentBufferLayout::argument 298, ArgumentPlace 0, AstcDecode::block_values 0,
AstcDecode::texel_format 0, EtcDecode::ALL 62, EtcDecode::texel_format 0,
FunctionTableSnapshot::byte_len 0, FunctionTableSnapshot::bytes 7067, FunctionTableWords 0,
FunctionTableWords::byte_len 0, FunctionTableWords::new 9170, heap_classes 0, image_classes 0,
RasterizationRateMap::from_layers 0, RasterizationRateMap::layer 325,
RasterizationRateMap::parameter_data_size 0, RasterizationRateMap::physical_granularity 4,
RasterizationRateMap::physical_to_screen 4, RasterizationRateMap::shader_physical_to_screen 0,
RasterizationRateMap::shader_screen_to_physical 0, RasterizationRateMap::vertical 19,
RateMapAxis::from_tiles 0, RateMapAxis::granularity 24, RateMapAxis::screen_extent 0,
RateMapAxis::tiles 148, ycbcr_read 0, ycbcr_texel 0, YCbCrCodes::units 507, YCbCrInPlace::bits 940,
YCbCrInPlace::element_bytes 0, YCbCrInPlace::elements 50, YCbCrInPlace::format 3896,
YCbCrInPlace::of 20774, YCbCrInPlace::view_bytes 3, YCbCrInPlace::with_planes_image 0, YCbCrPlanes
0, YCbCrPlanes::new 9170, YCbCrPlanesSampler::bits 940, YCbCrPlanesSampler::format 3896,
YCbCrPlanesSampler::matrix 122, YCbCrPlanesSampler::range 1784
2026-11-22 01:44:19 -08:00
Anees Iqbal 9f3ff1aa75 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-22 01:27:12 -08:00
Anees Iqbal 8db6d705da Vertex quads ask nothing of subgroupQuadOperationsInAllStages: their modules hold no quad instruction
A vertex function's quad broadcasts and shuffle-xors lower to subgroup shuffles on every device:
quad instructions are emitted only in kernels (lower/simd/mod.rs, GroupPlan::quad_instructions),
and Vulkan exempts the compute and fragment stages from subgroupQuadOperationsInAllStages. So no
module this translator emits needs that property. The tier still refused a vertex function with
quad operations on a device without it (QuadOperations). That refusal was false: the function runs
there as it runs on any other device.

What changed:
- SubgroupModel::quad_all_stages is deleted, with the tier's refusal and quad_instructions' vertex
  clause.
- The requirement derived from a module (spirv/requirements) adds SubgroupQuadOperationsInAllStages
  for a quad instruction in every execution model except Fragment and GLCompute. Before, it was
  added for Vertex alone, so a TessellationEvaluation, task or mesh module that held a quad
  instruction would have missed it. No emitter writes one today; the derivation follows Vulkan's
  rule for any module.
- The description's quad_operations_in_all_stages and VkProperty::SubgroupQuadOperationsInAllStages
  stay. Enabled caps and that requirement read them.

Consumer check: `git -C reims-vgpu grep -n -w quad_all_stages development -- '*.rs'` has 0 hits. The
removed field is the only public item that goes; api_signatures is blessed and loses that one
record. docs/REFUSALS.md is regenerated: the QuadOperations row no longer names the property, and
it has one site.

Test: tests::engine_simd::vertex_quads_need_no_quad_operations_in_all_stages. It compiles
gsm2_vertex_quad_permutes' three vertex functions on the Iris Xe (RPL-P) description with the
property cleared, and each is a valid module that holds no quad instruction or capability. Without
the change, each is refused with QuadOperations. No committed profile has vertex subgroups without
the property, so the tier table is unchanged. The vertex quad cases on the measured cards read as
before: every one of them lists the property.

SEMANTICS: this is a refusal turned into a translation on such a profile. It shares the bump to
2272 with PrecisionNote::VertexSimdgroupGrouping on this branch, since the two land together.
2026-11-22 00:57:03 -08:00
Anees Iqbal 5e3477e60a Translator: a buffer slot takes the storage view on every profile; the uniform view goes
A buffer slot took a uniform view only where containment was the device's
(contain::encoding gave Check::None, under robustBufferAccess or robustBufferAccess2): the
uniform arm of the slot's view choice and Profile F's per-stage storage-buffer fallback. The
runtime enables neither feature, so no runtime module took one. The next commit deletes the
robustness choice; memory, lower and spirv are crate-private, so its dead_code would fail that
commit on its own. The uniform view goes first, with everything that only it reached:

- the uniform forms of a view (UniformWords and UniformVec4) and their reads, and Profile F's
  fallback (fallback_view, fallback_rank). Profile F (runtime-floor without device addresses,
  below the runtime's floor) now refuses a stage past maxPerStageDescriptorStorageBuffers as
  DescriptorCount, where before it read its read-only slots through uniform views, under robust
  descriptors only;
- SlotPlan::lane_read and its planner pass, and Uniformity::among_active_lanes, which only that
  pass ran;
- the storage-view variant: LoweringInputs and VariantKey storage_view_slots, the binder's
  storage_view_variant and large_view_candidates;
- RuntimeFact::UniformViewAliasing and UniformViewRange with UniformViewChoice, and the binder's
  aliasing check with its refusal BindError::UniformViewAliased (docs/REFUSALS.md regenerated:
  binder refusals 9 to 8);
- SpecKey::RangeAtBindOffset (only uniform views declared it), BindState::view_base_alignment and
  uniform_views_at_residual, StageTable.at_bind_views and StageTable::class_alignment;
  BoundBuffer::shape, BoundBuffer::same_shape and StageTable::shape lose their
  view_base_alignment parameter;
- BufferRanges.uniform: BufferRanges::length_class and the binder's offset alignment now read
  maxStorageBufferRange and minStorageBufferOffsetAlignment alone. Nothing in the runtime crate
  reads BufferRanges, BindState, BoundBuffer, StageTable or BindShape (git grep: 0 hits); it
  reaches validation's candidate engine only;
- AccessClass::Uniform, DescriptorView (Storage, UniformWords, UniformVec4) and
  BufferForm::uniform_view; BufferForm::Descriptor loses its DescriptorView field.

The loop hoist stays: the argument table's Uniform block (lower::access::table, the spilled
push fields) still feeds it. Its docs no longer name a buffer slot's uniform view.

Removed or changed public items and the types that own them, each with 0 hits in the
consumer's checkout at bd9d6ae85a and at ad28ebd881 (git grep -w -F over *.rs, *.toml, *.md):
DescriptorView, UniformWords, UniformVec4,
UniformViewChoice, UniformViewRange, UniformViewAliasing, UniformViewAliased, RangeAtBindOffset,
storage_view_slots, view_base_alignment, uniform_views_at_residual, at_bind_views,
class_alignment, uniform_view, same_shape, AccessClass, BufferRanges, buffer_ranges, BufferForm,
StageTable, BoundBuffer, BindState, VariantKey, LoweringInputs, RuntimeFact, SpecKey, BindError.
crates/metal2vulkan/tests/api_signatures.tsv and api_surface.rs are blessed in this commit, and
docs/API.md (the uniform-view form, the bind-offset key, BufferRanges) changes with it.

Stored: VariantKey's storage_view_slots, and the codec tags of BufferForm::Descriptor (no
field), SpecKey (RangeAtBindOffset gone), RuntimeFact (two variants gone) and DescriptorView
(gone). The batch's ARTIFACT_FORMAT_VERSION bump (590 to 591), applied last once for the
batch, covers them; no version moves here.

Tests deleted whole, neither a containment proof: engine_storage_view_variant.rs (the
variant's fixed point) and engine_lane_reads.rs (the uniform view's lane choice). Deleted with
the forms they tested: the uniform-view cases of engine_access.rs and engine_binder.rs, the
slots tests of the large-view candidates and the bind-offset range, the variant's cache round
trip, and the active-lanes tests of lower/simd/uniform. The kept containment proof, a constant
buffer shorter than its window, runs on the storage form
(a_constant_buffer_shorter_than_its_window_is_contained_in_shader). Profile F's new refusal has
its test (a_stage_past_the_storage_buffer_limit_without_device_addresses_is_refused).

Golden: at the batch's top only the stated set's 24 texel-buffer rows moved, the 312 cells
commit 2 alone moved before the rebase; no other row moved on either set. The .air.ll half (567 typed-pointer fixtures,
which need metal-as) is unchecked per commit; the batch's golden bless on the M3 covers it.

Verified:
- On unshipped's tip before this rebase (96d953bb0b), the same change: compile job
  m3-max-66120 green (fmt, signatures, refusals, clippy plain, m2v_gpu and m2v_cpu_icd,
  workspace Rustdoc, api-docs). Before that rebase, this commit alone (hash probe job
  m3-max-65979) read 252 rows equal to its base's arm.
- At the batch's top on 96d953bb0b (all four commits, probe job m3-max-66130): the hash probe's
  252 rows equal unshipped's arm at 4861c9863d (m3-max-65976); the golden probe's set without
  buffer robustness (the runtime's state) equals the base arm 96d953bb0b (m3-max-66128), 1855 of
  1855 rows.
- The states-only play at the batch's top (render and compute states made and refused,
  pipelines_created, made_ahead_variants) is the coordinator's, run on the branch; it is not
  evidence here.
- Here: cargo fmt; signatures check; refusal surface regenerated. The compile job follows on the
  branch tip.
2026-11-22 00:17:41 -08:00
Anees Iqbal 4aee2fa9f1 Translator: the ordered fetch form goes; its computed writes are refused on every device
The framebuffer fetch had a second form chosen by rasterizationOrderColorAttachmentAccess: over
a rasterization-order input attachment, a fragment function computed writes no Vulkan blend,
write mask or logic operation gives. No runtime enables that feature, so the form ran on no
guest's device. It goes (rule 2: a second form chosen by a query outside the named list; rule 4).

What changes:
- A fetch reads its input attachment ordered between draws alone on every device, noted
  UnorderedFetchWithinDraw. Under the identity domains it reads the pushed texture
  (PushField::FetchedColor).
- These states are refused on every device: a padded extended-range attachment's blend; a write
  of some of the codes one word of an extended-range attachment holds; and a blend no Vulkan
  state gives on a rotated (ARGB8Unorm) attachment. Each refusal is FramebufferFetch, not
  implemented (lower::fragment::fetch::computed_write_refused).
- A word attachment under a partial mask takes its format's own attachment, and is refused where
  the device lacks that format.
- A private logic operation on a device without logicOp is refused naming
  PrivateRenderState(LogicOperation) and logicOp.
- Deleted: lower/fragment/input_blend.rs, word_input.rs, the shader logic operation in logic.rs,
  lower/arith/extended_range/blend.rs, pipeline/link/fetch.rs, and the arithmetic only they used
  (the fma emulation cluster, div_exact, encode_keeping).
- Deleted public items:
  - LoweringInputs.framebuffer_fetch and .logic_operation;
  - FramebufferFetchInputs, FetchedAttachment, BlendEquation;
  - GraphicsState.rasterization_order_attachment_access and
    FragmentCaps.rasterization_order_color_access;
  - metal::format::extended_range_blend, Feature::ExtendedRangeBlend and the ExtendedRangeBlend
    enum;
  - RuntimeInput::FramebufferFetch and ::LogicOperation;
  - RuntimeFact::ExtendedRangeInputBlend, ::RotatedInputBlend and ::WordInputMerge;
  - PrecisionNote::ExtendedRangeBlendSource and ::ExtendedRangeFloatBlendSource.
- The enable-set facts class VK_EXT_rasterization_order_attachment_access as described and never
  enabled.

Docs, in this commit:
- rt README: Known gaps of render encoders gets one line per refused state, each built on the
  runtime's own fetch form if a guest meets it. The Not-enabled row of
  rasterizationOrderColorAttachmentAccess goes, and so does logicOp's mention of the shader form.
- docs/API.md loses the two blend-source notes from the precision-note catalogue, the
  rasterization-order form and the word merge.
- REFUSALS.md is regenerated (reach row of ExtendedRangeBlend removed), along with
  api_signatures.tsv and the api_surface table.
- The conformance ledger: the 39 rows refused naming rasterization-order access (on llvmpipe and
  the UHD 630; on other venues the case read as lacks-feature) become 22 every-venue rows,
  refused, needs NotImplemented. The matrix replay on development confirms the scope.

Lines: product sources (crates/metal2vulkan, -air, -runtime src, tests excluded) +238 -4647;
product tests +277 -2279; validation and conformance +61 -182; docs +48 -67.

Consumer search (reims-vgpu at 71573a84c8, git grep -w over *.rs, *.toml and *.md):
- 0 hits: ExtendedRangeBlend, rasterization_order_color_access, BlendEquation,
  FramebufferFetchInputs, rasterization_order_attachment_access, framebuffer_fetch,
  extended_range_blend, ExtendedRangeBlendSource, ExtendedRangeFloatBlendSource,
  ExtendedRangeInputBlend, RotatedInputBlend, WordInputMerge, DualSource.
- Hits that are not these items: FetchedAttachment 2 (rt's DrawKind); logic_operation 8 (its
  own structs and rt's private state).
- RuntimeInput: only LinkedFunction is used.
- No glob import or re-export of a metal2vulkan module (only `use metal2vulkan_runtime as rt`).

Verified: cargo fmt; refusal surface and signatures regenerated locally. The compile job and the
host suites follow on the branch.
2026-11-22 00:17:40 -08:00
Anees Iqbal c78ff4022c Translator: a ulong texture's atomics are refused on every device; the 64-bit image form goes
The rule: a sole lowering under 150 lines that nothing executes is
deleted to a typed refusal. Metal's atomic_min and atomic_max on a ulong
texture lowered to OpAtomicUMin/UMax on an R64ui image, which needs
shaderImageInt64Atomics; no runtime enables it, so nothing ran the form.

texture::atomic::select now refuses the pair as
Unsupported{ImageAtomics} not implemented, on every device. Gone with
the form: TexAtomic.ulong, the R64ui slot declaration and its reads and
writes in the emitter, RuntimeFact::UlongAtomicView with its codec, name
and mechanism rows, the binder's R64_UINT view and neutral,
DeviceProfile::ulong_atomic_gaps, LeafCaps.image_int64_atomics, and
R64_UINT in the queried formats. VK_EXT_shader_image_atomic_int64 is
described and never enabled. Product lines +34 -142.

Tests: the four tests of the 64-bit form and the fact's round trip go;
ulong_atomics_are_refused_on_every_device asserts the refusal on every
committed profile; the legacy-offset test takes the refusal as a gap;
the mechanism table renumbers; the recommendations test lists
shaderImageInt64Atomics as unread. The runtime README's known gap says
the atomics are refused, and its Not enabled row for
shaderImageInt64Atomics goes (the profile reads it no more).
docs/REFUSALS.md and api_signatures.tsv regenerate.

Consumer search (reims-vgpu ad28ebd881): ulong_atomic_gaps 0,
UlongAtomicView 0, image_int64_atomics 0.
2026-11-22 00:17:22 -08:00
Anees Iqbal 90b3171413 Translator: a multisampled storage image is refused on every device; the enabled arm goes
Where a profile enabled shaderStorageImageMultisample a multisampled storage slot was declared,
and a heap held multisampled storage classes; elsewhere both were refused as needing the
feature. The runtime never enables it (its README: a multisampled texture has no storage element
on any device, as Metal's shaders only read one), and no test executes the declared form. The
enabled arm goes: the slot and the heap group are refused Unsupported::not_implemented(
Feature::StorageImageMultisample) on every device, the heap's image classes hold no
multisampled storage class, and the public ImageCaps.storage_multisample goes with its
derivation. docs/REFUSALS.md is regenerated (the refusal is ours now, at both sites). The
VkFeature vocabulary and the requirement derivation of a multisampled storage image type stay.

The runtime README's "Not enabled" row for shaderStorageImageMultisample goes
(tests::feature_enables fails on a row the profile no longer reads).

Tests: the heap class test asserts no multisampled storage class on any profile.

Class 3 of the planner's rule (a sole lowering under 150 lines that nothing executes). Public
item removed: ImageCaps.storage_multisample (api_signatures.tsv blessed); the consumer's
checkout (reims-vgpu at bd9d6ae85a) holds 0 uses of it. Product lines: +14 -16. No module that
compiles changes; no SEMANTICS bump.
2026-11-22 00:17:21 -08:00
Anees Iqbal 3d8e01d2c2 Translator: the coverage after the depth tests is refused on every device; its lowering goes
[[sample_mask, post_depth_coverage]] read SampleMask under the PostDepthCoverage execution mode
where a profile enabled VK_EXT_post_depth_coverage, and was refused as needing the extension
elsewhere. The runtime never enables the extension, so it refused every such function all along,
and nothing ever executed the lowering: no test runs it, and the golden tables only compile it.
It goes to a typed refusal, Unsupported::not_implemented(Feature::PostDepthCoverage), at the
parameter's plan; the IR's ExecMode::PostDepthCoverage goes with its builder, serializer and
requirement arms, and the enable-set facts class the extension as described and never enabled.
The AIR decode of the parameter (Builtin::PostDepthCoverage) and the SPIR-V and Vulkan
vocabulary stay, the decode being what the refusal reads.

The refusal moves from a device's to ours: Feature::PostDepthCoverage's doc, its reach mark and
docs/REFUSALS.md (regenerated) say every device. The runtime README's known gaps of render
pipeline states gain its line: refused on every device, built on the extension with its tests if
a guest meets it.

Class 3 of the planner's rule (a sole lowering under 150 lines that nothing executes). No public
item goes (signatures.py --check clean). The consumer's checkout (reims-vgpu at bd9d6ae85a)
names it once, Metal's supportsPostDepthCoverage in a guest test's protocol member list, not an
item of ours. Product lines: +15 -34. The golden tables' pdc_after rows move from compiled to
refused on the profiles that enabled the extension (re-stamped at the pin); no SEMANTICS bump
(the refusal changes no module that compiles).
2026-11-22 00:17:21 -08:00
Anees Iqbal 22d32fc372 Translator: a raster order group takes the pixel interlock alone; the sample interlock goes
A raster order group of a function that runs at sample rate took SampleInterlockOrderedEXT where
a profile enabled fragmentShaderSampleInterlock and not the pixel interlock. The runtime never
enables the sample interlock (floor.rs: the pixel interlock where reported, the sample interlock
left off), so on its devices every group already took the pixel interlock or was refused; once
validation enables what the runtime enables nothing runs the sample arm. It goes with the
public FragmentCaps.sample_interlock and its derivation, the IR's ExecMode::SampleInterlockOrdered
with its builder, serializer and requirement arms, and lower::fragment::rog's sample-rate test
of the stage interface. The refusal on a device without the pixel interlock names that feature
alone, at the site and in the device's unsupported-feature list (docs/REFUSALS.md regenerated).
The VkFeature, SPIR-V capability and execution-mode vocabulary stays.

The runtime README's "Not enabled" row for fragmentShaderSampleInterlock goes
(tests::feature_enables fails on a row the profile no longer reads).

Tests: the sample-interlock test becomes a test that a device with the sample interlock and
without the pixel interlock refuses a sample-rate group; the builder and serializer tests take
the pixel interlock.

Class 1 of the planner's rule (an alternative to what the runtime runs). Public item removed:
FragmentCaps.sample_interlock (api_signatures.tsv blessed); the consumer's checkout
(reims-vgpu at bd9d6ae85a) holds 0 uses of it. Product lines: +15 -58. Modules change only
on profiles that enabled the sample interlock without the pixel interlock (none of the
committed profiles); no SEMANTICS bump.
2026-11-22 00:17:21 -08:00
Anees Iqbal a347af5f65 Two stage bounds by path: kernels leave the process past 39,014, render stages are refused past 99,109
COMPILED_STAGE_WEIGHT is now 39,014: the heaviest kernel measured to compile in its creating
process within 512 MiB of that process's resident growth on every driver measured. Made cold (no
pipeline cache, shader cache off) and alone in its own process, the app library's heaviest kernel
under the old bound (entry weight 39,014) grew the process by 350 MiB in 6.8 s on the Iris Xe of
RPL-P (ANV, Mesa 26.2.6; job m3-max-66048), 148 MiB in 1.8 s on an RTX 3090 (NVIDIA 620.70.06;
job m3-max-66050) and 80 MiB in 0.55 s on a Radeon 780M (RADV, Mesa 26.2.6; job m3-max-66049).
No real stage between 39,014 and 99,109 is measured (the app's 63-kernel library, job
m3-max-65984; the nine standard streams and the app's two recordings, states-only on lavapipe, job
m3-max-66001). The older build's 1.76, 2.24 and 3.65 GiB (job m3-max-26147) and the helper's
2,620/2,763 MiB and 3 GiB breaches (job m3-max-65807) stay in the docs as what lies above it.

No helper compiles a render stage, so the runtime keeps 99,109 as its own render bound
(stage::RENDER_STAGE_WEIGHT): past it a render pipeline is refused (Gap::StageSize,
StageGap::RenderStage), at or under it it compiles in the process with no cap. The heaviest real
render stage measured (35,063 beside a vertex stage of 431; 39,424 as lavapipe's profile weighs
it) grew the process by 316 MiB in 3.8 s on the Iris Xe (job m3-max-66048), 180 MiB in 2.5 s on
the RTX 3090 (job m3-max-66050) and 58 MiB in 0.6 s on the 780M (job m3-max-66049). The docs say
the two numbers measure two things and become one when a render helper exists. Metrics gains
render_makes_past_kernel_bound and render_weight_past_kernel_bound_max: render pipelines translated
with a stage past the kernels' bound, and the heaviest such weight.

The translator's re-plan keeping the widest pin follows the constant (StageBounds::MEASURED), so
SEMANTICS_VERSION 2269 -> 2270. The rt README's stage-bound section, its render-pipeline known gaps (the
uncapped range), Gap::StageSize's docs, docs/API.md, docs/REFUSALS.md and the signature table are
updated; the "132 s and 3.65 GiB" basis is replaced by today's figures.

Test: a_render_state_past_the_kernel_bound_is_made_in_process_and_counted (with the kernels'
bound set to 1, a render state is made, not refused, and counted once at its heaviest weight); it
fails before this change, where the render check read the kernels' bound.

Verified: the figures are the rows of jobs m3-max-66048, 66049 and 66050 (probe branch
steelbrain/boundread-probe 7dd5c2f52e, never lands: each make's peak reset before it, VmHWM after
it less VmRSS before it). Checks on the branch (f8ed8d8953, the same change on 4e9aad67d5 with its bump numbered 2271):
compile job m3-max-66144 green (fmt, clippy plain / m2v_gpu / m2v_cpu_icd, workspace Rustdoc,
signatures, refusal surface, api-docs); the rt device suite on lavapipe m3-max-66148, 640 passed;
suites m3-max-66146, product 4023/4027 with the four bless-class failures development's own run
showed, validation 1334/1334, conformance 1025/1025, doctests. Golden: 0 cells moved by this change
(887 changed in both arms, jobs m3-max-66226 and m3-max-66260, lists identical); the render key
moves with SEMANTICS. States-only play of the 9 standard streams (m3-max-66274): 0 refused, 0 not
attempted, every count equal to m3-max-65778's. Landed on 626cbd9846 with SEMANTICS 2270, as it
landed before the batch.
2026-11-21 23:13:25 -08:00
Anees Iqbal 591f813569 REFUSALS.md: a rate map outside the compile's measured bounds is ours
docs/REFUSALS.md section 4 showed '-' for its five rows (UnpinnedCompile: ScreenExtent,
LayerCount, DenseSamples, SampleOutOfRange, SampleCount). The code says the basis: each is
built in one place, `RasterizationRateMap::new` (bind/rate_map.rs), through
`RateMapError::Unpinned`, which refuses a descriptor outside the bounds where Apple M3's compile
was measured, and the enum's own doc states "The bounds are this crate's, not Metal's". So the
script derives `ours` for the section, as it does for the translation caps and the deadline.
No row of another section moved. Every section's '-' total is now 0.

Verified (locally, source-reading scripts): refusal_surface.py --check and --selftest pass.
2026-11-21 19:04:11 -08:00
Anees Iqbal dd150e4f46 Delete the 14 Feature variants and 3 Needs variants nothing builds
Nothing in the product crates built these 14 Feature variants: SamplePositions, TextureSize,
TextureSampleCount, TextureView, MipmapGeneration, HostMemory, GpuTimes,
ViewFormatReinterpretation, SeparateMultisampledDepthStencil, SparseTextures,
TimelineSemaphores, HeapTextureTiling, UndeclaredTextureUsage and RenderTargetSize. They were
refusals of the runtime this tree cut over from, and so they were docs/REFUSALS.md's last 14 '-'
rows. Nothing built the Needs variants DeviceCapability, MetalGpuFamily and MetalRefuses either,
nor called their constructors Unsupported::device_capability and Unsupported::metal_gpu_family
outside tests. No doc or test showed one to be the vocabulary of a Metal refusal anything
answers: the three Feature docs that said the runtime answers MetalGpuFamily or MetalRefuses
were corrected in the previous commit.

Searches:
- The tree, outside the definitions, the reach rows and the generated tables:
  - Feature::SeparateMultisampledDepthStencil in one translator test
    (bind/depth_stencil_copy/tests.rs), now Feature::StencilExport, since
    depth_stencil_copy_modules refuses with whatever feature its caller names;
  - Feature::SparseTextures, SparseNeed and Unsupported::device_capability in one conformance
    test of verdict::device_gap_of's DeviceCapability arm. That test pinned a chain from the
    runtime's `sparse_refusal`, which no longer exists, so the test and the arm go together;
  - Unsupported::metal_gpu_family and the three Needs variants in error/tests.rs
    (one_of_each and the retry table);
  - the golden and public-fixture tables' refusal cell (golden_hashes.rs, public_fixtures_engine.rs)
    named the other Needs through a wildcard arm, now unreachable: the three arms are the cell;
  - stale prose naming them in conformance cases/sparse_heaps.rs, probes/bgra4_write_and_mipmap.m,
    the engine fixtures README and docs/API.md (its TextureSampleCount sentence now names the
    runtime's Limit::TextureSamples, which refuses that texture);
  - the payload enums SparseNeed and LinearNeed are used by nothing else, and go too.
  The other hits for these names are other enums' variants (the runtime's Limit::TextureSize,
  Refusal::TextureSampleCount, Gap::TextureView, ImportHandle::HostMemory, ...).
- The consumer's checkout at bd9d6ae85a: 0 hits for Feature:: with any of the 14, SparseNeed,
  LinearNeed, Needs::DeviceCapability, Needs::MetalGpuFamily, Needs::MetalRefuses,
  metal_gpu_family or device_capability( (its own `Piece::SamplePositions` and
  `Piece::SparseTextures` and its own HostMemory types are unrelated).

Needs is now AnyOf, NotImplemented and NotRepresentable; Needs::basis answers Device, Ours and
Device for them. The script drops the two constructors and their condition texts.
docs/REFUSALS.md: section 1 is 119 variants, every one with a site and a basis (device 51,
ours 68, '-' 0). api_signatures.tsv: 35 records removed, all in metal2vulkan::error; the public
surface table loses SparseNeed and LinearNeed.

Verified (locally, source-reading scripts): refusal_surface.py --check and --selftest pass;
signatures.py --check passes after --bless.
2026-11-21 19:04:10 -08:00
Anees Iqbal 004573964a 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-21 18:27:01 -08:00
Anees Iqbal 7f156bc920 Error::basis answers a translation error from what its refusal needs
The runtime's Error::basis answered None for every Error::Translation, so each translator
refusal a guest met sat in a consumer's census unsorted between Metal's own refusal and our
gap, and 36 of the translator's 133 Feature variants showed no basis in docs/REFUSALS.md.

What:
- RefusalBasis moves to metal2vulkan::error; the runtime re-exports it at the same path
  (metal2vulkan_runtime::RefusalBasis: its signature records do not move).
- Needs::basis: AnyOf, DeviceCapability and NotRepresentable are Device, NotImplemented is
  Ours, MetalGpuFamily MetalDocumented, MetalRefuses MetalMeasured.
- metal2vulkan::error::Error::basis: a refusal's from its Needs; LimitExceeded, Budget and
  Internal Ours; InvalidInput, InvalidDescriptor, NeedsInput and Cancelled None. Both matches
  are exhaustive in the translator, so a new Needs or Error variant must answer (the runtime
  could not match the translator's #[non_exhaustive] enums without a wildcard arm).
- The runtime's arm is `Error::Translation { error, .. } => error.basis()`.
- refusal_surface.py follows the helper a site hands its feature to (a front-end reference is
  NotImplemented; the feature argument of a construction; a helper's argument; the enclosing
  function's computed construction; a function that returns the feature, through its calls in
  its file). Its kind-to-basis table is read from Needs::basis's arms. --check fails on a
  variant with a site whose basis is not settled.
- docs/REFUSALS.md: the 22 variants with a site and no basis are settled, and their Where
  cells filled; no other row's Where or Basis moved. Section 1's totals: device 51, ours 68,
  '-' 14 (the 14 variants nothing builds).
- The docs of SimdgroupMatrix16x16x16, IndirectRenderState and GlobalBuiltinInFragment (and
  three comments that repeated them) said the runtime answers them as Metal's own refusal; no
  code does, and the translation refuses them NotImplemented on every device, so they say that.

Size, past the 200-line mark (hand-written lines, generated tables excluded): 272 added, 50
removed. The script +147/-12 (helper following and its call scan about 60, the Needs table and
derived basis 20, scan bookkeeping 25, the unsettled check 12, selftest cases 20, doc text 10);
the translator +63/-7 (21 of them RefusalBasis moved from the runtime, -23/+8 there); the
runtime test +44; docs/API.md +6.

Verified (locally, source-reading scripts): refusal_surface.py --check and --selftest pass;
with unsettled() emptied the selftest fails; signatures.py --check passes after --bless added
7 records, all on metal2vulkan::error.

Verified: compile m3-max-65442 (fmt, refusal_surface.py --check and --selftest, signatures.py --check,
clippy plain / --cfg m2v_gpu / --cfg m2v_cpu_icd, workspace Rustdoc -D warnings, scripts/api-docs);
host suites m3-max-65443 (metal2vulkan, -air, -runtime: 3969/3969, the golden hashes and the old
render key among them; doctests); before-run m3-max-65444 (development plus the new test alone):
a_translation_error_answers_the_basis_of_what_it_needs fails as expected (None against Some(Device)).
2026-11-21 18:25:57 -08:00
Anees Iqbal 325e88c276 Runtime: an indirect offset off 4 is Metal's documented refusal; arguments past the end are ours
Refusal::IndirectOffset covered two cases under one `ours` basis. Metal's headers document
the first: "indirectBufferOffset must be a multiple of 4" (MTLComputeCommandEncoder.h for
dispatchThreadgroupsWithIndirectBuffer:indirectBufferOffset:threadsPerThreadgroup:,
MTLRenderCommandEncoder.h for the indirect drawPrimitives and drawIndexedPrimitives; Apple's
page for the indirect drawPatches sends its offset to the feature set tables, whose minimum
constant buffer offset alignment is 4 bytes). The headers state no rule for the second,
arguments that run past the buffer's end, which is the runtime's own check because Vulkan's
indirect commands read inside the buffer (VUID-vkCmdDispatchIndirect-offset-00407,
VUID-vkCmdDrawIndirect-drawCount-00487, VUID-vkCmdDrawIndexedIndirect-drawCount-00539).

- IndirectOffset { offset, length } is now the offset-off-4 case alone, Basis:
  metal-documented.
- New IndirectArgumentsPastEnd { offset, length, needed }, Basis: ours, for arguments at a
  multiple of 4 with fewer than `needed` bytes (12 dispatch, 16 draw, 20 indexed draw) after
  the offset, or an end that overflows.
- Both raise sites (the indirect dispatch, and the indirect draws' shared check) test the
  alignment first, then the length.
- Regenerated docs/REFUSALS.md and error/basis.rs (refusal_surface.py), and
  api_signatures.tsv (one variant added). The runtime README's indirect-draw paragraph
  names both refusals.

Tests: every_device_refuses_an_indirect_dispatch_off_4_or_past_the_buffer_s_end (compute)
and every_device_refuses_an_indirect_draw_off_4_or_past_the_buffer_s_end (draw) assert each
variant and its basis(): off 4 at 2 and at an offset that is also past the end (alignment
first), past the end at a multiple of 4 and at an overflowing offset, an indexed draw's 20
bytes where a plain draw's 16 fit; then the arguments in each buffer's last bytes dispatch or
draw and their results are read back. The compute refusal test's two IndirectOffset asserts
moved into the dispatch test.

Checked here: refusal_surface.py --check and signatures.py --check pass (source only).
2026-11-21 15:33:10 -08:00
Anees Iqbal c5ee8d7919 rt: Error::basis answers each refusal's basis, generated from its Basis: line
What: a public RefusalBasis (MetalDocumented, MetalMeasured, Ours, Device) and Error::basis, which
answers Refused, Limit and Unsupported from the variant's own basis, BelowFloor and
NoDirectDriverLoading as Device, and None for Translation, the platform's and Vulkan's failures and
the consumer's own block, stage or quiesce. Refusal::basis, Limit::basis and Gap::basis live in
crates/metal2vulkan-runtime/src/error/basis.rs, which scripts/refusal-surface/refusal_surface.py
writes from the `Basis:` line each variant's doc comment ends with: 131 arms (Refusal 82, Limit 17,
Gap 32), one per variant in declaration order, no `_` arm. The doc comment stays the one source.

Why: a consumer's census of the refusals its guests meet could only match names, so 67 refusals
whose basis is ours counted as "Metal refuses it". A typed basis tells them apart.

How: the script enumerates the enums structurally (rt_refusal_enums), reads each variant's pattern
(`Name`, `Name(..)`, `Name { .. }`) with enum_arms, and maps the basis value to the RefusalBasis
variant it names. It fails where the enum has no such variant (metal-takes and unknown have none:
the value comes with the first variant that needs it) and where a name is too long for rustfmt to
keep its arm's pattern on one line. It writes the file as `cargo fmt` leaves it (one line per arm,
else rustfmt's block form past 100 columns), so no rustfmt run is needed. `--check` fails where
basis.rs is stale, as for docs/REFUSALS.md, and one run regenerates both. `--selftest` gains three
cases: the arms and the block form, two Basis lines give two files, a missing value fails.

Verified: refusal_surface.py --check and --selftest, signatures.py --check and cargo fmt --check
pass on this tree. The generated forms were checked against rustfmt at five name widths and three
variant shapes. The compile job and the lavapipe rt suite are named in the lane report. Without
the change, the new tests do not build: RefusalBasis is unresolved and `basis` is not found.
2026-11-21 09:41:04 -08:00
Anees Iqbal 44a1c864c8 rt: no copy command whose source and destination share memory: buffer copies over a texture in place cut in slabs, heap aliases refused
A copy between a buffer and a texture in place over its bytes (copy_from_buffer into it,
copy_from_texture_to_buffer out of it, and their options forms) recorded one
vkCmdCopyBufferToImage or vkCmdCopyImageToBuffer whose region's bytes could be the texture's own,
which Vulkan forbids (VUID-vkCmdCopyBufferToImage-pRegions-00173,
VUID-vkCmdCopyImageToBuffer-pRegions-00184). And a copy between two textures placed in one heap
whose ranges meet, or between a heap buffer and a heap texture whose ranges meet, recorded one
command over memory one image lays out as the device chooses (VUID-vkCmdCopyImage-pRegions-00124
and the same two). Metal leaves both undefined.

Buffer and texture over it: buffer_copy now compares the region's rows (its offset and
bytes_per_row in the VkBuffer shaders reach) with the texture's rows (Side::rows, from bufcopy)
where both lie in one VkBuffer, and feeds every meeting pair of rows to bufcopy's meeting/cut:
one slab form for every copy whose bytes meet. A BufferCopy carries its slabs; each slab is its
own vkCmdCopyBufferToImage / vkCmdCopyImageToBuffer, with the COPY->COPY execution barrier between
two slabs that copy_from_texture's slabs take (now one fn, between()). The region on the
texture's own texels copies nothing; regions whose bytes do not meet stay one command. The answer
is the source's bytes from before the copy, as an Apple M3 Max gives between two textures over one
buffer (conformance buffer_texture_blits); between a buffer and its texture it was not recorded on
a Mac.

Heap aliases: a texture names where its image's memory lies that other resources may share
(TextureObject::bound: a heap texture's range, from Under::Heap's block and offset; a texture in
place, from its rows). copy_from_texture between two textures (not one image) whose memory meets
where either has no rows, and a buffer copy whose region's bytes meet a heap texture's memory, are
refused: nothing records, and nothing is emulated.

Both refusals have their own kind, Gap::OverlappingCopy { pixel_format }, which also takes over
bufcopy's two shapes no one-axis cut orders (a destination row across the end of its own source
row and the start of the next; rows of two pitches meeting at their starts), until now under
Gap::TextureCopy. Every one counts in the new Metrics::overlapping_copies_refused.

Docs: the rt README's blit section describes the buffer slabs and the heap refusal, and a new
"Known gaps of blit encoders" names the two shapes (built, cut on two levels, when a replay stream
or a walk counts one) and the heap refusal. docs/REFUSALS.md regenerated; api_signatures.tsv
blessed (the variant and the Metrics field).

Tests: a_buffer_copy_over_its_texture_s_own_bytes_copies_in_slabs_or_in_no_order (slabs a row on
into and out of the texture with their order, two texels on both ways, a one-row region, whole rows
two texels on unordered, a region after the texture and one in another buffer one slab, the
texture's own bytes nothing, a heap texture's memory met or not);
textures_whose_memory_meets_where_one_is_laid_out_by_the_device_copy_in_no_order (heap/heap both
ways, in place/heap, touching ranges, another buffer, a texture of its own, two slices of one heap
texture). On a device: every_device_copies_between_a_buffer_and_a_texture_over_it_from_the_source_before_the_copy
(a row on and back into and out of the texture, within the rows both ways, apart; whole buffer
bytes as from the source before the copy, one submission, 2 + slabs barriers, no byte copied; whole
rows a memory alignment on refused, counted, nothing recorded) and
every_device_refuses_a_copy_between_heap_resources_whose_memory_meets (texture onto its alias, into
and out of a heap buffer over its bytes: refused, counted 3, nothing recorded; copies between heap
resources apart run, the bytes back as they went in, one submission). bufcopy's device test now
expects Gap::OverlappingCopy and its count.
2026-11-21 07:59:23 -08:00
Anees Iqbal 817463704e rt: texture buffers are buffer views of their buffer's bytes in set 1's two texel-buffer arrays
What: Buffer::new_texture of a texture buffer's descriptor makes one VkBufferView of the bytes
shaders reach (a Managed buffer's device copy where it has one), from the offset, its width's
texels long: no image, no copy, no new push field. Set 1 gains two arrays of 65,536 elements,
binding 5 (uniform texel buffers, the read ones) and binding 6 (storage texel buffers, the written
ones), at the same index class as textures; a texture buffer's index is the same element of both,
and placing a texture or a texture buffer over the other's index nulls the other's elements. The
translator's identity domains classify a texture_buffer slot or argument-buffer member as a texel
buffer of that array (no TexelBufferRange fact, no swizzle under identity), so a pipeline that
declares one is no longer Unsupported{IdentityDomains}. SEMANTICS_VERSION 2258.

Metal's own refusals are typed: an offset off Device::minimum_texture_buffer_alignment
(minimumTextureBufferAlignmentForPixelFormat:, the device's texel-buffer offset alignment, the
larger of the uniform and storage ones, a single texel's size where the device says it suffices)
is Refusal::TextureBufferAlignment; a bytesPerRow below the row or texels past the buffer is
Refusal::BufferTextureLayout; a descriptor of more than one row, level, slice or sample, and a
swizzle with writes, as Metal refuses them. Device::new_texture (and every other make) of a texture
buffer's descriptor is Refusal::TextureBufferNotOverBuffer: the consumer places the bytes as it
places every buffer. Gap::TextureBuffer goes; a swizzled texture buffer (Gap::TextureBufferSwizzle),
a view of one, and a blit copy of one are recorded gaps. A format needs both texel-buffer usages in
its buffer features (Gap::TextureFormat otherwise): the view's buffer has both usages, and without
maintenance5 its usage is the buffer's.

The floor requires the six texel-buffer descriptor-indexing features (update-after-bind, dynamic
and non-uniform indexing, uniform and storage) and raises the limits the two arrays count against:
uniform texel buffers against the sampled-image limits, storage texel buffers against the
storage-image limits, both against maxPerStageUpdateAfterBindResources and the pools: sampled and
storage per stage and per set 131,072 (196,608 sampled with attachment reads' second elements),
resources 262,152 (327,688), pools 274,144 (339,680). Every recorded device fits: the 8 device dumps'
least are llvmpipe's 1,015,808 sampled/storage/resources and the UHD 630's 1,048,576 pools; all 12
devices there report the six features.

Why: six harvested guest functions declare a texture buffer, and a pipeline that declared one was
refused at creation.

Checked by: tests::texture_buffers (lavapipe: R32Uint read at a buffer offset and written, out of
bounds read zero and dropped, atomics through read_write, every refusal), engine_identity's
a_texture_buffer_is_the_texel_buffer_element_its_resource_id_names (L3 on lavapipe and moltenvk-m3),
the floor tests, the signatures table and REFUSALS.md regenerated; the lane's compile job reports
the runs.
2026-11-21 07:27:27 -08:00
Anees Iqbal abb3c82247 rt: a copy between two textures over one buffer whose bytes meet copies in slabs
copy_from_texture recorded one vkCmdCopyImage when its source and destination were two
different textures in place over one buffer (each a linear image on the buffer's bytes) whose
regions' bytes meet, which Vulkan forbids (VUID-vkCmdCopyImage-pRegions-00124: no memory both a
source and a destination of one command). Only regions of one subresource of one image were
cut into slabs. Metal leaves such a copy undefined; an Apple M3 Max gives each destination texel
what the source held before the copy (the conformance crate's buffer_texture_blits rows
within-buffer-a-row-on and -reversed).

A texture in place now names where its texels lie: the VkBuffer commands reach the buffer's bytes
through (one per allocation, spanning it), the first texel's offset there and the row pitch the
device reports for the linear image (Rows, Side::rows). Where both textures of a copy lie in one
VkBuffer, texture_copy finds every pair of a destination row and a source row whose bytes meet
(meeting: a source row meets at most the two destination rows whose starts lie nearest it, as a
pitch is at least a row; nothing to look at where the two regions' spans of bytes do not meet)
and feeds their shifts to the slab chooser of 7c1baad228, generalized to take several shifts
(cut): an axis every shift moves along, all one way, is cut no thicker than the least shift in
whole texels (bytes along x, rows along y), the end the shifts point to first, so no slab's
source and destination share a byte and no slab reads a byte an earlier one wrote; the axis of
fewest slabs wins, as before. One subresource of one image is the one-shift case and cuts as
before. Regions on the same bytes copy nothing. Regions whose bytes do not meet, interleaved rows
included, stay one command.

Where along each axis the rows meet shifted both ways, or not shifted (a destination row across
the end of its own source row and the start of the next, or rows of two pitches meeting at their
starts), no cut along one axis keeps the order: Gap::TextureCopy names that arm now, its doc,
docs/REFUSALS.md (regenerated) and the rt README's blit section with it, instead of an invalid
command. No scratch image, no cap, no copy of the runtime's own.

Tests: regions_of_two_textures_over_one_buffer_copy_in_slabs_where_their_bytes_meet checks the
slabs (a row on both ways with the regions' order, two rows on, two texels on within the rows
both ways, a row and two texels on), the gap (whole rows two texels on; two pitches meeting),
one slab for interleaved rows of one pitch and of two and for another buffer, and nothing for
the same bytes. On a device, every_device_copies_between_textures_over_one_buffer_from_the_source_before_the_copy
makes four RGBA8 textures in place over one Shared buffer at the device's own pitch (asserted in
place) and copies a row on and a row back, a memory alignment on within the rows on and back,
and apart, each expecting the whole buffer to hold the source's bytes from before the copy and
everything else kept, one submission, 2 + slabs barriers, no byte copied; the gap case is refused
and records nothing.
2026-11-21 07:08:04 -08:00
Anees Iqbal d245bab9d1 rt: an execution over a range the GPU writes counts its parts with a kernel; parts bounded at 2 MiB of preprocess bytes
What: an execution of an indirect command buffer runs in parts of the most commands whose
preprocess bytes, as vkGetGeneratedCommandsMemoryRequirementsEXT answers with the inherited
pipeline, stay at or under 2 MiB (indirect::PART_BYTES), one rule on every device, in place of
parts of 64 commands. The device is asked from one command up, doubling while the answer stays at
or under the bound, then again at fewer in proportion to the last answer until it is, so no answer
at far more commands than a part takes is trusted (lavapipe's grows with the square of the count
and wraps at 32 bits). An execution over a range a buffer holds (executeCommandsInBuffer:
indirectBuffer:indirectBufferOffset:), location 0 included, ends the rendering, runs the
translator's new count kernel (pipeline::own_kernel(OwnKernel::ExecutionCounts), one workgroup a
part, its parameter block pipeline::ExecutionCounts in the ring), one global barrier, and begins
the rendering again; each part's vkCmdExecuteGeneratedCommandsEXT reads its count at
sequenceCountAddress: its commands through the range's last, none past it or wholly before its
location. A CPU-given range runs no kernel. While a visibility result's query counts the draws,
the execution is refused (Gap::Draw VisibilityResultInterrupt, counted), as the rendering cannot
end inside the query. The runtime makes its own kernels once a device, at first use, through the
pipeline cache and layout (runtime src/own.rs), and destroys them with the device. The idle
preprocess pool's bound goes from 128 to 64 MiB: one frame of the sample now takes about 27 MB of
commands' bytes plus at most one part an execution.

Why: an execution over a GPU range ran the buffer's whole capacity, every command past the range
costing its vertex work. Parts of 64 commands cost 61 times one execution's GPU time on the 2080.
RADV fails past about 4 MiB of generated commands in one execution (draws nothing on a 7900 XTX,
loses the device on a 780M): it chains by sequence count, not bytes. The 2 MiB bound is half that.

Verified: on the probe branch (d59701c670), jobs 63460 and 63481 measured the frame of Apple's
rendering sample: at the 2 MiB bound 931.8 us of GPU time on the 2080 (920.0 at whole capacity)
and 588.5 on the XTX. This commit: compile job and the lavapipe rt suite, reported with the sha.
Tests: the count kernel against a brute-force count on the interpreter and valid on every
committed profile; held ranges at 0, past a part, past the commands, and a CPU range across
parts; a held range in a Boolean visibility mode before and after its first draw; the widest
layout's part at or under the bound on every device.
2026-11-21 06:47:06 -08:00
Anees Iqbal b5ac9fd07b rt: visibility results, one precise occlusion query per mode, copied into the buffer at the pass's end
What: `setVisibilityResultMode:offset:` builds `Boolean` and `Counting`. Each such mode set is one
segment counted by one precise occlusion query (`VK_QUERY_CONTROL_PRECISE_BIT`), begun in the
pass's rendering before the segment's first draw and ended there at the next mode set or the
encoder's end; a segment with no draw begins and ends its query as it ends, so its word is 0.
After `vkCmdEndRendering` the pass copies the counts (`vkCmdCopyQueryPoolResults`, 64-bit, WAIT)
straight into the visibility result buffer's `VkBuffer` at place+offset, one copy for each run of
consecutive offsets in one pool, before the pass's second barrier (recorded or owed), which orders
them before every later command; a Shared buffer's segment end barrier reaches the host, and a
Managed buffer's write and a texture over the buffer in an image of its own are kept as a blit's
write is. `Boolean` writes the count too, nonzero exactly where a sample passed (Metal documents a
nonzero word; the M3 Max writes 1): an accepted difference in docs/API.md section 10, and the
conformance cases compare a `Boolean` word as nonzero alone.

A command buffer takes its queries from occlusion pools of 256 the device lends it
(`crate::visibility`), each query reset on the host (`hostQueryReset`) as the command buffer
retires or drops uncommitted; the device keeps at most 16 pools free and destroys the rest
(`Gauges::occlusion_pools`). `occlusionQueryPrecise` joins the floor's required features (every
venue's profile reports it; Roadmap 2022 requires it), with the README floor table, the
runtime-floor profile's `m2v_runtime_floor` block and the regeneration script's list.

Refusals: Metal's own, each where the mode is set, the encoder's mode unchanged:
`Refusal::NoVisibilityResultBuffer`, `Refusal::VisibilityResultOffset` (not a multiple of 8, or
past the buffer), `Refusal::VisibilityResultOffsetTaken` (Apple documents each offset as set once
per pass; Metal's validation stops it), and `Refusal::ArgumentPlace` at alignment 8 for an offset
at an allocation byte off a multiple of 8 (VUID-vkCmdCopyQueryPoolResults-flags-00823). Gaps, each
counted and a README known gap: `DrawKind::AccumulatedVisibilityResults` (a mode in an
`Accumulate` pass; `Metrics::accumulated_visibility_refused`) and
`DrawKind::VisibilityResultInterrupt` (a command that would end the rendering while a query counts:
a memory barrier after a writing draw, a draw that moves an attachment to the feedback layout, pays
an owed barrier before an attachment read or copies into a shadow, and, bounded, a draw that looks
at textures over a buffer in an image of their own or reaches a Managed buffer with textures over
its device copy; `Metrics::visibility_interrupts_refused`). Every refusal is checked before the
encoder changes state; a segment's first draw may still end the rendering, before its query
begins. `DrawKind::VisibilityResults` is gone. `RenderPassDescriptor::visibility_result_type`
(`VisibilityResultType`, Metal's `visibilityResultType`) is a field now.

Translator: `PrecisionNote::DeviceOcclusionCount`, the static note of a `Boolean` or `Counting`
result (`RenderCommandEncoder::VISIBILITY_NOTE`), quoting Vulkan's "Occlusion Queries" (precise
counts differ between implementations: fragments killed before rasterization, counts multiplied
per colour output) and "Fragment Operations" (`earlyFragmentMultisampleCoverageAfterSampleCounting`);
its codec tag, ARTIFACT_FORMAT_VERSION 588, validation's allowance (unbounded, no tolerance), the
conformance degradation `device-occlusion-count` among the native notes, and docs/API.md's
catalogue. The dead `Feature::CountingVisibility` (no construction site) is removed with its reach
row. The old runtime's `Device::new` is untouched; the runtime-floor test profile now states
`occlusionQueryPrecise`, which re-keys that profile's fingerprint.

Why: the visibility-cut ruling. A guest that sets a mode got a refusal; it now gets its results,
or a typed, counted refusal where the cut does not build the shape (continuations and a combine
are not built).

Verified: cargo fmt; scripts/api-signatures --bless/--check, refusal_surface (0 without reach or
basis), metal-coverage and conformance-coverage regenerated, check_device_profiles (0 findings).
The compile job (fmt, signatures, clippy plain / --cfg m2v_gpu / --cfg m2v_cpu_icd, workspace
Rustdoc -D warnings) and the lavapipe rt suite, with tests/visibility.rs (Boolean and Counting
against the CPU's counts, pool reuse and the 16-pool bound past 17, Metal's refusals, Accumulate,
the barrier and attachment-read interrupts), are named in the lane's report.
2026-11-21 06:16:57 -08:00
Anees Iqbal 7c1baad228 rt: overlapping regions of one texture copy in slabs, as from the source before the copy
copy_from_texture refused a copy whose regions overlap in one level and slice of one image (a
texture into itself, or a texture and its view) as Gap::TextureCopy, and the program's copy was
skipped. Metal does not refuse the call; it leaves the result undefined, and an Apple M3 Max gives
each destination texel what the source held before the copy (the conformance crate's
buffer_texture_blits case, which recorded it).

No vkCmdCopyImage may read a texel it writes (VUID-vkCmdCopyImage-pRegions-00124), so
texture_copy now cuts such a copy into slabs along one shifted axis, the one of fewest slabs. Each
slab is no thicker than the shift there, so its two regions lie apart, and the slab at the end the
shift points to goes first, so no slab reads a texel an earlier one wrote: the result is memmove's.
Each slab is one vkCmdCopyImage in the general layout, with an execution barrier (COPY to COPY)
between two slabs, every hazard between slabs being a write after a read. Each extra barrier is
counted. Regions apart remain one slab and one command, and the same region still records nothing.
A shift of 20 texels over a 21-texel row is 2 commands; the worst case, a shift of one texel, is one
command per texel of the region's extent on that axis. No scratch image, no cap.

Gap::TextureCopy keeps its other arms (a multisample texture, depth and stencil both, one pixel
format in two Vulkan formats, 1D with another type); its doc, the rt README's blit section and
docs/REFUSALS.md (regenerated) drop the overlapping arm. The conformance ledger's row for
buffer-texture-blits-overlapping goes, since the rt side now answers that case, and
docs/CONFORMANCE-COVERAGE.md is regenerated.

Tests: overlapping_regions_copy_in_slabs_the_far_end_of_the_shift_first checks the slabs' regions
and order (a 21x1 row shifted by 20, a shift toward lower y, a diagonal shift on the axis of fewer
slabs, regions apart as one slab); the 3D/array host test now expects slabs where it expected the
gap. On a device, every_device_copies_overlapping_regions_from_the_source_before_the_copy copies
toward higher and toward lower x and y, from a view into its texture, along a 3D texture's depth,
and by whole BC1 blocks where the device makes them. Each case expects the source's bytes from
before the copy, one submission, 2 + slabs barriers and no byte copied of the runtime's own.
2026-11-21 06:24:22 -08:00
Anees Iqbal c3f9f55e63 rt: a kernel past the stage bound is made from its helper's compile alone, never compiled in the process
A driver's compiler takes memory that grows faster than the stage, in the process that creates the
pipeline. The translator refused every stage past COMPILED_STAGE_WEIGHT (99,109, the heaviest
measured to compile within host-sized memory, ANV on the Iris Xe of RPL-P), where Metal makes it.
Now the translator states the weight and the runtime compiles such a kernel only in a helper
process the consumer starts, caps and times.

Translator: the stage bound refuses nothing. stage_bound::emit still plans a kernel again keeping
its widest-mode pin where only that emulation passed the bound, and returns the module with its
entry weight, now ModuleStats::entry_weight (codec and serde carry it). COMPILED_STAGE_WEIGHT is
public in pipeline. Feature::StageSize and Needs::StageBound are gone. SEMANTICS_VERSION 2257,
ARTIFACT_FORMAT_VERSION 588.

Runtime (new stage.rs):
- Floor: pipelineCreationCacheControl, required and enabled (Vulkan 1.3 requires it), for
  VK_PIPELINE_CREATE_FAIL_ON_PIPELINE_COMPILE_REQUIRED_BIT.
- A kernel's VkPipeline of a module past the bound is made from a VkPipelineCache of its own entry
  in the cache directory's stages/ alone, with the fail-on-compile-required flag, the cache
  destroyed when the create returns; the device's shared cache and blob never hold it
  (Metrics::pipelines_from_stage_fills).
- With no entry the make is refused with Error::StageUnfilled(StageRequest), at the state's
  creation, at prepare_dispatch (which now returns Result and reports only this refusal) and at
  the dispatch. A StageRequest is Clone, Send, Sync, Eq and Hash by its stage key, the entry's
  name, so a consumer joins the makes and dispatches of one pipeline into one fill.
- Device::fill_stage writes the request to the helper's pipe, reads its reply and keeps the
  cache data as the entry (Metrics::stage_fills); serve_stage is the helper's main: it opens the
  device of the request's deviceUUID and driverUUID with the parent's options, checks the
  enables, compiles through an empty cache and writes its data. A wire frame is the magic
  m2vstage, the wire version, the length and a checksum.
- Device::record_stage_breach keeps what the consumer ended its helper for (memory, time) as the
  entry; fill_stage keeps a failed compile; a create answered compile-required keeps that. Each
  refuses the pipeline (Gap::StageSize, StageGap::Breach) with no helper asked again, until the
  driver's header changes the key.
- stages/ holds at most 256 MiB and 32 entries, breaches among them, least recently used out
  first (a hit touches the file). An entry that does not check, of another key or another
  driver's header is a miss and is removed. Nothing of an entry stays in memory past the call
  that reads or writes it.
- A device with no cache directory, or whose driver writes no pipeline cache header (lavapipe),
  and a render stage past the bound are refused typed (Gap::StageSize with its StageGap).

The validation runtime executor reports a refused prepare_dispatch; the replay prepass ignores it
as the dispatch reports it again.

Docs: the runtime README's "Kernels past the stage bound" and its known gaps, the stages/
directory, prepare_dispatch's one error, the floor row; docs/API.md's entry_weight;
docs/REFUSALS.md regenerated; the api signature and surface tables.

Tests: tests/stage.rs: the directory past capacity on both bounds, oldest use out first, a hit
outliving older entries, a breach under the same bounds; cut, foreign-key, other-header and
unknown-breach entries a miss and removed; the wire's version and cut frames; the request's
joinable bounds; and on a device (m2v_gpu, m2v_cpu_icd), with the bound lowered for the test, the
refusal with no directory, lavapipe's NoPipelineCache, and elsewhere refused unfilled, filled by
serve_stage over two pipes, made from the entry alone with the shared cache's data unchanged,
then refused by a recorded breach.
2026-11-21 05:55:29 -08:00
Anees Iqbal 20ae73f152 Translator: the resident-table domains' encoder-operation lowering goes; object words stay
What: lower/access/encode.rs goes. It lowered a function's indirect-command encoder operations
under the resident-table domains, writing the binder's records and their written flags. What it
held that is still used moves to lower/access/object.rs:
- an argument buffer's command-buffer or pipeline-state member read as its word (ObjectWord);
- the plan that admits such a load only as an encoder operand.

Every encoder operation is now refused, `Unsupported{GpuEncodedIndirectCommands,
NotImplemented}`, except those the identity domains' icb.rs lowers: a render command's buffer
setters, its indexed triangle draw and a reset. icb.rs is selected first, as before. The other
deletions follow from that:
- indirect_commands.rs drops CommandEncoderOperation's per-operation policy table;
- lower/access/dynamic.rs drops the resident-set search and address helpers only encode.rs
  called (plan_search, plan_address, search_start, plain_base);
- the error doc of the depth-stencil argument names the setters' refusal;
- engine_indirect_commands.rs keeps two tests: every encoder operation refused under the
  resident-table domains on every committed profile and Profile F, and a depth-stencil member
  compiled unread and refused read. engine_handles.rs expects the refusal where a pipeline-state
  member is a command's operand;
- the command-writes interface test now takes icbcut's indexed kernel (icb_indexed_16) under the
  identity domains, plus the template that takes no command buffer;
- the authored census integration test expects the encoding case's refusal on both forms;
- docs/API.md's indirect-command section says which domain refuses what;
- docs/REFUSALS.md is regenerated.

Why: rule 4 (small) and rule 2 (one form). The runtime compiles under the identity domains, where
this lowering never ran. Under the resident-table domains, the validation executor's alone, it was
a second form of GPU-encoded commands that no consumer path takes.

No public item changes (indirect_commands is pub(crate); api_signatures.tsv is unchanged).
Versions: SEMANTICS_VERSION 2255 -> 2256 (a placeholder; the landing sets the number), because the
resident-table domains refuse what they lowered. Under the identity domains no output changes.

Verified (jobs at this commit's tree less the runtime README edit below it, 4606692494, or at the
next commit's, the runtime-sources pin, 4e9e857f8c):
- m3-max-63058 at the pin: fmt, clippy, clippy --cfg m2v_gpu, clippy --cfg m2v_cpu_icd, Rustdoc
  -D warnings and scripts/api-docs, all rc 0 (peak 7.5 GiB);
- m3-max-63040, the validation suite at this commit: 1359 of 1360 passed, the one failure the
  runtime guard, which the next commit pins;
- m3-max-63057, the metal2vulkan and metal2vulkan-runtime suites and doctests at the pin: 3349 of
  3360 passed. The failures are the render key, the AIR printout and the golden table (bless due
  at development's next pin) and the engine inventory's 8 parts: 2,142 cells moved, 0 rows new or
  gone, of which 1,342 are the storage forms' removal below this commit (ilock, m3-max-63032) and
  800 are this commit's, the resident-table encoder operations now refused: m3-max-63151, the
  parts with every difference printed, names them as 50 entries on all 16 profiles, each
  ok -> Unsupported{GpuEncodedIndirectCommands; NotImplemented}, in 31 fixtures, every entry a
  kernel that encodes indirect commands (26 engine/icb_* and 3 kernel_icb_* fixtures,
  resident_draws.ll's rd_encode and mesh_commands.ll's six enc_* kernels); the other 1,342 are
  ilock's, class for class. The inventory compiles under RESIDENT_TABLES
  (spirv::testing::committed_profiles), and its bless runs on macOS only (bless_engine_inventory
  refuses without every assembler, m3-max-63084);
- docs/REFUSALS.md regenerated by scripts/refusal-surface/refusal_surface.py;
- no states-only play: the runtime compiles under the identity domains, whose output this commit is
  expected not to change. That is read from the code: icb.rs, the identity lowering, is untouched
  and still selected first. It is not measured, because the golden table's every cell is re-keyed
  until development's bless. ilock and this commit report the same staleness: 29,792 cells,
  m3-max-63032 and 63057.
2026-11-21 04:39:28 -08:00
Anees Iqbal 7e8b93d953 Fetch: the interlocked storage forms go; one input-attachment form, ordered by ROA where the device has it
What. The pixel interlock's storage forms of framebuffer fetch, of the fragment imageblock and of
the shadow stencil are deleted, with their snapshot reads, the sample planes' split and merge
modules, the stencil shadow's copies and the binder, pipeline and runtime items that served them.
A color input now has one form on every device: its input attachment, ordered by
rasterization-order attachment access where the device has it, and elsewhere ordered between
draws alone, noted `PrecisionNote::UnorderedFetchWithinDraw`. The pixel interlock serves raster
order groups only; on a device without rasterization-order access a group on a color input or a
read output does not interlock. What had no other form is refused, typed:
- a fragment function's imageblock use, `Unsupported{Imageblocks, NotImplemented}`;
- a `[[stencil]]` output on a device without `VK_EXT_shader_stencil_export`, naming
  `StencilExport`;
- a merge, a rotated blend or a logic operation that reads the attachment, on a device without
  rasterization-order access, naming `FramebufferFetch` and
  `RasterizationOrderColorAttachmentAccess`.

Why. Rule 2 (one form per Vulkan capability) and rule 4 (small): the storage forms were a second
form of fetch, imageblocks and stencil output chosen by the interlock feature, outside the eight
allowed second forms. The runtime never took them under the identity domains.

Versions: ARTIFACT_FORMAT_VERSION 586 -> 587 (a placeholder; the landing sets the number).
SEMANTICS_VERSION moves in this stack's fourth commit and the runtime-sources pin in its fifth.
RUNTIME_VERSION is not bumped.

Removed public items (crates/metal2vulkan/tests/api_signatures.tsv): pipeline::StorageAttachmentUse,
ShadowStencilUse, FragmentImageblock, ImageblockMechanism, SnapshotForm, SnapshotRefusal,
StorageAttachmentView; bind::PlanesSplitModule, PlanesMergeModules, StencilSplitModule,
planes_split_module, planes_merge_modules, stencil_split_module, CopySource, FragmentTests;
RuntimeFact::{FragmentImageblock, InterlockedFramebufferFetch, MovableStorageWrites,
ShadowStencil, TestedStorageWrites}; PushField::{ShadowStencilState, SnapshotPhase,
StorageKeptChannels}; ResourceKind::SnapshotTexels, BindingSource::SnapshotTexels,
WriteSource::{ShadowStencil, SnapshotTexels}, PushHole::SnapshotPhase,
DrawReplayRule::{FragmentImageblock, ShaderStencil}, PlanesCopy::Alpha8,
ExtendedRangeBlend::OneColorChannel, PrivateRenderField::SampleMask,
PrecisionNote::UnmeasuredFetchBlend (translator and runtime), runtime
RenderPipelineKind::{Imageblock, ShaderStencil}. Changed: FramebufferFetchInputs::of(read, colors),
DepthStencilCopy::{StencilExport, StencilPlane}, WriteSource::TileAttachment.

Runtime README, known gaps: a new bullet names a fragment function with imageblock data (an input
or output declared [[imageblock_data]]) as refused on every device, and the stencil output bullet
says the runtime has refused it on a device without the extension all along. Both say why: the
forms deleted here bound a storage image through a descriptor, which the identity domains the
runtime compiles under hold none of. The raster order group bullet already names its refusal.
docs/REFUSALS.md is unchanged (scripts/refusal-surface/refusal_surface.py leaves it as it is).

Consumer check (~/.cache/m2v-orch/consumer-uses.sh, consumer development e76e2ffeb4 plus its 49
steelbrain/* tips younger than a day): 0 code hits on development for every removed name above
(Imageblock appears there only in rt_platform/diag.rs comments); UnmeasuredFetchBlend and
OneColorChannel hit only crates/reims-vgpu-vulkan on unlanded lane branches, none on development.

This commit does not build crates/metal2vulkan-validation alone: its executor still names the
removed pipeline items until the next commit, which removes its storage-form arms.

Verified: in the stack's second commit, which states every job; this commit alone does not
build the validation crate.
2026-11-21 04:39:18 -08:00
Anees Iqbal f61383d22b rt: delete Device::release_indices, Grants::release and Refusal::IndicesInUse
A grant now lasts as long as the device. The consumer never returns one:
its code, read at its tree on the 8a36a49453 pin, has zero calls of
release_indices and no IndicesInUse (it calls grant_indices in four
files). Only the runtime's own tests called it.

Product: Grants::release, Device::release_indices with its doc, the
IndicesInUse variant and its Display arm go; Bits::put and Grants::set
lose the clearing arm only release used. 40 code lines and 19 comment
lines fewer. IndexGrant::indices stays (grant uses it). Grants are
dropped with the device.

Docs: the README's index section, Device::grant_indices, new_texture,
IndicesNotGranted, Gauges::releases_waiting and the pool's release
comments no longer name the call; they say a grant lasts as long as the
device and point at Gauges::descriptor_slots where a vacate shows.
api_signatures.tsv re-blessed (two records out) and docs/REFUSALS.md
regenerated (77 runtime refusals). The api_surface table pins only the
translator's names and does not change.

Tests: 36 tests called release_indices only as cleanup; those calls go
and their grant bindings take a leading underscore. The two Grants unit
tests in tests/arrays.rs drop their release cases. The four that read IndicesInUse read instead:
- an_index_has_one_owner_the_object_placed_there_last: the owners map
  (owns goes false after the owner's vacate);
- every_device_round_trips_texture_bytes and
  every_device_shares_sampler_states_device_samplers:
  Gauges::descriptor_slots, counted while the objects live and back to
  its count before the placements once they are gone;
- every_device_holds_a_release_until_the_work_committed_before_it_retires:
  releases_waiting nonzero and descriptor_slots 1 under the work, then
  descriptor_slots 0 once releases_waiting reads 0 (the block-maker
  thread vacates the index before that gauge falls).

Checked before the commit: signatures.py --check and
refusal_surface.py --check pass. The compile gate (fmt check; clippy
plain, --cfg m2v_gpu and --cfg m2v_cpu_icd; workspace Rustdoc, all with
-D warnings) and the runtime's tests on lavapipe run on this commit.
2026-11-21 03:03:59 -08:00
Anees Iqbal 2a054f7785 Translator: the emitted words are the only words check; the size estimate goes
Selection summed a word cost per strategy and per interface part into a `SizeEstimate` and refused
the function `LimitExceeded(SpirvWords)` before emission when the sum passed the cap. The sum was a
forecast, not a bound, and it overshot: a guest kernel (function hash 4cc9c0bb, Iris profile, on
the command-line path) estimated 30,197,397 words against the 16,777,216 cap and emits 8,589,684
(job 62553), so it was
refused for a size it does not have. The cap already held exactly on the serialized module; that
check is now the only one (`pipeline::compile::lower_bounded`). That kernel is now refused by what
it holds, `LedgerBytes` at 450 MiB; a function the estimate overshot that fits the ledger can now
translate (none in this library does).

Removed with the estimate, as nothing else read them:
- `lower::estimate` (`SizeEstimate` and its frame costs), `Plan::estimate`, the check in
  `stage_bound::emit` (which no longer takes the cap) and the selection's block count;
- the word sums that fed only the estimate: the stage interface's (`StageIoPlan::words`, its
  parameter, object, store and rounding costs, and the fragment family's input attachments,
  discards, interlock, sample loop, snapshots, imageblock, storage form, shader stencil, logic
  operation, blends and word merges), the tessellation and mesh interfaces', the dispatch forms',
  a module blob's, the tile staging's, and the emulated tier's and the predicated walk's extra
  words, with `Predication::reloads`;
- the predicated walk's second structurization before emission, which only measured its
  constructs for the estimate (`structurize::emit::construct_words`).
The per-strategy costs and shared-routine costs the `StrategyCensus` reports stay.

Public: `EntryPlan::estimated_words` goes. The consumer's checkout (reims-vgpu at 44d738908a) has 0
hits for `estimated_words` and for `EntryPlan`. `tests/api_signatures.tsv` loses that one row;
`tests/api_surface.rs`'s pinned names do not move (`EntryPlan` stays).

Tests: the checks that the estimate bounds the emitted words go from the tests that also check
something else; the tests that checked only that go (every stage, simd, leaf, tail, coordinate,
bicubic, snapshot, pulled-fetch and shared-switch entry's estimate, the large predicated body under
a multiple of its words, and the skeleton's estimate bound). The word cap's test keeps both sides
on the emitted words: a module compiles at a cap of its own words and is refused one word below.

SEMANTICS 2253: a function the estimate refused can now translate, and the refusal of one that
does not fit names the ledger. docs/REFUSALS.md regenerated: `SpirvWords` has the one site.

Verified:
- The gate on this change over f3f661dd14 (job 62796): fmt, the API signatures, clippy plain,
  --cfg m2v_gpu and --cfg m2v_cpu_icd, workspace Rustdoc and doctests green; nextest of
  metal2vulkan and metal2vulkan-runtime 3464 of 3468, the four reds development's own suites show
  at f3f661dd14 (m3-max-62774): the old render descriptor key, which hashes SEMANTICS_VERSION,
  and the new icb_indexed_extras fixture's golden cells, AIR printout and inventory part, all
  blessed on development.
- Every kernel of the guest library (63, by hash), on the command-line path: intel-irisxe-anv's
  runtime-policy device file, the release command line before (fe1e8780a2) and with this change
  over it, alternately per kernel on one node (job 62742). 62 keep their outcome and their
  output's hash; the one difference is 4cc9c0bb, refused SpirvWords before and LedgerBytes after.
  It is the slowest row and the largest peak on both sides: 2.55 s and 309 MiB before, 2.86 s and
  470 MiB after (it now runs into emission before the ledger refuses it). Total wall 12.0 s
  before, 12.3 s after.
2026-11-21 02:53:10 -08:00