Commit Graph
9837 Commits
Author SHA1 Message Date
Anees Iqbal 0bf6fa1e3e rt README: a target's linear image in place is made again without the loop usages for any place condition it fails
Audit finding F3 (wording). The runtime README said a colour render target's
linear image over a buffer is made again without the sampled and feedback
usages where the image with them "does not lie at bytes_per_row". The
retry (texture.rs, after make's Unmade::Unfit) runs for every cause Unfit
names:
- Pitch: its rows not at bytes_per_row;
- RenderReach: its subresource past the texture's rows or the buffer;
- Alignment: its memory alignment not met;
- ImageMemory: its memory type not taken.
The sentence now names those conditions. It also says what follows the
retry: the texture lies in place where the image without the usages meets
them, and is copied where it does not.

Docs only; nothing built.
2026-12-02 09:30:21 -08:00
Anees Iqbal 0a7a446fa1 Harness: its gauges name what they hold, with level elements, timestamp pools and buffer set pools
named()'s doc said it held every count of an object kind the runtime keeps live; it held 15 of
them. It now says what it holds: the kinds a compute workload makes or reaches, and the render
contents and attachment views, which none makes; the kinds only draws, passes, surfaces, imports,
exports and indirect command buffers make are a replay's gauge records. It adds the three of
those kinds a compute workload reaches: level_elements (a texture's levels' storage elements),
timestamp_pools (the command buffers' GPU time queries) and buffer_set_pools (a dispatch's bound
buffers' descriptor sets). Each is recorded at the 100th and 200th runs and at device drop, as
the others are.

Verified: in the hand-over.
2026-12-02 09:29:20 -08:00
Anees Iqbal 8dd00ec58c rt: a quiesce begins no last blob write past its deadline
What: Caches::last_write, the reaper's last write at a quiesce, checks the quiesce's deadline
before each try for the creations lock and again before it reads the cache's data to write: past
the deadline it writes nothing and counts the skip in Metrics::pipeline_cache_writes_skipped. A
write begun before the deadline still runs to its end. Past the deadline before the lock, the size
is not read, so the skip is counted whether or not the cache changed; the doc says so. At the
device's teardown, with no deadline, nothing changes.

Why: the audit lane's finding. The deadline was checked only while a creation held the lock, and
halt() asks the reaper to stop after the submit, block-maker and completion stages, which may use
the whole timeout; so with no creation running a write of up to 128 MiB could begin past the
deadline, quiesce answering false while it ran on, against the quiesce doc.

Docs: Device::quiesce, Metrics::pipeline_cache_writes_skipped, Caches::last_write, the runtime
README's Quiesce and exit.

Verified: red on the RTX 5080 Laptop (NVIDIA 615.71.09) with the runtime sources of the test's
commit, m3-max-78990: the new test timed out waiting for the skip (61.7 s; the last write took the
lock and wrote). Green in the same job at this code: the five blob tests passed, 902 skipped;
"quiesce late: the last write past a passed deadline skipped, the drop wrote the blob"; the
doubling test 5 writes of 286050 bytes for a 108159-byte blob. At this tree (dd0a40d8c6, the same
tree): clippy -D warnings plain, under m2v_cpu_icd and under m2v_gpu, and rustdoc -D warnings, all
exit 0; the runtime's suite on lavapipe 902 passed, 3 skipped (m3-max-78987). lavapipe keeps no
blob, so the blob tests pass there without one.
2026-12-02 08:57:41 -08:00
Anees Iqbal 5b1acd0aa9 rt test: a quiesce begins no last blob write past its deadline with no creation running (red)
Caches::last_write checks a quiesce's deadline only while a creation holds the creations lock.
halt() asks the reaper to stop after the submit, block-maker and completion stages, which may use
the whole timeout, so with no creation running a blob write of up to 128 MiB could begin past the
deadline: quiesce answers false, and the write runs on after it, which the quiesce doc says does
not happen.

The test: a cache grown with its look skipped under a creation held open; the reaper held at a job
of the test's; the creation ended; a quiesce of no time, which answers false; then the reaper,
let go, comes to its end with the deadline passed and no creation running. It writes nothing and
counts one skip in Metrics::pipeline_cache_writes_skipped, and the drop then writes the grown
cache.

Expected red today: the last write takes the lock at once and writes the blob; no skip counted.
2026-12-02 08:57:41 -08:00
Anees Iqbal 78ae218f00 rt docs: the sample-positions links name their items plainly
The private-items rustdoc (CI's "Private intra-doc links" step, merge check m3-max-78917 at
9c375eb504, STEP privdoc EXIT=1) failed on redundant explicit links that 1c307b4608 added:
`Refusal::SamplePositions` in device.rs (programmable_sample_positions_supported) and pass.rs
(RenderPassDescriptor::sample_positions), each in scope by its import, so the explicit target
repeated the text's own path. pass.rs's `RenderPassKind::SamplePositions` link, also imported, takes
the same form. The links that name items not imported there (Device, DrawKind) keep their targets.

Verified: the job named in the handover runs rustdoc with -D warnings over the workspace, with and
without --document-private-items, and cargo fmt --check.
2026-12-02 08:54:02 -08:00
Anees Iqbal 212d7b2d8e rt: blit copies whose rows meet go a row at a time where no one axis orders them, and a surface's plane lies in its buffer
Row L212. Metal leaves overlapping copies undefined; an Apple M3 Max reads the
source whole before it writes, which the runtime gives as slabs, and no Vulkan
copy command may read bytes it writes (VUID-vkCmdCopyImage-pRegions-00124,
VUID-vkCmdCopyBufferToImage-pRegions-00173,
VUID-vkCmdCopyImageToBuffer-pRegions-00184).

Form (blit.rs):
- Slabs becomes an enum: Across (the existing single-axis cut) and Rows
  (RowSlabs). Where cut() finds no axis, row_by_row() takes the rows one at a
  time. Each row goes before every row whose source its destination lies on:
  descending where every destination row lies on a source row after its own
  (meeting()'s y shifts all positive), ascending where all are negative.
- Within a row, the shift from the destination row to its own source row
  (the first row's, plus the pitch difference per row) decides the cut. Zero:
  the row is its own bytes and copies nothing. Less than the row: slabs of
  |shift| in whole texels, the far end first. Otherwise: one command.
- Slabs::of yields each slab's 3D start, which ImageCopy::regions and
  BufferCopy::slabs add to the other side's origin and to the buffer offset.
- An execution barrier still separates two commands. Every hazard between
  them is a write after a read, as no row reads bytes an earlier row wrote.
- Still refused (Gap::OverlappingCopy): rows of two pitches that cross, where
  one destination row lies on a source row before its own and another on one
  after its own.

Surface (texture.rs, buffer.rs, surface.rs, d3d11.rs):
- An exported surface's plane image keeps its PlaneLayout (Under::Surface
  laid, from SurfaceImage).
- TextureObject::rows_in(buffer) answers the plane's rows in a buffer on the
  surface's memory: BufferObject::surface_range matches the buffer's block
  aliases to the plane's (Arc::ptr_eq) and maps the plane's offset through the
  block's memory range.
- A copy between a buffer and a texture takes those rows where the texture
  has none of its own. A texture over the surface's buffer is always the copied
  form (OverCause::Surface), so a copy between it and a plane shares no bytes
  in Vulkan, and is left as it was.
- The surface's buffer and planes are aliases that read alike in the general
  layout. Surface::buffer's doc quotes the section.

Docs:
- blit.rs and the copy methods' docs; error.rs's OverlappingCopy (REFUSALS.md
  regenerated).
- The runtime README: Blit encoders, their known gaps (only crossing pitches
  remain refused), and the surface's buffer.

Verified:
- Green, on lavapipe, m3-max-78902 (at 70c887a155, before the rebase): the
  blit module, 26 of 26 passed (865 skipped). The plane is in place
  (OpaqueFd); into it and out of it go a row at a time.
- Cards, the blit module at 02421a08a9, 26 of 26 passed (867 skipped) on each.
  That tree differs from this one only by a branch for a texture in place over
  a surface's buffer, now deleted: no device laid one in place, and each
  printed "copied".
  - Radeon 780M (RADV, Mesa 26.2.6), m3-max-78888.
  - Iris Xe (ANV, Mesa 26.2.6), m3-max-78889.
  - RTX 3090 (NVIDIA 620.70.06), m3-max-78896.
  On each, the textures over one buffer are in place: whole rows go a row at a
  time (16 slabs; 256 on the Iris, whose memory alignment is 4), and two
  pitches go a row at a time. The surface's plane is in place (OpaqueFd), into
  it and out of it a row at a time.
- m3-max-78906 at 70c887a155: workspace clippy (all targets, all features,
  -D warnings) EXIT=0 in all three configurations (plain, --cfg m2v_cpu_icd,
  --cfg m2v_gpu). Rustdoc and the runtime's private Rustdoc EXIT=0. The
  runtime suite on lavapipe: 888 tests run, 888 passed, 3 skipped.
- refusal_surface.py --check: 0 at this commit.
2026-12-02 08:42:26 -08:00
Anees Iqbal fb53900e04 Tests: blit copies whose rows meet in no order one axis keeps, and a surface's buffer and its plane
Row L212: copies between rows in place over one buffer (two textures over it,
or a region of it and a texture over it) whose rows meet in no order a cut
along one axis keeps were refused (Gap::OverlappingCopy): a destination row
across the end of its own source row and the start of the next, and rows of
two pitches that meet at their starts. Copies between an exported surface's
buffer and its own plane in place were not checked at all: the plane carried
no rows, so the copy was one command whose source and destination share bytes.

Unit tests (blit.rs):
- regions_of_two_textures_over_one_buffer_copy_in_slabs_where_their_bytes_meet
  expects whole rows two texels on to copy a row at a time, the last row first
  on and the first row first back, each row in slabs of two texels, the far end
  of its shift first. Rows of two pitches that meet at their starts copy a row
  at a time, after the row whose source each writes, and the first rows (the
  same bytes) copy nothing.
- a_buffer_copy_over_its_texture_s_own_bytes_copies_in_slabs_or_in_no_order
  expects the same of a region and a texture over its bytes, into the texture
  and out of it, with each command's buffer offset.

Device tests:
- Textures over one buffer: whole rows a memory alignment on and back. Where
  the device lays a texture twice as wide at twice the pitch in place, the two
  pitches both ways.
- A buffer and a texture over it: whole rows on, and a region at twice the
  texture's pitch, into it and out of it.
- New: a copy between an exported surface's buffer (Surface::buffer) and its own
  plane, a row on, into the plane and out of it.
Each checks every byte against a memmove of the source from before the copy,
one submission, and the barriers of one command a row (blit barriers for the
surface, whose hand-overs add barriers of their own). None is refused.

Verified (red): on lavapipe, m3-max-78902 at this commit alone: 26 tests run,
21 passed, 5 failed, the five tests above. The unit tests and the two device
tests of rows in place are refused (Gap::OverlappingCopy). The surface test
records one command where three rows were due: blit barriers (1, 2, 0, 0)
against (1, 4, 0, 0).
2026-12-02 08:42:26 -08:00
Anees Iqbal 9c375eb504 Conformance ledger: the sample-positions cases answer on the runtime, so their seventeen refused rows go
The rt side of the suite now hands a pass's positions to the runtime's RenderPassDescriptor
instead of answering `setSamplePositions:count:` Unavailable, so the answer those rows expect,
`Err(Unavailable({call: "setSamplePositions:count:"}))`, can no longer occur on any venue. The
fourteen `*` rows (custom-left, custom-mixed, custom-right, the three fewer-, high, off-grid,
off-grid-low and the five rounded- cases) and the three venue rows of sample-positions-custom-2x
(Iris(R) Xe, RADV, NVIDIA) are dropped. A venue without VK_EXT_sample_locations, or whose
properties fall short of the answer, would answer at the same site with
`Refusal::SamplePositions` of `Unsupported` or `Gap::RenderPass`, which its replay would print as
unlisted; no venue run here does. docs/CONFORMANCE-COVERAGE.md is regenerated (7979 ledger rows to
7962); docs/METAL-COVERAGE.md is unchanged.

Verified: `conformance replay` of the 19 sample-positions cases and pass-sample-positions at
33865b2a57, before this edit, on each venue: every one of them listed exactly these rows as no
longer held ("now matches: 15", 14 on the Apple M3 Max, which has no custom-2x row) and nothing
unlisted; the custom and rounded cases read announced (justified by notices) on each.
- RX 7900 XTX, RADV NAVI31, Mesa 26.2.6: m3-max-78702
- Radeon 780M, RADV PHOENIX, Mesa 26.2.6: m3-max-78710
- RX 550, RADV POLARIS12, Mesa 26.2.6: m3-max-78713
- RTX 2080, NVIDIA 620.70.06: m3-max-78703
- RTX 3090, NVIDIA 620.70.06: m3-max-78711
- Iris Xe (RPL-P), Mesa 26.2.6: m3-max-78704
- Apple M3 Max, KosmicKrisp Mesa 26.3.1 (VK_EXT_sample_locations revision 1): m3-max-78722
lavapipe's replay with this ledger runs in the green job. Not run: the RTX 5080 Laptop GPU and the
Windows host's UHD Graphics 630.
2026-12-02 08:39:11 -08:00
Anees Iqbal 1c307b4608 Runtime: a pass rasterizes at the sample positions its descriptor sets, through VK_EXT_sample_locations
L168: a pass's custom sample positions were dropped while the guest could be told they are
supported, so a non-default set rendered at the standard positions with no refusal.

What changed:
- VK_EXT_sample_locations joins the floor's OPTIONAL_EXTENSIONS (enabled where listed; it has no
  feature). Device::programmable_sample_positions_supported (programmableSamplePositionsSupported)
  is true where the device lists it with locations at every sample count above 1 it renders, a
  1 x 1 grid, every sixteenth from 0 to 15/16 and variableSampleLocations; false elsewhere. No
  second form: a device that answers no refuses positions other than the defaults.
- RenderPassDescriptor::sample_positions is checked as the pass begins (crate::positions): each
  coordinate is taken to the nearest sixteenth, a tie up, at most 15/16, and each sample past the
  positions given at the pixel's corner, as the conformance suite's sample_positions rows measured
  an Apple M4. A set that comes to Vulkan's standard locations (Metal's defaults at 1, 2 and 4
  samples) rasterizes as an empty one on every device.
- Refusal::SamplePositions (Count, Coordinate, OneSample, Unsupported) where Metal's validation
  stops the descriptor or the device answers no. Gap::RenderPass of SamplePositions for other
  positions beside a depth attachment (Vulkan needs a sample-locations-compatible depth image whose
  layout transitions name the last locations) or at a count the device's locations lack.
  Gap::Draw of SamplePositions for a draw in such a pass whose fragment module uses
  InterpolateAtSample (VUID-01524), read from the translator's GraphicsState.
- A draw in such a pass takes a VkPipeline of its class made with sampleLocationsEnable and the
  locations as dynamic state (Raster::positions), one pipeline for every set; the encoder records
  vkCmdSetSampleLocationsEXT before the pass's first draw. Every coordinate handed to Vulkan is a
  sixteenth in [0, 15/16], which Vulkan's required 4 sub-pixel bits hold exactly, so no precision
  note.
- The translator's description of a device that enables the extension states it
  (floor::shader_extension), as for every extension creation enables that the translator names;
  the translator reads none of its properties. tests::translator_fields gives
  GraphicsState::interpolates_at_sample its verdict (refused at custom positions).
- The conformance rt side passes a case's positions to the runtime; the replay player sets them on
  the runtime's descriptor and drops its count of passes at other positions (docs/REPLAY-STREAM.md
  says so).
