Commit Graph
1135 Commits
Author SHA1 Message Date
Anees Iqbal 01207df533 Spares: a command buffer that recorded much frees its pools' command buffers as it gives them back
A rate-mapped pass records each draw once per region of its map, each with its own viewport and
scissor. On ANV (Mesa 26.2.6, Iris Xe) every such draw takes about 100 bytes of a device-wide
dynamic state pool of 1 GiB. A command buffer holds what its recording took until it is begun
again, reset or freed, and spare pools kept their command buffers' recordings for later takers.
A guest's ICB passes over a rate map, replayed by host steps at about 880k draws a step, filled
the pool with four command buffers alive. The core showed the "dynamic pool" block pool at its
1 GiB maximum, one command buffer holding 97.5 MiB of it, and its batch status
VK_ERROR_OUT_OF_DEVICE_MEMORY. ANV then wrote the next SF_CLIP_VIEWPORT through a null state
inside vkCmdDrawIndexed, and QEMU took a SIGSEGV.

A command buffer now counts the draws its recordings record (its host steps' included) with the
state commands they set (CommandBuffer::recorded, counted at render.rs's draw loop). Where the
count reaches spares::RECORDED (65,536), each pool it gives back sheds every command buffer it
holds, freed on the device's free thread as an idle spare's are, and rejoins the spares stocked
with a secondary. Below the bound nothing changes. The rerun check's pool passes its command
buffer's count. A kept chunk's pool passes 0, since its draws count in the command buffer that
recorded them.

Counted: WorkCounts::spare_command_buffers_freed_past_recorded (api_signatures.tsv). FAST-PATHS
records the gap that remains: command buffers alive at once that record enough to fill the pool
by themselves.

Tests: tests::spares::device::a_command_buffer_that_recorded_much_frees_its_pools_command_buffers
(lavapipe). The opt-in Iris probe runtime_lane::rate_mapped_volume (m2v_gpu_hazards) prints the
new count per round.
2026-11-12 11:57:27 -08:00
Anees Iqbal 99146ff67f In-place reads: the lane test and docs name the devices whose passes fetch no color
A pass on a device with rasterization-order color attachment access (lavapipe) or without the
pixel interlock (the RX 550) fetches its colors as input attachments, and in place, like the
snapshot, takes no such pass (its subpass would name the color in two layouts). The lane test
asserts the read in place only where the device's passes fetch no color, and API.md, FAST-PATHS.md
and render/snapshot.rs say which devices keep the copy.

Verified: lavapipe lane job m3-max-22227 (msi) at e83d75fe83: 33 of 34 attachment-read, snapshot
and in-place tests passed, debug and under METAL2VULKAN_LANE_VALIDATION=sync; the one failure was
this expectation (lavapipe fetches through inputs: copies 1, in place 0).
2026-11-12 11:55:21 -08:00
Anees Iqbal 7284147b43 A draw that reads its own color at its own pixels and writes none of it reads in place
A draw whose fragment function reads, at its own pixels alone, a texture its own render pass
instance renders as a color, and whose pipeline writes no channel of that color, now reads the
attachment in place, with a memory barrier before it or without: no copy, snapshot or split.
The color is in the feedback loop layout for its instance, the pipeline is made with
VK_PIPELINE_CREATE_COLOR_ATTACHMENT_FEEDBACK_LOOP_BIT_EXT, and the slot binds the texture in that
layout. A by-region barrier before the draw (color writes to fragment shader reads) orders the
earlier draws' and the load's writes before its reads (Vulkan 8.10.5), and a by-region execution
barrier after it (fragment shader to color output) orders its reads before later draws' writes.
Its own writes go to other colors, so no fragment of the draw races another over the texels it
reads. It reuses the snapshot route's checks (pass shape, view format, pins, one image) and its
binding (render/snapshot.rs, in place), on a device that enabled attachmentFeedbackLoopLayout.

Why: the real Macs disagree on such a read without a barrier (probe ownread.m: the M3 Max
answers the texels from before the pass at every pixel; the 5300M answers the earlier draws'
writes at 98.6% of pixels and at all after a barrier; the UHD 630 at all but 0.01%). Under the
owner's rule for such disagreements we take the cheapest form, the x86 Macs' answer, recorded as
an accepted difference in docs/API.md. A compositor's backdrop reads paid a copy of the whole
target per draw before.

texture/attached_reads.rs now gives a color's image feedback loop usage wherever the device
enabled attachmentFeedbackLoopLayout, not only where it has the snapshot route's write-mask
command. New WorkCounts::reading_draws_in_place (api_signatures.tsv row). The draw-key and
graphics-key carry a feedback_loop bit for the pipeline flag.

render.rs (the draw's snapshot plumbing) is touched at: the draw's snapshot request, the phase
hole, the counts, the snapshot views, the pair base and phases, Recording::record (the barrier
after), and settle_draw's snapshot checks.

Lane test runtime_lane::in_place_reads with an owned fixture ipr_reads.metal (regenerated with
scripts/regen-air-fixtures). The golden tables and the compile census are re-blessed on
development.

Verified: not yet compiled; potluck build, lint and lavapipe lane jobs follow.
2026-11-12 11:55:21 -08:00
Anees Iqbal 47ca9278c8 Pages beside live dma-buf imports import their own dma-bufs, not a copy
A no-copy buffer or heap (made or rebound) whose pages a live import of another holds some of
was always a copy of them (CopiedBecause::OverImport), for VK_EXT_external_memory_host's
undefined second import of a host pointer (its issue 6). On RADV every no-copy object's pages
are udmabuf dma-bufs, which that clause does not cover, so since the one-import rule landed a
consumer's 780M walk made 2715 such copies (copied_over_live_imports, 292 MB copied in).

Now, where every live import that holds some of the pages is of dma-bufs, the pages come with a
source of dma-bufs the device imports, and the device's barriers order blits through two
imports of the same pages (no RuntimeDriverDefect::AliasedImportBlitsUnordered, which ANV and
MoltenVK have), the object imports its own dma-bufs from the source, never its pointer
(Device::imports_beside). Two dma-bufs of the same pages are two aliases of external memory
(Vulkan 1.4, 12.11 Memory Aliasing: consistent for buffers, uses separated by a memory
dependency); the tracker orders every use by the host bytes it touches across keys with global
memory barriers, as for a guest RAM's run imported beside its chunk. A pointer import on either
side keeps the copy. A failed import there falls back to the copy, announced with the failure.
HostAliases::within now names the live imports that meet the pages (Within::Meets(Vec)).
Counted: ObjectChurn::dma_buf_imports_beside_live (imports_inside_live stays the count of
pages imported twice where that is undefined).

Tests: tests::dma_buf_beside (device, Linux): a buffer over part of a live import's pages and a
buffer rebound onto pages two live imports hold some of, as made and without pointer imports:
beside dma-bufs where the first import is of dma-bufs, else a copy; the GPU reads the CPU's
bytes, CPU writes between encode and commit reach the command, GPU writes reach the pages and
the other buffer, and in imports a fill through one and a copy through the other in one encoder
are ordered either way. The host_aliases unit test checks Meets names the import met. The
validation lane's dma-buf joined-import test takes the third outcome. Checks: to run.
2026-11-12 11:11:08 -08:00
Anees Iqbal 3a619009b7 Run one-row threadgroups of a row-lockstep kernel on a variant without its simdgroup barriers
What: a kernel whose only simdgroup semantics are lockstep simdgroup barriers that order pairs
meeting only where a simdgroup spans two rows (RowLockstep) kept them, their cross-lane class
and, on a device with tangled 32-lane subgroups, its pinned subgroup size, even for a dispatch
of one-row threadgroups, where no such pair meets. On the Iris Xe that pin makes ANV compile a
register-heavy kernel at SIMD32, which spills and takes seconds where SIMD8 takes 0.3 s.

- Address facts: a place among the threadgroup's linear threads (thread_index_in_threadgroup,
  and under rows thread_position_in_threadgroup's x, never the grid's) with its low five bits
  cleared (`& -32`) or shifted out (`>> k`, k >= 5) is one value per simdgroup (AddrFacts::
  aligned, in fixed). The lattice walk skips such terms like uniform ones, and its spread now
  holds two facts, the finest lattice and the whole bounded difference, either clearing a pair.
- Lockstep::rows holds where, under row facts, no conflicting pair wants more than a
  threadgroup barrier: threadgroup barriers stand where the whole threadgroup runs together,
  order every pair a simdgroup barrier would and need no subgroup size, so a one-row pipeline
  keeps them and drops only the simdgroup barriers (the argument is in Lockstep::rows' doc).
- VariantKey::one_row / LoweringInputs::one_row: the lockstep pass inserts only the threadgroup
  barriers where rows holds; the kernel states RuntimeFact::OneRow (Mechanism::Variant). The
  binder asks a dispatch whose every region is one row of a RowLockstep kernel for it
  (dispatch_variant), the planned pipeline still runs such a dispatch, and the variant's plan
  sends a dispatch with a taller region back (NeedsVariant). The runtime settles on it through
  dispatch_variant and prepares it beside the base where a one-thread dispatch asks for it.

Tests: engine_simd_emulated's a_one_row_dispatch_drops_the_lockstep_simdgroup_barriers on the
Iris profile (a tile whose halves meet only across rows plus a workgroup-uniform pair): the own
pipeline keeps its simdgroup and threadgroup lockstep barriers, CrossLane(BASIC), Direct and
RowLockstep, and leaves the expected words at 144 x 2 (the shared lane's included); the one-row
variant has one threadgroup lockstep barrier, no simdgroup one, (None, NoSubgroup), no subgroup
requirement and OneRow, and leaves the expected words at 128 x 1 and 48 x 1 at 8, 16 and 32
lanes; the binder sends 128 and 48 to the variant and 144 x 2 to the base, whose plan refuses
the variant 144 x 2; the kernel with a simdgroup sum keeps Direct and its own pipeline for 32,
128 and 144 x 2. a_row_of_a_lockstep_only_kernel_takes_one_compile now expects the one-row
variant for one-row threadgroups of the row kernel, and the pinned pipeline for whole ones of
the others. The mechanism table, the inputs-encoding test and api_signatures take the new items.
2026-11-12 11:02:40 -08:00
Anees Iqbal b46459080d A batch held for its pipelines' making gives way to later commits of other queues
What: the scheduler's order across queues (scheduler/order.rs) no longer keeps the place of a
batch held unsubmitted for a host step that has not taken its gate: its pipelines being made, or a
step that reads nothing the GPU writes (`place_of`: `Place::GivesWay`). A later commit of another
queue that conflicts with it on a resource goes first, and the held batch is submitted after it,
so the tracker orders the two that way (submission order). The batches after it on its line give
way with it. What still holds a head back behind such a batch is a fence the two share
(`tracker::fenced`: one updates a fence the other waits for or updates, or a batch whose uses are
not known yet against one that names a fence), so no batch is moved after a fence update it waits
for. Unchanged: same-queue order, event and binary-semaphore waits (a batch waiting for the
program still keeps no place), batches held for their submission checks or for a host step whose
gate was taken (they keep their place: a later write going first would land after the step read),
and the order among submitted batches.

Why: on an Intel Iris Xe a guest process's cold compute pipeline took about 3 s to make; its
command buffer kept its place, and the other processes' heads that conflicted with it (the window
server's frames among them, over a surface they shared) waited behind it: the guest's display
froze for 3.1 s. Metal's order across queues is the order the GPU takes the command buffers, not
commit order: probes/cross_queue_surface_order.m's same-buffer control (one tracked buffer,
written by queue A's long compute, then read or written by queue B's later commit) ran B before A
once in three on a Radeon Pro 5300M and on a UHD 630 (macOS 26.7.1; m3-max-21850, m3-max-21851),
and in commit order on an M3 Max (macOS 27.0.1). Where real Macs differ, the cheapest form inside
them is taken; no switch, as matching the x86 Macs trades no accuracy. (The previous commit's
message miscounted the no-copy buffer case: unordered in 10 of 12 runs, 6 of 6 on the M3, 3 of 3
on the 5300M, 1 of 3 on the 630.)

Docs: order.rs's contract (**Tracked order across queues is the order the batches go**, **Held
batches give way**, **No deadlock**), the scheduler's tracking and gate docs,
WorkCounts::heads_held_for_earlier_commits, pending_dispatch.rs, docs/API.md's and the runtime
README's pipeline-wait passages.

Tests: tests::scheduler a_later_commit_goes_before_a_batch_held_for_its_making and
a_batch_held_for_its_making_holds_back_a_commit_sharing_a_fence (the order's model; its existing
a_later_commit_that_conflicts_waits_behind_a_batch_held_for_its_step is the kept-place control);
tests::hold_sites a_head_that_shares_a_buffer_with_a_batch_held_for_its_making_goes_first (was
..._waits_behind_it: the fill completes while the dispatch is held, and the dispatch's words land
over it), a_head_that_waits_for_a_fence_a_batch_held_for_its_making_updates_waits_behind_it (the
fence control), and the host-alias leg, which passes again.
2026-11-12 10:29:05 -08:00
Anees Iqbal aa2256b6e7 Order host-alias uses across queues again: Metal orders textures over one IOSurface across queues
Reverts a5634d48db and 3926d2d8c9, which left the uses the host aliases add out of the
scheduler's order across queues on the strength of host_aliases.rs's line that Metal orders two
textures over one IOSurface across queues only as the program orders them. The conformance probe
probes/cross_queue_surface_order.m measured that case (queue A's long compute write committed
before queue B's blit read of the same bytes, no event between them, three runs each):

- two tracked textures over one IOSurface: B ran after A and read its writes in every run on an
  M3 Max (macOS 27.0.1, m3-max-21812, m3-max-21830), a Radeon Pro 5300M and a UHD 630 (macOS
  26.7.1, m3-max-21850, m3-max-21851); untracked, the same but one run on the 5300M;
- a texture of another surface (control): ran alongside A on the M3 and the 5300M;
- two no-copy buffers over one allocation: B ran alongside A, reading stale or mixed words, on
  all three (8 of 9 runs; the 630 ran it one after the other twice);
- one tracked buffer (control): ordered on the M3; the 5300M and the 630 each took B first once.

So the alias keys' order across queues is the surfaces' order, which Metal keeps; dropping it was
wrong for the consumer's surfaces, whose textures lie over per-texture no-copy buffers.
host_aliases.rs now states those measurements, the plain no-copy buffers' among them, in place of
the M4 line. The freeze the revert reopens (a held batch's making holding other queues' heads
over a shared surface) is answered by the next commit, which lets a batch held for its making give
way across queues, as the x86 Macs' GPUs may take a later commit first.

Until that commit, tests::hold_sites::a_head_over_the_same_host_bytes_through_another_buffer_goes_while_a_batch_is_held
fails as before a5634d48db (m3-max-21752).
2026-11-12 10:29:05 -08:00
Anees Iqbal 1b802ea45a Cross-queue commit order counts a conflict only on a resource both batches name
What: a use the device's host aliases add (host_aliases.rs: a no-copy buffer over the bytes of
another, the consumer's textures of one IOSurface over their plane buffers) is now marked
(`Use::aliased`). The scheduler's order across queues (`Footprint::conflicts`, behind
`Order::is_behind`) leaves marked uses out, so a batch the runtime holds for a reason of its own
(its pipelines' making, a host step, its checks) holds back no later commit of another queue that
meets it only over shared host bytes. A use joined with one its command named stays named (join
and merge keep `aliased` only where both are; `covers` lets no aliased use hold a named one), so
two batches that name one resource still run in commit order, as Metal's tracking orders them.
The tracker's barriers, inside a queue and on the GPU once both are submitted, take aliased uses
as before.

Why: on an Intel Iris Xe, one guest process's compute pipeline took about 3 s to make cold. Its
command buffer kept its place in commit order (held for its making), and five other queues' heads
in each scheduling pass, the window server's frame among them, conflicted with its footprint only
through the alias keys over IOSurface pages they shared (heads_held_for_earlier_commits +5 per
pass, footprints_built +2, the scheduler otherwise idle). The frame's present waits for its
writers' completion, the guest's display pipe allows two unanswered presents, and the guest froze
for 3.1 s. Metal orders two textures over one IOSurface across queues only as the program orders
them (host_aliases.rs's measurement: an M4, macOS 27.0.1, plain and under API validation), so a
later commit of another queue through another resource over those pages does not wait for an
earlier one there; holding it was ours alone.

docs/HOWTO.md's paragraph on copied and same-surface buffers says the same; the order.rs,
scheduler gate and host_aliases.rs docs name the exception.

Tests: tests::hold_sites::a_head_over_the_same_host_bytes_through_another_buffer_goes_while_a_batch_is_held
(the previous commit) failed before this change on lavapipe (m3-max-21752: TimedOut, the fill
waited behind the held dispatch) and is expected to pass after; tests::tracker gains
a_use_the_host_aliases_added_orders_no_batch_across_queues (aliased-only overlaps unordered both
ways, a named key on both sides ordered, a named use joined with an added one of the same range
named); tests::host_aliases expects the added uses marked.
2026-11-12 10:29:05 -08:00
Anees Iqbal a96e93f4da runtime_lane under sync validation: the layer's false positives become narrow claims, and the tests' own races are taken out
Under METAL2VULKAN_LANE_VALIDATION=sync on lavapipe the runtime lane failed 31 tests on
the layer's hazard reports. At def64b1999 it failed 34: these 31, plus write_routes and two
frame_costs tests, all since fixed in the runtime (write_routes in 14c0b28928 and 952755253f).
None of the 31 is a missing barrier. Each is one of:
- the layer taking a shader's storage buffer as written over its descriptor's whole range;
- the layer reading no indirect draw's counts;
- a difference the runtime already announces;
- a test program's own race, which Metal leaves unordered too.

Claims (runtime_lane::apart_writes, runtime_lane::stage_races; docs/VALIDATION.md's table):
- NotedWrites notes every write a test places in a buffer: a dispatch's, a draw's, a fill's, a
  bounded draw's or a patch draw's, by command buffer. The layer's hazard reports are held
  apart, each distinct one once with its count, so a claim reads every report.
- LAYER-APART-WRITES, widened from dispatches to draws and fills: a write after write between
  noted writes, each one Vulkan command's, no two of which share a byte.
- LAYER-IDLE-DRAW: the index bounds pass's two vkCmdDrawIndexedIndirect of one bounded draw,
  reported as recorded, one such draw noted per command buffer, on a device that announced
  indirect-index-bounds-pass. At most one of the two draws.
- LAYER-IDLE-CHUNK: an emulated patch draw's vkCmdDrawIndirect chunk draws, reported as
  recorded, the patch draws of each command buffer noted apart, on a device that announced
  emulated-tessellation-draws. The tests keep each patch draw below 2^30 triangles and the scan
  writes vertexCount 0 past them, so at most one chunk of a draw draws.
- LAYER-STAGE-RACE: a later draw's vertex stage against an earlier draw's fragment stage of one
  pass, on a buffer the test names, reported as recorded, of the kind whose notice the device
  announced (in-place-vertex-reads, fragments-before-geometry).
- Each form has unit tests of the shapes that pass and of those that must fail.

Tests:
- draw_bases, index_fetches, index_pools: bounded draws noted (idle draw).
- int_attributes, normalized_vertex_fetch, memoryless_uses, render_executions,
  render_gpu_executions, predication: their writes noted apart.
- argument_buffers moves to NotedWrites.
- patches, patch_indices, render_executions' indexed patch commands: patch draws noted (idle
  chunk on the emulation, apart draws on a device with tessellationShader).
  answer_as_plain_metal gives each draw that runs a marks buffer of its own: Metal orders no
  draw's vertex writes after another's in a pass.
- pass_start_reads: the stage-race claim.
- helper_select: a texture memory barrier between its draws, whose storage image the layer
  takes whole.

Verified on lavapipe (CPU ICD), the same sync command at base and tip (whole runtime lane,
--success-output immediate, claim lines printed):
- base 13e0a9b60b, m3-max-21616: 2019 run, 32 failed. That is the 31 above, plus depth_executions,
  a regression from RV 2124 fixed on its own branch.
- tip, m3-max-21631: 2032 run, 1 failed (depth_executions). 31 tests passed with claim lines.
- clippy (every feature, --cfg m2v_gpu, --cfg m2v_cpu_icd) and rustdoc clean, m3-max-21617.
2026-11-12 09:20:56 -08:00
Anees Iqbal 1d911cb848 FAST-PATHS: RADV refuses a dma-buf plane at offset 32 even at 256-byte rows
The probe on the Radeon 780M (m3-max-21640, Mesa 26.2.6): a dma-buf
DRM_FORMAT_MOD_LINEAR plane at rows 256 bytes apart is made at offsets 0
and 256 and refused at offset 32
(VK_ERROR_INVALID_DRM_FORMAT_MODIFIER_PLANE_LAYOUT_EXT), and an image's
memory offset must be a multiple of its own alignment
(VUID-vkBindImageMemory-None-10735), so the gap row names the offset as
well as the pitch.

Verified: the cited device run.
2026-11-12 09:14:10 -08:00
Anees Iqbal 52a4f5c147 GenericPointer::Aggregate and the FAST-PATHS gap: what an aggregate's leaves do not follow
With an aggregate's generic pointers followed element by element, `Aggregate` refuses only a
value no followed instruction makes, a part taken from a constant aggregate, or a constant
expression in an aggregate constant; an aggregate loaded from memory is `Memory` and one that
crosses a call is `Call`. The variant docs and docs/FAST-PATHS.md's known gap say so.
docs/REFUSALS.md regenerates unchanged (0 variants without a reach mark or basis).
2026-11-12 08:57:46 -08:00
Anees Iqbal 079b8c8af3 FAST-PATHS: RADV's 256-byte rows hold on the RX 7900 XTX too
The probe on the XTX (m3-max-21379, Mesa 26.2.6) answers as the 780M:
linear rows 256 apart for 18 RGBA16Float texels, explicit planes refused
at rows 192, 384 and 1920 (offsets 0, 256, 32) and made at 256, minimum
linear alignment 256. The row's lines are rewrapped.

Verified: the cited device run.
2026-11-12 08:57:13 -08:00
Anees Iqbal daf22e11d1 Docs: the red-held A8 route in the runtime README; NVIDIA's 128-byte rows and its ordered renders as known gaps
README: a read-only A8Unorm texture over a buffer, on a device whose
A8_UNORM image lacks a feature in linear or DRM_FORMAT_MOD_LINEAR tiling
and whose R8_UNORM image lacks none, has R8Unorm's image read through
(0,0,0,R).

FAST-PATHS known gaps: the RTX 3090 lays linear rows at multiples of 128
bytes and reports an explicit plane asked at 192 at rows 256, so
glyph-sized A8 textures at rows 16 to 448 that are no multiple of 128
stay shadows there (m3-max-21480's sweep); and on the 3090 the check of
renders over pooled memory makes no image (verdicts unchecked), so a
render target over padded rows in ordered memory stays a shadow there
(m3-max-21392, m3-max-21480).

Verified: the cited device runs; cargo fmt.
2026-11-12 08:57:13 -08:00
Anees Iqbal ed8b9a137b A texture that renders over padded rows in ordered memory is in place where the device's check of renders passed
linear_plan::holding refused every texture that renders over rows with
bytes between them, ordered memory too (a Private buffer, a Managed one's
own copy on a discrete GPU), since Vulkan lets a render pass's load and
store read and write back any byte of the attachment's subresource. So
each such render target was a shadow (BytesBetweenRows): 32 Managed
textures at rows of 152 in 256 on reims's XTX walk.

Now holding takes renders_kept: Device::ordered_renders_kept answers it
where the device's policy takes images in place and its check of renders
over its pooled memory (PagesClass::Pooled, Access::Renders, the texels'
row ends) passed. That check renders into a linear image over padded
rows, through its moves into the layouts a render takes, a pass that
clears and stores it and a draw over its last column, while the CPU
writes the bytes beside its texels, and passes only where every byte but
a texel keeps what was last written: the owner's per-driver check, the
same that takes images in place over host pages and pooled memory. In
ordered memory no other agent writes those bytes meanwhile. The texture
is then the device's linear image made PREINITIALIZED (Between::Kept),
as one that only reads; a pending verdict starts the check, and a
texture made meanwhile is a shadow. The pooled move path asks the same.

Docs: the shadowed-texture notice (API.md), HOWTO, the degradation's
declaration and linear_texture_bytes_per_row's doc say so.

Verified: cargo fmt; unit test linear_plan::ordered_writes_let_a_
texture_that_renders_nothing_hold_its_rows_padding covers renders_kept
(kept in ordered memory, refused outside it and over shared rows);
device runs of tests::ordered_renders follow.
2026-11-12 08:57:13 -08:00
Anees Iqbal f958409811 FAST-PATHS known gaps: RADV's 256-byte linear rows, and the short last row's documented basis
RADV lays a linear image's rows at multiples of 256 bytes and refuses a
DRM_FORMAT_MOD_LINEAR image with an explicit plane at any other pitch
(VK_ERROR_INVALID_DRM_FORMAT_MODIFIER_PLANE_LAYOUT_EXT), so an IOSurface
plane of RGBA16Float 18x28 at 192-byte rows and dma-buf planes at rows
384 or 1920 bytes apart (offsets 0, 256, 32) are shadows there. The
surface or dma-buf sets the pitch; no image of the device lays rows
there. The short-last-row row now names the Vulkan rules that keep it
a shadow (VUID-vkBindImageMemory-None-10737,
VUID-VkImportMemoryHostPointerInfoEXT-handleType-01750).

Verified (device probe tests::shadow_causes_device at 282341f5bb):
Radeon 780M m3-max-21292 (rowPitch 256/512/2048, explicit planes
refused at 192/384/1920, made at 256, minimum alignment 256); RTX 3090
m3-max-21293 (short last row Refused(Placement), a page longer
InPlace); lavapipe m3-max-21290 (explicit planes made at 192/384/1920).
2026-11-12 08:57:12 -08:00
Anees Iqbal 12119c572d GenericPointer::Memory and the FAST-PATHS gap: memory other than a closed thread allocation's slots 2026-11-12 08:52:14 -08:00
Anees Iqbal 039f6e5fbc FAST-PATHS: a replayed draw's attributes are among those the shader pulls
The GPU form of an execution's draws now pulls every attribute, so a normalized one there is
the module's product, as the vertex conversion row states for the other pulled attributes.
2026-11-12 08:37:43 -08:00
Anees Iqbal 7cd885ea5b runtime_lane::render_merged_attributes: stage_in states' executions run on the GPU alone
The lane test of executions whose inherited state's vertex function reads [[stage_in]]
attributes now states the GPU form, against the host step's pixels (a barrier the CPU set and
cleared), for a kernel-written ICB of triangle draws and indexed draws (merged) and triangle
strips (one draw per command), each command binding its own positions and per-instance marks at
its own offsets, first/base vertex and base instance:

- pulled_attributes_of_executed_draws_fetch_their_commands_elements: strides 10 and 6, which the
  shader fetches anyway (merged draws read the command's vertex and instance, not the merged
  draw's corner indices);
- fixed_function_layouts_of_executed_draws_are_pulled: strides 8 and 4, marks at step rates 1
  and 2, no vertex buffer bound at the encoder;
- a_layout_of_a_stride_set_per_bind_keeps_the_host_step: a dynamic-stride position layout the
  commands bind at their own stride takes the host step, whose notice names the rule.

The fixture gains ima_strips (a triangle strip writer). docs/API.md states the attribute rule in
the indirect command buffer section and in the GPU form's list; api_signatures.tsv and
api_surface.rs list draw_replay_vertex_layouts.
2026-11-12 08:37:43 -08:00
Anees Iqbal 729912a69e ARCHITECTURE: SCCP's values of a few constants 2026-11-12 07:59:08 -08:00
Anees Iqbal 15866645a8 A generic pointer of no one space is refused as GenericPointer, naming how and where
canon::generic refused every generic pointer it could not give one address space as AddressSpace(8), with no location, so a caller could not tell a pointer of two spaces from one loaded from memory. Feature::GenericPointer (both crates) now names how the pointer gets a space only the run knows (TwoSpaces, Memory, Aggregate, Call, Integer) and the refusal locates the instruction where it does. AddressSpace's doc now lists 8 as defined; the planner treats a generic pointer that survived canonicalization as an invariant breach. FAST-PATHS records the gap, REFUSALS and the API signature table are regenerated, ARCHITECTURE names the pass. runtime_lane::generic_pointers compares generic_spaces and generic_null with the M3 Max's answers (run next on lavapipe).
2026-11-12 07:40:47 -08:00
Anees Iqbal 3a7568d5b4 A device can be made to open no dynamic library's file; only regular files are read
A pipeline creation loads, for each install name its stage's libraries name, the file that name
names (dynamic_library.rs, `stage_with_dependencies`), and `new_dynamic_library_with_url` and a
binary archive's descriptor read the file they name. Where the library bytes come from another
party (a guest's metallib in a virtual GPU), its install names name any host path: `/dev/zero` grew
`read_to_end` until the process ran out of memory, a FIFO blocked the creating thread for ever,
opening a device file could act on the device, and any host file that parses as a dynamic metallib
linked into the pipeline.

- `DeviceOptions::load_no_dynamic_library_file` (and `RawDevice`'s), off by default: the device
  opens no file a library's install names name and refuses `new_dynamic_library_with_url`
  (`DynamicLibraryError::NoFileLoading`, new). A creation links only the libraries its function
  descriptors give (`libraries.preloaded`, `libraries.loaded` by install name); an install name
  `loaded` lacks loads nothing, so a creation whose import survives specialization fails
  `Compile(NeedsInput(DynamicLibrary))`, as Metal's does for a file it cannot load.
- Without the switch, every such read goes through `container::read_file`: a regular file alone,
  looked at before it is opened, opened `O_NONBLOCK | O_NOCTTY` and looked at again through the
  handle, read once no further than its length when opened, a length the process cannot hold
  refused rather than allocated. A FIFO, device or directory loads nothing as an install name and
  is `InvalidFile` for `new_dynamic_library_with_url` and a binary archive.

The stage_with_dependencies call sites (compute, render, mesh, tile creation) pass the device.
Docs: the field's and variant's doc comments, the runtime README's options table, docs/API.md's
accepted differences. api_signatures.tsv blessed (two fields, one variant); docs/REFUSALS.md
regenerates unchanged.

Tests, each failing without the change (a control commit neutralizing the gate and the
regular-file read, run once):
- tests::binary_archive::a_path_of_no_regular_file_is_no_archive_and_is_not_waited_on (CPU):
  a FIFO and /dev/zero are InvalidFile, each read bounded at 30 s.
- runtime_lane::dynamic_libraries::an_install_name_of_no_regular_file_loads_nothing_and_waits_on_nothing
  (lavapipe): a FIFO's and /dev/zero's install names load nothing, the creation is refused
  NeedsInput(DynamicLibrary), new_dynamic_library_with_url is InvalidFile, each bounded at 60 s.
- runtime_lane::dynamic_libraries::a_device_that_loads_no_file_links_only_the_libraries_it_is_given
  (lavapipe): with the switch, a client linked against A's real file is refused, A preloaded or
  not; given A in `libraries.loaded` it links A's values; new_dynamic_library_with_url is refused.
2026-11-12 07:02:06 -08:00
Anees Iqbal 9dc4b0c953 Runtime lane: argument_buffers lets the layer's writes after writes between its dispatches' apart words pass
Under METAL2VULKAN_LANE_VALIDATION=sync on lavapipe, two argument_buffers tests failed with
SYNC-HAZARD-WRITE-AFTER-WRITE between dispatches of the word copier on set 0 binding 1
(resource_ids_a_kernel_writes_name_resources_as_the_cpus_do,
addresses_a_kernel_writes_reach_buffers_as_the_cpus_do; privmem's m3-max-21017 and 21016).
These hazards are not races. Each copy writes 4 bytes, at owner offsets 4 bytes apart. The
runtime's tracker orders a serial encoder's dispatches by the plan's proven window (here 4 bytes
each, disjoint), so it records no barrier between them. The layer takes the descriptor's whole
range as written, and bind::descriptor_range binds that range from the offset alignment down, in
16-byte granules and 16 bytes at least, so to the layer the two ranges meet. Vulkan's memory
model has a data race only between operations on overlapping memory locations ("A memory
operation must not affect memory at a memory location not within its set of memory locations").
The lane's sync_coverage::disjoint_words_of_one_block_are_a_hazard_to_the_layer_alone already
shows this false positive word by word and names these reports. The runtime is unchanged:
adding barriers would only silence what the layer reports.

runtime_lane::apart_writes is a fourth claim form,
layer_reported_nothing_but_apart_writes(messages, claim, &writes). The test notes each
dispatch write as it places it (DispatchWrites: buffer, bytes). A message passes, with a
LAYER-APART-WRITES line, only when all of these hold:
- it is a SYNC-HAZARD-WRITE-AFTER-WRITE (not the racing form);
- both commands are dispatches (hazards::DISPATCHES, now shared with the sequences lane);
- it is on a VkBuffer the test noted two writes or more of;
- no two of those writes share a byte. The writes are read in VkBuffer space through
  Buffer::vk_buffer, asked only once the work ran.
Everything else fails as layer_reported_nothing does. So does a message list the sink filled
(Messages::MAX, now crate-visible), since what it dropped is unread. The hazard text is read by
the sequences lane's parser (parity::sequences::hazards::parse, now crate-visible), not a second
one. Both tests now state that claim after each iteration's run. VALIDATION.md's claim-form table
gets the row. The table's last row and the paragraph after it had run together on one line; they
are split again.

Unit tests (no device) show these fail: a read after a write, a write after a read, the racing
form, a draw or a copy at either end, an image, a buffer not noted or noted once, and two noted
writes at one word or overlapping ones.
2026-11-12 06:52:42 -08:00
Anees Iqbal fbb1f7c6bb docs/REFUSALS.md: regenerated after the heap texture beside a selected sampler compiles (one ArgumentBufferTextures site fewer) 2026-11-12 06:21:36 -08:00
Anees Iqbal 416f6aeb32 Lane test and Metal answers for the sampler-table fixture; architecture doc 2026-11-12 06:20:54 -08:00
Anees Iqbal 126420d6a8 SCCP folds integer minimum and maximum of constants
A loop whose trip count the function constants decide through llvm.umax (a convolution kernel's max(tile / stride, 1)) kept the call unfolded, so its exit compare had no constant bound, reach could not follow the counter, and a 256 KiB private accumulator was refused against the device's 96 KiB (PrivateMemory 263240). The scalar llvm.umin, umax, smin and smax now fold over constants as ctpop, bitreverse and bswap do; integer minimum and maximum have one answer. engine_arith took its opaque integer bits from llvm.umin(C, -1); they now come from a volatile private word, which no pass folds.

Verified: canon::tests::private_reach's clamped trip count (fails without the fold); the guest kernel at its constants compiles with 144 bytes of private memory on the rdna3 profile (scratch, m3-max-20815).
2026-11-12 05:57:01 -08:00
Anees Iqbal 131887a2e1 Merged draw replays take indexed draws, and each fragment its own command's slot table
A render execution whose records a kernel writes ran on the host step wherever the buffer's
command types held DRAW_INDEXED, and the merged form refused any fragment function that reads
buffers, since one merged draw had one fragment slot table. Now both stay on the GPU.

- Indexed draws (DrawReplay::indexed, from draw_replay_indexed over the decided writes). The
  preprocess holds an indexed record where the policy and the INDEXED flag allow it: its
  arguments are [index count, instances, base vertex, base instance], and it writes a 16-byte
  index entry per command (the device address of the first index, its offset rounded down to the
  index size; the whole indices to the buffer's end; the size, 2, 4 or 0 for a draw without
  indices). An index buffer of address 0 or a bad index type is a RECORD fault; an address no
  resident range holds draws nothing and counts a resident miss; a position past the buffer reads
  index 0, as the encoder's indexed draw reads it. The merged vertex reads its vertex as the index
  at its position plus the base vertex, a u16 from its aligned word. An indexed replay that does
  not merge is refused (ReplayRefusal::IndexedApart): the runtime host-steps it
  (HostStepCause::Rule).
- Per-command fragment tables. The merged vertex writes its command to a flat uint varying
  (IoRole::MergedCommand, VaryingKey::merged_command). A merged fragment that reads buffers takes
  it as an input and MergedDrawAddress as its push field, and reads its RootTableAddress as the
  header's tables plus command times the stride plus the fragment table's offset
  (bind::merged_fragment_table). The header grows two words (H_INDICES_AT 48, H_FRAGMENT_TABLE
  52; MERGED_HEADER_BYTES 56). A fragment that reads [[primitive_id]] keeps the merged variant
  refused, so its executions host-step, as before.
- Runtime (render/executions/gpu.rs): indexed executions take the merged form alone, no
  per-command fallback; one whose type does not merge host-steps with the rule named. The
  host-replayed-indirect-commands notice text names indexed draws that do not merge.
- The fixture icb_merged_indexed (ours: kernels writing indexed draws of 16-bit and 32-bit
  indices with per-command vertex marks and fragment tints), its AIR companions compiled by
  scripts/regen-air-fixtures on the M3, and its AIR input golden.

Verified:
- metal2vulkan's draw replay, merge, stage IO, varyings, link and API tests, among them the new
  interpreter test of seven indexed records (u16 and u32 offsets, base vertex -1 over two
  instances, indices past the buffer, a residency miss, a bad type, a null buffer): 354/354
  (potluck m3-max-20787, msi).
- Clippy in every configuration (all features, each feature alone, the runtime, --cfg m2v_gpu)
  (m3-max-20812, msi); Rustdoc of both crates and 379/379 tests of the replay, AIR goldens, stage
  IO, API tables, refusals and catalogue (m3-max-20824, msi).
- The new lane test merged_indexed_draws_draw_what_the_host_step_draws (16-bit and 32-bit: six
  commands merged on the GPU with no record read, each fragment its own command's tint, the
  same pixels as the host step's) with the other merged and range-read lanes: lavapipe 12/12
  (m3-max-20811, msi), RADV Radeon 780M 10/10 (m3-max-20814, um790).
- The golden icb_merged_indexed.txt was blessed under the pinned llvm-as (m3-max-20792); no other
  golden moved.

The semantics and artifact format bumps, the golden re-bless and the census stay with the
landing.
2026-11-12 05:39:20 -08:00
Anees Iqbal c2b02c5269 Static-initializer division by zero: the probe of what Metal answers, and the accepted difference 2026-11-12 05:30:09 -08:00
Anees Iqbal e6df98ef2a Rebind a kept draw of another call or index buffer, not every step
A render encoder's draw that differs from its pipeline state's kept draw only in
its call of the same primitive type (with indices or without), its counts and its
index buffer or type, each read in place, now takes the rebound of a draw of
other arguments instead of every step. The binder's redraw_apart_into writes the
Vulkan draw, overrun, base fields and index use of any pair of direct draws
(Ok(false) where a vertices-per-primitive field or a fixed-function fetch window
sets them apart); the route check adds the two route parts a call or index type
changes (a strip restarted at another index, a de-indexed variant); a draw of
another index buffer is no draw moved (its uses meet a buffer the kept draw's did
not: detached buffers and shadows are looked at again) and holds that buffer as
every step does; the kept draw takes the new call.

Same draws, bindings and pixels: the debug-assertion checks compare each rebound
draw with every step's commands, writes, uses and recording; the new runtime test
draws_with_indices_and_without_in_turn_are_rebound_with_their_call compares the
commands and pixels with every step; the binder test covers the new pairs.
Counter: draws_unlike_kept_call and draws_rebound_arguments in draw_costs
compositor --counts.
2026-11-12 05:23:20 -08:00
Anees Iqbal e17223aed8 A render execution's range read from a buffer runs on the GPU in the merged form
executeCommandsInBuffer:indirectBuffer:indirectBufferOffset: sent every render execution to the
host step, even when the GPU wrote the commands and they merge into one draw. That costs a
GPU-to-CPU round trip each time.

Now an execution whose commands merge takes the GPU form whatever its range:

- The draw replay gets DrawReplay::range_read. The preprocess runs over every command of the
  buffer. Each invocation reads the range (location, then length) from the parameters
  (DrawReplayLayout::range_offset). A command outside the range draws nothing.
- The range is taken as the host step takes it (ExecutionRange::commands): clamped at the size.
  A location past the size, or an end past 2^32 - 1, draws nothing and reports RANGE once.
- The binder refuses range_read unless the replay is merged and covers the whole buffer
  (ReplayRefusal::RangeRead).
- The runtime copies the range's 8 bytes, where the encoder read them
  (indirect_execute::range_from), into the scratch's parameters between barriers, before the
  preprocess.
- These still take the host step, and the notice names the rule: commands that do not merge (a
  strip type, or a rule of the merged form), and an execution whose records the CPU alone writes.

The degrade notice's text (degradation.rs, docs/API.md), the render executions' docs and the
upload arena's docs now describe this. The API signatures are re-blessed.

Tests:
- bind::replay::draws::tests::a_replay_that_reads_its_range_draws_the_commands_inside_it, on
  the CPU interpreter: seven ranges, including clamped, empty, at the size, past the size and
  past 2^32 - 1. Each command's arguments and the merged corners are checked, plus both refusals.
- runtime_lane::render_merged_executions::a_range_read_from_a_buffer_draws_on_the_gpu_what_the_host_step_draws:
  four ranges, one written by a blit before the pass. The GPU form draws 8 merged commands and
  reads no record. Its pixels and execution report equal the host step's.
2026-11-12 05:08:28 -08:00
Anees Iqbal 2724757bbf A host step waits for the batches that wrote what it reads, not every queue's work
A batch whose host step records indirect commands the GPU may write waited, once otherwise
ready, until every VkQueue completed what was submitted to it by then. A frame of a GPU-culling
renderer (a kernel encodes the draws and their execution range, then several render passes
execute them through the range) paid one GPU round trip per pass: each pass's step waited for
the passes before it in its command buffer, and for other queues' unrelated work, though it
reads only the records and the range the culling wrote. The range read made it worse: it was
read from a copy recorded right before the execution, in the batch of the previous pass.

Now the gate is taken from the hazard state where it can be (scheduler gate_of):

- CommandBufferShared::step_reads names what a batch's host step reads on the host of what the
  GPU may write, where each segment whose step waits for the GPU is an execution (outside a block
  of command predication) or a render pass of executions whose uses commit bounded: their
  records and ranges (Deferred::host_reads, ExecutionRange::host_reads), with their host
  aliases. Anything else (an indirect dispatch, a loop's check, a staged gather, an indirect
  sparse update) answers None.
- Tracker::last_writes answers, per VkQueue, the value of the last batch that wrote those bytes
  of the writes the state holds; None for an untracked resource. The state forgets only what
  completed, and a write that let an older entry go waited for it, so once each queue reached its
  value every GPU write to those bytes completed and reached the host (every batch ends with the
  barrier to the host). Every such writer is submitted by the time the gate is taken: earlier
  batches of the line went first, an earlier commit's conflicting batch on another line holds the
  head behind it (its footprint holds the step's reads), a later one waits behind it.
- Where either answers None the gate is every queue's last submission, as before.
- The range of executeCommandsInBuffer:indirectBuffer: is read in place where the host maps the
  bytes the GPU writes (Buffer::maps_gpu_bytes: not Private, not a Managed host copy on a
  discrete device, not a copied host buffer), through Buffer::read_mapped, which holds a no-copy
  buffer's pages while it reads 8 bytes so a detach and rebind meanwhile free none of them; a
  detached buffer runs nothing. The read is noted at the call as a command that reads the bytes
  (no GPU work), so the encoder's order, a detach and the hazard state see it as they saw the
  copy's. Other buffers keep the copy.
- WorkCounts::host_step_gates_narrowed counts gates that left out work submitted before them;
  the conformance cost tables report it and never gate it (QUEUE_DEPTH: whether a gate falls
  below a queue's last submission depends on whether the host had seen the writer complete).
- The HostReplayedIndirectCommands notice's cost, its catalogue entry in docs/API.md, the
  scheduler's and indirect_execute's module docs and the execution calls' docs say so.

Tests: tracker a_host_read_waits_for_the_last_writes_of_its_bytes_alone (the writer per queue, no
writer, a covering write on another queue, untracked, a queue past the count, retired). Lane
depth_executions a_frame_s_executions_wait_for_the_culling_alone: a culling command buffer on one
queue, a fill on another queue submitted before the frame, then a frame of two passes that
execute the commands through the range: two host steps, both gates narrowed, both targets hold
each kept chunk's depth. The existing depth_executions test now shares its workload.

No Metal-visible behaviour changes: what the steps read and record is the same; they start
earlier.
2026-11-12 04:53:27 -08:00
Anees Iqbal 605a99f639 A texture over a Private buffer at a pitch the driver takes only explicitly is in place: the GPU keeps its bytes
A Between::Kept texture (bytes only the runtime's ordered commands write; no render target) whose
pitch the device's linear image does not lay on its own now takes route 2, the DRM explicit-pitch
image (VK_EXT_image_drm_format_modifier, DRM_FORMAT_MOD_LINEAR), over the buffer's own memory,
where the driver's reported rowPitch equals the buffer's pitch at offset 0 and the image fits.
Checked per texture. Such an image starts UNDEFINED (VUID-VkImageCreateInfo-initialLayout-12478:
PREINITIALIZED only with TILING_LINEAR; 01443 for external memory), and 7.1.1 lets the move out of
UNDEFINED discard its range, so the first move keeps the bytes on the GPU: one span copied out to
a scratch buffer, the move UNDEFINED -> GENERAL, the span copied back, in one ordered sequence.
The submission taking a keep waits on every other queue's last submitted work, so the keep follows
every earlier access to the span; later work waits through the first move's owners. Afterwards the
image and the buffer alias as a linear resource (glossary, DRM_FORMAT_MOD_LINEAR; 12.11).

Counted: WorkCounts::first_moves_kept, first_move_bytes_kept.
2026-11-12 04:26:42 -08:00
Anees Iqbal 89483d65cb An idle device lets go of its kept empty blocks and parked objects
What: a device keeps an emptied memory block for 10 s (KEPT_EMPTY_FOR) and a
released image or buffer parked for 1 s (recycle.rs), and only let either go
at a later call of the program: a release in the block's pool, a creation
call (sweep_stale, from keep_room), or a recycler's park or take. A device
whose program stopped making resources kept them until its next creation
call, however long that took. The consumer's Iris Xe rerun showed it: after a
guest application quit, 11 empty pooled blocks, 4 empty dedicated ones and
the parked objects sat 33 s with no counter moving; the first creation call
then freed 12 at once, and 7 empty blocks still stayed, the "one pooled block
per pool" kept for good.

How: one idle-sweep thread per device (idle_sweep.rs), started by the first
creation call that may wait (Device::keep_room). A block kept empty, a block
made ahead and an object parked each say when they may go (Due::by). The
thread waits for the earliest of those moments, sweeps (recyclers first, then
Memory::sweep_kept, the creation calls' sweep without its throttle), asks
what comes due next (Recycler::due, Memory::sweep_due) and waits again, with
no timeout when nothing is due. It sweeps at most once a second. It holds the
memory, the two recyclers (now Arc'd), the functions and the counts, never
the device. Its Vulkan calls run in an exit-guard section, and the teardown
stops and joins it before the parked objects and the memory go. Freed blocks
are posted to the free thread, which paces them as before.

The pool's last empty block now stays only in the pools the runtime keeps
room in for its own encodings' and commits' resources (Memory::keeps_room:
the kept list, not a small heap's). That block is the room the next creation
call's keep_room would make again. Every other pool keeps none past the 10 s.
So the lasting spare is bounded at one block per kept pool and counted in
WorkCounts::empty_memory_blocks_live. docs/FAST-PATHS.md's row says so and no
longer claims "held until 10 s after the dip" for blocks that stayed for good.

Verified: tests::idle_sweep (lavapipe, ms01). Private buffers and textures
over several blocks are used by a command buffer that completes, one refused
at commit (abandoned encoder) and one its submission check fails, then all
are released and the device idles. Before this change (b11d8115f1, job
m3-max-20498) it failed after 40 s idle: 32 images and 3 buffers parked,
8 pooled blocks live against 1 at the start, 512 MiB in the heap against
64 MiB. The unit test a_pool_without_room_lets_its_last_kept_block_go covers
stale/stale_at with and without room. The after-run is in the report.
2026-11-12 04:24:52 -08:00
Anees Iqbal 6d9bc9f096 RuntimeGap::IndirectRenderCommands names the rule that refused it (IndirectRule)
One gap stood for a dozen rules: an execution of the other encoder kind's commands, a range a
draw of the encoder may write, a command's memoryless texture slot, a color in another format,
the shader-side depth test, a shadowed texture the call did not gather, residency past the call
meeting a shadow's truth, an emulated mesh command's ordering, a memoryless attachment read past
the pass, and on an Apple10 device the render states the commands set themselves. A consumer's log
said "IndirectRenderCommands" for all of them, so a report could not say which one a program met
(a public GPU-culling sample's host step on an RX 550 did not).

The variant now carries IndirectRule (public, non-exhaustive, Copy), one value per site, and the
error's text prints it: "not implemented in the runtime yet: IndirectRenderCommands(UngatheredShadow)".
A family row of indirect render commands names FamilyRow, the summary of the others. No
behavior changes: every site refuses where it did, typed as before.

Tests that expected the gap now expect its rule: the other encoder kind (render_executions,
indirect_command_buffers), a range a draw wrote (render_executions), residency past the call
(buffer_texture_renders), mesh ordering (mesh_commands) and the Apple10 states (state_ids,
command_render_states, families). docs/REFUSALS.md and api_signatures.tsv regenerated.

A consumer that names RuntimeGap::IndirectRenderCommands names a rule now, or matches
IndirectRenderCommands(_).
2026-11-12 04:10:12 -08:00
Anees Iqbal 3e5293679e minimumLinearTextureAlignment: every usage's pitch, at least the device's line
The answer was, per format, the smallest power of two from 16 at which
a ShaderRead texture of every probed width took its in-place image. Two
things it did not cover:

- A texture that renders or that a shader writes takes the same
  in-place image with those usages, whose linear layout the driver may
  pitch otherwise. The probe now tries reading, reading and rendering,
  and reading and a shader's writes (USAGES), and answers the largest of
  the usages that ever lie in place (a usage the format's linear images
  cannot take has none).
- The device's check of images in place measures lines of
  nonCoherentAtomSize bytes (in_place::RowEnds), and on the Iris Xe its
  renders and writes of texels that share a line with bytes beside them
  fail (the line holding a row's last texels is written back whole). ANV
  answered 16 against a 64-byte line, so a guest that laid a render
  target out at 16 put its texels in a line with bytes before them: a
  shadow. The answer is now at least nonCoherentAtomSize, "the size and
  alignment in bytes that bounds concurrent access to host-mapped device
  memory" (vkspec, Limits) (placed_answer). At it, a texture whose rows'
  bytes fill whole lines shares none with other bytes. Rows whose bytes
  are no multiple of the line keep their padding in their last line at
  any alignment, so on ANV those stay shadows for renders and writes
  whatever the answer; the docs say so.

Metal's 16 stays where the device imports no host pages, for a format
no usage brings in place, and where a probe failed. The record's VERSION
goes to 2, so no answer of the old probe is read again. Expected answers
(the venues' read answers with the line): ANV 16 -> 64, lavapipe 64,
RADV 256, MoltenVK 16 (its line is 16).

Tests: tests::linear_alignment's the_answer_is_the_usages_largest_and_
at_least_the_line (the rule over every committed profile's line, ANV's
16 before and 64 after); the lane's render-target test (previous commit)
gains the same texture at Metal's 16, a shadow wherever the check failed
such renders.
2026-11-12 04:08:33 -08:00
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 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 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 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 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 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 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 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 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 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
Anees Iqbal 0709ba7ba5 A sampler state's lodBias moves the level on a device presenting an Intel or AMD Mac
What: vk_sampler set mipLodBias 0 whatever the descriptor's lodBias, read as
Apple9 (an Apple M3 Max samples every level as with no bias). The
consumer's oracle (an AMD Radeon Pro 5300M and an Intel UHD 630) shows a
Mac with an Intel or AMD GPU adds the bias to every sample's level,
explicit (level()), gradient and implicit alike, clamped into the
texture's levels. So a guest presenting such a Mac read the wrong level.

How: the translator's SamplerUse gains lod_bias (with_lod_bias), a fact
the consumer states per bind from the Mac it presents; a plan's uses
leave it unset. With it, vk_sampler's mipLodBias is device_lod_bias's
(new, public): the bias within the device's maxSamplerLodBias, the limit
of its sign past it (Capped), none for a NaN (NotANumber) and none where
the portability subset withholds samplerMipLodBias (Withheld). Without
it, 0 as before; a use of texel coordinates takes none either way. Vulkan
adds mipLodBias to an explicit level too, so the device's sampler gives
the measured answer within the limit.

The runtime keeps the resolved MacClass in DeviceProperties (one place,
presented_class; lossless_compression derives from it). A state's taken
descriptor keeps its bias on IntelOrAmd (-0 as 0, NaN as none) and 0 on
AppleSilicon, and SamplerState::bound_use adds the flag at every bind:
a slot's, an argument sampler's, a heap set's array element, and the
attached-levels reckoning of the levels a draw samples. A bias the
device cannot take as it is is announced once as the state is made, the
new precision kind CappedLodBias (capped-lod-bias), never fatal.

Docs: vk_sampler, SamplerDescriptor::lod_bias, the runtime sampler module,
MacClass and DeviceOptions::mac_class name the answer per class; API.md's
catalogue lists capped-lod-bias and the Mac-class section the bias. The
api_surface and api_signatures tables take DeviceLodBias,
device_lod_bias, SamplerUse::lod_bias/with_lod_bias and the new kind.
REFUSALS.md regenerated unchanged.

Tests: metal::sampler's a_lod_bias_is_the_device_s_where_the_use_adds_it
(every committed profile, both uses) and
the_device_lod_bias_is_the_bias_within_what_the_device_takes (exact,
capped finite and infinite, NaN, withheld on MoltenVK's profile);
tests::sampler takes the bias per class; the lane's lod_bias tests a
device presenting each class: AppleSilicon reads the unbiased level
(kernel explicit, fragment implicit), IntelOrAmd the biased one, the
capped ones announced once (CAPPED_LOD_BIAS, listed as a site).
Evidence: potluck jobs in the report to main.
2026-11-12 02:04:48 -08:00
Anees Iqbal cf4d8017f2 FAST-PATHS: the heap answer row's measured counts and bytes
heap_texture_images at 4c6ffc7567 (code identical to this tip), under each HeapAnswerPolicy:
of the 22 compositor shapes, on ANV (Iris Xe, m3-max-20000) 14 lie in an image put in place of
their first one and 7 are shadows in Metal's tiles under Metal, none of either under Device, the
answers 3769962 bytes against Metal's 3656426; on the RX 7900 XTX (m3-max-20001) 1 and 8 under
Metal, none under Device, 4155498 bytes. heap_compression_costs on ANV under the default
(m3-max-20014): the 2048x2048 render target still takes the linear image under both compression
values (clear 955.3 and 971.4 us), so the HeapCompression row now says so.

Verified: the jobs named; docs only here.
2026-11-12 01:52:37 -08:00
Anees Iqbal 5b5362124c FAST-PATHS: the heap-shadow cost entry is HeapAnswerPolicy::Metal's
Under the default HeapAnswerPolicy::Device a heap texture Metal keeps uncompressed lies in its
device's image wherever its alignment is within the answer's bounds, so the entry's shadow and its
ANV figures describe the switch, and a texture past the bounds whose 4 KiB image does not fit.

Verified: docs only.
2026-11-12 01:52:37 -08:00