Commit Graph
2216 Commits
Author SHA1 Message Date
Anees Iqbal 296e2d7fa8 Bump RUNTIME_VERSION to 1827: a copy that drops the GPU's writes takes its guest RAM's dirty log
The runtime-sources pin re-derived for amdperf-14 (RO-1, 61a9a4f460). A
commit's copy-in compares only the pages the dirty log reports written; a
completion's merge back skips the copy where a draw only reads through loaded
addresses. Evidence: m3-max-5323 (lavapipe on the rebased tree: the control
fails both new tests; copied_device + host_ram 79/79 x2; lanes host_memory,
dma_buf_imports, no_copy_heaps 43/43; plain clippy), 5240 (RADV 780M and XTX on
the pre-rebase tree: the same counters). The RADV rerun on the rebased tree
follows.
2026-11-07 14:28:20 -08:00
Anees Iqbal 442dcd08c9 Copied host memory: a copy that drops the GPU's writes takes its guest RAM's log, and a draw that only reads through loaded addresses leaves unnamed copies uncompared
A copy of memory of Metal's private option bit 24 (on a system that maps no read-only view of
the pages) skipped the routing of its guest RAM runs, so it kept no log: every commit compared
every byte of it, and every completion of a command buffer with a root table compared every
copy. In consumer boots that is about 29.5 MiB per commit and per completion over 37-44 objects.

- Commit (copy in): a no-copy buffer, heap or rebind whose GPU writes are dropped has its runs
  asked as a writable one's are (routes_runs), so its copy takes the RAM's log and copies in only
  the pages the log reports written. It is still never bound in the RAM's chunk: the in-chunk
  binding is filtered on drops_writes. macOS keeps its read-only view and asks no runs.
- Completion (merge back): State::writes_unnamed narrows reaches_unnamed to commands whose
  functions may write memory. A draw's root table writes only where the vertex or fragment
  function may store or update memory (GraphicsState::vertex_writes_memory,
  fragment_writes_memory) or the pipeline has another stage; kernels, tile functions, replay
  tables and records resolved by host steps stay as they were (every copy compared). The compare
  itself stays: in a dropping copy it is what restores the dropped bytes, so later command
  buffers read the pages' bytes.