- README (floor table, the device's answers, the known gap rewritten), REFUSALS.md and basis.rs,
  api_signatures.tsv, METAL-COVERAGE.md and CONFORMANCE-COVERAGE.md regenerated.

Tests: the device test every_device_rasterizes_a_pass_at_its_sample_positions now gates on the
device's answer and holds the answer to the extension's properties; new device tests
every_device_refuses_the_positions_metal_refuses and
a_draw_that_interpolates_at_a_sample_is_refused_at_custom_positions; new device-free tests
(placed::) of the answer's gates (each count above 1 the device renders in
sampleLocationSampleCounts, a 1 x 1 grid, a range holding 15/16, 4 sub-pixel bits, variable
locations) and of the placement (every coordinate in [0, 1) on a sixteenth from 0 to 15/16,
refusals, the corner, the standard sets, the count and depth gaps); the replay device test
sample_positions_play_through_the_runtime_s_descriptor. Verification: the lane's jobs, named in
the ledger commit that follows.
2026-12-02 08:39:10 -08:00
Anees Iqbal c2860b1fa0 Runtime test: a pass rasterizes at the sample positions its descriptor sets
The red test of L168 (custom sample positions dropped while the guest is told they are
supported): RenderPassDescriptor gains sample_positions (`setSamplePositions:count:`), held and not
applied, and SamplePosition (`MTLSamplePosition`). The device test
every_device_rasterizes_a_pass_at_its_sample_positions draws a white triangle left of a vertical
edge through column 4 of an 8 x 8, 4-sample RGBA8Unorm target, resolves it, and checks the samples
of that column the positions cover, as the conformance suite's sample_positions rows measured
Metal on an Apple M4: the defaults 2 of 4 at the column's middle, four at x 0.25 all, at 0.75
none, one at 0.25 and three at 0.75 one, a tie at 0.53125 taken up to 9/16, 0.97 taken to 15/16,
and two positions in the pass of four putting samples 2 and 3 at the pixel's corner. It runs on
each device that lists VK_EXT_sample_locations with 4 samples and variable locations, and prints
the extension's properties.

