Commit Graph
4430 Commits
Author SHA1 Message Date
Anees Iqbal cdcd787fb8 A render target's channel-order sibling views are views of its image
A pass rendering into a BGRA8Unorm or BGRA8Unorm_sRGB view of an
RGBA8Unorm texture made without PixelFormatView usage (and the same for
BGRA8Unorm and the sRGB twins) rendered through a shadow image of the
view's format, copied in before the pass and back after it
(shadowed-texture-view, about 50-95 us a command buffer at 64x64): the
texture's image was mutable only for its sRGB twin's formats, so Vulkan
made no view of it in the sibling's format.

Basis, documented on both sides:
- Vulkan: VkImageFormatListCreateInfo (core 1.2), pViewFormats
  "specifying all formats which can be used when creating views of this
  image", with MUTABLE_FORMAT; the formats are of one class.
- Metal: MTLTextureUsage.pixelFormatView, "Don't set this option if your
  texture view only converts between linear space and sRGB. For example,
  if your texture uses the rgba8Unorm pixel format and your texture view
  uses bgra8Unorm_srgb." Plain Metal makes the BGRA8Unorm view too and
  renders through it (its API validation stops it; view_attachments).

Change (image_plan.rs): a color texture of those four formats with
RenderTarget usage lists, besides its sRGB twin's views, the views of
its sibling and the sibling's twin (reordered_views, reordered_formats),
in the single-sample and the multisample plan; a word attachment's view
is left out as for the twin. A texture that renders nothing lists none:
its sibling views already read the image through a swizzle. The view's
other uses then view the image too (takes_views_of).

Compression: expected, not measured. Mesa's sources suggest RADV before
GFX11 keeps no DCC for a list whose formats' channel orders differ, ANV
keeps CCS_E for formats of the same channel bits, RADV GFX11+ keeps DCC
for any list; NVIDIA documents nothing. The A/B lane
view_attachments::reordered_view_render_costs (the parent commit)
measures it per driver.