Tests: host_ram_copy_device a_private_bit_copy_over_the_pages_copies_in_only_the_pages_the_log_reports
(one page written: length - page bytes not compared, the GPU's fill dropped) and copied_device
a_merge_back_skips_a_copy_when_a_draw_only_reads_through_loaded_addresses (root table noted,
merge back compared 0). Docs: copied.rs, FAST-PATHS known gap, HOWTO section on copies.

(cherry picked from commit 61a9a4f4603a4c080ba5a4f2e204668ae621cf41)
2026-11-07 14:28:18 -08:00
Anees Iqbal 83741d1029 Bump RUNTIME_VERSION to 1826: mipmapped, 3D, multisample, sliced, wide-row and BC1/BC4 textures over a surface's plane
The runtime-sources pin re-derived for surface pieces 3, 4 and 6 (463cd6b9ec,
400ca57f55, 7e27f59946; 20be8f7a5f, 344cd110f8; ff454bd8b2) and host-ram-cfg
(81ecdd4154: development's clippy under --cfg m2v_gpu on macOS failed on a
Linux-only test setter). Piece 3's merge of a texture with a tail goes through a
copy, never in place in its buffer (the in-place merge wrote slice 1's writes
into the plane). Evidence: m3-max-5255 (lavapipe: runtime lane 189/189, the
merge's negative control fails), 5288 (M3 MoltenVK lane 203/203, surface_shapes
0 wrong), 5310 (rebuilt at 283f1e34f4: plain clippy, unit 115/115, conformance
64/64), 5319 (M3 clippy plain and m2v_gpu 0), 5147 and 5159 (pieces 4 and 6
negative controls fail).
2026-11-07 14:23:57 -08:00
Anees Iqbal 5ad63ab255 Build the guest RAM tests' import-heaps setter on Linux alone, where its tests are
Device::count_host_ram_imports_against (78a98addc1) is called only by
tests::host_ram_dma_buf, which compiles on Linux alone. On macOS under
--cfg m2v_gpu the method was dead code, and clippy -D warnings failed
the runtime's lib test there (m3-max-5310: "method
count_host_ram_imports_against is never used"). It now carries the same
cfg(target_os = "linux") as host_ram_chunks beside it.

Verified: cargo fmt. The M3 clippy under m2v_gpu follows in the tip's
evidence.

(cherry picked from commit 81ecdd415421e30c910ac155fb9c42fc5206316d)
2026-11-07 14:23:57 -08:00
Anees Iqbal c6e1d5a9fd Make a BC1 or BC4 texture over a surface's plane at an offset or pitch off 16
The runtime refused a BC texture over a plane of a surface with planes
whose offset or bytesPerRow is off 16 bytes, as
NotImplemented(SurfacePlaneShape). The M3 Max answers nil for every BC
texture over a surface, so the x86 Macs are the reference (job
m3-max-4779 on macbook-pro-2019: an AMD Radeon Pro 5300M and an Intel
UHD 630 under macOS 26.7.1, surface_texture_envelope.m's bgraat8.bc1 at
offset 8 and bgrarow264.bc1 at 264 bytes a row). Both GPUs' blits and
samples take block row j at the plane's offset + j x bytesPerRow, with
no rounding to 16.

linear_plan::blocks_off_sixteen makes a BC texture of 8-byte blocks
(BC1, BC4) at an offset and bytesPerRow that 8 divides, at least 16
bytes a row. Every BC plane now lies at the CPU's layout on the GPU too
(plan_iosurface_plane's blocks flag): at multiples of 16 the two were
already equal. The CPU calls take the plane's own offset, as the
5300M's getBytes does, while the UHD 630's getBytes and replaceRegion
take a plane at offset 8 from byte 0. That difference is recorded in
docs/API.md's accepted differences. BC4 was not measured off 16; it
takes BC1's 8-byte block rows. BC textures of 16-byte blocks (BC2,
BC3, BC5, BC6H, BC7) off 16, and 8-byte ones off 8 or under 16 bytes a
row, stay refused. SurfacePlaneShape's doc names them, and so does its
reach mark in REFUSALS.md.

Tests: tests::linear_plan makes bgraat8.bc1, bgrarow264.bc1, BC4 at
(8, 264) and BC1 at offset 40, with the GPU layout equal to the CPU's.
It refuses BC3, BC5 and BC7 off 16, BC1 at offset 4 and at 260 bytes a
row, and BC4 at 8 bytes a row. tests::surface_shapes (a device test)
gains bgraat8.bc1, bgrarow264.bc1 and bgraat8.bc4 on every path.

docs: linear_plan.rs's Block-compressed surfaces, the plane call,
SurfacePlaneShape, BufferRefusal::PlaneShape, the FAST-PATHS known gaps
and the API.md accepted differences. Regenerating REFUSALS.md changes
only the reach mark. CONFORMANCE-COVERAGE.md and the API signatures are
unchanged.

(cherry picked from commit ff454bd8b269fff6abf590da85cd050862d539a9)
2026-11-07 14:23:18 -08:00
Anees Iqbal 0c621da77a Make a texture over a surface's plane whose rows are wider than its pitch
Metal makes a 2D texture over a plane of a surface with planes whose
rows are wider than the plane's bytesPerRow, and a 1D texture wider than
one row; the runtime refused both as NotImplemented(SurfacePlaneShape).
On the M3 Max every path reads row y whole from the plane's offset plus
y times bytesPerRow (surface_texture_envelope.m's bgra1x2.65x64,
bgra1x2.128x32, 420v.p0.65x64, 420v.p1.33x32 and bgra1x2.1d.128), so
the texels lie in one place and the 2D texture's rows overlap, on the
GPU and the CPU alike.

linear_plan::wide_rows makes such a texture of a colour format over a
plane whose offset and bytesPerRow are multiples of 16, its GPU layout
its CPU one. A 1D texture is one row from the offset. A 2D texture's
overlapping rows are held as the rows of a pitch off 16 are: a shadow
whose copies reproduce the sharing, refused where a render pass stores
into it, blits into it refused (NotImplemented(OverlappingSurfaceRows)),
announced as CollidingSurfaceRowWrites. What is new is that the shared
head can be wider than the pitch (a byte shared by three rows or more),
so plane_copy_regions copies it in in pieces no wider than the pitch,
and copies row 0's head back as one row. plane_rows_share_bytes asks the
GPU layout alone, as a wide plane's CPU rows share bytes too. Other
formats, and planes off 16, stay refused: nothing measured them.

The write orders come from overlapping_plane_row_writes.m, extended in
the previous commit and run on the M3 Max (macOS 27.0.1, job
m3-max-5088, three processes a case), and recorded in its header. The
GPU gives the shared bytes the answers it gives the rows of the same GPU
pitch and row at a pitch off 16: no one order for blits, and for a
kernel the earlier row's within the first threadgroup's rows. Where
three rows share a byte, the kernel at 8 x 4 keeps the earliest row's.
replaceRegion writes the rows in order, so the latest row's bytes stand,
in every shape and process. So the runtime's copy back, which keeps the
earliest row's bytes, is one of Metal's kernel answers. Its CPU writes
go row by row, as Metal's do. The notice's cost now says "the earliest
row's" in place of "the earlier row's", and docs/API.md's catalogue says
the same.

Tests:
- tests::linear_plan: the probe's wide shapes are made, with their
  layouts. Wide rows off 16, of a depth format or of a 1D texture off
  16 are refused. A render target over wide rows is OverlappingRows.
- A new sweep: 2232 wide planes, 1302 of them sharing more than a
  pitch, over five texel sizes, pitches of 16 to 64 and 2 to 4 rows.
  It holds plane_copy_regions to what Vulkan allows and to the
  earliest-row rule (hold_the_copies, which now allows the head's
  pieces and a bufferRowLength of 0).
- tests::buffer_texture: its sweep now holds that only a wide plane's
  CPU rows share bytes, its CPU layout its GPU one.
- tests::surface_shapes (a device test): the probe's five wide shapes
  read as Metal reads them on every path, with a blit into the 2D ones
  refused.

docs: linear_plan.rs's Beyond the plane's rows and Rows that overlap;
SurfacePlaneShape, the plane call and BufferRefusal::PlaneShape; the
CollidingSurfaceRowWrites declaration and its API.md entry; and the
FAST-PATHS known gaps. REFUSALS.md, CONFORMANCE-COVERAGE.md and the API
signatures are unchanged when regenerated.

Checks: job ids are in the tip's report.
(cherry picked from commit 344cd110f8f612907f26dd9a30b0871e299ddb27)
2026-11-07 14:23:18 -08:00
Anees Iqbal 40af16c35f Probe which row's bytes stand where a plane's rows wider than its pitch overlap
Metal makes a 2D texture over an IOSurface plane whose rows are wider
than the plane's bytesPerRow, and every path of the M3 Max's reads row y
at the plane's offset plus y times bytesPerRow, so its rows overlap on
the GPU and the CPU alike (surface_texture_envelope.m's bgra1x2.65x64
and others). Which row's bytes its writes leave where rows meet was
measured only for the other overlap, a pitch off 16 rounded down.

The probe gains nine configurations of a texture wider than its plane,
over a plane whose pitch is a multiple of 16 (rows sharing 1 to 24
bytes, one byte shared by three rows, and every byte past the first
pitch shared by two), and a cpu kind: replaceRegion of the whole
texture, the CPU's write. The answers are recorded in the probe's
header by the commit that uses them.

(cherry picked from commit 20be8f7a5f3339a102c27162b4bec86790e05f8a)
2026-11-07 14:23:17 -08:00
Anees Iqbal 51691e432d Merge a texture with a tail through a copy, never in place in its buffer
A shadow's merge went in place wherever the texture's first byte is a
whole word of its buffer and its last byte's word lies in the buffer. A
tail used to imply the second test failed, since a texture had a tail
only where its texels ran past the buffer's length. A 2D array of more
than one slice over an IOSurface plane (piece 3) keeps its slices past
the first in its tail although the buffer's bytes run on past them.
Those bytes are the plane's own. The merge in place wrote a kernel's
writes to slice 1 into them, and get_bytes, blits and kernels read
slice 1 from the tail, which still held zero.

The merge now goes in place only where the texture has no tail. A
texture with a tail merges through a copy, whose current part takes
the tail's bytes from the tail (Merged::current_copies), as one past
its buffer's length already did. Nothing else changes: every other
texture that merged in place has no tail.

Verified: tests::buffer_tail_device::an_array_over_a_plane_keeps_its_
second_slice_in_its_tail failed without this on the M3 Max under
MoltenVK ("slice 1 get_bytes 0" read zero; jobs m3-max-5145, 5177, and
5201 at piece 3 alone on development, the array a shadow). The run
with it follows in the tip's evidence.

(cherry picked from commit 7e27f599460afe45fc978920dce3e254f8e36257)
2026-11-07 14:23:17 -08:00
Anees Iqbal 1071858d47 Name a new texture's start Initial, apart from first_move's Fresh trait
The previous commit added an enum Fresh to texture.rs. That module
already imports first_move::Fresh, a trait, so the crate failed to
compile (E0255) (job m3-max-5113 on the M3 Max). It also left
texture/shared.rs calling new_texture_image with the hazard mode alone.
The enum is now Initial (AsMetal, Zero). The shared-texture path passes
Initial::AsMetal, which is how it started before.

(cherry picked from commit 400ca57f55e30a1ca82423bff93b3a0a8755b886)
2026-11-07 14:23:17 -08:00
Anees Iqbal 6b6a7f522b Make mipmapped, 3D, multisample and sliced textures over a surface's plane
What. Buffer::new_texture_with_iosurface_plane over a plane of a surface
with planes makes three shapes it answered
NotImplemented(SurfacePlaneShape) for:
- a 2D texture of more than one level, a 3D texture and a 2D multisample
  one, of a colour format (linear_plan::apart_from_plane: is_linear and
  tail_held): a texture of the device's own memory
  (Device::surface_texture_apart), zero when made in every storage mode,
  a Private one's too (texture.rs's new Fresh::Zero start, which skips
  Metal's fresh pattern and the uncounted held start), announced by the
  new Degradation::SurfaceTexelsApart ("surface-texels-apart",
  precision). A Memoryless one stays MemorylessSurfacePlane.
- a 2D array of more than one slice, of a colour format, over a plane
  whose offset and bytesPerRow are multiples of 16
  (linear_plan::slices_apart): its first slice over the plane as a 2D
  texture's rows, its others in a tail of the texture's own. The planner
  lays the slices one image apart and gives Placed::kept, the second
  slice's first byte (or the buffer's length where that comes first);
  Texels::kept cuts the tail there instead of at the buffer's length
  (with_tail, past, staging), so the shadow's copies, blits and CPU
  calls take slice 0 from the plane and the rest from the tail.
  Announced by SurfaceTexelsTail, whose doc and cost now name both
  cases.