Red here: the positions are dropped, so every custom case covers what the defaults cover.
2026-12-02 08:39:10 -08:00
Anees Iqbal d4b181c2a8 Translator: the graphics state says whether the fragment module interpolates at a sample
GraphicsState::interpolates_at_sample is true where the fragment stage's module statically uses
GLSL.std.450's InterpolateAtSample (interpolate_at_sample, or a sample-qualified varying read in
the loop over the covered samples), read from the module's instructions at link: an OpExtInst of
instruction 77 through the GLSL.std.450 import. Vulkan forbids that instruction in a pipeline
whose sampleLocationsEnable is true (VUID-VkGraphicsPipelineCreateInfo-sampleLocationsEnable-01524),
so a runtime that draws Metal's programmable sample positions through VK_EXT_sample_locations
reads it before it makes such a pipeline.

The field is encoded with the graphics state, so ARTIFACT_FORMAT_VERSION moves to 600, and it is a
new reflection fact of every render pipeline, so SEMANTICS_VERSION moves to 2317 (development's is
2316). No module's words change.

Test: engine_pull_model's the_graphics_state_states_whether_the_fragment_module_interpolates_at_a_sample
(pm_sample and pm_sample_id true, pm_center, pm_centroid and pm_offset false, at four samples on
every committed profile that compiles them). Verification: the lane's msi job (below the fix).
2026-12-02 08:39:10 -08:00
Anees Iqbal dcd502c921 Tests: the attachment-view tests' render targets take a texture index
A colour render target takes an index of set 1's texture arrays (Refusal::TextureIndex), so
both tests stopped at their target's make on lavapipe (job m3-max-78835) before reaching a
pass. Each now grants index 4096 and makes its target there, as the pass tests do.
2026-12-02 08:36:02 -08:00
Anees Iqbal 80ef3ea24e Runtime: a texture's attachment views bounded, the least recently used idle one evicted
A texture kept an image view for each level, first layer and layer count a pass rendered into,
for its whole life and with no bound (the field's doc said levels times slices, but the key
holds the layer count, so an N-slice array could keep N(N+1)/2 a level). Now a texture keeps at
most one view for each level and slice (each depth plane of a 3D texture's levels) and one more
a level (texture.rs attachment_bound): a cube's six faces one by one and its six layered fit.
A view made past the bound first evicts the least recently taken views that no command buffer
holds, to the reaper, until the bound has room (texture.rs evict_idle); where command buffers in
flight hold every one it evicts none, so the list holds the bound and what work not yet retired
holds past it.

How a view a command buffer in flight uses is known never to be evicted:
- Each view is an Arc (texture.rs AttachmentView). The texture's list holds one count; a take
  (texture.rs attachment_view) clones another only under the list's lock, into the pass's
  Attachment::held (texture.rs:406).
- The pass's begin keeps that Arc in its command buffer's kept list before the pass records
  (render_encoder.rs:935 for each target, :940 for each resolve; command.rs:1701
  hold_attachment_view into kept.rs:256 ByKind::attachment_views, via Kept::hold, kept.rs:191).
  A stencil target that targets() skips shares the depth target's view, which the pass checks
  (pass.rs DepthStencilViews).
- That list is cleared only at the command buffer's retirement (command.rs:2124, in retire) or
  at the drop of one never committed (command.rs:2201), before the texture list
  (kept.rs:264).
- Eviction takes only a view whose strong count is 1, the list's own (texture.rs:386), counted
  under the same lock, so no other hold can appear while it decides.
Between the take and the keep, the pass's own Attachment holds a count, so a view is never seen
idle in that window.

Docs: the field's, the attachment call's, Gauges::attachment_views' and the runtime README's
pass section now state the key and the bound. The kept-list size note counts eight lists.

Verification is in the jobs named where this lands; the device tests of the previous commit
are red without this change.
2026-12-02 08:36:02 -08:00
Anees Iqbal 15d5e6f0f2 Tests: a texture's attachment views within a bound, a view held in flight kept until it retires
A texture keeps an image view per level, first layer and layer count a pass renders into
(texture.rs attachment_view), with no bound: the field's doc says at most its levels times its
slices, but each distinct renderTargetArrayLength from each first slice adds one, so an N-slice
array can keep N(N+1)/2 a level for its whole life.

Two device tests, red here:
- a cube's six faces one by one, then all six layered: seven views, the cube's bound, and the
  same passes again make none (no thrash at the bound); the views go with the cube;
- a 4-slice 2D array rendered at all ten first slices and layer counts keeps five (its bound),
  the most recently rendered. The first view's command buffer is held in flight (its pass ran,
  then it waits at a shared event) while the other nine render on another queue, each retired
  before the next: the held view stays through every eviction, though least recently rendered,
  and once its command buffer retires a view rendered again takes its place.

A test-only accessor lists a texture's views.
2026-12-02 08:36:02 -08:00
Anees Iqbal 1ff3f6b522 Tests: a stage object asked past its decode and answer bounds keeps the most recent
StageEntries bounds its module decodes (KEPT_DECODES, 4) and its plain answers (32) with
least-recently-used eviction (pipeline/compile.rs evict), but no test drove either past its
bound: the existing fill test asks forty entries of one module, so it holds one decode and no
answer.

The new test assembles the multi-entry fixture under seven source file names (seven libraries
of different bytes, six stages each) and asks every stage's plain answer through one object:
seven decodes read, forty-two answers made, and four decodes and thirty-two answers held. The
last answer is found again with no decode read; the first library's first answer, gone past both
bounds, is made again and its decode read again, and both bounds still hold.

KEPT_DECODES becomes pub(crate) for the test, and a test-only accessor reads the answers held.
2026-12-02 08:36:02 -08:00
Anees Iqbal 1f2e18c97f rt: the pipeline cache blob is written where the cache's size at least doubled since the last write
What: the reaper's look writes the blob only where the size the driver gives is at least twice the
size at the last write (and more than it, so an empty cache's first pipelines write once); the
drop still writes where the size changed at all. The looks' writes then sum to at most twice the
last of them, and with the drop's the data of a device's writes over its life comes to at most
three times the data it leaves, where the cache stays within its bound. One threshold, no switch.

Why: L171. At the eighth, a run from an empty cache wrote the blob at nearly every look while it
was small, up to about nine times the blob it left (9 writes, 271.9 MB, for a 62.6 MB blob on the
Mac host, seedfoot m3-max-68006). The cost, now in the runtime README beside the bound: a crash
loses the pipelines made since the last write, at most those made since the size last doubled,
where at the eighth it lost at most an eighth; a later run compiles them again. A run seeded from
its own blob writes once, at the drop, where it made anything new.

Docs: the cache module doc, Caches::look, DeviceOptions::pipeline_cache_dir,
Metrics::cache_bytes_written and the runtime README's pipeline cache paragraph.

Verified: red at the parent on the Iris Xe, m3-max-78862: ten kernels wrote the blob 8 times,
254030 bytes in all, for a 60535-byte blob left (4.2 times). With the fix, m3-max-78867 on the Iris
Xe: 4 writes, 122950 bytes in all, for the same 60535-byte blob (2.0 times). The file part of a
write (create, write, rename, no fsync) on a btrfs disk, m3-max-78865: 62.6 MB in 6.1, 37.3 and
37.4 ms; 128 MiB in 74.1, 93.4 and 89.7 ms.

The series' tree (cd06eda084, the same tree as this branch's tip): clippy -D warnings plain,
under m2v_cpu_icd and under m2v_gpu, and rustdoc -D warnings, all exit 0; the runtime's suite on
lavapipe 892 passed, 3 skipped (m3-max-78869). lavapipe keeps no blob, so the device blob tests
pass there without a blob; their evidence is the Iris Xe's.
2026-12-02 08:33:34 -08:00
Anees Iqbal 506ec28c26 rt test: a device's blob writes over its life come to at most three times the blob it leaves (red)
The reaper's look writes the pipeline cache blob whenever the cache's size grew by more than an
eighth since the last write, so from an empty cache a run's writes come to up to about nine times
the blob it leaves (L171: 9 writes, 271.9 MB, for a 62.6 MB blob on the Mac host). The test makes
ten kernels one after another on a new cache directory, each followed by the reaper's look, sums
the bytes of every blob write (each look's that wrote, and the drop's where it changed the blob),
and asks for at most three times the blob left.