Tests: image_plan::render_targets_take_their_channel_order_sibling_s_views
(every committed profile: the sibling and its twin taken where the
device renders them directly, none for a texture that only reads, none
for RGBA16Float); runtime_lane::view_attachments::
a_render_target_s_reordered_views_render_in_place (draws through both
views, Metal's bytes, no shadowed-texture-view).
Docs: the ShadowedTextureView notice (degradation.rs, API.md), the
FAST-PATHS view bullet, view_shadow.rs.

Verified: not yet built.
2026-11-12 03:56:51 -08:00
Anees Iqbal 99d83d06f4 view_attachments: what a render target and its reordered view's pass cost the GPU
An ignored measurement, run by name: a 2048x2048 RGBA8Unorm Private
render target made without PixelFormatView usage, timed for a pass that
clears it and stores, a blit into another such texture, and a pass that
clears its BGRA8Unorm view, each its own command buffer (medians and
fastest of 40 after 8), with the notices printed (shadowed-texture-view
when the view's pass renders through a shadow).

It is the A/B for listing the channel-order sibling's formats in such a
texture's image (the next change): the first two numbers show whether
the driver keeps its compression with the longer list, the third what
the view's pass costs as a shadow against in place.

Verified: not yet built.
2026-11-12 03:56:51 -08:00
Anees Iqbal afff0e6cfe kept_padding: the Managed test's words by as_chunks
clippy's chunks_exact_to_as_chunks denied the constant-size
chunks_exact in the Managed test's host words (m3-max-20244's clippy
leg). The words are the same.

Verified: m3-max-20244 (lavapipe on msi, at 602a8bcc3e) ran the runtime
filter (248 passed, the three kept_padding tests among them), the
validation filter (332 passed, the heap_layouts lane among them) and
api_signatures/api_surface (15 passed); only this lint failed.
2026-11-12 03:56:51 -08:00
Anees Iqbal 946ee6e0b6 Device::linear_texture_bytes_per_row: the driver's own linear pitch for a 2D texture
A texture over a buffer whose rows hold bytes between them is the
device's linear image in place (route 1, and Between::Kept for a buffer
only the device's ordered commands write) only at the pitch the driver
itself reports for that image (vkGetImageSubresourceLayout's rowPitch);
the alias checks it exactly. A caller laying out rows had no way to ask
for that pitch: minimum_linear_texture_alignment_for_pixel_format
answers the alignment of images over host pages (16 where the device
imports none), and a pitch rounded up to it can miss the driver's.

The new query (a runtime extension, no Metal counterpart) plans the
image as the texture's making does (declared_plan), makes the plan's
linear image unbound, reads its rowPitch, and releases it. It answers
None where the texture is not one 2D level, layer and sample, or where
the device has no linear image of the plan.

Test (kept_padding.rs): at the answered pitch the texture over a
Private buffer is in place; at each other padded pitch it is a shadow.
Docs: the runtime README beside the alignment query, HOWTO beside the
kept-padding sentence; api_signatures.tsv.

Verified: not yet built; the lavapipe job and one GPU run follow.
2026-11-12 03:56:50 -08:00
Anees Iqbal 3918e6de0b requirements: Query derives no Debug
vk::ImageTiling has no Debug, so the derive on Query, the requirement
cache's key for host linear images and tilings, failed to compile
(E0277 on the lavapipe build of m3-max-20214). Nothing prints a Query.

Verified: not yet built; the next lavapipe job builds it.
2026-11-12 03:56:50 -08:00
Anees Iqbal 42e11abcd4 Textures over buffers only the device's ordered commands write hold their rows' padding in place
What: a texture that renders nothing over a buffer of the runtime's own memory whose rows lie
with the buffer's bytes between them is now the device's linear image, made PREINITIALIZED, at
the buffer's pitch, where only the device's commands, in the runtime's order, write those bytes:
a Private buffer, and a Managed buffer's own on a device without unified memory (a two-copy
no-copy buffer's device copy, or one with its own host copy), not one whose VkBuffer was handed
out or whose memory is exportable (Buffer::gpu_bytes_ordered). linear_plan::holding answers what
an image may hold besides the texels (Between::{Nothing, Unobserved, Kept}); Kept takes route 1
alone: the linear image whose rowPitch the driver reports equal to the buffer's
(vkGetImageSubresourceLayout, aliases with within_padding). No DRM_FORMAT_MOD_LINEAR image at
Metal's pitch, no image over exportable memory or in exportable blocks, as each is made
UNDEFINED. A render target stays a shadow. Counted: WorkCounts::kept_padding_aliases.

Also two pairs of counts of what the program asks of a two-copy Managed buffer, beside the bytes
the runtime copies: managed_ranges_modified and managed_bytes_modified (did_modify_range),
managed_resources_synchronized and managed_bytes_synchronized (synchronize_resource), to compare
with managed_bytes_copied_in and managed_bytes_copied_out.

Why: the RTX 2080 guest census (reims's v302 run) made 230 textures over Managed buffers, 200 of
them RGBA8 ShaderRead|ShaderWrite at 3884, 4208 and 2448 texels a row with rows rounded up to
256 bytes, every one a shadow for its padded rows ("its rows lie N bytes apart"): 2.52 G shadow
texels first copied in, 1.26 G kept, 1.26 G words examined by merges back. Owner's rule:
in place where possible, a shadow only where impossible. Main approved the route and its
conditions.

Basis (Vulkan 1.4, docs/API.md's shadowed-texture entry): 7.1.1 Image Layout Transitions, "Image
layout transitions may perform read and write accesses on all memory bound to the image
subresource range ... If the old layout matches the current layout of the image subresource
range, the transition preserves the contents of that range": the image's one transition is its
first move, PREINITIALIZED to GENERAL, out of the layout it is in, ordered after and before every
write of those bytes, as only the device's ordered commands write them. 12.11 Memory Aliasing:
"Buffers, linear tensors, and linear image subresources are considered host-accessible
subresources when they are in any of these layouts: VK_IMAGE_LAYOUT_PREINITIALIZED,
VK_IMAGE_LAYOUT_GENERAL ... 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." VkSubresourceLayout's "size includes any extra memory that is required based on
rowPitch" puts the padding inside the range. A kernel's writes may change the padding as on the
x86 Macs (in_place::Padding::Free); a render pass's load and store "may read and write back" it,
so render targets keep the shadow.

Verified: not built yet. tests::kept_padding (a Private buffer at 416, 448 and 512 bytes a row,
the buffer read back whole after the image's first move; a Managed two-copy texture changed in
one row through did_modify_range, then a blit-written row synchronized out, every byte between
rows as given, against a Shared buffer's shadow), tests::linear_plan's holding cases and
tests::texture_placement run on lavapipe next, then one RTX 3090 run.
2026-11-12 03:56:50 -08:00
Anees Iqbal e1ba565ea3 Tests: a plain texture in a heap over host pages lies in the device's image over the pages, else in Metal's tiles
What: runtime_lane::heap_layouts follows the route e3b1cd42d1 gives a texture Metal keeps
uncompressed in a heap over host pages. The plain-shape test (renamed
a_host_heap_s_plain_texture_lies_in_place_or_in_metal_s_tiles) branches on the texture's count:
in place (counted untiled, the first announced heap-texture-untiled-layout with its ID, made with
no zeros) its texels round-trip through replaceRegion and getBytes, a blit in and out and a
buffer's fill over its bytes, and a blit into it writes no byte of the heap outside its answered
size; tiled, every assertion of Metal's tiles stands. It prints how many shapes lay each way: the
proof that the tiled count over host pages goes from one per shape to none where the device's
image serves. The made-again, beside-dispatches and two-ways tests check Metal's bytes only for a
tiled texture; the merge-scratch test skips, saying so, for one in place; the block rows count an
untiled row (in place, or decoded) beside a tiled one.

Verified: not run yet; the lavapipe run of the heap lanes follows.
2026-11-12 03:56:50 -08:00
Anees Iqbal 3689e5c9d6 Heaps over host pages: keep the linear image's requirements for host allocations as the plan's others
What: host_image_requirements (the linear image made for host allocations that a texture in a
heap over host pages lies in) now takes the answer kept for its plan on a device that enables
maintenance4, as planned_requirements does, and counts its limits query and its image
(WorkCounts::requirement_limits_asked, requirement_images_made). RequirementAnswers is keyed by
plan and a Query (a tiling for the device's own memory, or the host-allocation linear image).

Why: the commit before this one has every plain texture in a heap over host pages try that image
first, so each making (a window server makes its heap textures each frame) made and destroyed a
VkImage and asked the device's limits, uncounted, where the tiled route asked nothing after the
first. Vulkan fixes the answer by the creation parameters (Resource Memory Association: size by
the create info and its pNext chain, memoryTypeBits by tiling and handleTypes, alignment under
maintenance4), and an image whose handle type the limits take without DEDICATED_ONLY requires no
dedicated allocation ("requiresDedicatedAllocation will otherwise be VK_FALSE").

Verified: not built yet; runtime_lane::heap_layouts' made-again test checks the counts on the
lavapipe run that follows.
2026-11-12 03:56:50 -08:00
Anees Iqbal 9d184d13ec Heaps over host pages: a texture Metal tiles lies in the device's image over the pages first
In a heap over the caller's host pages (new_heap_with_bytes_no_copy), a single-sample texture
whose bytes Metal lays out in its tiles now takes the image bound to the pages wherever one
serves: its linear image made for host allocations, or over dma-buf pages the driver's
DRM_FORMAT_MOD_LINEAR image, in the driver's rows with no copy, announced
heap-texture-untiled-layout (Untiled::LINEAR). The shadow of Metal's tiles (AliasRoute::Tiled)
is the fallback where no such image serves, and stays the route of a copied heap.

The bytes in guest pages are now the device's layout, not Metal's tiles. Basis: Apple documents
a texture's layout in a heap's bytes as private to Metal, and the consumer confirms that no guest
code of theirs reads or writes a heap texture's bytes in guest pages (replaceRegion and getBytes
go through a staging blit; no buffer aliases a heap texture), so the copies in and out of the
tiles shadow bought nothing it could see (the owner's rule: shadows are a fallback, never a
first option). dma_buf_heap_plan now answers why its image does not serve instead of taking the
shadow itself, so a texture Metal tiles over dma-buf pages falls back to the tiles shadow before
the rows one.

Docs: host_heap_plan, AliasRoute::Tiled, the dma_buf module, the heap-texture-untiled-layout
declaration and catalogue entry, and the FAST-PATHS known-gap entry on heap textures in the
driver's layout.

Verified: cargo fmt only; builds and tests run as potluck jobs after this commit.
2026-11-12 03:56:49 -08:00
Anees Iqbal ee52d7e483 Tests: a layer pass's own shadow stands and its backdrop read copies its rectangle alone
The compositor-shaped probe now asserts what lavapipe measured (m3-max-20039, LAYER-STANDING):
from the second command buffer on, the Private plane's shadow is skipped by its standing (1024
texels), and the only texels copied in are the attached read's rectangle a pixel wider each way
(108), whose shadow holds part of the truth and so never stands (Missed::Partial).

Verified: m3-max-20039 printed these counts at d22a0902e5 on lavapipe; the assertions run in the
next job.
2026-11-12 03:56:49 -08:00
Anees Iqbal 658e8b4976 Tests: a compositor's layer pass over a Private plane, command buffer after command buffer
A probe of the standing of a shadowed texture over a Private surface plane that a pass loads,
draws into and reads at its own pixels (a backdrop), as a window compositor's layer passes do:
it prints each command buffer's copies in (LAYER-STANDING) and checks the bytes each pass
leaves.

Verified: cargo fmt only; the run is a potluck job after this commit.
2026-11-12 03:56:49 -08:00
Anees Iqbal 230c34472e Re-pin the runtime sources at the landing tip
The landed packet changed a runtime-sources input, so the committed digest no

longer described the sources and `the_runtime_sources_are_the_committed_ones`

would fail. Recomputed over the same inputs and committed by land-pkt.sh.
2026-11-12 03:45:55 -08:00
Anees Iqbal b5c0db3294 attached_levels: name the slot parts alias SlotParts
The exit-guard scan (tests::exit_guard::only_the_listed_modules_keep_the_device_s_functions)
finds the types that keep the device's functions by name, and device/mod.rs's visible `Parts`
keeps them: the private `type Parts<'a>` of render/attached_levels.rs, which holds `&Device`
and keeps no copy of the functions, read as one by name at its three by-value parameters.
Renamed, the module keeps nothing the scan lists.
2026-11-12 03:44:56 -08:00
Anees Iqbal 250438e30e Candidate rows: the argument-buffer sparse-sample cases on the RADV 780M
The two authored cases over tail_argument_sparse_samples (99b72141..., the sample's value where
resident; c8f6a438..., resident() states every texel resident) ran as Vulkan candidates on the
amd-780m-radv venue (AMD Radeon 780M Graphics, RADV PHOENIX, Mesa 26.2.6-arch3.1), stated and
robustness-off legs, against the M3 Max's Metal rows (apple-m3-max-macos27.0.1). All four runs
report Match, with candidate output hashes ebc81c32... and 67c145ea..., the Metal rows' own.

Lavapipe on that node is Mesa 26.2.6 with LLVM 23.1.4, not the venue's Ubuntu 26.0.8 identity, so
the venue check rejected those runs and no lavapipe row is recorded here; CI's Ubuntu lavapipe
qualification covers them.

Verified: potluck m3-max-20423 (homelab-um790-xtx-1, MESA_VK_DEVICE_SELECT=1002:15bf!, radeon
ICD only).
2026-11-12 03:43:53 -08:00
Anees Iqbal d714059dd0 Metal observations of the two heap-texture sparse-sample cases on the M3
corpus-metal qualified both on apple-m3-max-macos27.0.1 (job m3-max-20396, three runs each):
99b72141ffee (the value where resident) output_sha256 ebc81c32735a, and c8f6a438d16d (the residency
read) output_sha256 67c145ea102f, each the SHA-256 of the 2x2 rgba16_float pixels the rationale
states: Metal samples the argument buffer's texture that is not sparse as resident, its texels
exact.
2026-11-12 03:43:53 -08:00
Anees Iqbal 6d9649716b Authored cases over tail_argument_sparse_samples: a heap texture's sparse sample, resident
Two fragment cases over the owned fixture, each a 2x2 rgba16_float argument-buffer texture of
distinct exact texels sampled at its texel centres through the fixture's constexpr sampler (linear
min, mag and mip filters, repeat, anisotropy 10), compared exactly:
- sparse-sample-of-an-argument-buffer-texture-returns-its-value-where-resident
  (argument_sparse_fragment, case 99b72141ffee): the value where resident(), else the
  min_lod_clamp fallback;
- sparse-sample-of-an-argument-buffer-texture-states-it-resident
  (argument_sparse_residency_fragment, case c8f6a438d16d): the value's first two channels and
  0.25 where resident, 0.75 where not.

Installed by corpus-case-check (job m3-max-20388). Qualification on the M3 and the candidates
follow.
2026-11-12 03:43:53 -08:00
Anees Iqbal eef34650ba Re-bless the engine inventory and the golden tables for the argument-buffer sparse-sample fixture
Blessed on development at 7f6c002dce (potluck m3-max-20398, macOS: xcrun metal-as, llvm@21 printouts) after SEMANTICS_VERSION 2042 landed engine/tail_argument_sparse_samples without its cells. Only additions: its golden hashes on every committed profile, its engine-inventory rows and its air_input printout; no existing cell moved.
2026-11-12 03:41:45 -08:00
Anees Iqbal 0096578d8f Re-pin the runtime sources at the landing tip
The landed packet changed a runtime-sources input, so the committed digest no

longer described the sources and `the_runtime_sources_are_the_committed_ones`

would fail. Recomputed over the same inputs and committed by land-pkt.sh.
2026-11-12 03:39:26 -08:00
Anees Iqbal 543be65531 RUNTIME_VERSION 2104: maxThreadgroupMemoryLength is the presented Mac class's, up to the device's limit
The commits before this one. The runtime answered maxThreadgroupMemoryLength as min(maxComputeSharedMemorySize,
32 KiB), an Apple GPU's bound, for every Mac class; a real AMD Radeon Pro 5300M and Intel UHD 630 answer 65536
(reims's oracle Q9), the M3 32768. It now answers min(maxComputeSharedMemorySize, the presented Mac class's
bound): 32 KiB for AppleSilicon (unchanged), 64 KiB for IntelOrAmd (MacClass::max_threadgroup_memory_length).
Direct dispatches already took up to the device's limit; the indirect host step clamps to this answer.

Verified: RX 550 (RADV POLARIS12, m3-max-20392) answers 65536 where reims's rsprobe read 32768 at pin 48, and a
kernel wrote and read back all 16384 words of a 65536-byte threadgroup argument, 0 wrong; lavapipe (m3-max-20356)
answers its own 32768, 8192 words, 0 wrong; tests::capabilities and tests::families 37/37 (m3-max-20355); lint three
ways and rustdoc (m3-max-20358, 20359).
2026-11-12 03:38:13 -08:00
Anees Iqbal 13a8232d8c docs/API.md: maxThreadgroupMemoryLength among the presented Mac's answers
The Mac-class section lists what a device presenting a Mac with an Intel
or AMD GPU answers as that Mac; it now names the threadgroup memory
bound (65536 bytes, where an Apple silicon Mac's is 32768) that the
previous commit made the runtime's answer. Docs only.
2026-11-12 03:38:01 -08:00
Anees Iqbal ef9bc65fb7 maxThreadgroupMemoryLength: the presented Mac's answer, 64 KiB on an Intel or AMD Mac
The runtime answered maxThreadgroupMemoryLength as the compile layer's
min(maxComputeSharedMemorySize, an Apple GPU's 32 KiB) on every device,
whatever the Mac class it presents. A Mac with an Intel or AMD GPU
answers 65536 (the consumer's oracle probes: an AMD Radeon Pro 5300M and
an Intel UHD 630, macOS 26.7.1; the M3 Max answers 32768), so a guest
presenting an AMD Mac on an RX 550 (RADV, 64 KiB of shared memory) read
32768 where a real one reads 65536, and took lower paths for it.

The answer is now the device's maxComputeSharedMemorySize up to the
presented class's own (MacClass::max_threadgroup_memory_length, private):
32 KiB for AppleSilicon, unchanged, and 64 KiB for IntelOrAmd. A direct
dispatch already took threadgroup memory up to the device's own limit
(bind::plan::compute), and the indirect host step clamps to this answer,
so every length answered runs. The GPU replay registers flat variants
only, which read no lengths.

The other three queries the consumer reported low (function pointers,
dynamic libraries, rasterization rate maps) are yes in the runtime on a
RADV device; the consumer's lane answers them no. A unit test pins that
on the RADV profile, and the device test checks it where it runs.

Tests:
- tests::capabilities: threadgroup_memory_is_the_presented_mac_class_s
  (per profile and declared class: RADV 65536 as an AMD Mac and 32768 as
  Apple silicon; MoltenVK M3 32768 either way; never past the device's
  limit). The test devices now take their profile's vendorID, so the
  MoltenVK profile presents Apple silicon as its device does. The pinned
  venue answers move: RADV 65536, ANV and NVIDIA 49152.
- tests::families: a_radv_device_answers_function_pointers_libraries_
  and_rate_maps.
- tests::threadgroup_memory_device (m2v_gpu, m2v_cpu_icd): a kernel
  writes and reads back every word of exactly the answered length.
- runtime_lane::capabilities follows the new answer.
2026-11-12 03:38:01 -08:00
Anees Iqbal 7f6c002dce Re-pin the runtime sources at the landing tip
The landed packet changed a runtime-sources input, so the committed digest no

longer described the sources and `the_runtime_sources_are_the_committed_ones`

would fail. Recomputed over the same inputs and committed by land-pkt.sh.
2026-11-12 03:37:02 -08:00
Anees Iqbal 1435c6f658 SEMANTICS_VERSION 2042: a heap element's observed residency is resident (the commits before this one)
The commits before this one bumped SEMANTICS_VERSION 2040 -> 2041, the value development already took for the
private-array reach fix, so this one is 2042 (ARTIFACT_FORMAT_VERSION 504 for the new RuntimeFact::HeapResidency).
lower::texture::residency refused the observed status word of a texture read through an argument buffer
(sparse_sample then resident()), so a public forward-rendering sample's fragment shader, whose material textures
sit in an argument buffer, was refused as Lowering(Texture) NotImplemented on every GPU. Such a word is now 0 (Metal's
answer for a texture that is not sparse) and the stage states RuntimeFact::HeapResidency; the planner refuses a
sparse texture its handle tables reach (Unsupported ArgumentBufferTextures, a known gap in FAST-PATHS). A texture-
or sampler-family refusal of an air.* call now names the intrinsic in Unsupported.symbol.

Verified: our fixture engine/tail_argument_sparse_samples FALLBACK before (m3-max-20327), translated with spirv-val
PASS after (m3-max-20349); nextest heap|mechanism|fast_paths|api|refusal|codec 174/174 incl.
tests::engine_heap_residency; the sample's own AIR read in place on the M3 translates on amd-780m-radv and
moltenvk-m3 (m3-max-20381, nothing kept). Golden table and inventory re-bless on development follow.
2026-11-12 03:35:55 -08:00
Anees Iqbal bd427d30ca Name the air.* intrinsic in a texture or sampler family refusal that names nothing
One family refuses many operations alike: Lowering(Texture), NotImplemented, has some 30 sites,
and a refusal's location (a block and an instruction of the canonicalized function) does not say
which operation a consumer's log met. lower::select now names the call's declaration
(Unsupported::naming, diagnostics only, as route_air and the ray tracing family already do) where
a texture or sampler family selection of an air.* call refuses it without a symbol. Feature,
needs and location are unchanged, so no golden cell moves.

Why: a consumer's GL-on-Metal pipeline is refused Lowering(Texture) at block 68 instruction 748
of a function whose AIR stays on the guest; the next log names the operation.
2026-11-12 03:35:36 -08:00
Anees Iqbal 236340a171 A heap texture's observed residency is resident; a sparse member under it is refused at plan
A function that observes the residency of a read, sample or gather of a texture it reaches
through an argument buffer (sparse_sample, then sparse_color::resident()) was refused at
pipeline creation: lower::texture::residency answered Lowering(Texture), NotImplemented, for a
heap element's status word. A forward renderer that streams its material textures compiles
exactly that, so its pipeline never made and it drew nothing.

Metal reports a texture that is not sparse resident everywhere, which is the word 0 the module
already builds for a heap element's access (emit::with_word). So residency() now answers a heap
element's observed residency with no residency form, the word 0, and the stage states the new
RuntimeFact::HeapResidency { stage } (PlanTimeCheck). The planner (bind::heap::HeapPlanner::new)
refuses a sparse texture (TextureFacts::sparse) that such a stage's handle tables reach,
Unsupported { ArgumentBufferTextures, NotImplemented }: answering one would need the member's
tile map or sparse image per handle-table entry, which is not built. docs/FAST-PATHS.md records
it as a known gap; a slot's sparse texture stays answered (RuntimeFact::SparseTexture).

SEMANTICS_VERSION 2041 (refusals become modules); ARTIFACT_FORMAT_VERSION 504 (a RuntimeFact
variant). docs/REFUSALS.md and the API surface table regenerated.

Test: tests::engine_heap_residency over the new tail_argument_sparse_samples fixture: both
fragments compile behind its vertex function on every committed profile with what they use
(moltenvk-m3, lavapipe and amd-780m-radv named), state the fact and pass L3; their plan holds
a texture that is not sparse and refuses a sparse one. Before the change the base CLI refused
argument_sparse_fragment with Lowering(Texture), NotImplemented, at block 0 instruction 2, the
sparse sample (job m3-max-20327, gem10).
2026-11-12 03:35:36 -08:00
Anees Iqbal 9b1e6b09ec Fixture: a fragment's sparse sample of an argument buffer's texture, its residency observed
tail_argument_sparse_samples: a material {texture2d<half> t; uint min_mip;} in constant buffer 0;
argument_sparse_fragment samples t through a constexpr sampler (linear min, mag and mip filters,
repeat, anisotropy 10) with sparse_sample, returns the value where resident() holds and else the
sample clamped by min_lod_clamp(min_mip); argument_sparse_residency_fragment states the residency
it read beside the value's first two channels; argument_sparse_vertex draws a triangle over the
target with uv its normalized position. The front end merges the two samples' {half4, i8} results
in a phi and tests (status & 1) == 0, the shape a forward renderer that streams its materials
compiles.

Compiled by scripts/regen-air-fixtures (metal 32023.922, SDK 27.2).
2026-11-12 03:35:35 -08:00
Anees Iqbal f7f9a72263 Re-bless the engine inventory and the golden tables for the private-reach fixtures
Blessed on development at ee9f6df70c (potluck m3-max-20335, macOS: xcrun metal-as, llvm@21 printouts) after SEMANTICS_VERSION 2041 landed the private_reach_tiles and private_reach_functions fixtures without their cells. Only additions: their golden hashes on every committed profile (57 cells), their engine-inventory rows and their air_input printouts; no existing cell moved. The merged check m3-max-20300 failed exactly these two tests (golden_hashes_match_the_table, engine_fixtures_match_their_golden_printout).
2026-11-12 03:24:19 -08:00
Anees Iqbal ee9f6df70c SEMANTICS_VERSION 2041: a private array of nested arrays is allocated only as far as its proven indices reach
The commits before this one (their own bump to 2040 met development's NaN-LOD bump to 2040, so this one is 2041).
A kernel's private accumulator, alloca [32 x [32 x [4 x [4 x [4 x float]]]]] (256 KiB), was counted and emitted at
its declared size, so a compute pipeline with that shape was refused as PrivateMemory (FunctionStorageBytesPerThread
264264 > 98304 on RADV) where an AMD Mac compiles it; the guest's convolution kernels (Core ML, Vision, MPSGraph full
convolutions) abort on every AMD host. New canon pass (crates/metal2vulkan-air/src/canon/reach.rs), after unrolling:
a count-1 private array of nested arrays narrows to the reach of its indices only where every index is proven (a
constant, a function-constant value, or the counter of a loop whose trip count is decided, through PHI joins and
integer ops that cannot wrap) and every use is an element access or GEP of its own type; anything unbounded,
escaping, read whole or past a level keeps the declared type.

Verified: Metal on the M3 (m3-max-20190, the conformance probe private_array_reach.m) and the RX 7900 XTX (RADV,
m3-max-20285, under the validation layer): our tile kernel's pipeline is made and its 4x128 words equal the M3's; the
kernel with a buffer-bound loop keeps its declared size and is refused as before. canon unit tests (narrowing by
counters and by a function constant; dynamic index, past-level, ptrtoint and whole load keep the type) and the engine
tests: metal2vulkan-air + engine 592/592 (m3-max-20191).
2026-11-12 03:09:57 -08:00
Anees Iqbal 664b7617d7 The tile fixtures' lane and engine tests; SEMANTICS_VERSION 2040
The runtime lane's private_reach makes private_reach_tiles (tile sizes 2 and 4, linking postfix)
on the device the cfg selects and compares its words with what the probe private_array_reach.m
printed on the M3 Max under macOS 27.0.1, and checks private_reach_rows, whose loop a buffer word
bounds, is refused needing its 256 KiB, as the M3 refused it ("Compute function exceeds available
stack space"). The engine test compiles the same fixtures on the RX 7900 XTX's profile: 128 bytes
a thread with no note, and the rows kernel refused needing 262144 of 98304.

SEMANTICS_VERSION 2040: a private array of nested arrays that bounded indices reach in part is
now emitted and counted at its reach, so refusals and modules change under unchanged keys.
The canon module docs and ARCHITECTURE name the pass.
2026-11-12 03:09:30 -08:00
Anees Iqbal 4677b9e1bc The tile fixtures' companions and the Metal probe of the same kernels
scripts/regen-air-fixtures compiled private_reach_tiles and
private_reach_functions (Xcode 27.2's Metal toolchain); conformance's probe
private_array_reach.m runs the same source on Metal. The canon test's builder
is renamed so it no longer shadows the shared kernel() helper.
2026-11-12 03:09:30 -08:00
Anees Iqbal 630870cbdc Reach: an access at an address's offset 0 reaches element 0 below; owned tile fixtures
An access whose type is the type at offset 0 of the type its address names
(trailing zero indices left out) reaches element 0 of the levels it passes
down and the levels below those whole; before, such an access kept the
array's declared size.

The owned MSL private_reach_tiles (a kernel written for its largest tile:
float acc[32][32][4][4][4], tile loops of function constants 0 and 1, each
sum handed to a linked visible function) and private_reach_functions (that
function). Companions follow from scripts/regen-air-fixtures.
2026-11-12 03:09:30 -08:00
Anees Iqbal 503546f49e Test a kernel's private array that bounded indices reach in part
engine_private_memory: the kernel 'reached' declares float a[64][64][16]
(256 KiB) and reaches a[0..2][0..4][3] and a[gid & 1][3][3]; it compiles at
128 bytes a thread with no note on the RTX 5080 (32 KiB) and on the floor of
a device not measured, and read at a[gid][3][3] it keeps 256 KiB and is
refused on both. reach also bounds 'and' by one bounded operand and 'urem' by
its divisor.
2026-11-12 03:09:30 -08:00
Anees Iqbal 6f27ca4d3d A private array of nested arrays is allocated as far as its counted indices reach
A kernel written for its largest configuration declares its thread arrays at
that size and indexes them by counters whose trip counts its function
constants decide. Selection held such an array to the device's Function
storage at its declared size: a 256 KiB accumulator of which the bound
constants reach 512 bytes refused the pipeline on every AMD device.

canon::reach narrows each alloca of nested arrays whose every use is a typed
load or store through an address of its own type, and every index of every
address is bounded within its array: constants, counters of loops whose
header runs the bound constants decide (followed as unrolling follows them,
now shared as unroll::counter_bounds), and non-wrapping integer arithmetic
of those. Each level is allocated as long as the largest index an access
takes there, plus one; a level an address does not index stays whole. Any
other use or any unbounded index keeps the declared type.

Verified: canon tests (private_reach) on a potluck job, see the report.
2026-11-12 03:09:30 -08:00
Anees Iqbal 68e739b0ab Re-pin the runtime sources at the landing tip
The landed packet changed a runtime-sources input, so the committed digest no

longer described the sources and `the_runtime_sources_are_the_committed_ones`

would fail. Recomputed over the same inputs and committed by land-pkt.sh.
2026-11-12 03:09:04 -08:00
Anees Iqbal 65430c272d RUNTIME_VERSION 2103: on RADV a pipeline whose fragment stage interlocks is made whole, not fast-linked
The commits before this one. RADV's fast-linked graphics pipeline libraries break the ordered fragment shader
interlock on GFX11: the fragment library is compiled without the output interface, so its last export lands in a
separately built PS epilog after the main part's image stores, with no wait for them, and the ordered section (which
ends at the done export) closes before the stores land; the next overlapping wave reads stale data. Nothing the
runtime emits breaks the spec (EarlyFragmentTests with PixelInterlockOrderedEXT, Begin/End once in the entry point,
Coherent storage image). New RuntimeDriverDefect::FastLinkedInterlocksUnordered, every RADV GPU (driverID MESA_RADV):
on it GraphicsContent::links() is false for a variant whose fragment stage declares an interlock mode, so the pipeline
is made whole, the switch the feedback-loop states already take. Every interlocked fetch, the attached reads'
snapshot route included, was exposed on such a device.

Measured, RX 7900 XTX (RADV NAVI31), release, lone_fetch's two tests: base (m3-max-20257) 20 of 42 and 35 of 72
targets wrong; fix (m3-max-20254) 0 of 42 and 0 of 72, "pipelines made whole 3 of 5". Creation, cold, the first
pipeline: whole 0.9 ms against linked 1.1 ms; a later key of an interlocked state pays its own compile (~0.9 ms)
where a linked one paid ~0. A bare-Vulkan probe of our own reproduces the defect (fast link 62 of 72 wrong, whole
0) and shows an LTO link also fixes it, but VUID-VkGraphicsPipelineCreateInfo-flags-06609 needs
RETAIN_LINK_TIME_OPTIMIZATION_INFO on all four libraries, so whole it is. lavapipe (m3-max-20223) lone_fetch 16/16,
driver_defects + interlocked_writes 13/13; lint (m3-max-20279).
2026-11-12 03:07:53 -08:00
Anees Iqbal e25e6c5258 FAST-PATHS: the RADV interlock row's measured creation time
Release, on the RX 7900 XTX with Mesa 26.2.6 and MESA_SHADER_CACHE_DISABLE=true:
con_fetch_coverage's first pipeline made whole in 0.9 ms (m3-max-20254, at the fix), and
linked in 1.1 ms at the base (m3-max-20257: pre-rasterization library 0.6-0.7 ms, fragment
shader library 0.4 ms, link 0.0 ms).
2026-11-12 03:07:42 -08:00
Anees Iqbal 9ad6257845 Runtime: on RADV a render pipeline whose fragment stage interlocks is made whole
RADV's fast-linked graphics pipelines leave the ordered pixel interlock unordered within a
draw. A fragment shader library made without the fragment output interface jumps to a separate
color epilog, and ACO waits for the interlocked storage writes before the final export only where
that export is the shader's own (RADV_DEBUG=shaders: a whole pipeline's image_store is followed
by s_waitcnt_vscnt and the done export, a fast-linked one's by s_setpc_b64 into the epilog). The
GPU ends the ordered section at that export, so the next overlapping fragment reads before the
write lands.

The new RuntimeDriverDefect::FastLinkedInterlocksUnordered is RADV's on every GPU (keyed on the
driverID, no clean GPU). On a driver with it, GraphicsContent::links() is false for a variant
whose fragment stage declares an interlock execution mode (interlocked_writes::facts), so the
pipeline is made whole, as a feedback-loop state is.

Evidence so far, all on the RX 7900 XTX, Mesa 26.2.6:
- tests::lone_fetch's layers leg at the base: 35 of 72 targets wrong, and 0 of 72 under
  RADV_DEBUG=nogpl (m3-max-20108).
- A bare-Vulkan probe with 12 instances of one quad in one draw: fast-linked, 46 to 62 of 72
  counters wrong; whole or linked with link-time optimization, none (m3-max-20040, -20134).

lone_fetch's run now prints the device's pipelines made whole and asserts one there. The fixed
tests on the XTX, the creation time, lavapipe and lint follow.
2026-11-12 03:07:42 -08:00
Anees Iqbal 1c27fc2c28 Re-pin the runtime sources at the landing tip
The landed packet changed a runtime-sources input, so the committed digest no

longer described the sources and `the_runtime_sources_are_the_committed_ones`

would fail. Recomputed over the same inputs and committed by land-pkt.sh.
2026-11-12 03:04:57 -08:00
Anees Iqbal 175d17e34a RUNTIME_VERSION 2102: a pass renders a linear color attachment in place whatever it loads
The commits before this one. A pass that cleared a color attachment whose texture's image is linear, and which the
device renders under VK_NV_linear_color_attachment, cleared an image its texture keeps and copied it back after,
because clearing the linear image of host memory in place measured slower (linear-attachment-clear-copies). That is a
copy chosen for speed, and the owner's rule is zero copy, in place where possible, shadows a fallback only. Such a
pass now renders the attachment in place whatever its load action. Removed: Degradation::LinearAttachmentClearCopies,
its API.md catalogue entry and api_signatures row, the pass-end check only that route used, and the notice's lane and
conformance expectations. On every device where the rule applies (NVIDIA).

Measured, RTX 3090, a 1920x1080 clear over a Shared buffer, median GPU time of 7 (m3-max-20249 before, 20269 after):
4.926 ms through copies -> 8.434 ms in place (1.7x; the zero-copy rule's cost, kept on the record).

Test: the linear_attachments lane, 25/25 on the 3090 (20269) and lavapipe (20259): a cleared render target over a
Shared buffer counts 1 in place, 0 through copies, texels right; a pass beside a stencil attachment announces
linear-attachment-copies exactly when it renders apart by the rule. The touched set 103/103 on lavapipe (20232); lint
three ways and rustdoc (20270).
2026-11-12 03:03:51 -08:00
Anees Iqbal 598400ae5e Expect linear-attachment-copies of a sampling pass apart beside a stencil attachment
The change that cleared linear attachments in place turned the sampling
tests' check that no pass announced linear-attachment-clear-copies into a
check that none announced linear-attachment-copies. A pass beside a stencil
attachment renders apart by the rule and announces exactly that kind: on the
RTX 3090 (job m3-max-20256) a_pass_apart_sampling_its_surface_after_a_barrier_
reads_its_draws and a_cleared_pass_apart_sampling_its_surface_after_a_barrier_
reads_its_draws failed on it (Some(1)), their texels right. The check is now
that the kind is announced exactly where the pass renders apart by the rule.

For the record (not a gate), the 1920x1080 clear of a render target over a
Shared buffer (host-cached system memory on the 3090), median GPU time of 7
passes, debug build, the lane test's cleared_1080p:
- before (962b302902, cleared on chip and copied back, job m3-max-20249):
  0 passes in place, 8 through copies, 4.926 ms (4.526 to 5.726)
- after (86d08081e6, in place, job m3-max-20256): 8 passes in place, 0
  through copies, 8.430 ms (8.425 to 9.616)
2026-11-12 03:03:41 -08:00
Anees Iqbal 130a0d6c36 Read the 1080p clear's texels in chunks of a constant size, as clippy asks
clippy's chunks_exact_to_as_chunks (job m3-max-20145, the lint at 4fa0d76217)
flags chunks_exact with a constant size in cleared_1080p; as_chunks reads
the same texels.
2026-11-12 03:03:40 -08:00
Anees Iqbal 175fd330f6 Take back image_plan::view_candidate, committed with the test's removal by mistake
The previous commit swept in an unfinished function of the next change
(a texture's view form), which nothing calls yet: a dead-code warning.
image_plan.rs is again as the change clearing linear attachments in place
left it.
2026-11-12 03:03:40 -08:00
Anees Iqbal 46737dba6b Drop the forced-rule test of a cleared linear target: lavapipe counts it neither way
a_cleared_target_alone_renders_in_place counted the pass neither in place
nor through copies on lavapipe (job m3-max-20144: (0, 0)): there the device's
framebuffer fetch reads input attachments, so every color of a pass counts as
taken and linear_attachment::choose counts none of them, before the change as
after. It proved nothing on the device it was for. The lane test of a cleared
render target over a Shared buffer counts the pass on a device that renders it
by the rule, which is the proof.
2026-11-12 03:03:40 -08:00
Anees Iqbal 6b14f719d3 Clear a linear color attachment in place where the rule allows it
A pass that cleared a color attachment whose texture's image is linear and
which the device renders under VK_NV_linear_color_attachment, where the rule
allowed it in place, cleared an image its texture keeps and copied it back,
announced linear-attachment-clear-copies, because clearing a linear image of
host memory in place measured slower than that copy. A copy chosen for speed:
the owner's rule keeps a copy only where the device lacks the in-place form.
The pass now renders such an attachment in place whatever it loads.

Removed with it: the Degradation kind (its API.md catalogue entry and its
api_signatures row), the pass end's analysis of whether a command of the pass
may read the attachment's bytes, which only that route used, and the lane and
conformance expectations of the notice. through_backing keeps the one kind
and area its callers still pass.

Tests: the lane test of a pass clearing a render target over a Shared buffer
(now a_cleared_render_target_over_a_shared_buffer_renders_in_place) counts it
in place and through no copy on a device that renders it by the rule; the
runtime's a_cleared_target_alone_renders_in_place forces the rule (lavapipe
included) and counts 1 in place, 0 through copies, every texel the clear; it
counted 0 and 1 before.
2026-11-12 03:03:40 -08:00
Anees Iqbal a0c40c1182 Print a cleared linear render target's ways and GPU time at 1080p
The lane test of a pass clearing a render target over a Shared buffer now
also clears a 1920x1080 one, printing how many passes rendered it in place
and through copies and the median GPU time of seven, and checks the buffer
holds the clear. A record of the clear's cost before and after a change to
how it renders; it asserts nothing about the time.
2026-11-12 03:03:40 -08:00
Anees Iqbal c46497dc8b Re-pin the runtime sources at the landing tip
The landed packet changed a runtime-sources input, so the committed digest no

longer described the sources and `the_runtime_sources_are_the_committed_ones`

would fail. Recomputed over the same inputs and committed by land-pkt.sh.
2026-11-12 02:47:24 -08:00
Anees Iqbal d5d76912e9 The lowest level's test takes a NaN sampler bias as none, as the code does
the_lowest_level_follows_the_bound_sampler expected a NaN bias to give the first level, but
f32::min takes it as none (m3-max-20172 failed there): a bias of 3.0 with a NaN bias gives 3.
That is the device's answer too: no Vulkan sampler takes a NaN mipLodBias, and
metal::sampler::device_lod_bias makes it none. The test and the comment now say so.

Verified: built and run in the next job.
2026-11-12 02:46:14 -08:00
Anees Iqbal 6a951995e1 The lowest level a slot reads counts no size query: it reads no texel
What: LevelReads::lowest_read counted a size query at a constant level as a read of that level.
A sample's lowering queries the level-0 size for offsets, pixel coordinates and bias axes
(lower/sampler/emit.rs), so every such slot stated lowest_read 0 and no read past an attached
level could read in place: the lane and runtime tests of the past-level reads counted the slots
first-level or reaching (m3-max-20154, at 70b6b737e7 on lavapipe). A size query reads no texel,
and the view a narrowed slot binds keeps the texture's first level as its own, so it answers the
same at any level the view holds; the query still raises named, which keeps that level in the
view. Fetches and gathers read texels and still count.

Tests: level_reads::tests::each_read_states_the_levels_it_reaches (a size query at level 3:
named 3, lowest_read none). Verified: built and run in the next job.
2026-11-12 02:46:14 -08:00
Anees Iqbal d971205216 RUNTIME_VERSION 2101: a slot that reads only levels past the attached ones reads them in place
A draw that samples a texture its own pass renders at one level read the texture's copy unless
every read reached only levels before the lowest attached one. A slot every read of which
reaches only levels past the highest attached one (a pyramid pass that renders level m from
level m + 1, or through a sampler whose minLod lies past m) now binds the texture's own image
through a view of its levels from the first up to the highest it reads (all of them where the
sampler's maxLod reaches past the last), and names in its uses only those from the lowest it may
read (LevelReads::lowest_level, SampledLevels::lowest, through each bound sampler's levels, its
lodBias as the bind takes it included). The levels read hold the copy's texels: nothing the
instance does writes them, checked as the levels-before case checks (reads_levels_in_place,
shares_attachment, the unordered writes, the draw's own writes).

The view holds the attached levels too, unread. Vulkan's rules against reading an attachment are
of accesses (VUID-vkCmdDraw-None-10795; the Render Pass chapter's subresource "simultaneously
being used as an attachment"), and the descriptor's layout must match the subresources the view
holds (VUID-vkCmdDraw-imageLayout-00344): GENERAL, where every attachment rests. So such a slot
keeps its copy in an instance that holds one of the texture's attached colors in the feedback
loop layout, and the instance's general_colors (renamed from storage_colors, which now also
holds the colors such a view spans) sends a later snapshot read of one into another instance.

Counted as WorkCounts::attached_read_slots_past. The reasons a slot keeps its copy now test any
level before the first-level case, which covers only a read that may reach an attached level.

Tests: tests::attached_levels (runtime, the device cfgs) gains reads past the attached level;
runtime_lane::attached_levels (validation, under the layer) reads levels past the attached one in
a pass recorded inline, where the layer sees the attachment. Verified: built and run in the next
job, with a negative control.
2026-11-12 02:46:13 -08:00
Anees Iqbal 6ab2d18f04 LevelReads and SampledLevels state the lowest level a slot's reads may reach
A runtime that serves a draw's read of a texture its own pass renders can read the texture's own
image in place where every read reaches only levels past the highest attached one, but the fact
gave only the highest level read. It now gives the lowest too:

- LevelReads::lowest_read: the lowest constant level a fetch, size query or gather reads (a
  level-count containment's comparison reads no level, so it raises `named` alone).
- SampledLevels::lowest_lod_bits: the lowest constant explicit level of detail through each
  sampler, a NaN where one is.
- SampledLevels::lowest(SamplerLevels): floor of the lower bound of the level of detail, which
  Vulkan's LOD Operation clamps into [minLod, maxLod] after any bias (minLod where one is
  computed; the lowest constant plus a negative sampler bias, clamped so), the first level for a
  NaN constant or crossed or unbounded sampler bounds. Both mipmap modes read floor(L) or above.
- LevelReads::lowest_level: the lowest among the reads; 0 where a read may reach any level.

ARTIFACT_FORMAT_VERSION 503 (two encoded fields); the interface's other facts are unchanged, so
SEMANTICS_VERSION stays at the NaN fix's 2040. api_signatures rows added; docs/API.md's "Levels a
slot reads" says how to ask.

Tests: level_reads::tests::each_read_states_the_levels_it_reaches (each read's lowest, and a fetch
beside a level-count comparison: named 3, lowest 2), the_lowest_level_follows_the_bound_sampler,
constant_levels_of_detail_keep_their_lowest_and_a_nan_there. Verified: built and run in the next
job.
2026-11-12 02:46:13 -08:00