Why. Metal makes these, and on the M3 Max under macOS 27.0.1
(probes/surface_texture_envelope.m, job m3-max-4776) it lays them out in
no one place: bgra1x2.mips2/mips7, 420v.p0.mips2, bgra1x2.3d.d2,
420v.p0.3d.d2 and bgra1x2.2dms4.private read level 0 or slice 0 by blit
and kernel from other bytes than its blits, replaceRegion and getBytes
put there; bgra1x2.2darray.a2 and .a2.64x64 keep slice 0 over the plane
on every path while slice 1 is read at the plane's offset by blits and
getBytes, one image on by kernels, and written at the plane's offset.
By the rule of 9ee7323e76 what lies in one place stays in place and the
rest goes in memory of the texture's own, announced (the orchestrator's
option A). The x86 Macs under macOS 26.7.1 keep level 0 and slice 0 of
the first shapes over the plane; API.md's accepted differences records
that the runtime does not.

Docs: API.md's catalogue (the new kind, SurfaceTexelsTail rewritten) and
two accepted differences (sliced arrays; mipmapped/3D/multisample);
FAST-PATHS.md's known gap; SurfacePlaneShape's, PlaneShape's and the
plane call's docs; REFUSALS.md regenerated; api_signatures.tsv blessed.

Tests: tests::buffer_tail_device::an_array_over_a_plane_keeps_its_second_slice_in_its_tail
(64x32x2 RGBA8 over a 32768-byte plane: slice 0 the plane's bytes and
slice 1 zero on get_bytes, blit and a kernel through 2D views; kernel,
CPU writes read back on every path; the plane past slice 0 and the
buffers around unchanged; one notice) and
a_plane_s_texture_metal_lays_in_no_one_place_lies_apart (2 levels, 3D of
depth 2, 4-sample Private; level 0 zero, levels and slices written and
read back, no byte of the surface changes, one notice);
validation lane a_mipmapped_plane_lies_apart_and_is_announced, listed in
degrade_notices; linear_plan table rows for apart and sliced shapes,
their kept cut, and the off-16 and depth arrays still refused.

Verified by potluck jobs at this commit (clippy plain and m2v_cpu_icd,
runtime unit tests, lavapipe runtime and validation lanes, a negative
control at the runtime sources before it); results in the tip's report.

(cherry picked from commit 463cd6b9ecccc9e0b4263d8ac2452190f0287241)
2026-11-07 14:23:17 -08:00
Anees Iqbal 283f1e34f4 Re-bless the authored compile census at 5f334c5204
Its product fingerprint follows development's versions at 5f334c5204. Blessed on the
M3 (s37-pl.sh censusbless --bless, dv-m3).

(cherry picked from commit adbf04bce19b10f4941239345282bb61fa48c4b1)
2026-11-07 14:12:25 -08:00
Anees Iqbal 860c14532b Bump RUNTIME_VERSION to 1825: a listed guest RAM chunk stays imported while the whole RAM fits
The runtime-sources pin re-derived for amdperf-13 (75f17258dd, f7a53ed2f9,
52f46a2194, 960b5c6958, e673f2cb81, 61cbacb232). The 780M A/B (m3-max-5090,
reims's shape, 4 KiB pages): the first gather after the idle window went from
475.7/480.1 ms to 2.76/2.58 ms, for about 1.5 us per submission with 3 chunks
kept. The listed-release test now waits for the chunk's free as well as its
release (it read the counts in between once, m3-max-5196). Evidence:
m3-max-5276 (RADV 780M and XTX: host_ram 51/51 x2 each, the listed-release
test 6/6, dma_buf_imports 17/17), 5243 (plain clippy, host_ram unit tests and
fast_paths 35/35), 5115 (lavapipe). The 2 MiB rows (5277) and clippy under
m2v_gpu (5296) follow.
2026-11-07 14:11:28 -08:00
Anees Iqbal dfa37b6c7c Guest RAM test: the listed-release test prints how many reads of the counts saw the release before the free
The evidence that the window the previous commit waits through is real on a device: each read of
the counts that saw the chunk's release with the chunk still live is counted and printed.

(cherry picked from commit 61cbacb2322b0179798106d0f1dc3d1db1aa619f)
2026-11-07 14:11:17 -08:00
Anees Iqbal e687a81306 Guest RAM test: the listed-release test waits for the idle chunk's free as well as its release
The device's thread counts a chunk's release (host_ram_chunks_released) before the chunk's drop
frees it and takes it off host_ram_chunks_live; the drop destroys the buffer and hands the memory
to the free list first, which took long enough on an RX 7900 XTX that the test's 20 ms poll read
the count between the two (m3-max-5196, run 2: '1 released 2.4 s after the last buffer went; 1
chunk(s) live', then live + 1 == held live failed, 2 against 1). The wait now ends once both are
seen, and fails as before if the chunk is never freed.

Verified: the host_ram device tests on the 780M and the XTX (job ids in the tip).
(cherry picked from commit e673f2cb81f01888107a3626db0ecbe240f89b9d)
2026-11-07 14:11:17 -08:00
Anees Iqbal 16cf2acf08 Lane probe: the guest RAM probe in 2 MiB pages as the main case, 4 KiB apart, and each use of its objects timed
QEMU aligns memory-backend-memfd guest RAM to 2 MiB and advises huge pages, which take effect
where the host's shmem_enabled is advise (CachyOS's own): a 16 GiB guest on the RTX 5080 had about
10 GiB mapped at 2 MiB (reims). The probe's memfd took 4 KiB pages, the case of a host whose
shmem_enabled is never.

runtime_lane::submit_per_import::submit_per_ram_chunk now advises its RAM MADV_HUGEPAGE before
touching it, and submit_per_ram_chunk_in_small_pages advises MADV_NOHUGEPAGE; both run the same
measurement (ram_chunks). Each prints whether madvise took the advice, and the host's
ShmemHugePages before the RAM and once its chunks were imported, which shows the pages it got. Each
use of the objects is timed from commit to completion, the second being the first submission that
lists the chunks just imported (the page tables' cost the chunks then keep paying for nothing
more).

A measurement (ignored test), Linux only, as before. The scratch experiment it replaces
(steelbrain/amdperf-thp-probe de7b816ae2, an environment variable) never landed.

(cherry picked from commit 960b5c69581254291a709b10b6382b100ec6e859)
2026-11-07 14:11:16 -08:00
Anees Iqbal 32b8a9dfa1 FAST-PATHS: the guest RAM chunk's first-submission stall as the 780M A/B measured it
The row kept the 231 to 275 ms a /proc stack sampler saw (gem10 job 4750). The A/B of the probe
runtime_lane::submit_per_import::submit_per_ram_chunk on the Radeon 780M (gem10 job m3-max-5090,
--exclusive, an 8 GiB memfd RAM with its udmabuf source and with_largest_dma_buf at the host's
limit, 3 chunks of up to 3.94 GiB, two rounds each) measured more:

- the first gather after the idle window, its chunk released and imported again (the plan before
  this branch): 475.7 and 480.1 ms from commit to completion, 453 and 462 ms of it submitting;
  with the chunks kept: 2.76 and 2.58 ms (0.49 and 0.32 ms submitting), no import made;
- a gather at each 64 MiB: 240.7 and 185.3 ms released, 4.6 and 5.9 ms kept;
- steady submission p50 4 s after the objects went: 14.7 and 15.3 us with no chunk live, 16.8
  and 16.2 us with 3 kept.

The row now gives 231 to 462 ms and both gathers' times, and 14 to 15 us with no chunk.

(cherry picked from commit 52f46a21948eee752d2702b42ec171309bd3ab55)
2026-11-07 14:11:16 -08:00
Anees Iqbal 56b8390229 Guest RAM: the listed-ask test's plan says whether it releases idle chunks
(cherry picked from commit f7a53ed2f9d52156418878ed230c0d3857a402a0)
2026-11-07 14:11:16 -08:00
Anees Iqbal 78a98addc1 Guest RAM: a listed chunk stays imported where the whole RAM fits the memory its imports count against
On RADV the first kernel submission that lists a guest-RAM chunk just imported waits while
amdgpu writes the chunk's page tables, one entry per host page, through SDMA jobs that wait
for room in the IB suballocator (amdgpu_cs_ioctl > amdgpu_vm_bo_update > amdgpu_vm_sdma_update
> drm_suballoc). It holds the VM's reservation lock throughout, so every other submission of
the device waits too, and so did the guest-RAM thread's next PRIME_FD_TO_HANDLE (218 ms in
amdgpu_gem_object_open). Seen with a root /proc stack sampler on the Radeon 780M (gem10 job
4750): 231 to 275 ms of a gather's submission per 3.94 GiB chunk imported again. Every
re-import after the idle release paid it again.