Expected red today: a write at nearly every look while the cache is small.
2026-12-02 08:33:34 -08:00
Anees Iqbal 7d9073331d rt: a device's seed removes a killed blob write's temporary file once a minute old
What: prune_blobs, run at a device's seed, also removes each blob's temporary file
(<blob>.<pid>.<n>.tmp, write_whole's) older than STALE_TEMP, 60 s. A younger one stays: another
process's write may still rename it, and where the prune removes one a write still holds, that
write fails, a miss that leaves the blob as it was. Anything not named as a blob or its temporary
file stays, as before.

Why: L171, the coordinator's question on the last write at a quiesce. A write begun before the
quiesce's deadline runs to its end, so a SIGKILL can land in it. The blob survives that: the write
goes to the temporary file, and only its rename replaces the blob. The temporary file, up to
128 MiB, was never removed, nor written again under its name (which carries the process id and
the write's number), so killed writes gathered them without bound.

Docs: prune_blobs, STALE_TEMP, the cache module doc and the runtime README's directory paragraph.

Verified: red at the parent on lavapipe, m3-max-78841: the ten-minute-old temporary file stayed
("...4321.7.tmp removed" failed). Green on the Iris Xe, m3-max-78867, and in the suite below.

The series' tree (cd06eda084, the same tree as this branch's tip): clippy -D warnings plain,
under m2v_cpu_icd and under m2v_gpu, and rustdoc -D warnings, all exit 0; the runtime's suite on
lavapipe 892 passed, 3 skipped (m3-max-78869). lavapipe keeps no blob, so the device blob tests
pass there without a blob; their evidence is the Iris Xe's.
2026-12-02 08:33:34 -08:00
Anees Iqbal 112494364b rt test: a killed blob write's temporary file is removed at the next seed once a minute old (red)
A blob write is a temporary file beside the blob, named for its process and write
(<blob>.<pid>.<n>.tmp), renamed over the blob. A process killed between the two, which the
reaper's last write at a quiesce makes likelier (a write begun before the deadline runs on, and
the consumer's SIGKILL can land in it), leaves that file, up to 128 MiB, and nothing removes it:
prune_blobs keeps every temporary file, so they gather, one a killed write.

The test leaves two such files ten minutes old, for the device's own blob and another's, a young
one and another file's temporary file, and runs the seed's prune: the old two are to go, the
other two to stay.

Expected red today: the old temporary files stay.
2026-12-02 08:33:34 -08:00
Anees Iqbal 4346532344 rt: the reaper writes the pipeline cache's blob as it ends, so a quiesce keeps what the device made
What: the reaper's end, at Device::quiesce or at the device's teardown, writes the blob where the
cache's size changed since the last write (Caches::last_write), before it ends. Where a creation
still runs, it tries for the creations lock every 10 ms (LAST_WRITE_STEP) until the quiesce's
deadline, the same deadline quiesce's other waits share (Reaper::stop now carries it), and past it
skips the write and counts it in Metrics::pipeline_cache_writes_skipped; at the teardown, with no
deadline, until the creation ends. It waits for no GPU work: the wait is for a creation, which
compiles on the CPU, and reading a cache's data waits for nothing the GPU does. The drop's write in
Caches::close then finds nothing changed. No public item is added.

Why: L171, the planner's addition. A consumer's process that ends with _exit after quiesce, as the
README's Quiesce and exit says it does, kept none of the pipelines made since the last look's
write: quiesce stopped the reaper, which ended with no blob write, and only the device's drop wrote
the blob.

Docs: Device::quiesce, Metrics::pipeline_cache_writes_skipped, the cache and reaper module docs,
the runtime README's Quiesce and exit and pipeline cache paragraphs.

Verified: red at the parent on the Iris Xe (ANV, i915), m3-max-78842, at the test's first form
(the skip test then read the count as soon as the quiesce returned): no blob after the quiesce, and
no skip counted. With the series, m3-max-78867 on the Iris Xe: a 6439-byte blob written at the
quiesce after the creation it waited for, nothing more at the drop nor at a seeded device's
quiesce with no growth; under a creation held past a 300 ms quiesce's deadline, one skip counted,
no blob, and the drop then wrote it. The reaper counts that skip as it ends alone, about one 10 ms
step past the deadline at most, after the quiesce may have returned (m3-max-78866, at the first
form, read the count too early); the test now waits for it.

The series' tree (cd06eda084, the same tree as this branch's tip): clippy -D warnings plain,
under m2v_cpu_icd and under m2v_gpu, and rustdoc -D warnings, all exit 0; the runtime's suite on
lavapipe 892 passed, 3 skipped (m3-max-78869). lavapipe keeps no blob, so the device blob tests
pass there without a blob; their evidence is the Iris Xe's.
2026-12-02 08:33:33 -08:00
Anees Iqbal 1149c04081 rt test: a quiesce writes a grown pipeline cache blob with no drop, after a creation it waits for (red)
The blob is written only at the reaper's looks and at the device's drop (Caches::close). A
consumer whose process ends with _exit after Device::quiesce, as the README's Quiesce and exit
says it does, keeps none of the pipelines made since the last look's write: quiesce stops the
reaper, which ends with no blob write.

The tests: a cache grown with its look skipped under a creation held open; a quiesce on another
thread, the creation ending once the reaper's stop is asked; then the blob holds the cache, the
drop writes nothing more, and a device seeded from it quiesces with no growth and writes nothing.
And with the creation held past a 300 ms quiesce's deadline, the last write is skipped and counted
in Metrics::pipeline_cache_writes_skipped, and the drop writes the grown cache.

Expected red today: no blob after the quiesce; no skip counted.
2026-12-02 08:29:50 -08:00
Anees Iqbal 0a1173ab55 rt: an image an upload or a command buffer held past its texture's release goes by the release's mark
What: the release of a texture, and of each view over its image, notes its mark (the wait for the
work committed by then, and those commits) in the image. Where an upload (the move home, its
zeroing, a copy) or a command buffer holds the image past that release, the image's Free::Texture,
made when that holder lets it go, waits for that mark instead of every commit made by then, and
goes into the queue of releases waiting at its mark's place, after the releases noted at as many
commits, so the queue's waits still rise along it and the texture's index, elements and views go
before its image. Pool::release_marked carries the mark; Pool::release is unchanged.

Why: L181. The zeroing upload holds a new texture's image until it retires; a texture released
before then had its image freed only after the command buffers committed by the upload's
retirement, which cannot reach it (in the harness's busy row, an image stayed two command buffers
past its views). Work committed after a release reaches nothing it released, as the runtime's
README states; the image now keeps that too. A holder that kept the image for its own work lets it
go once that work retired, and the work that reaches the image without a handle (through set 1)
was committed before the last texture over it let go, which the mark covers.

Verified: in the hand-over.
2026-12-02 08:24:00 -08:00
Anees Iqbal 856bb57b20 rt test: an image its upload held past its texture's release goes by the release's mark (red)
The upload that moves a new texture's image to its home layout, zeroing it, holds the image until
it retires. Where the program released the texture before then, the image's Free::Texture is noted
at the upload's retirement, against every commit made by then, so the image waits for command
buffers committed after the texture's release, which cannot reach it (L181: two command buffers
past its views in the harness's busy row).

The test holds the completion thread in a first command buffer's completed handler, makes a
Private texture whose zeroing upload goes with the next commit (the carrier, whose scheduled
handler marks the upload taken), releases the texture, and holds a later command buffer between
its close and its submission. Once the completion thread goes on, the image is to go while the
later one is held.

