A two-plane YCbCr texture whose planes a function reads in place still made
its conversion's staging buffer (the planes' whole byte range, 24.9 MB for a
4K x420 frame), its kernels' descriptor sets and its refresh as it was made,
though no function of it converted. On the 780M a texture made each frame
paid that every frame.
YCbCrConversion now holds what its making takes and makes the rest at its
first conversion: Encoder::plan_shadows prepares every shadow a command uses
(ShadowCopies::prepare), the one place a copy in is planned. The device's
own conversion is still announced as the texture is made. The converted
image itself is still made with the texture.
Test: ycbcr_in_place_loop::a_texture_read_only_in_place_makes_no_conversion
(no scratch buffer after two sampling dispatches of a texture read in
place; one after its first read()).
(cherry picked from commit 05cb080a878384e254921d0d97b4b7872ee4c175)
Built on gem10 (m3-max-8204): five double mutable borrows of the function
builder in the model's sample.
(cherry picked from commit 87fb0eec5e8406e907077033521198db5eda9060)
FAST-PATHS.md gets the ledger row for ycbcr_in_place_reads (Model default,
Exact switch, the 780M's exact-form cost measured at development's tip),
the device-gaps row and the in-place section name the choice; API.md's
policy list and the half/float filter and ycbcr-filter-not-exact catalogue
entries name the model; PrecisionNote::HalfSampleFilter/FloatSampleFilter
and Degradation::YCbCrFilterNotExact docs say the model records and
announces them.
(cherry picked from commit 5f83699d296386c3b0b357f2baa63cfefc086096)
A function that reads a two-plane YCbCr texture's planes in place (a
uniform texel buffer over their codes, on an integrated GPU or a CPU
device) filtered every linear sample as Metal does: four taps, each five
fetches, its chroma weighted 9/3/3/1 and rounded to a code, a fixed-point
conversion with a division, then Metal's exact sum on the grid 2048. On
the Radeon 780M that sampling cost 6.4-6.9 ms of GPU time per 4K frame.
DevicePolicy::ycbcr_in_place_reads now chooses between the model (the
default) and Exact (DevicePolicy::exact_answers). The model is Vulkan's
Y'CbCr model as the device's own conversion with a linear chroma filter
computes it: four luma codes and four chroma pairs blended bilinearly
(midpoint siting), then the surface's range and matrix (Metal's
coefficients) in float, clamped into [0, 1]: eight fetches. A nearest
sample, a border address mode, an offset placed by a parent's size and a
gather stay Metal's under either value; a runtime sampler decides by its
word as the function runs. The model records PrecisionNote::HalfSampleFilter
or FloatSampleFilter under the bound converted 4:2:0 format (and the
runtime sampler's linear, border-free word), which the runtime announces as
ycbcr-filter-not-exact.
The profile carries the choice (its fingerprint moves), SEMANTICS_VERSION
1993. Tests: the Metal-bits test runs under Exact, a new engine test checks
the model against an f64 model on lavapipe and MoltenVK profiles, the
fast_paths tests check the switch. The measurement lane times the planes
read in place under both values.
(cherry picked from commit 6c6d803e93910860a4b9e8a0659ecc472dfa7cbc)
A swizzled YCBCR10_420_2P texture keeps its converted image on every device,
so the same shader and sampler take the image's route (refresh, conversion,
the device's filter) beside the planes read in place.
(cherry picked from commit 7e10f693b3a732af5e8d59ab64dbc89fbe676203)
The lane devices take DevicePolicy::exact_answers and keep execution
records; a consumer's device takes neither. video_frame_parts samples each
form linear and nearest, over pages the CPU writes each frame and over
pages left as written.
(cherry picked from commit 6e8d0d47f1958feae2fb63a3ad2c12aa08213987)
A report-only lane (ignored by default, release builds): the CPU writes a whole
3840x2160 P010 frame (CoreVideo's x420 layout, planes 32 bytes into their
pages, 7680-byte rows) into the next of three surfaces over host pages, then one
render pass samples it into a 3840x2160 BGRA8 target, through a YCBCR10_420_2P
texture or R16Unorm and RG16Unorm plane textures. Printed: each texture's
placement, the frame's GPU time, host times and every work count it moved.
Verified: build only so far (potluck).
(cherry picked from commit f195cfae62584274979d612e46da2a8fbe2ffed2)
irisperf-words (562fc5fc52): the pages-copy kernel's table entries carry a word count (at most
1024; a whole page is one entry as before), so copies whose runs start, end and land on words take
dispatches; only runs that end off a word, and a scatter that writes a byte twice, keep
vkCmdCopyBuffer regions. Re-pinned.
Verified (irisperf): Iris ms01 8523 host RAM copy tests 17/17, negative control fails the new
device test; gem10 8466 clippy plain and m2v_gpu, translator tests 24/24, lavapipe host_ram 56/56.
Iris, a 31.5 MB surface of 4-byte texel rows over 7703 runs downloaded in one call: GPU 0.83 ms by
the kernel against 13.5 ms by regions and 4.3 ms by the page view's blits, no mapping.
The pages copy's table entries become three words: the run's first word in
the scattered binding, its first word in the consecutive one (from the
shape's first_word) and its words, at most a page's 1024. Each invocation
copies its strided words below the run's count. Whole pages are entries of
1024 words, one a page as before, so their tables' entries, dispatches and
windows are unchanged.
In the runtime, a copy whose runs all end on a word (they already start on
one, and the buffer's bytes too) takes the dispatches: plan() cuts each
piece into runs of at most a page from its start and where a window of the
buffer ends. Only runs that end off a word (rows of 1- or 2-byte texels),
or a scatter whose runs write a byte twice (share_a_byte, so the later
run's bytes stay as with regions), keep vkCmdCopyBuffer regions.
The Iris measured regions at about 1.6 us of GPU and 1 us of CPU each
(m3-max-8389: 8853 regions of a 31.5 MB surface, 14.0 ms GPU, against 0.99
ms for the page kernel over the same pages).
Tests: the kernel's interpreter test of word runs (a word, 128, 129, a run
across a page, a page less a word) with no word around them changed; the
plan's cuts at a page and at a window's end; a device test of rows of 2044
bytes at a 2048 pitch from 16 bytes into a page, a run ending a word before
a page's end, three pages and more from inside a page, one across the
chunks' end and a word, with sentinels over every touched page, a dispatch
per chunk and no region both ways, and a twice-named scatter of word runs
by regions, the later run kept. The regions refusal case now ends off a
word. The bench measures rows of 4-byte texels (dispatches), of 2-byte
texels (regions) and 2046 bytes at a 2048 pitch.
Docs: the kernel's module and entry docs, the copy module, both calls' API
docs, HOWTO and the runtime README; signatures re-blessed (entry() takes
the run's words and returns 12 bytes; ENTRY_WORDS).
(cherry picked from commit 562fc5fc526cce2b31db280c4bbffb29314f8ac4)
Its product fingerprint follows development's versions at 0578e213c0. Blessed on the
M3 (s37-pl.sh censusbless --bless, dv-m3).
(cherry picked from commit 990f74d2e57c53b7a2200b11d05795461c9a1389)
aligned_byte (bef28766ee, ed3f0801da) is an opt-in runtime extension for the runtime's own memory:
a buffer's chosen byte lands on a multiple of 256 bytes of its memory (refused with NoCopy,
Problem::AlignedByteNoCopy), so textures over planes at that byte alias the memory on RADV. A
buffer made without it is laid out as before, so RUNTIME_VERSION stays.
Verified (video4k): 780M gem10 8456 tests::aligned_byte 2/2, all 24 planes (R8/RG8/R16/RG16 at
0x20, 0x7e9020, 0xfd2020; read, write, render; Shared and Private) alias with the option and are
shadows at 0x20 without it; lavapipe and clippy 8457 2/2; 780M device-cache A/B 8485: 10-bit 4K
frame, 10,368,000 texels copied a frame and GPU 1946 us without, 0 and 1262 us with it.
zero_buffer handed buffer_of_length the placement and the byte apart, where it takes them as one
(Place, Option<u64>) pair (E0061; um870 m3-max-8425, gem10 m3-max-8426).
Verified: cargo fmt; the builds follow.
(cherry picked from commit ed3f0801da87a9031bc6e98885c2d3c22e6a4293)
A consumer that lands decoded frames in a buffer of the runtime's own memory makes plane textures
at CoreVideo's offsets: the first plane 32 bytes into the surface, the second 32 bytes past a
multiple of 256 after the first's rows. A linear image aliasing the buffer binds at the buffer's
memory offset plus the texture's, which must meet the device's linear-image alignment (256 on
RADV, 128 on NVIDIA, 64 on lavapipe), and the runtime starts each buffer on a multiple of 256, so
those planes are shadows there (the 780M probe, um870 m3-max-8351: Shared and Private buffers,
in place at 0 and 256, shadows at 32, 64 and 128).
BufferDescriptor::aligned_byte (with_aligned_byte), a runtime extension for the runtime's own
memory, names the byte to lay on a multiple of 256 (LINEAR_IMAGE_ALIGNMENT). placed_new_buffer
then makes the VkBuffer that byte's shortfall longer, binds it where its placement starts, and
starts the buffer's bytes that many bytes into both (BufferParts offset and base, the mechanism
host imports use), so the byte lands on the multiple and textures there alias the memory. Such a
buffer is never parked nor taken from the parked, and lies in no fresh pages. Its length and
gpuAddress (the runtime's address space's) are unchanged; a Shared one's contents start the
byte's remainder short of a multiple of 256, which the field's docs name against Metal's
page-aligned contents. Refused with NoCopy contents (Problem::AlignedByteNoCopy).
tests::aligned_byte: over Shared and Private buffers laying byte 0x20, the 8-bit and 10-bit
frames' planes (R8/RG8 at rows 3840, R16/RG16 at rows 7680; the second plane at 0x20 + 0x7E9000
or 0xFD2000), sampled, written and rendered into, alias wherever the same texture at offset 0 of
a plain buffer does, and are shadows at 0x20 of a plain buffer wherever the device's linear
alignment is past 32; a blit of each sampled plane reads the bytes at its offset; length,
gpuAddress and contents as above; the refusal over NoCopy. Docs: the field, HOWTO, API.md's
shadowed-texture entry, the runtime README; api_signatures blessed and REFUSALS.md regenerated.
New public items: BufferDescriptor::aligned_byte, BufferDescriptor::with_aligned_byte,
Problem::AlignedByteNoCopy.
Verified: cargo fmt; the 780M, lavapipe and Iris runs follow.
(cherry picked from commit bef28766eee658ef30dfcc5d0492a1493171b34d)
an_event_wait_a_gpu_signal_in_flight_meets_is_checked_at_once failed on the
RTX 5080 laptop in a batch beside a second lane (pkg 104 C): "at commit
false: the signaller never ran at the waiter's scheduling in 9 tries".
Its window was the signaller's GPU time: fills doubling from 4 to 1024 of
64 MiB, each try passing only where the waiter read Scheduled, and the
test thread read the companion event, before the fills ended. That window
hangs on the GPU's speed and on the host's load (it was already raised
once, from 7 tries to 9, after a host acting 145 ms late), and the two
sibling tests shared it.
Now the signaller first waits for a plain event's value 1 whose one signal
the test reserved (Event::reserve_vk_signal) and gives from the host
(vkSignalSemaphore of the reserved counter) once it looked. A plain
event's wait for a reserved signal goes to its VkQueue at once, so the
signaller is submitted and scheduled, its signals in flight and held on
the GPU until the gate opens, on every device and at any load. So each
of the three GPU-signal tests runs once, deterministic:
- the Event wait: the waiter reads Scheduled with the companion still 0,
its check read 0, no head awaited, its fill ran; printed: how long
after the signaller the waiter was scheduled (scheduled handlers);
- the SharedEvent wait detached in flight: companion 0 at the detach,
checked at 1 off the committing thread, a head awaited, code 8;
- the SharedEvent wait the host meets: checked at 0, then runs.
A run dropped with its gate closed (a failed assertion) opens it, so no
command buffer waits for good. The fills, FILL and ATTEMPTS are gone.
Verified: pending (20 runs on the RTX 5080 beside a second lane, lavapipe).
(cherry picked from commit 6739c5034582bd954406c63c7c1e26f01060af12)
irisperf-runs (1ba8aba840, f65c492f82): copy_from_host_ram and copy_to_host_ram take runs that
start on a 4-byte word and end at any byte; runs that are not whole pages copy by vkCmdCopyBuffer
regions between the chunk's import and the buffer (WorkCounts::host_ram_copy_regions), whole-page
runs keep the page-table kernel. Calls refused before (a laid-out device cache's row-cut runs,
reims-vgpu's downloads on the Iris) now copy, so the version is bumped. Re-pinned.
Verified (irisperf): Iris ms01 8389, host_ram_copy_device 10/10, negative control (whole pages
only) fails the new test; gem10 lavapipe host_ram 54/54 under nextest (8408), runtime clippy plain
and m2v_gpu (8420), signatures and refusal surface (8373). Iris 31.5 MB surface over 7703 runs:
no mappings (the page-view fallback made 7703, 15.5 ms of host work a download); GPU 14.0 ms by
regions against 9.9 ms for the view's blits.
The merged() unit test joined a row starting 2 bytes off a word, which
the new rule refuses (lavapipe, job m3-max-8373), and clippy's
single_range_in_vec_init flagged a one-run array. The touching rows now
start on words and the one-run case uses the one() helper.
(cherry picked from commit f65c492f82e4f6753b6b62d56aa2d92f61831513)
reims's laid-out device cache downloads hand copy_to_host_ram each texel
row's bytes (encode_out): runs that start on the device's linear texture
alignment, always a 4-byte word, and end at any byte, short of the row's
padding, which the guest's CPU owns. merged() refused every such run
(Problem::HostRam) and the consumer fell back to a view of the surface's
pages: on ANV one mapping per 4 KiB page, 278 of 294 device caches in
boot 8267.
Now a run starts on a 4-byte word and ends at any byte past it. Copies
whose runs are all whole 4 KiB pages keep the pages copy's one dispatch
per chunk, unchanged. Any other copy records each run's bytes in a chunk
as a region of vkCmdCopyBuffer between the import that holds them (whole
pages, imported as before) and the buffer: byte offsets and sizes, so no
other byte of the runs' pages is read or written. The regions of one
import are one command, at most 1024 each (MOST_REGIONS). A scatter whose
runs name a byte twice takes a round of commands per overlap, so no byte
is written by two regions of one command (VUID-vkCmdCopyBuffer-pRegions-12482),
the later run's bytes left; a buffer over host pages the runs overlap is
refused (VUID-vkCmdCopyBuffer-pRegions-00117). Counted in the new
WorkCounts::host_ram_copy_regions.
Tests: copy.rs's unit tests (word starts, any ends, rows that touch merge,
whole_pages, rounds); host_ram_copy_device's
runs_inside_pages_move_their_bytes_alone_and_leave_the_rest_of_their_pages
(2046-byte rows at a 2048 pitch from 16 bytes into a page, a run ending 2
bytes before a page's end, one across the first chunk's end, one of 3
bytes; pattern sentinels around them; gather into Shared and Private,
scatter back; 10 regions, no dispatch; twice-named bytes; the overlapping
buffer refused); the whole-page test now also asserts no regions; the
refusal test's cases off a word. host_ram_copy_bench gains the laid-out
download: a call a row, one call, and the view with a blit a row.
Docs: copy.rs module and both calls' API docs, Problem::HostRam,
docs/HOWTO.md, the runtime README; docs/REFUSALS.md regenerated and the
API signatures re-blessed (the new WorkCounts field).
(cherry picked from commit 1ba8aba84076208a1eccaf65dd4993058ed53431)
The lane's write-or-pass-beyond-the-usage test predicted in place from the verdicts alone; it now
follows the placement query's answers for the three usage sets (in_place_image.rs's module doc
states the tie order). On the 5080 at 1024-byte rows the render-target image is refused at the
pitch (Shadow(Refused(Pitch))), so the pass renders through its shadow, as the runtime chose.
Verified (pooledmove): 5080 c entry pm-usage-reach-1 (batch 8349) 3/3 in_place_textures incl.
the round 5ce ln02 failure; lavapipe 10/10 (8223); clippy cpuicd/gpu and rustdoc (8282).
The previous commit left one line of in_place_image.rs's module docs at 162 columns. Comment only.
Verified for the change before this one (8f0125351c), whose test this paragraph documents:
- RTX 5080 (b5080 c entry pooledmove-pm-usage-reach-1-042641, batch m3-max-8349): the three
in_place_textures tests passed. At a 1024-byte pitch the placement answers were: ShaderWrite
and RenderTarget Shadow(Refused(Pitch)), ShaderWrite InPlace, RenderTarget Shadow(Refused(Pitch));
the kernel wrote in place and the pass rendered through its shadow, as the test now expects. At
512 bytes all three were InPlace and both forms lay in place.
- lavapipe (msi, job m3-max-8223): in_place_textures 10 of 10; all three answers InPlace at both
pitches.
- Linux clippy (cpuicd, gpu) and rustdoc (um790, job m3-max-8282): clean.
(cherry picked from commit 411b2a66ffa1e51df16fb5801ad8fcacc771447f)
What: writes_and_passes_beyond_the_usage_reach_the_pages_where_their_checks_passed expected a pass
over a sampled-only texture over host pages in place wherever the check passed renders over the
class, and a kernel's writes wherever it passed writes. But the image in place takes one set of the
usages the texture lacks: the first the device makes it with, the most first, the storage usage
before the attachment usage (Device::in_place_plans' order). Where the device makes the image with
the storage usage and not with both, the texture takes the storage usage, and a pass renders
through a stand-in whatever the renders verdict. The test now asks the placement query for a
texture of the same shape declaring ShaderWrite and RenderTarget, ShaderWrite, and RenderTarget
(the verdicts for their accesses and the image's making up to the bind), and expects the kernel
in place where the first or second is InPlace, the pass where the first is, or the third with the
second not. It asserts the verdicts the query asked too, and prints the three answers.
in_place_image.rs's module docs name the order.
Why: on the RTX 5080 (dev round 5ce05e1908, b5080 entry m2v-orch-dv-ln02-034557, built at
8a974ab605) the pass over the 64x64 RGBA16Float texture at a 1024-byte pitch took the usage shadow
while Pointer renders, rows on lines, passed, after the kernel form of the same shape had written
in place with no shadow: the image took the storage usage.
Verified so far: cargo fmt only; the 5080 and lavapipe runs follow, printing the three answers.
(cherry picked from commit 8f0125351c88ff5f1b7a97fd33b5c0d2e1043027)
pooledmove (b9d2be92aa..4f81997bbe): a texture over a padding-unobserved buffer of the runtime's
pooled memory made before the pooled class's verdict takes a PendingMove and moves to its
DRM_FORMAT_MOD_LINEAR image at Metal's pitch at the first lone commit after the verdict passes,
through the host-page moves' path (WorkCounts::pooled_textures_moved_in_place,
pooled_texture_shadows_freed_after_move). Resolved one conflict in padding_unobserved.rs's module
doc by keeping both bullets (the Private-only bound and the moves). Re-pinned.
Verified (pooledmove, at 4f81997bbe on e659154063): Iris 8371 16/16, 93 caches made before the
check -> 65 moved in place, 28 shadows (as caches made after it); negative control 8379 fails
both new tests; M3 8342 40/40; lavapipe 8340 16/16; clippy cpuicd/gpu and rustdoc clean; 780M
8333 15/15 (no image at the pitch, unchanged).
The test held every cache made before the device's check answered to be a shadow. A cache whose
rows the device's own linear image lays out at their pitch lies in place on that image, which
takes no verdict: 45 of the 93 on lavapipe. The test now counts those first and holds the rest to
be shadows, with none at its pitch.
Verified: lavapipe on homelab-um870-1 (job m3-max-8234, at 290ba21c8c) failed with 'before the
check answered: 0 at their pitch, 48 shadows, where all 93 are shadows', the other lapses clear
(45 in place before and after, 0 moved); the rerun follows.
(cherry picked from commit 4f81997bbe9d067148b0d965ccd002b6b7e5bf7f)
clippy (mut_from_ref, --cfg m2v_cpu_icd and --cfg m2v_gpu) refused buffer_bytes, which took
&Buffer and returned &mut [u8]; the test now takes the slices inline, as the file's other tests do.
Verified: msi-laptop clippy in both configurations (job m3-max-8188) gave that error alone; the
rerun follows.
(cherry picked from commit f181ca061279317fab7cab82135d7a8ed0aa4154)
AliasCount and Device::pooled_move_image were pub(super) while the Image they name is private to
the texture module, which rustc warned of (private_interfaces); both are used only by the texture
module and its storage_form child, so they are private now.
Verified: the M3 build of the runtime and validation tests (job m3-max-8152) gave that warning
alone.
(cherry picked from commit 9f01a92463846b3f7e5f36d06db44a4a141ab179)
TexturePlacement::Pending: over the device's own memory, a texture made while the pooled check
is pending now moves to its image at Metal's pitch the same way (it no longer stays a shadow for
good). Texture::vk_image, docs/FAST-PATHS.md (row 41), docs/API.md (the shadow reasons over the
device's own memory) and docs/HOWTO.md (the padding-unobserved paragraph) say so, naming
WorkCounts::pooled_textures_moved_in_place and pooled_texture_shadows_freed_after_move.
API signatures: the two new WorkCounts fields (scripts/api-signatures/signatures.py --bless, two
lines added).
(cherry picked from commit 4c1beda492dcc4af16923df09724b7fbf0e7387a)
The padding-unobserved device test gains a texture of the guests' most common cache shape
(172x67 BGRA8Unorm at a 704-byte pitch, rendered) made on a device whose check has not run: a
shadow where the query answered Pending, a clear before the check in the buffer's rows; after the
check settled, the next command buffer (a blit that reads it) moves it exactly where a texture
made then is an image at its pitch (pooled_textures_moved_in_place and pooled_pitched_images one
each), its shadow freed (pooled_texture_shadows_freed_after_move), the blit reads the clear, a
later read takes no shadow copy, and a later clear reaches the rows with the bytes after the last
row kept.
The in-place lane gains device_caches_made_before_the_check_move_to_their_pitch_once_it_passes:
the 93 device caches of pooled_pitched_costs, declared, made before the check answered under the
validation layer, each cleared to its own value; once the check answered, the next command buffer
blits each and moves every one whose shape a cache made then takes at its pitch; each blit reads
its clear. Printed: POOLED-PITCHED-MOVE.
Verified so far: cargo fmt only; the device runs follow.
(cherry picked from commit 0e77ce528b7a2a68469039f91608450f26db0371)
What: a texture over a buffer of the device's pooled memory whose image at Metal's pitch (the
pooled class, PagesClass::Pooled) was pending when it was made is a shadow that now waits to move,
as a shadow over host pages does: storage_over_buffer sets its PendingMove (class Pooled), the
texture waits in StorageForms::moves, and once the class's verdicts pass, the next quiet commit's
switch makes the image the texture would have had (Device::pooled_move_image: the plans with the
feedback loop usage and the usage it lacks, then its own, through the same alias_image) and the
texture presents it from then on. A failed verdict leaves it a shadow; past the pooled bound it is
never pending (LinearCost comes first). The alias attempt over the device's own memory is one
function now (alias_over_device), used by the making and the move, and alias_image returns what
the image counts (AliasCount: pitched, unobserved padding, feedback loop) for the caller to count:
the making at once, a move as it moves in. Counted: WorkCounts::pooled_textures_moved_in_place
and pooled_texture_shadows_freed_after_move (the host-page counts stay host pages').
Also: the in-place check gives its verdicts to the waiting shadows before it settles, so a
settle_in_place_checks that answers true finds them waiting for the next quiet commit (it ran
after the settle, so a commit right after the wait could miss them).
Why: on the Iris Xe the check takes about 1.9 s after the device is made, and a guest's
WindowServer makes its device caches in that window; each stayed a shadow for good.
Verified so far: cargo fmt only; builds, tests and the Iris evidence follow.
(cherry picked from commit b9d2be92aa207b0b3f472869c6e922b1dc7068c7)
irisperf-sampled (d99c9c507b, cd89debcd7, 4327592cb5): the pooled bound (LinearCost, 48 KiB)
applies only to tracked textures over Private or memoryless buffers, where no CPU reads the
bytes; over Shared and Managed buffers, and untracked, a texture that samples, renders or is
written takes the DRM_FORMAT_MOD_LINEAR image at its pitch at any size where its check passed
(the owner's 2026-11-07 rule: CPU-visible memory in place, a shadow only as a correctness
fallback). Re-pinned the runtime sources.
Verified (irisperf): Iris on ms01 8357, padding_unobserved 4/4, negative control fails the new
test; pooled_sample_costs four 5 MB tiles a frame 464/428 us in place against 1000/833 as
shadows, 30 MB 2999/3127 against 6222/5705; gem10 8317 clippy (plain, m2v_gpu) and lavapipe
padding_unobserved 4/4.
The owner's 2026-11-07 ruling: over CPU-visible memory the GPU works in
place wherever the device's check passed, however much slower; a shadow
there is a correctness fallback, never a speed choice. The 48 KiB pooled
bound (LinearCost) chooses between two speeds where both forms give the
same answer, which holds only over bytes only the runtime's commands
write. So it now applies to tracked textures over Private buffers alone
(Texels::only_commands_write), for every access; over a Shared or Managed
buffer, and for an untracked texture, a texture that samples, renders or
is written takes the DRM_FORMAT_MOD_LINEAR image at its pitch at any size
wherever its check passed. This widens the previous commit's sample-only
exception. reims's histogram (boot 8203) shows no rendered cache past
48 KiB, so the render and write side changes nothing measured today.
The bound's doc comment, LinearCost's (internal and public) and
docs/API.md and docs/HOWTO.md now say so.
Test: a_texture_past_the_pooled_bound_is_a_shadow_of_its_linear_cost_over_private_memory_alone
replaces the rendered bound test and the previous commit's sampled one:
164x82 at 704-byte rows, past the bound, rendering and sample-only, over a
tracked Private buffer Shadow(LinearCost) and no pitched image where the
device makes such images, over a Shared buffer never LinearCost and the
pitched image where the pooled check of its access passed.
(cherry picked from commit cd89debcd731885e8045dc998252a08edc3dc60f)
The 48 KiB bound weighs a DRM_FORMAT_MOD_LINEAR image at Metal's pitch
against a shadow that renders into its own optimal image, or samples it
copied in once. A texture that only samples a Shared or Managed buffer's
bytes (or an untracked texture that only samples) has no such shadow: its
shadow is copied in whole at every command buffer that samples it, as the
CPU may have written the bytes. The guest's large device caches are
WebKit's tiles, about 5 MiB each, CPU-painted and only sampled; past the
bound each was a shadow re-copied in every command buffer.
Measured on the Iris Xe (ANV, Mesa 26.2.6; job m3-max-8243,
runtime_lane::pooled_draw_costs::pooled_sample_costs), a frame that
samples four such textures whole after the CPU wrote a texel of each,
GPU microseconds as shadows at the padded pitch against linear images at
the tight one: over Shared buffers 1308x512 (2.7 MB) 327.8/215.9,
1324x940 (5.0 MB) 802.2/380.1, 3648x2038 (30 MB) 5789.3/2601.6; over
Private buffers, whose shadows stand copied in once, 237.7/216.2,
404.4/409.4, 2028.1/2433.2. So the bound keeps covering textures that
render or are written, and those that only sample bytes only the
runtime's commands write (Texels::only_commands_write, the predicate a
shadow's standing uses).
Test: a_sampled_texture_past_the_pooled_bound_lies_in_place_over_bytes_the_cpu_writes
(164x82 at 704-byte rows, past the bound, sampled: over a Shared buffer a
pitched image where the pooled reads check passed and never
Shadow(LinearCost); over a Private buffer Shadow(LinearCost) where the
device makes such images).
(cherry picked from commit d99c9c507b00e7b1537257a7a2fddd18d9563e2f)
perdraw-13 (2e524e00b4) skips the moved-use comparison, pass-start reads and gathering for a
rebound draw whose patched uses lie inside those they replaced, counted in
WorkCounts::draws_moved_inside; uses_noted_covered no longer counts those draws, so counts move
and the version is bumped. Re-pinned the runtime sources.
Verified (perdraw): M3 8219 draws.10k -3.7% instructions, -4.4% ns per draw (-6.9% at
--threads 3), cost --check exit 0, MoltenVK suite 1849/1849; gem10 8232 lavapipe -4.5%
instructions, -10.3..-10.6% ns, runtime suite 1879/1879, clippy x5 and rustdoc exit 0 (its lane
failures are the format-query warning f6ca703353 fixed, absent from its base).
A rebound draw moved after calls that moved a buffer slot's offset alone
already patches its moved slots' uses in place and notes, adds to the
pass's reads and gathers those alone. Where the offset moves along the
buffer, as a guest's upload chunk is read draw after draw, each patched
use lies inside the bytes of the use it replaced (the last draw's at its
place), which the encoder's part, the pass's reads and the instance's
gathered uses hold already, or hold one covering it. Comparing and
noting it again changed nothing, but cost every such draw that walk.
Now binding::patch_buffer_uses answers, where it patched, whether each
patched use equals or lies inside (Use::covers) the one it replaced. A
draw narrowed whose patched uses all do is inside: EncoderCore::note_moved
checks the noted state as before (NotedApart::moves), observes fresh
reads and holds what was made resident as before, then compares and
records none of the moved uses and keeps the covering ones (counted as
the new WorkCounts::draws_moved_inside, and not in uses_noted_covered);
record_rebound adds nothing to the pass's reads and gathers nothing. The
attachments' and geometry writes' checks of the moved uses are unchanged.
Builds with debug assertions check, for each draw inside, that the
noted kept uses cover the moved ones (NotedApart::covers_at), and that
adding them to the pass's reads or the instance's gathered uses changes
neither. New test draws_moved_along_their_buffer_note_nothing_again:
draws moved along the vertex buffer are each inside, with the same
commands, state commands and pixels as every step, and every step's
covered count equal to the rebound run's plus the draws inside.
command_counts lists draws_moved_inside. api_signatures re-blessed.
Verified: pending (A/B on the M3 and lavapipe, suites, cost --check).
(cherry picked from commit 2e524e00b4a50f175a5df59ef1ac1b667e30b091)
The notice names the command buffer whose work announced it; no cached answer or work count
moves, so RUNTIME_VERSION stays. Verified (cbnotice): M3 MoltenVK job 8280, 24 touched tests
pass, four negative controls each fail at their assertion; lavapipe and clippy on gem10 (8283)
follow post-merge.
A loop's check (command_buffer/rerun.rs) records the work its laying left
apart again as a host step on a thread of its own, through exit_guard::host_step
directly, not CommandBufferShared::host_step: its notices named no command
buffer. LoopCheck::record holds the command buffer; it now names it there.
Found by reading every exit_guard::host_step caller after the first tip.
(cherry picked from commit 685b8f9a50beee8f6dff63700a5fa1c91fdbcd02)
Its literal in shader_cache/store.rs missed the new field (E0063 on the first
build, job m3-max-8227). The notice is the shader cache directory's, which
names no call either: None.
Verified: the lavapipe build of the runtime crate failed on exactly this; the
rerun follows.
(cherry picked from commit ba95f86a059201d1992074c36378718a2c5b311c)
A consumer that makes some notices fatal (reims-vgpu's ReleasedCommandState,
PrivateResourceOption, HostDeallocatorDelayed) could not tell which command
buffer a notice was about: a ReleasedCommandState announced at a host step on
the scheduler's steps thread ended its whole VM. Now every notice carries the
ID of the command buffer whose work the runtime was doing on the announcing
thread, so the consumer can fail that one command buffer.
What changed:
- CommandBuffer::object_id: an ObjectId, minted at the command buffer's
making from the process-wide count buffers, textures and heaps use.
- DegradeNotice::command_buffer: Option<ObjectId>, read at the notice's making
from a thread-local scope (degradation::NoticesFor), as `call` reads the
call being lowered. The scope is set where the runtime holds the command
buffer and does its work: the compute and blit encoders' logged funnels and
their other recording calls and ends, the render lowering's at-call funnel,
its unit calls, its batches' lowering (on the lowering thread or a drain)
and its end, the resource state encoder's calls, encoder openings, the
commit (at the call or queued behind a render end), a batch's submission and
the storage-form settle that rides on it, host steps, a rebind's encoding
again, and GPU-time reads. Nested scopes name the innermost.
- None, explicitly, for a recovery of the device (device-recovered), for
grouped-completion (several command buffers' batches), and inside the
program's code the runtime calls (exit_guard::program, indirect command
checks, executed-commands handlers).
- A bind's memoized notices, announced again at each later bind under
announce_each, are named as that bind's: its command buffer and the call
being lowered (the call was the first bind's before; same mechanism).
- ObjectId docs, docs/API.md section 9, docs/RUNTIME-PORTING.md; API
signatures re-blessed (two records: the field and the method).
Tests (runtime crate, device tests):
- notice_command_buffers: an ICB execution recorded at a host step announces
released-command-state on the steps thread naming the executing command
buffer; its commit's host-replayed-indirect-commands, on the program's
thread, names it too; private-resource-option of an ICB made between the
encoder's calls names none.
- deferred_calls: the call-naming test also checks the command buffer under
both lowering policies; a new test waits for the lowering thread to announce
unsized-points after end_encoding and checks the thread, call and command
buffer, and that a device notice between the encoder's calls names none.
- vertex_conversion_notices: a memoized bind notice (device-nan-encoding)
announced at a second command buffer's draw names that command buffer and
its own call index, with bound_notices_made proving the memo was reused.
(cherry picked from commit b4c2ba83ea726229f129a405ce6f432b0bdb0127)
The pooled bound fell from 256 to 48 KiB (23f2986689): a drawn device cache over the
runtime's Private pooled memory between 48 and 256 KiB is a shadow again, as it runs faster
there on the Iris Xe at a frame's draws. Both forms give the same answer over device-only
memory, so it is a speed choice and no ledger row; the bump keeps cached answers from the
older bound apart. Re-pinned the runtime sources.
Verified (irisperf): Iris on ms01, job 8244, padding_unobserved 4/4 at the tip, negative
control with the bound at 256 KiB fails the new test; gem10 8179 clippy (plain and m2v_gpu)
and lavapipe padding_unobserved 4/4.
Shader-read textures over Shared buffers the CPU writes each frame and over Private ones: a
common small device cache, a browser's tile and window and the desktop, at a padded pitch (past
the pooled bound a LinearCost shadow, which copies in each command buffer over a CPU-mapped
buffer) and at their tight rows (the device's own linear image, in place at any size).
(cherry picked from commit 01857779731081a06edca3efb4ec12150893110a)
The guest window server's 3662x2038 device cache at 14848-byte rows lies past the pooled bound, so
it stays a shadow, whose copy back runs at the end of every encoder that writes it. One command
buffer a frame of 1, 8 or 30 passes, each its own encoder of three blended 600x400 draws (with
and without scissors), then a draw that reads it whole; over a private texture, the declared and
undeclared 3662 caches and a declared 3648x2038 one.
(cherry picked from commit 6fd2951c41f95f240451e42f1a93bcf8b3a2f8cb)
The pooled bound (TextureShadowReason::LinearCost, 256 KiB) came from a sweep whose frame clears
each cache and reads it once, with no draw into it; on the Iris Xe a linear image renders about 5x
slower than a tiled one (fill_target_costs), so the crossover may move with the draws a cache
takes. Four caches of each of nine shapes (the consumer's three most common, 23-47 KB, and the
sweep's up to 1.36 MB), 0, 1, 4 and 16 blended whole-cache draws a frame each, as shadows and in
place at their pitch.
(cherry picked from commit 901e24c1e1e2161598ff0bbafbf9c98a92261993)
The bound (TextureShadowReason::LinearCost) came from a sweep whose frame cleared each cache and
read it once, drawing nothing into it: there the crossover lay at 256 KB. A draw into a linear
image costs about 270 picoseconds a pixel on the Iris Xe against 74 into the shadow's optimal
image, whatever the size, so the crossover falls with the draws a frame makes: with one whole
draw a frame it lies between 47 and 128 KB, and with four or more the shadow wins at every size
measured (runtime_lane::pooled_draw_costs, ms01 job m3-max-8151; the table is in the bound's
comment). 48 KiB keeps the consumer's three most common device caches (104x52, 136x68 and 172x67,
23-47 KB) in place.
The pitched-image test's 3662-wide cache is 3 rows, not 9, so it stays inside the bound; a new
device test makes a 47,168-byte cache and a 57,728-byte one: the second takes no pitched image
and, where the first took one, answers Shadow(LinearCost) and counts as a shadow.
(cherry picked from commit 23f2986689836c8e1160c6ba14dcfdc38dbf09fd)
identities_with (eb9ae5b139, ff59770ed3) lists every physical device's identity without making a
device, and registry_ids_with and system_default_identity_with now answer from it; their answers are
unchanged, so RUNTIME_VERSION stays. Verified by holds: device_registry tests on lavapipe (um790 8130)
and the M3 (8142), api_signatures and rustdoc clean; the exit_guard test's clippy fix (75f7145da0)
clean on um790 (8141).
The field's doc said what a discrete or unified-memory GPU's heap is without a measurement. It now
gives the one measured: the M3 Max's DEVICE_LOCAL heap under MoltenVK 1.4.2 is 68,719,476,736
bytes (the host's 64 GiB), where Metal's recommendedMaxWorkingSetSize on the same machine is
55,662,788,608 (the value capabilities.rs's maxBufferLength doc already cites).
Verified: every_listed_identity_is_read_with_no_device_made_and_is_its_device_s_own printed the
identity on m3-max (job m3-max-8142, cfg m2v_gpu): recommended_max_working_set_size
Some(68719476736). Doc text only.
(cherry picked from commit dd298c4f23537878640e037cfabaf69c8cae6f7b)
reims picks the physical device itself on multi-GPU hosts (Device::with_registry_id), and to
learn each candidate's registry ID it copied the crate-private properties::registry_id fold
behind a drift test. This gives it a public answer instead.
- Device::identities_with(&DeviceOptions) lists the PhysicalDeviceIdentity of every physical
device registry_ids_with lists, in its order, read without making any device, through the same
instance rule (the live group's instance, else one made for the call). registry_ids_with and
system_default_identity_with now answer from it (its registry IDs; its first identity), so the
three share one path instead of holding copies of the lock, ranking and identification.
- PhysicalDeviceIdentity gains recommended_max_working_set_size: the size of the physical
device's largest DEVICE_LOCAL heap, the one read that already bounds maxBufferLength. Its doc
says how it differs from Metal's recommendedMaxWorkingSetSize (an estimate of what the GPU can
use without hurting performance, where this is the heap's whole size, with no budget taken
off), and that no device property answers it.
- The registry ID stays the fold the device answers (Device::registry_id).
Test: every_listed_identity_is_read_with_no_device_made_and_is_its_device_s_own checks that
identities_with makes no device, that its registry IDs equal registry_ids_with's and its first
identity system_default_identity_with's, and that each listed physical device's device (made by
with_registry_id) answers its registry ID, UUID, name, kind, IDs, version, bus and render node,
with maxBufferLength within three quarters of the heap.
api_signatures re-blessed; REFUSALS.md regenerated (unchanged); the runtime README names the call.
(cherry picked from commit 667a097228e7b267e15f76d1d5983de5c6d3c0c7)
clippy's cloned_ref_to_slice_refs (-D warnings) refused the_sections_in_progress_name_where_they_began's
[here.clone()], which edee4b4963 (landed as f5da0934bf) added: development's clippy with
--all-targets failed on it. std::slice::from_ref(&here) compares the same one-element list.
Verified: cargo clippy -p metal2vulkan-runtime --all-targets --all-features -D warnings on
homelab-um790 (lavapipe cfg) failed on the line before this change; the run after it is in the
report.
(cherry picked from commit a9584bbb39ebc545cb7571b8f6caf13da8a24743)
f6ca703353 chains VkExternalImageFormatProperties only into the queries that name a handle type; the
pooled class's own-memory queries got no properties from it before either (the driver left them
untouched), so every answer is the same and RUNTIME_VERSION stays. It removes the validation layer's
WARNING-vkGetPhysicalDeviceImageFormatProperties2-missing-external-info that failed 43 lavapipe lane
tests in round 5ce05e1908 (pooledmove, um870 8135); their rerun is pending.