A listed chunk, once imported, now stays imported while the device uses the RAM, where the
whole RAM fits in half the device's memory heaps with unified memory (RADV reports an APU's
GTT and carve-out together, split across two heaps), else in three quarters of the heaps that
are not device-local (a discrete GPU's GTT). Chunks kept past their objects must fit in the
kernel's GTT: RADV lists every import in every submission, which fails once they pass it.
Where the RAM does not fit, chunks are released while idle as before. Each kept chunk costs
every submission about half a microsecond (3 chunks for 8 GiB: 16 us against 14 us).

Plan::releases says which; Device::count_host_ram_imports_against is the device tests' seam
(cfg(test)): the release test makes the RAM too long, and a new test sees chunks kept past
their objects and the idle window, with the next objects bound in them and no import made.
The lane probe's gathers say how many chunks are live and were released. FAST-PATHS and
HOWTO say what is true now.

(cherry picked from commit 75f17258ddd0dc03e2f89a85819091cfa22c345a)
2026-11-07 14:11:16 -08:00
Anees Iqbal dcbe4552b7 Bump RUNTIME_VERSION to 1824: a one-plane YCbCr texture in a placement heap lies in Metal's rows
The runtime-sources pin re-derived for one-plane-heap-rows (1e59e4c80f,
b74c234d00, 7d437bdd07; probe a02cc28211, aa3e5aae61). The nine one-plane
formats' heap textures take Metal's size answer and lie in the heap's bytes at
Metal's offsets (M3 Max probes m3-max-5055, 5064). Where Metal lays them no
one way (rows not a multiple of 16 bytes, mipmapped, 3D) the new precision
notice heap-one-plane-layout is announced. Evidence: m3-max-5151 (byte for
byte), 5164 (heap, degradation and copy tests 90/90 cpuicd), 5184 (lane 2/2,
clippy cpuicd clean), 5257 (control fails all three new tests; plain clippy
clean).
2026-11-07 14:11:12 -08:00
Anees Iqbal 5f57fad5c4 Build the one-plane lane test's descriptors by assignment: TextureDescriptor is non-exhaustive outside its crate
(cherry picked from commit 7d437bdd074340043761bfb9e1109b505e457e4b)
2026-11-07 14:10:20 -08:00
Anees Iqbal 41a5354918 Give heap-one-plane-layout its lane site, and read a shadowed one-plane texture's copies out from the heap's bytes
degradation_sites (m3-max-5151) found the new kind named by no lane site:
runtime_lane::heap_one_plane makes a 16 x 16, a 13 x 7 and a mipmapped
YCBCR8_422_1P texture in a placement heap and holds the notice to the last
two, once (ONE_PLANE_LAYOUTS, listed in the device test's lists).

The 13 x 7 test read its copies out against what its copies in wrote; the
texture is a shadow of the heap's bytes, so after the heap's bytes are laid
with a pattern its copies out read that pattern at its packed rows, which
the test now expects (the mipmapped one, apart from the heap's bytes, still
reads what it wrote).

(cherry picked from commit b74c234d00e89715f2a051eb7f06240bf7563bd4)
2026-11-07 14:10:20 -08:00
Anees Iqbal 8eb3b6df31 Lay a heap's one-plane YCbCr texture in Metal's rows, not the carrier's tiles
Apple's nine one-plane YCbCr formats (501, 504, 521, 524, 560, 562, 563, 590,
607), held for copies alone in R16Uint or R32Uint, took the carrier's tiled
heap layout in a placement heap: their texels lay in R32Uint/R16Uint tiles,
and the texture took the carrier's tiled answer, where the size query answers
Metal's packed rows (reims-vgpu's jobs m3-max-4955 to 4985).

Metal lays them as rows (probes/one_plane_ycbcr_heap_rows.m on the M3 Max,
jobs m3-max-5055 and 5064, every format alike): a 2D texture's rows one
packed row apart where the row is a multiple of 16 bytes, a 1D texture's one
row, an array's slices at multiples of 128. The runtime now answers them
through planes_answer (one_plane_heap_answer, HeapLayout::Measured) and holds
them as the 4:2:2 textures are held, always a shadow of the heap's bytes in
rows (HeapTextureShape::rows); heap_plane_layout lays a one-plane array's
slices at 128 and heap_planes copies such slices a region each.