Expected red today: the image waits for the later submission, and the wait times out.
2026-12-02 08:24:00 -08:00
Anees Iqbal edad2e31fb rt: dma-buf rule A: a device-local first type takes a coherent device-local type of its own heap
What: the dma-buf rule reads the first type a dma-buf's fd query offers as the driver's word for
where such an import lives. Where that type is host-visible and host-coherent and the buffer's
requirements list it, the import takes it, as before. Where it is device-local, the import takes
the first type offered that the requirements list and that is device-local, host-visible and
host-coherent, in that first type's own heap. Anything else is Limit::ImportType. It is still one
choice from the query and one import, never a type after another (on NVIDIA's 620.70.06 one failed
import into a later type broke that type's later allocations). DmaBufTypes holds each type's
coherent and device-local bits and its heap, read once at the device's making. import_dma_bufs
takes its fds' types by the same rule. Docs: the module doc, import_dma_buf, Limit::ImportType,
and the runtime README (the import contract, the NVIDIA paragraph, the Iris Xe known gap with the
Xe2 claim as read, the pointer-import and texture-over-dma-buf paragraphs, and the AMDVLK row,
which now says nothing of a dma-buf pick: its recorded row gives no flags or heap of type 0).

Why: the planner's ruling (rule A). The Iris Xe's query offers its device-local type 0 first, so
every dma-buf was refused there, and its pages took the host-memory import and the counted copy.

Rows, each from the device test every_device_takes_its_dma_buf_type_by_the_rule at f3f332b209
(before, the rule's pick):
- Iris Xe RPL-P (ANV, Mesa 26.2.6, i915), m3-max-78652: offered 0x7f, listed 0x7, types
  [0:DL 1:DL|HV|HC 2:DL|HV|HC|HCACHED 3:DL 4:DL 5:DL|HV|HC 6:DL|HV|HC|HCACHED], one heap:
  refused, 1.
- RX 7900 XTX (RADV), m3-max-78660: offered 0x420, listed 0x7ad: 5, 5.
- Radeon 780M Phoenix (RADV), m3-max-78662: offered 0x10820, listed 0x1eaad: 5, 5; the same
  table as Hawk Point's, m3-max-78548: 5, 5. RX 550 (RADV), m3-max-78563: 5, 5.
- RTX 3090, m3-max-78667, and RTX 2080, m3-max-78547 (620.70.06): offered 0x11, listed 0x3b,
  type 0 with no flag, both offered types of heap 1: refused, refused.
- lavapipe, m3-max-78608: offered 0x1, listed 0x1: 0, 0.

Coherence both ways, every_device_imports_a_dma_buf_by_the_rule_and_each_side_reads_the_other_s_write:
65,536 bytes the guest's side wrote through a shared mapping of the memfd after the import, read
by a GPU copy, then a GPU fill read through that mapping, with no flush or invalidate call: 0
stale each way on the Iris Xe in type 1 under i915 (m3-max-78652), the XTX (m3-max-78660), the
Phoenix 780M (m3-max-78662), the RX 550 (m3-max-78563) and lavapipe (m3-max-78608).

Tests: the unit test a_dma_buf_takes_the_first_offered_type_or_a_coherent_type_of_its_device_memory
over the three table shapes (RADV's from m3-max-78548, the Iris Xe's from m3-max-78652, the RTX
2080's from m3-max-78547) and its refusals: a coherent first type not listed, nothing coherent
offered or listed, a coherent device-local type of another heap, no type offered.

Verified: the dma-buf modules (import, import_time, import_overs, dma_bufs, the Managed buffer
over a dma-buf) on the Iris Xe at this code, m3-max-78694: 24 passed, 860 skipped; a texture over
a dma-buf in place there with 0 copies and 1 acquire. At this tree (74c6614ae9): clippy -D warnings
plain, under m2v_cpu_icd and under m2v_gpu, and rustdoc -D warnings, all exit 0 (job m3-max-78815);
the runtime suite on lavapipe 884 passed, 3 skipped (job m3-max-78816).
2026-12-02 08:23:03 -08:00
Anees Iqbal 6750442c22 rt: a draw reads its target over a buffer in place through the feedback loop, or through its shadow
Row L291: a texture over a buffer laid in place (a linear image on the
buffer's memory, rule 3's form) took neither the feedback usage nor a shadow,
so a draw that read it as an attachment of its own pass, through a texture or
by a fetch, was Gap::Draw (AttachmentRead, FetchedAttachment) on every device.
Metal reads any render target this way.

Form (the ruled one: rule 2's attachment feedback loop form, with the counted
shadow copy where it is not available, a known gap):
- Plan::linear_loop. check_over sets it where the plan reads attachments, the
  device has the feedback loop, the format's linear tiling features sample it,
  and the linear image query makes the image with the sampled and feedback
  usages at the texture's extent (asked with the dma-buf handle for a dma-buf's
  import). Plan::linear_usage then adds both usages.
- If the linear image with those usages does not lie as the texture's bytes do
  (Unmade::Unfit), it is made again in place without them, and a draw reads it
  through its shadow where the device makes one (Plan::shadow_offered), as a
  device without the loop does. Only after that does a texture fall back to the
  copied form, as before.
- The pass moves the image from the general layout to the feedback layout and
  back, through the same moves a surface plane takes. Once it is back in
  general, the image and the buffer are again aliases that read their bytes
  alike. vkspec, 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,
  VK_IMAGE_LAYOUT_ZERO_INITIALIZED_EXT" and "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."

Docs: the runtime README says where the image leaves the general layout
(Memory blocks and buffers) and how a draw reads it (Render encoders). Its
known gaps of render encoders gain the shadow for an in-place target whose
linear image takes no feedback usage, and drop the refusal. error.rs's
AttachmentRead doc is updated, and REFUSALS.md is regenerated (unchanged).
known-gaps-rt.tsv drops the 15 rows the change fixes, each of which the replay
printed as "the gap looks fixed" once the draw read its target in place:
- pass-start-barrier-over-buffer-{read, sample, barrier-read, barrier-sample,
  draw-barrier-read} on llvmpipe and the Iris Xe (10 rows): their targets are
  in place on these two, and the reading draw was refused; it now reads its
  target in place. The 780M, the RX 7900 XTX and the RX 550 had no rows for
  these cases; their replays report "differed, justified" (the case's
  accepted difference).
- pass-start-barrier-new-texture-chain on llvmpipe, the Iris Xe, the 780M, the
  RX 7900 XTX and the RX 550 (5 rows): its new texture over a buffer is in
  place on all five (the refusal arose only there), and its reading draw was
  refused the same way; it now reads its target in place.
CONFORMANCE-COVERAGE.md is regenerated.

Verified:
- Green, on lavapipe, m3-max-78715 (at 60d2af3017, this change before the
  ledger and layouts edits): 12 of 12 passed (876 skipped). Both forms read
  in place through the feedback loop.
- Cards, at 921a33a894, running over_reads, fetch-over and the layouts
  in-place test, 3 of 3 passed on each:
  - Radeon 780M (RADV, Mesa 26.2.6), m3-max-78784: in place, through the loop.
  - Iris Xe (ANV, Mesa 26.2.6), m3-max-78819: in place, through the loop.
  - RTX 3090 (NVIDIA 620.70.06), m3-max-78785: its linear tiling lays these
    targets in the copied form, so the in-place path did not run there.
  - The shadow form for an in-place target (a linear query that refuses the
    feedback usage) ran on no lab device: unaudited.
- Conformance replay (the case selection, or every case for lavapipe) with
  the 15 rows dropped, EXIT=0 with no surprise either way:
  - llvmpipe, m3-max-78743 (at 580fecacb7, every case);
  - RX 7900 XTX, m3-max-78749; RX 550, m3-max-78750; Radeon 780M,
    m3-max-78751; Iris Xe, m3-max-78760 (each at f9f3178302).
  The trees differ from 921a33a894 only in other venues' rows and the
  layouts test.
- m3-max-78783 at 921a33a894: workspace clippy (all targets, all features,
  -D warnings) EXIT=0 in all three configurations (plain, --cfg m2v_cpu_icd,
  --cfg m2v_gpu); Rustdoc EXIT=0. The runtime suite on lavapipe: 885 tests
  run, 885 passed, 3 skipped.
- m3-max-78757 at f9f3178302: private Rustdoc of the runtime EXIT=0. The
  conformance crate's suite: 1047 of 1047 passed, 0 skipped.
2026-12-02 08:22:01 -08:00
Anees Iqbal 8117a49bf9 Tests: a draw reads and fetches its target over a buffer in place
Row L291: a draw that reads the colour target its own pass renders, through a
texture or by a fetch ([[color(n)]]), is refused (Gap::Draw AttachmentRead,
FetchedAttachment) where that target is a texture over a Shared buffer laid
in place, a linear image on the buffer's memory. Metal reads any render target
this way.

tests/over_reads.rs: an RGBA8Unorm render target of shader-read usage over a
Shared buffer, its rows a whole number of the device's linear alignment answer
and the rest of the buffer a sentinel. A pass reads it at the fragment's own
pixel and at the first texel, draws blue over it, then after a memory barrier
draws each pixel read plus green. Every texel in the buffer must be blue plus
green and every other byte the sentinel. Both reading draws go through the
feedback loop (2 loop reads) or through the shadow (1 copy), and the texture's
form must match the counts.

tests/fetch.rs: exf_fetch_count over 1 and 4 draws into an RGBA32Uint target
over a Shared buffer. The values must be exact in the buffer at its pitch, and
the draws counted as for a texture of its own image.

A device without the attachment reads refuses both. Each device prints whether
its target lies in place and which form read it.

Verified (red): on lavapipe, m3-max-78715 at this commit alone, both tests
fail with the draws refused (fetch.rs:558, over_reads.rs:125): 12 tests run,
10 passed, 2 failed.
2026-12-02 08:22:01 -08:00
Anees Iqbal 36b1daff16 rt: a command buffer's parts that go at its signals are seen complete
A command buffer's part before its last goes at an event's signal as a
submission of its own (submit.rs, WorkState::step), and its queue
counts it in flight (Fifo::in_flight), so it takes room (submit::room).
It carries no command buffer, upload or copy-in, so the completion
thread had nothing to retire for it: with nothing else in flight it
waited on the host, never read the progress semaphore, never raised
`completed` and never woke the submit thread. A command buffer whose
signals made IN_FLIGHT parts then held its last part for room for good,
unless a host wait for it or another queue's work came. Its completed
handler never ran and polling its status never saw it complete.

Done::submitted now gives such a submission a retiree of its own
(Item::Part), which retires nothing: the round that sees it complete
raises the completed value and wakes the submit thread, as the round
for any other submission does.
2026-12-02 08:11:12 -08:00
Anees Iqbal e44d4d31f8 rt tests: a command buffer whose signals fill its queue's room completes with no host wait
One command buffer signals an event IN_FLIGHT times, a fill after each,
with nothing else in flight, no later commit and no host wait. Its parts
before its last go at their signals, one submission each, and fill the
queue's room (submit::room); its last part is held for room.

Red at development's tip: the command buffer stays Scheduled. The parts
carry nothing that retires, so the completion thread waits on the host
and never reads the progress semaphore; the submit thread's settled
value stays below the first part and the held last part never goes.
2026-12-02 08:09:46 -08:00
Anees Iqbal 9f680a352e Tests: an older heap texture read before a newer one over its bytes is first written
A newer texture placed over an older one's bytes takes its move home from
UNDEFINED in the upload ahead of its first command buffer. Vulkan lets that
move write the image's memory: RADV initializes DCC, and ANV ambiguates the
CCS, each inside the image's own range. If that command buffer reads the older
texture before writing the newer one, the move can change bytes the read
still needs.

The test takes that shape: for four newer shapes, each smaller than the older
512 by 512 RGBA16Float texture, A is written in one command buffer, which
completes. B is then placed over A's bytes, and a second command buffer reads
A, then writes B. Each read of A must be A's write.

No lab driver showed the loss, so the test lands as coverage, and its comment
says so:
- Radeon 780M (RADV): m3-max-78630.
- Iris Xe (ANV, Mesa 26.2.6): m3-max-78670.
On each, every one of the four shapes read A's write.
2026-12-02 07:52:39 -08:00
Anees Iqbal 5d6ac696d0 Runtime and translator: a framebuffer fetch from the first slice of a 2D array that its pass renders alone
Row L223: a fragment function's fetch ([[color(n)]]) of a one-slice 2D array
attachment of a layered pass was refused (Gap::Draw FetchedAttachment), where
Metal reads the attachment at the fragment's pixel. The fetch reads the
texture's second element, which for a 2D array texture holds a 2D_ARRAY view.
Vulkan reads such a view only through an arrayed image (vkspec, image view
validation). The function read every element as a 2D image.

Form (ruled B, the per-state variant, as L97's compute variant):
- Translator: LoweringInputs::arrayed_fetches names the colours read through
  such an element. The fragment function declares that element's class arrayed
  and fetches it at (x, y, 0). The key takes the field only when it is set,
  so every existing function keeps its key and its bytes. No SEMANTICS bump.
- Runtime: set_render_pipeline_state binds, for a pass whose fetched attachment
  is a 2D array texture (a multisample one too), the state's content lowered
  with those colours (RenderPipelineState::for_pass, which also makes the
  content without colours past the pass's last attachment, as before). The
  content is kept in the device's bounded map of contents under the
  descriptor's key and its colour mask (KernelKey::arrays). The cache
  directory's render record is neither read nor kept for it. A failed variant
  leaves the state itself, whose fetching draws are then refused.
- attachment_reads accepts a 2D array texture whose first level and slice the
  pass renders, one layer, where the bound content fetches that colour
  arrayed.

Still refused (README, error.rs): an array whose pass renders more than one
layer, a slice past an array's first, and a view whose first slice is not the
rendered one.

REFUSALS.md and the api_signatures table are regenerated (the new
LoweringInputs field). API.md and the runtime README are updated.

Verified:
- Red, lavapipe, m3-max-78542: the test commit alone fails at fetch.rs:396
  (FetchedAttachment): 10 tests run, 9 passed, 1 failed.
- Green, lavapipe, m3-max-78570: 45 of 45 passed (832 skipped); the one-slice
  array is fetched exactly through the feedback loop.
- Radeon 780M (RADV), m3-max-78604; RTX 3090 (NVIDIA 620.70.06), m3-max-78609;
  Iris Xe (ANV, Mesa 26.2.6), m3-max-78649: the fetch and unattached-colour
  tests, 6 of 6 each, the array fetched exactly through the feedback loop.
- States-only play, m3-max-78602, lavapipe, this change against 118bd0dff7:
  identical on both replay streams (one recorded on the 3090: 10643 render and
  15299 compute states made; one on the 780M: 8972 and 225), 0 refused.
- m3-max-78600 (at the pre-rebase 90726b13b7): clippy, Rustdoc and private
  Rustdoc EXIT 0; runtime 874 of 874 passed (3 skipped), translator 3393 of
  3393 (37 skipped).
- Workspace clippy in all three configurations (plain, --cfg m2v_cpu_icd,
  --cfg m2v_gpu; all targets, all features, -D warnings): m3-max-78645 at
  this change alone on development, and m3-max-78677 at this tree on top of
  the row-1166 tests. Every EXIT=0.
2026-12-02 07:52:24 -08:00
Anees Iqbal d33ac94a3a Tests: a framebuffer fetch from the first slice of a 2D array that its pass renders alone
Row L223: a fragment function's fetch ([[color(n)]]) of a one-slice 2D array
attachment of a layered pass is refused (Gap::Draw FetchedAttachment), where
Metal reads the attachment at the fragment's pixel.

The test draws exf_fetch_count over 1 and 4 draws into a one-slice
RGBA32Uint 2D array in a pass of render_target_array_length 1, and into slice 0
of a two-slice array in a pass of one layer. Every texel must hold the exact
count, slice 1 must keep the bytes written to it, and the counts must match a
2D target's (through the feedback loop or the image's shadow). The arrayed
content must be lowered once and kept in the device's map of contents at a cap
of 1. Slice 1 of the array, and a pass over both slices, stay
FetchedAttachment. A device without attachment reads refuses every case.
2026-12-02 07:44:36 -08:00
Anees Iqbal b1addc170c Tests: the other-queue hand-over drops the last run's B without an assignment it never reads
The build of the hand-over tests warned that the value assigned to b is never
read (seen in the 780M job m3-max-78533's build); the last run's B now goes by
an explicit drop.

Verified (these three commits' tests, at 38d497f6cb, before this warning fix):
one run per device of 4 pairs x 3 hand-overs x 256 runs; every pair and
hand-over read 0 of 256 runs a value not written:
- lavapipe: m3-max-78501
- RTX 3090: m3-max-78519
- Radeon 780M (RADV): m3-max-78533
- Iris Xe (ANV, Mesa 26.2.6): m3-max-78659
Row 1166 did not reproduce on any lab device; the tests land as coverage.
2026-12-02 07:44:36 -08:00
Anees Iqbal 15aae65dc3 Tests: a 2 MiB aliased pair among the hand-overs run after run
A device may keep a compression state only for images past a size; the
hand-overs now take a 512 by 512 RGBA16Float texture and a 512 by 256 RGBA8Unorm
one over its bytes too, their buffers 4 MiB apart.
2026-12-02 07:44:35 -08:00
Anees Iqbal 8deeb4c38a Tests: aliased heap textures handed over run after run, as a Tracked heap's program hands them
The consumer's row 1166: heap textures over one memory give compute results
that vary run to run (2 of 64 on the Iris Xe). Its recording of the compute
benchmark shows the guest keeps Metal's aliasing contract: textures at one
offset of a Tracked heap, the older never used after the newer's first use,
handed over inside one serial compute encoder with no fence, in a later
command buffer of the same queue, or on another queue after the older's
release.

These tests take that shape: for three pairs (one shape twice, and two pairs of
different formats and sizes) A and B at offset 0 of one heap, 256 runs each of
A written, A read, B written over A's bytes and B read, every read compared
with its write. Hand-overs: one serial encoder; the next command buffer of the
same queue; another queue after A's release. Each prints how many runs read a
value not written.
2026-12-02 07:44:35 -08:00
Anees Iqbal 908e7eed55 rt tests: the cube-read and OpenCL-line tests split their read-backs with as_chunks
clippy -D warnings under --cfg m2v_cpu_icd and --cfg m2v_gpu denied `chunks_exact` with a constant
size in both device tests that 039de2090e and 283d8d8f50 added (use `as_chunks::<N>()`), seen in
m3-max-78608. Plain clippy compiles neither test. Each now takes the fixed-size chunks of its
read-back with as_chunks, as the AIR crate's bitcode readers do; the values read are the same.

Verified: the next job runs clippy over the runtime under both cfgs and the two tests on lavapipe.
2026-12-02 07:29:59 -08:00
Anees Iqbal b4cf114a13 rt: a Managed texture's texels are its own (TextureBacking::Texture), as Metal's buffer of one is nil
What: Texture::backing answered TextureBacking::Buffer for every texture that names bytes in a
buffer, a Managed texture's among them. A Managed texture's image is memory of its own; the bytes
the consumer names are a copy beside it, which upload_region and synchronize_resource move. It now
answers Texture for a Managed texture, and Buffer for a texture over a buffer in place or through
the image the runtime copies the buffer's bytes into, and for a texture buffer.

Why: TextureBacking's doc says Texture is memory of its own and Buffer a buffer's bytes
(Buffer::new_texture), and Metal answers a Managed texture's buffer with nil (L319). The doc of
Texture and Buffer now names the Managed and copied forms.

Verified: the test every_device_names_a_managed_texture_s_texels_its_own_in_a_storage_gap, red at
the previous commit on lavapipe (job m3-max-78576: "a Managed texture's texels left: Buffer right:
Texture"); at this change (job m3-max-78577, tested at 9b29e1405c, the same change on an earlier base; rebased
since onto 2f16658ac2 with no conflict): clippy -D warnings plain, under m2v_cpu_icd and under m2v_gpu, and
rustdoc -D warnings, all exit 0; the runtime's suite on lavapipe 875 passed, 3 skipped, the test
among them.
2026-12-02 07:27:51 -08:00
Anees Iqbal a242170b38 rt test: a Managed texture's storage gap names its texels the texture's own (red)
TextureBacking's doc says Texture covers memory of the texture's own, and Metal answers a Managed
texture's buffer with nil; Texture::backing reports a Managed texture, whose bytes the consumer
names in a buffer beside its image, as TextureBacking::Buffer (L319). The test binds a 2 by 2
RGBA8Unorm_sRGB Managed texture of shader-read and shader-write usage to the fixture's
access::read_write slot, which is Gap::StorageElement on every device, and asks the gap's backing
to be Texture.

Expected red today: backing Buffer.
2026-12-02 07:27:32 -08:00
Anees Iqbal 2f16658ac2 Translator, runtime: an OpenCL-mode kernel's 1D images read their 2D textures under the identity domains
L61. A kernel of OpenCL mode that takes a 1D image stated RuntimeFact::OpenClLineTexture for each
such slot. That fact marks the variant in which the table domains read a 1D texture bound there,
as a Radeon Pro 5300M answers. The identity domains source no such fact, so every such kernel's
pipeline was Unsupported{IdentityDomains} when made, whatever else it did.

Apple's OpenCL binds a 2D texture of height 1 for an image1d_t and a 2D array of that height for an
image1d_array_t, and never a 1D texture. The kernel already reads its 1D images as those 2D textures
at row 0 (canon::opencl_1d), as the M3 Max and the 5300M answer. A 1D texture bound there is
outside documented Metal, and the Macs disagree on it: the M3 Max reads texel 0 at every
coordinate, the 5300M the 1D texture's texels, a UHD Graphics 630 layer 0 of an array.

- Translator: under the identity domains a kernel states no OpenClLineTexture and has no such
  variant; it reads the 2D textures. The table domains keep the fact and the variant.
  identity_unsourced no longer names a fact the identity domains never state.
- Runtime: a state records whether its kernel is of OpenCL mode (RuntimeFact::OpenClMode). A
  dispatch of one with a 1D or 1D array texture bound at any of its texture slots is the new
  typed Gap::OpenClLineTexture { slot }, not a read: Apple's OpenCL binds none, and Metal defines
  no reading of one. It is checked where the swizzle and bicubic checks run, when the state or a
  binding changes. Its doc ends in "Basis: ours".
- Docs: the runtime README's known gap is rewritten for the dispatch's refusal. API.md and the
  fact's doc say what the identity domains do. docs/REFUSALS.md and error/basis.rs are regenerated
  (Gap 30 to 31), and api_signatures.tsv is blessed (one variant).
- The runtime test opencl_lines now also binds a 1D texture at each of the kernel's three slots in
  turn. Each dispatch answers Gap::OpenClLineTexture naming that slot and writes nothing.

A refusal becomes a module, so SEMANTICS_VERSION 2316. The translator's refusal sites are
unchanged.
2026-12-02 07:25:18 -08:00
Anees Iqbal 283d8d8f50 Tests: an OpenCL-mode kernel's 1D images read their 2D textures under the identity domains
Red first for L61. Every kernel of OpenCL mode that takes a 1D image (image1d_t or
image1d_array_t) is refused when its pipeline is made: Unsupported{IdentityDomains} naming
RuntimeFact::OpenClLineTexture, the fact by which the table domains read a 1D texture bound
there in a variant. Apple's OpenCL binds a 2D texture of height 1 for an image1d_t and a 2D array
of that height for an image1d_array_t, and the M3 Max and the Radeon Pro 5300M read those as the
1D image's row 0. These tests now ask for that answer.

- engine_opencl_mode: __entry_lr (read_imagef of an image1d_t at 2 and of an image1d_array_t at
  (1, 1)) compiles in OpenCL mode and passes L3 on every profile the identity domains derive. It
  states OpenClMode and no OpenClLineTexture, and its images are elements of the sampled float 2D
  and 2D-array classes. On the CPU interpreter, over a 4 x 1 2D texture and a 4 x 1 2D array of two
  layers, it reads texel 2 of the first and texel 1 of the second's layer 1.
- runtime opencl_lines (device cfg, under the validation layer): __entry_ol, with its hidden
  buffers bound as Apple's OpenCL binds them, reads a 4 x 1 2D texture at x and a 2D array at
  (x, 1). It writes their sum to a third 2D texture and the array's texel to o[x]; both are
  checked.
2026-12-02 07:25:18 -08:00
Anees Iqbal 5806b10c13 Translator: a sampled cube read by face samples its cube element under the identity domains
L215 (a). A texturecube or texturecube_array read by face was declared as the binder's 2D-array
view of its faces (RuntimeFact::ImageViewShape), since SPIR-V's OpImageFetch takes no cube. The
identity domains hold a sampled cube's element as its cube view and source no such fact, so
every such read was Unsupported{IdentityDomains}.

Under the identity domains a sampled cube (not a depth cube) that is read is now declared as its
cube element, and the read samples it. It goes through element 0 of its numeric type's sampler
array (binding 2, or 4 for an integer texture), which no ID reaches: the default sampler. It
samples at the direction of the read texel's centre on its face, with the read's level as the
explicit Lod.
- On face f the centre is (sc, tc) = ((2x + 1 - w) / w, (2y + 1 - h) / h), whose numerator is an
  exact integer.
- The direction is Vulkan's cube map face selection read backwards, the table Metal's faces share.
  With m the face's sign, it is (m, -tc, -m*sc), (sc, m, m*tc) or (m*sc, -tc, m).
- Its major axis is the face's, at magnitude 1, so (s, t) on that face is the texel's centre, half
  a texel inside its cell, and nearest reads that texel. Integer Lod l under nearest mip selects
  level l.
- A sample clamps every operand, so the read is checked in the shader on every device
  (ReadCheck::Shader). x and y are tested against the extent at the level, the face against 6, the
  cube index against the cube count, and the level against the level count, with Metal's
  out-of-bounds texel outside (its alpha from the ID's word).
- slot::samples_cube_element is the one rule the declaration and the read's check share.
  SlotPlan::face_sampler gives the sampler use the sampler family declares.
- A depth cube read by face, and a cube whose faces an emulated filter fetches, keep the 2D-array
  view and stay refused under the identity domains. The table domains are unchanged.

The runtime's default samplers now reach every level (maxLod VK_LOD_CLAMP_NONE, was 0), so an
explicit level past 0 reads that level. A sampler element nobody owns holds the default, as do
nil, freed and out-of-range sampler IDs. Their samples could reach only level 0 before; they now
reach the level they ask for.
Existing tests that cover the default samplers:
- tests::arrays' set_1_is_filled_at_creation (both live with set 1);
- tests::device's gauge check (set 1's two default samplers and nothing else);
- tests::argument_sampling's argument_sampler_edges (an argument buffer's sampler against the
  default's answer).
RESOURCE-ID.md states the default sampler and the cube read's contract for a consumer that lays
the arrays out itself. API.md and the runtime README say so too; the README's known gap now names
only the depth cube read.

A refusal becomes a module, so SEMANTICS_VERSION 2315. The golden table's cube_faces cells
change from the refusal, a bless at the next pin. No refusal site was added or removed:
docs/REFUSALS.md regenerates unchanged.
2026-12-02 07:25:18 -08:00
Anees Iqbal 039de2090e Tests: a sampled cube read by face reads its texels under the identity domains
Red first for L215 (a). Under the identity domains a texturecube or texturecube_array read by
face (access::read or access::sample) is refused, Unsupported{IdentityDomains} naming
ImageViewShape: the read takes the binder's 2D-array view, which the identity arrays do not hold.
These tests now ask for Metal's answer, the texel read(coord, face[, cube], lod) names.

- engine_texture: texture_ops' cube_faces compiles and passes L3 on every profile the identity
  domains derive, with no ImageViewShape, its textures elements of the sampled float cube and
  cube-array classes, the plain sampler array declared, and an explicit-level sample where it
  fetches nothing. The CPU interpreter models no sampler, so values are a device's.
- runtime cube_reads (device cfg, under the validation layer): an RGBA32Float and an RGBA32Uint
  cube (4 x 4, three levels) and an R32Sint cube array (two cubes, two levels) read at every texel
  of every face, level and cube, each the uploaded texel bit for bit; an RGBA8Unorm_sRGB cube read
  the same way equals a 2D array's fetches of the same bytes (the device's decode); and reads past
  the level's extent on each axis, at face 6 and past, at the level count and past, at the cube
  count and past, and at u32::MAX on each operand are Metal's out-of-bounds texel (zero, alpha 1
  for R32Sint).
- validation engine_textures: the cube_faces case through the runtime, which asserted the
  refusal, now asserts its values: face 3's texel, cube 1's face 4 (layer 10), then width 1, 2
  cubes and 1 level.
2026-12-02 07:25:17 -08:00
Anees Iqbal 4295a197e1 rt: map_made answers the allocation and whether it was mapped
clippy's result_large_err refused Result<Allocation, Allocation> (job m3-max-78507, all three cfgs).
map_made now returns (Allocation, bool); a refusal is freed by its caller as before, outside the
timed map in Pool::take.
2026-12-02 07:20:50 -08:00
Anees Iqbal 531f3944d2 rt test: the block-maker panic tests' taker drops its core before it answers
The taker thread held its Arc of the core until its closure returned, after its answer, so the
device's teardown could wait for it past the test's gauge read: job m3-max-78507 read 8 blocks and
2 device samplers after the map case's teardown, the device not yet torn down. The taker now drops
the core first.
2026-12-02 07:20:50 -08:00
Anees Iqbal 71be3eedac rt: the block-maker thread ends as a stop however it ends, a panic of a consumer's hook too
What: run() holds an Ends guard whose drop, on a stop or a panic alike, stops the pool, clears
every internal asked or being made, wakes the waiters, and hands the ring's next block back to the
takes (Ring::unasked). The stop branch, which did the same for a stop alone, now only returns.
The consumer's two hooks on that thread:
- map: Pool::map_made runs BlockMappings::map under catch_unwind. Where it panics, the allocation
  just made is freed and the panic goes on (resume_unwind), on the block-maker thread (ahead) and
  on a take's thread (Pool::take) alike.
- unmap: free_idle runs BlockMappings::unmap under catch_unwind. Where it panics, the consumer's
  mappings may stand, so the allocation is not freed there: it goes back to the pool, which is
  stopped under the same lock so no take lands in it, and teardown frees it with no second unmap.
  Then the panic goes on.

Why: a panic of either hook ended the thread with the ring's ask outstanding, so a ring take that
found no free chunk waited for good, as did a call in Pool::await_made; and the allocation the
hook panicked over was never freed. Now a panic ends the thread as a quiesce does: a take of the
pool's memory is Error::Quiesced (the typed error rt already has; no new public type), what was
asked of the thread is made on the thread that needs it, as after a stop, and nothing waits.

Docs: Error::Quiesced, BlockMappings::map and BlockMappings::unmap say what a panic of the hook
does; the runtime README's mappings section the same.

Verified: the two tests every_device_whose_block_maker_thread_ends_by_{a_map,an_unmap}_hook_s_panic_leaves_nothing_waiting
(red at the previous commit) are the check; jobs in the hand-over.
2026-12-02 07:20:50 -08:00
Anees Iqbal e9b233b7c4 rt test: a block-maker thread ended by a panic of the consumer's map or unmap hook leaves nothing waiting (red)
The block-maker thread runs two of the consumer's hooks: BlockMappings::map for an allocation made
ahead of need, and BlockMappings::unmap before the free of an allocation idle past the idle age.
Where either panics, the thread ends with what was asked of it still marked asked or being made:
the ring's next block stays the thread's to make, so a ring take that finds no free chunk waits
for good, as does a call in Pool::await_made.

Two tests, one per hook, share one body. The hook is armed to hold the thread inside its run (the
map of the allocation a 12 MiB Shared take sets off; the unmap of a whole Shared unit given back
once the next is made). Takes of the parameter ring run past every free chunk on a thread of their
own until the ring has asked the thread for its next block; then the hook panics. The test waits
for the takes at most the tests' patience (60 s) and fails, not hangs, where they still wait. Then:
the pool is stopped, a take is Error::Quiesced, an internal asked now is the asking call's, the
allocation the hook panicked over is freed (gauges zero after teardown), and every other mapped
allocation is unmapped once, the one whose unmap panicked never a second time.

Expected red today: the ring's takes still wait after 60 s, in both tests.
2026-12-02 07:20:50 -08:00
Anees Iqbal bd1f8c479d CI: the private intra-doc link count runs with colour off, so a broken link counts
The step counts the lines of `cargo doc --document-private-items` that begin `error: ` and holds
each crate at its ceiling. The workflow sets CARGO_TERM_COLOR=always, under which Cargo prints
each diagnostic with a colour code ahead of `error`, so the count was 0 whatever rustdoc
reported: the step could not fail.

Verified: m3-max-78564 (msi) plants one broken private intra-doc link in the harness crate and
runs the step's count over it: CARGO_TERM_COLOR=always counts 0 (the unresolved-link diagnostic
is in the log), never counts 1. The step now sets never.
2026-12-02 07:11:57 -08:00
Anees Iqbal 118bd0dff7 Translator: a query-only argument buffer texture reads its element under the identity domains
L215 (b). An argument buffer's texture that a function only queries has no texel class: nothing
structural types it (the member's texture type is only its MSL type name, which decides nothing),
so its group is declared Float and states RuntimeFact::HeapNumericType for the binder of the
table domains. The identity domains source no such fact, so every function with such a member
was refused, whatever its shape.

Under the identity domains the group's element is the texture its resource ID names, as a
texture slot's is, and a slot only queried already takes the Float class there with no fact.
A query reads the element's extent and its level, layer and sample counts; Vulkan's image query
instructions access no texel (13.4.4), so the texture's numeric type changes nothing a query
returns. So under the identity domains a query-only group states no HeapNumericType; the table
domains keep it.

The runtime README's known gap for it goes; the golden table's tail_heap_cube_queries cells
change from the refusal, a bless at the next pin. SEMANTICS_VERSION 2314. No refusal site was
added or removed.

Verified (job m3-max-78379, msi, at this tree before its rebase onto 0b71bdf72a): the interpreter
test passes on every identity profile (2 passed with its neighbour), and on lavapipe (llvmpipe,
LLVM 23.1.1) the runtime test passes under the validation layer, both dispatches at their
addresses (M2V-FORM 0 bound, 2 at their addresses).
2026-12-02 07:00:02 -08:00
Anees Iqbal e02bfb2699 Tests: a query-only argument buffer texture answers its element's size under the identity domains
Red first for L215 (b). The pin that held the refusal of an argument buffer's texture a kernel
only queries (Unsupported{IdentityDomains}, naming HeapNumericType) now asks for Metal's answer:
the size of the texture the member's resource ID names, whatever its numeric type.

- engine_heap_groups: abq_2d (a 2D texture's width) and abq_cube_array (a cube array's cube
  count) on every profile the identity domains derive: no HeapNumericType fact, one Float sampled
  class, L3, and on the CPU interpreter, with an R32Uint texture's resource ID naming element 3,
  the width 12 and the 2 cubes from each thread, the word past them kept.
- runtime query_only_textures (device cfg, under the validation layer): the same kernels over an
  R32Uint 2D texture of 12 x 5 and three levels and an RGBA8Uint cube array of two cubes, each
  reached through an argument buffer's resource ID.

Verified red (job m3-max-78379, msi, at this tree before its rebase onto 0b71bdf72a): the
interpreter test fails at compile_kept with the refusal (1 passed, 1 failed with its neighbour),
and on lavapipe the runtime test fails at new_compute_pipeline_state (0 passed, 1 failed).
2026-12-02 07:00:02 -08:00
Anees Iqbal 357d728590 Validation tests: bin_exe! reads CARGO_BIN_EXE_<name> with env! again
56cf3dbd1b and 5d62e2079a moved the macro's compile-time fallback to option_env!, on the reading
that Cargo does not set `CARGO_BIN_EXE_<name>` for `cargo clippy --all-targets`. That reading was
wrong: Cargo sets it, and the remote CI's Linux leg lost it in scripts/rustc-wrapper, whose
/bin/sh there (dash) drops variables with a hyphen in the name. c231c41ddd runs the wrapper under
bash. The macro is again the text it had before 56cf3dbd1b, where a missing variable is a build
error rather than a test-time panic.

Verified: the next msi job's green arm runs clippy over the validation crate at this tree as CI
runs it (CI=1, a fresh target) through c231c41ddd's wrapper.
2026-12-02 06:59:54 -08:00
Anees Iqbal c231c41ddd scripts: rustc-wrapper runs under bash, so the compiler keeps Cargo's hyphenated variables
The remote CI's Linux leg has failed "Clippy (warnings denied)" on master since at least
11-15 (run 43704398652 and every push after it, 46893773054 at d8735b75f0 included): each bin_exe!
use in the validation crate's integration tests stopped with "environment variable
`CARGO_BIN_EXE_corpus-triage` not defined at compile time" (and corpus-pipeline, corpus-vulkan,
corpus-index, command-replay). The macOS leg's clippy, and every clippy in the lab, passed the
same tree on the same nightly.

The cause is the wrapper's shell. Cargo sets `CARGO_BIN_EXE_<name>` for the test's compile and
runs `scripts/rustc-wrapper` as `#!/bin/sh`. On ubuntu-26.04 /bin/sh is dash, which drops every
variable whose name is not a shell identifier from the environment it passes to exec, so rustc
never saw the hyphenated names. On Arch (the lab) and macOS /bin/sh is bash, which passes them
through. Checked by hand on macOS: `env 'CARGO_BIN_EXE_x-y=1' /bin/dash -c 'exec env'` prints
no such line; /bin/bash and /bin/sh print it.

The wrapper now names bash, present at /bin/bash on Ubuntu, Arch and macOS.

Verified: the next msi job runs clippy over the validation crate as CI runs it (CI=1, a fresh
target, env! in bin_exe!), once through the parent's wrapper under Debian's dash (red, "not
defined at compile time") and once through this one (green).
2026-12-02 06:59:34 -08:00