Shapes Metal lays no one way are announced, new Degradation
HeapOnePlaneLayout (heap-one-plane-layout): rows off 16 bytes, which Metal's
blits lay the row rounded down to 16 apart, lie packed; a mipmapped or 3D
texture, whose first level Metal addresses past its answer, lies apart from
the heap's bytes (AliasRoute::Unaliased) at Metal's answer.

Tests: heap_one_plane_rows (device): six shapes in a 4:2:2 and a 4:4:4
format, every byte of the heap after the copies in and every texel of the
copies out where Metal's are, allocatedSize Metal's answer; and the two
announced shapes reading what they wrote. The probe header gains what it
measured. API.md catalogue entry, api_signatures regenerated.

Not yet verified: the device tests, clippy and a control follow.

(cherry picked from commit 1e59e4c80f3e28c97ea80c8496e51dd6a94c4c83)
2026-11-07 14:10:20 -08:00
Anees Iqbal 37051cc5ed Probe: map each texel's bytes in the heap, and copies out at short rows (unrun)
(cherry picked from commit aa3e5aae61e95464053af60052c793360ae95b97)
2026-11-07 14:10:20 -08:00
Anees Iqbal 958d07a413 Add the one-plane YCbCr heap-rows and row-length probe (unrun)
(cherry picked from commit a02cc28211f17b8845b1e6320442b0fed5758249)
2026-11-07 14:10:19 -08:00
Anees Iqbal 5f334c5204 Bump SEMANTICS_VERSION to 1992 and RUNTIME_VERSION to 1823: the link refuses a rasterizing pipeline whose vertex function writes no position
The runtime-sources pin re-derived for void-vertex-answer (7f8536158d,
fcf4338efd, ffc6619794, 5da2f00827). The link's new refusal,
DescriptorError::RasterizedVoidVertex, changes a translation outcome under an
unchanged key, hence the semantics bump. A plain render creation no longer asks
the void-vertex question (fixes the cost and replay failures at 2f44dda930:
[specialized, linked_use] back to [2, 2]; control 01d28593fc fails with [3, 3],
m3-max-5095). The command line compiles a void vertex function given no
--fragment with rasterization disabled. Evidence: m3-max-5099 (M3 cost --show,
in order and alone: every count equals its record), m3-max-5223 (whole
metal2vulkan suite 3380/3380), m3-max-5213, m3-max-5093 (runtime cpuicd
1776/1776, clippy clean).
2026-11-07 14:03:30 -08:00
Anees Iqbal d6d695d951 Link the tests' and the tool's void vertex functions unrasterized, as Metal makes them
m3-max-5121 (the whole metal2vulkan suite at ffc6619794) failed eight tests
on the link's RasterizedVoidVertex refusal:

- five link tests (render.rs) replaced a vertex stage's io with one that
  writes no position; they now keep the position (positioned);
- engine_link's graphics-state test linked ob3_index_buffer, a void vertex
  function, rasterizing; it now links it with rasterization disabled, the
  one form Metal makes of it;
- the command line compiled a void vertex function with no fragment as a
  rasterizing pipeline (cli's ob3_vertex_input test): with no --fragment
  it now asks whether the vertex function returns a value and compiles a
  void one with rasterization disabled (README says so);
- the new link test ran on vk12-floor, whose vertex stage stores nothing,
  as the void function does; it runs on lavapipe's profile.

(cherry picked from commit 5da2f008274b04019121fe173adb98efa4f3ec26)
2026-11-07 14:02:59 -08:00
Anees Iqbal f673ff56d3 Give the link tests' synthetic vertex stages the position a rasterizing pipeline's vertex function writes
The link now refuses a rasterizing render pipeline whose vertex stage writes
no position (DescriptorError::RasterizedVoidVertex). Six link tests built
their vertex interfaces with no builtins and failed on it (m3-max-5093).
iface, from_module and with_io now give a vertex stage the position its
function would write, unless the io names one already.

(cherry picked from commit ffc66197948ccafd863939b51f4ac7d971d559a4)
2026-11-07 14:02:59 -08:00
Anees Iqbal f65f8b2282 Say what a void-vertex question would cost a plain render creation, in the count test's doc
(cherry picked from commit fcf4338efd1a1950b50d514b808d3156f02907eb)
2026-11-07 14:02:59 -08:00
Anees Iqbal e2491fe2b7 Read a rasterizing state's void-vertex answer from its compile, not a question
2f44dda930's render creations asked whether the vertex function returns a
value on every creation, so each plain creation counted one more linked-use
question, one more specialized stage entry and one more shared one than its
cost record (159 cases over bounds in the whole-set replay, all those counts).

The question now runs only where the state turns on it before its compile:
with rasterization disabled, and in OpenGL mode. A rasterizing state outside
OpenGL mode takes the answer from the vertex entry its compile specializes
anyway: the link refuses a rasterizing render pipeline whose vertex stage
writes no position (new DescriptorError::RasterizedVoidVertex), and the
runtime answers that refusal as Metal's error for a rasterizing void vertex
function, as before. The linked-use answers cache treats the vertex answer as
owed only where the creation asks it.

Tests: a link test refuses a rasterizing void vertex function with and
without a fragment, and makes it with rasterization disabled; a runtime test
counts one plain render creation at two specialized stage entries and two
linked-use questions. api_signatures and REFUSALS.md regenerated.

Not yet verified: suites, clippy and the M3 cost records follow.

(cherry picked from commit 7f8536158d856886ebedac8c0b6130ff32d22a31)
2026-11-07 14:02:58 -08:00
Anees Iqbal 97ec335a66 Bump RUNTIME_VERSION to 1822: a blit into a texture at a pitch below the row is made, each row read from y times the pitch
The runtime-sources pin re-derived for short-row-blits (3b174b3675; probe
d9a102de59, fca7bfa83f, a5de33f421, 44b080e2f8). Metal on the M3 Max reads each
row whole from y times bytesPerRow (166/166 shapes, m3-max-5158). A copy out at
such a pitch stays refused (Metal's overlapping rows land in no one order,
m3-max-5170). Evidence: m3-max-5185 (blit, copy and described-row tests 208/208
on lavapipe, clippy icd clean); m3-max-5222 (control branch fails both new tests;
plain clippy clean).
2026-11-07 14:01:48 -08:00
Anees Iqbal 529184db53 Count the half-row shapes in the probe header by fifths, as measured
(cherry picked from commit 44b080e2f80538c7f39e4f702e966d4834b4bd19)
2026-11-07 14:01:21 -08:00
Anees Iqbal 6ce8d6f2ce Say what the short-row blit probe measured, in its header
(cherry picked from commit a5de33f4218fecd5860be11b56da03dbc669c1a9)
2026-11-07 14:01:21 -08:00
Anees Iqbal 2d3b673067 Take a blit into a texture at a pitch below the row on Metal's aligned path
A copy into a texture from offset 0, of one image, at a bytesPerRow that is
a multiple of 16 below the row was refused Copy(BytesPerRow) as unmeasured.
That is the row MTLPixelFormatGetInfoForDevice describes for the one-plane
YCbCr formats (a byte a texel for YCBCR8_422_1P, two for YCBCR10_444_1P:
half the row), which reims-vgpu's blits use (m3-max-4955 to 4985).

Measured (probes/short_row_blits.m, M3 Max, macOS 27.0.1, m3-max-5158):
every row of a 32 x 8 texture (64 x 8 for R8Unorm) read whole from its own
row's offset at every pitch of the texel from 16 below the row, in eight
formats of 1 to 16 bytes a texel, Private and Shared, 166 of 166. The
aligned path now takes such a pitch, rows at y x pitch; a pitch of 0 and an
offset of 16 or more stay refused.

A copy out at such a pitch stays refused: Metal writes the overlapping rows
in no one order (m3-max-5170: 900 copies out at half the row, 300 shapes of
12 formats in 3 processes, later-row bytes at some widths, even rows' at
others, neither at most, 15 shapes differing between processes). The CPU
copies already move nothing below the row, as Metal's.

Tests: blit_plan's placed-rows test takes three such pitches;
described_row_copies (device) copies in at the described row of both
formats and reads each row from its offset, and holds the copy out refused.
REFUSALS.md regenerated (the basis states the measurement).

Not yet verified: the tests and clippy follow.

(cherry picked from commit 3b174b367547b6f6187671d84f01797f9fe8f8ea)
2026-11-07 14:01:21 -08:00
Anees Iqbal 6a2cd19438 Probe: copies out at half the row, over widths, heights and the nine one-plane formats (unrun)
(cherry picked from commit fca7bfa83fb9a843a00afe0d272ba368a435d385)
2026-11-07 14:01:20 -08:00
Anees Iqbal 9e1b62d666 Add the short-row blit probe: rows read in and rows that stand out, at a bytesPerRow below the row (unrun)
(cherry picked from commit d9a102de59ee86e8b6b8b475d3c1a20b2107c022)
2026-11-07 14:01:20 -08:00
Anees Iqbal 40aeb8506f Bump RUNTIME_VERSION to 1821: the sparse mapping's doc names the pages a slice past the texture's costs
The runtime-sources pin re-derived for rows2-left (c4a47fc17d, a doc and test
change to sparse/mapping.rs, tests::sparse and FAST-PATHS' known gap). Also
landed: fresh-pages-pitch (cff0105bd5, test-only), which fixes development's
M3 failure of tests::fresh_pages (the 512-byte pitch is refused under MoltenVK
and counted, so the shadow is right). Evidence: m3-max-5239 and 5229 (fresh
pages 6/6 on the M3 and lavapipe, both branches), m3-max-5234 (sparse 17/17,
fast_paths 21/21).
2026-11-07 14:00:28 -08:00
Anees Iqbal 2fff78740e Record that a sparse slice past the texture's costs its other levels and tail what it costs inside
UnitGrid::clipped_region charges a mapping update whose slice is past
the texture's own what the same region inside the texture costs: the
region clipped to the level's tiles, a page per tile, the slice's whole
tail at firstMipmapInTail, and nothing inside the tail past it. That
was measured on level 0 alone, and mapping.rs called every other level
and the tail unmeasured.

sparse_slice_past_levels_usedsize.m (landed with rows2's fixes) ran on
the M3 Max (macOS 27.0.1, job m3-max-4446): eighteen shapes, each in its
own process and run twice. It used the direct selector, the indirect one
and the direct one through a view, over a 2-slice 256x256 nine-level
R32Float texture. Every reading is the rule's, and so is every
control's on an in-bounds slice:
- a tile of level 1 or of level 2 costs one page;
- 8x8 tiles on a level holding 2x2 cost four;
- a tile of level 3, the first tail level, costs the slice's tail (one
  page here);
- level 5, inside the tail, costs nothing;
- an unmap gives the page back.
The three forms and the two runs read alike. No behavior changes.

- tests::sparse gains the readings row by row, each with its control.
- mapping.rs states the rule as measured on those levels and the tail.
- The probe's header records what it read.
- FAST-PATHS's known gap said the runtime counts none of these pages.
  It counts the pages Metal's heap counts (sparse/bind.rs charges them
  through SparseState::charged), as docs/API.md's accepted difference
  already said, so the known gap now says the same.

(cherry picked from commit c4a47fc17d634f750b9c62b6489c95d3d4d5d966)
2026-11-07 14:00:19 -08:00
Anees Iqbal 9e31d4f596 Hold the fresh-pages texture test to the shadow's counted cause and its notice
tests::fresh_pages::a_texture_over_a_long_buffer_is_its_bytes_in_place_
where_the_check_passed asserted that the texture is in place exactly
where the device's check passed for render targets over fresh pages.
Its texture is a 64x64 RGBA8Unorm render target with rows 512 bytes
apart, twice its own. On the M3 Max under MoltenVK the check passes
(Fresh, Fresh renders and Fresh writes all Passed). The texture is
still a shadow there, refused for its pitch
(host_texture_shadows_refused_pitch 1): MoltenVK lays a linear image's
rows at a pitch of its own and enables no
VK_EXT_image_drm_format_modifier. The runtime is right and the
assertion was too strong. It failed on every M3 run (m3-max-5145,
5177, and 5201 with development 4399915752's runtime crate alone, 2
runs out of 2).

The test now holds each outcome to what makes it:
- In place: only where the check passed, with no shadow cause counted.
- A shadow under Shadow: the exact cause.
- A shadow where the check passed: one refusal, of the image
  (host_texture_shadows_refused_image) or of its pitch (_pitch).
- A shadow where the check did not pass: failed, unchecked or pending.
- Every shadow announces shadowed-texture for this texture, and an
  image in place does not. The device now keeps the notices it hears.
Each cause is counted once. The rows' pitch is a parameter, and a new
case at the texture's own pitch (256 bytes) has an image in place
wherever the check passes and the device makes one, so both branches
run on one device.

Test-only. Verified: cargo fmt. The M3 MoltenVK and lavapipe runs
follow in the tip's evidence.

(cherry picked from commit cff0105bd575a7abd54c786b89f1a84bc5caef5c)
2026-11-07 14:00:19 -08:00
Anees Iqbal 4b0872126d Bump RUNTIME_VERSION to 1820: a texture over host pages made before its verdict is a shadow again, made without waiting
The runtime-sources pin re-derived for selfread-firsttex (eca12ad708). reims's
odd-width presented-surface regression on the 780M: the make waited 1.75-1.86 s
for the in-place check's verdicts (m3-max-5168), past the guest's ~2 s answer
wait. VERDICT_WAIT and WorkCounts::in_place_verdicts_waited removed. clippy in
every configuration, api_signatures and lavapipe tests 19/19 m3-max-5189; the
780M tests (5188) and reims's exact test (5192) follow.
2026-11-07 13:49:02 -08:00
Anees Iqbal 3312a0ad84 Make a texture over host pages before its verdict without waiting for the in-place check
A texture over host pages made while its class's in-place verdict was pending started the check
and waited for that verdict as it was made, up to in_place::VERDICT_WAIT (5 s). The check's
rounds take seconds on some devices and builds: on um870's Radeon 780M (RADV, Mesa 26.2.6), in a
debug build, the first of the consumer's odd-width surfaces (3662x16, rows of 14656 bytes,
ShaderRead | RenderTarget) took 1.75 s and 1.86 s to make (job m3-max-5168), past the ~2 s the
consumer's guest waits for the COMPLETE of its next message. reims-vgpu's
on_vulkan_a_presented_surface_at_an_odd_width_reads_row_for_row failed there ("a COMPLETE") from
the wait's landing on; every command buffer of the same shape completed in under 2 ms.

A texture made before its verdict is a shadow again (ShadowCause::CheckPending, counted in
host_texture_shadows_check_pending), and its making starts the check and waits for none of it.
A program that makes such textures as it starts, and wants them in place on a driver's first
run, starts the check earlier with Device::settle_in_place_checks and a zero timeout; a device
whose record holds the verdicts knows them as it is made, as before. VERDICT_WAIT,
InPlaceChecks::wait_for and WorkCounts::in_place_verdicts_waited go (api_signatures.tsv).

Test: tests::first_host_texture, the consumer's shape: six surfaces over no-copy buffers at widths
3662, 1831 and 1001 (rows padded to 64 bytes), ShaderRead | RenderTarget then ShaderRead, each
copied out by a blit and read at its own pixels by a draw. The first is a shadow made before its
verdict; before this change it waited and was counted 0 there (m3-max-5168), so the assertion
fails without the fix. fresh_pages's in-place test settles the check before its texture, as a
texture made before its verdict is a shadow now. The waiter's unit test goes with wait_for.

Docs: in_place.rs, docs/API.md, docs/HOWTO.md, the FAST-PATHS in-place row.
(cherry picked from commit eca12ad708a8f1ad53521c967d4340a9b2635a22)
2026-11-07 13:48:35 -08:00
Anees Iqbal 4399915752 Bump RUNTIME_VERSION to 1819: textures a shader writes over host pages in place; device copies of Managed textures alone; in-place render targets take storage usage
The runtime-sources pin re-derived for selfread-writes (fd9fc11dd3, c3ffb08376,
0ae253b844, e4d6115370, 4df642def8). Owner ruling 11-07: CPU-visible resources
in place, a shadow only where in place is impossible. 5080 entry
selfread-devcopy-writes 24/24; clippy plain and m2v_gpu m3-max-5116; the Iris
A/B waits for ms01.
2026-11-07 13:25:05 -08:00
Anees Iqbal 85c778eb10 Pass the in-place image its texels as a reference
db5177e4bb handed in_place_image a tuple holding &Arc<Texels> where it takes &Texels: no deref
coercion reaches into a tuple, and the runtime did not compile (E0308, texture.rs:2310,
m3-max-5041). The tuple now holds &*texels.

Verified: cargo fmt; the build and clippy follow in the tip's jobs.
(cherry picked from commit 4df642def8e6dd8b05648f7882abf473442478c7)
2026-11-07 13:24:34 -08:00
Anees Iqbal eb6c13f52b Give a render target in place over host pages the storage usage its snapshot reads fetch through
On the Iris Xe (m3-max-4845, the self_reads lane, a 3662x2039 BGRA8 surface over host pages, 30
pairs of a 600x400 draw, a render-target barrier and a draw reading the target at its own
pixel), a surface in place (557d9f0905) split every reading draw: 30 splits a frame, 30 copies
of the whole surface into the reader's copy (224M texels copied in), 22.4 and 27.2 ms of GPU a
frame, where its shadow took the snapshot (cut A, 60b9a69d39): 30 snapshotted draws, no split,
4.7 and 4.3 ms. The in-place image took the feedback loop usage (aliases 1) but not the storage
usage, which a snapshot's fetch of the attachment in the pixel interlock reads through
(RenderLowering::keeps_own_attachment), so snapshot_wanted fell back to the split: the image
was the texture's declared plan's, where a shadow takes undeclared usages (with_undeclared_usage).

A texture over host pages that renders, in place, now takes the storage usage too
(framebuffer_fetch::storage_candidate over the feedback loop plan, with the view in another
format a fetch stores through where the device needs one: ANV's RGBA twin of a BGRA format)
where the device's check passed for a shader's writes over the pages' class and the texel is one
the check's kernel stores (4, 8 or 16 bytes): with that usage a shader writes the texels in
place, which the check's writes cover. Tried first, then the feedback loop plan, then the
declared plan: the first the device makes the image in place with. Elsewhere its readers split
as before. A rebind asks the writes verdict of an image with storage usage already.

Tests: tests::in_place_storage (new, device): a render target in place over host pages has the
storage usage only where the check passed for writes there, with the feedback loop usage and a
fetch through storage. runtime_lane::snapshot_reads::a_surfaces_readers_take_the_snapshot_at_any_area
expects a snapshot for an image in place only where it took the storage usage (Pointer writes:
Passed), as for a shadow.

Docs: in_place_image.rs (its usage), API.md (textures over host pages in place), FAST-PATHS.md
(the attachment-read row: images over host pages, and the shadow only where a texture is one).

Verified: cargo fmt; the build, clippy, lavapipe and the Iris A/B and snapshot lane follow in the
tip's evidence.

(cherry picked from commit e4d61153702293e23bd874cf0830ff22d6be307a)
2026-11-07 13:24:34 -08:00
Anees Iqbal 402d4a5f76 Say the in-place check's cost and verdicts per access too
The module docs of in_place_check.rs still spoke of a verdict per class and of the first move's
cost alone, where each class's verdict is now per access, and a pass or a kernel's stores run
beside the writer as the first move does.

Verified: docs only.
(cherry picked from commit 0ae253b8447bddd6ca4f7172e41600e3d80047af)
2026-11-07 13:24:33 -08:00
Anees Iqbal 6276d55b25 Textures a shader writes over host pages in place, where the device's check passes for their writes
A texture over host pages whose usage writes it through a shader (`ShaderWrite` or `ShaderAtomic`)
was a shadow on every device: its texels copied in before each use and merged back after each
write. The owner's ruling of 11-07 (confirmed for discrete GPUs) has CPU-visible memory worked on
in place wherever the device can, slower or not, with a shadow only where in place is impossible,
announced and counted. This takes such a texture in place on the same terms as one that renders,
from the parked branch park/shaderwrite-in-place, onto the per-class, per-access check, with no
device-type rule: a discrete GPU takes it in place too.

- `in_place.rs`: a third access, `Access::Writes`, which a texture of `ShaderWrite` or
  `ShaderAtomic` usage takes; a texture is tried in place where its class's check passed for each
  access it takes (`Access::takes`: renders, writes, or reads where it does neither), asked in
  that order until one did not pass. A texture a shader writes of texels of 1 or 2 bytes, which
  the check's kernel stores none of, is a shadow (`ShadowCause::StoreWidth`); `ShadowCause::
  ShaderWrite` is gone. Nine verdicts a record (CHECK_VERSION 3).
- `in_place_check.rs`: the storage rounds, per class: a texture of `ShaderWrite` usage over the
  pattern, every texel stored by the crate-owned copy-in kernel through an unsigned-integer view
  (`Texture::store_in_place`, from a buffer outside the Metal address space), its first move
  first, while the writer writes the bytes between rows and after the image; every texel must read
  the kernel's bytes, every other byte the writer's or the pattern. `STORE_SHAPES`: 4, 8 and 16-byte
  texels, packed, padded at 512 bytes (widths no multiple of 4, odd heights) and at a tight 16-byte
  pitch, and 1920x1080.
- `WorkCounts`: `host_textures_in_place_written` (of `host_textures_in_place`, those a shader
  writes) and `host_texture_shadows_store_width` are new; `host_texture_shadows_shader_write` is now
  the subtotal of the shadows a shader writes, as `host_texture_shadows_render_target` is of those
  that render. The rebind of a texture in fresh pages asks every access its image's usage takes.

Tests: the decision test covers every usage, texel width and combination of the three accesses'
verdicts, and the order in which they are asked; the cause words and the record of nine verdicts.
Lanes: in_place_textures gains `written_textures_over_host_pages_take_the_path_their_checks_answered`
(64x64 `RGBA16Float` at 1024 and 512 bytes, 61x64 at 496, signaling-NaN halves beside the texels:
in place exactly where `Pointer writes` passed, a kernel's writes reaching the pages, every other
byte kept), and `textures_that_render_or_write_take_the_path_their_checks_answered` replaces the
test that counted every written texture a shadow; no_copy_textures and pitched_surfaces take a
written texture in place where its texels are 4, 8 or 16 bytes.

Docs: in_place.rs, in_place_check.rs, the policy's docs, API.md (the in-place paragraph, the
shadow paragraph, the `shadowed-texture` notice), HOWTO.md, the runtime README and FAST-PATHS.md's
in-place row and host-pages bullet.

(cherry picked from commit c3ffb08376251b87e16b7b417b39f1458e271085)
2026-11-07 13:24:33 -08:00
Anees Iqbal 24ceac6e88 Make device copies on a discrete GPU of Managed textures over host pages alone
On a discrete GPU, a texture over host pages that only samples or reads, over memory that carries a
log of its writes, was a device copy (a shadow in VRAM whose copies in take the rows the log
reports) whatever its storage mode: a speed choice, so the GPU read the surface from its own
memory instead of across the bus. The owner's ruling of 11-07 (confirmed for discrete): Shared
and IOSurface memory over guest pages is used in place over the import, never shadowed to VRAM
for speed; Managed keeps Metal's two copies on a discrete Mac. So `Texels::device_copy` now also
asks for `Managed` storage and a buffer's bytes (not an IOSurface plane's, whose memory is one copy
whatever the descriptor's storage mode): a Shared texture and an IOSurface's are in place over the
import where the device's check passed, as on every other device.

Tests: the runtime's `a_logged_device_copy_sampled_in_an_inline_pass_is_copied_in_before_the_pass`
and the device_copies lane make their buffers Managed (`over_logged_as`, `over_as`); the new lane
test `a_shared_surface_over_logged_pages_is_no_device_copy` asserts a Shared surface over logged
pages is no device copy on any device, in place exactly where the check passed for pointer pages,
and that its reads hold the pages' texels before and after a logged CPU write.

Docs: API.md, the runtime README, FAST-PATHS.md's in-place row, the WorkCounts field and the
lanes' module docs.

(cherry picked from commit fd9fc11dd372a0985fdbc921adb2bc971ff78a3d)
2026-11-07 13:24:33 -08:00
Anees Iqbal 66ce9f558f Bump RUNTIME_VERSION to 1818: the import tax check holds 32 imports, so a cost per listed object counts
The runtime-sources pin re-derived for intel (af338a507a: submit_check.rs,
CHECK_VERSION 2 to 3; the pending-pools lane commits are test-only). The
Iris Xe now answers taxed (job m3-max-4935: 5 of 5), so it takes the listed
guest-RAM plan.
2026-11-07 13:14:11 -08:00
Anees Iqbal b061a37a01 Lane: the pending-pools test's texture helpers no longer share a name with its bindings
A binding named depth shadowed the helper of that name (E0618 in the build of job m3-max-4799).

Verified: the build follows (job id in the report).
(cherry picked from commit b8ddabd57661bcd2d114f883763b55ca3810899a)
2026-11-07 13:13:55 -08:00
Anees Iqbal 9d3ac94e85 The import tax check holds 32 imports of its 16 MiB, so a cost per listed object counts
The submission checks' import tax held one import of 16 MiB and counted it where it added more
than a microsecond to a submission. ANV on i915, which has no VM_BIND, lists every buffer object
of the device in every execbuffer at about 0.35 us each whatever its length (reims-vgpu's
from-scratch probe on the Iris Xe of RPL-P, Mesa 26.2.6, Linux 7.3.1: 18.6 us a submission with
32 imports of 32 MiB, 107.5 with 256 of 1 MiB, 8.3 with none), so one import stayed under the
floor (0.2 us in the check's probe) and the device was answered untaxed while a guest's desktop
holds 135 to 278 imports: about 50 to 100 us a submission at 150 to 370 submissions a second.
The check now holds TAX_IMPORTS (32) imports of TAX_BYTES / 32 each, pages of their own, the
same bytes in all: a per-object cost adds up past the floor where it is a tenth of it or more,
and a per-page cost (amdgpu's) is what it was. CHECK_VERSION goes to 3, so no record of the old
form is read.

On a device answered taxed the runtime keeps its own long buffers out of fresh pages
(fresh_pages.rs) and imports a guest RAM with a dma-buf source as few long dma-bufs
(host_ram.rs, Plan::listed).

Verified: build, clippy and the check's unit tests follow; the Iris Xe, RADV, NVIDIA and M3
verdicts and floors are measured in the lanes (job ids in the report).

(cherry picked from commit af338a507a46f3c09ec2bbaa7a402cd6f771f14c)
2026-11-07 13:13:55 -08:00
Anees Iqbal 4cc1f6874f Lane: the pending-pools test adds a thread whose command buffers wait for events, and an inline pass
The first Iris run (job m3-max-4749) let go of all 720 command buffers while pending and the layer
reported nothing, but no pass recorded inline there: the pass into the surface over host pages
renders apart from its bytes on the Iris. The inline pass now draws into a private target. A
second thread commits a command buffer a frame on a queue of its own, waiting for the frame's last
command buffer's event signal and for a host signal the releasing thread makes as it lets go of
it, so its batches are held and go from the signalling thread, as a guest's decoder threads do.

Verified: build and run on lavapipe and the Iris Xe follow (job ids in the report).
(cherry picked from commit 209e85e908135e67dad0894c3733661a6f663253)
2026-11-07 13:13:54 -08:00