Commit Graph
2551 Commits
Author SHA1 Message Date
Anees Iqbal 642873f4e8 Pooled moves: the move's helpers private to the texture module
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)
2026-11-08 05:22:32 -08:00
Anees Iqbal 016c09572a Pooled moves: docs and API signatures
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)
2026-11-08 05:22:32 -08:00
Anees Iqbal 10ef687dcb Pooled moves: a device test and a lane of the guest's device caches made before the check
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)
2026-11-08 05:22:31 -08:00
Anees Iqbal abcb381c02 Pooled class: a texture made before the pooled check's verdict moves to its image at Metal's pitch once it passes
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)
2026-11-08 05:22:16 -08:00
Anees Iqbal bdcc1b62d7 RUNTIME_VERSION 1887: textures over CPU-visible device caches lie in place at any size
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.
2026-11-08 05:21:43 -08:00
Anees Iqbal 3bdce20ed7 Pooled bound test: its verdict line within 100 columns
(cherry picked from commit 4327592cb567d11e3b02df9cc4076195cb8f9840)
2026-11-08 05:20:54 -08:00
Anees Iqbal 535f50063f Pooled bound over tracked Private buffers alone: CPU-visible caches lie in place at any size
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)
2026-11-08 05:20:54 -08:00
Anees Iqbal f8caa83975 Pooled bound: a texture that only samples bytes the CPU writes lies in place at any size
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)
2026-11-08 05:20:54 -08:00
Anees Iqbal 2332605efc RUNTIME_VERSION 1886: a draw moved along its buffer notes, reads and gathers nothing again
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).
2026-11-08 05:08:05 -08:00
Anees Iqbal fd7fecced1 A draw moved along its buffer notes, reads and gathers nothing again
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)
2026-11-08 05:07:13 -08:00
Anees Iqbal e659154063 Re-pin the runtime sources after DegradeNotice::command_buffer, which changes no answer
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.
2026-11-08 04:46:05 -08:00
Anees Iqbal 98c412b6aa DegradeNotice::command_buffer: a predicated loop's run again names its command buffer
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)
2026-11-08 04:45:15 -08:00
Anees Iqbal 318963d8fa DegradeNotice::command_buffer: the shader cache's write-failure notice names none
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)
2026-11-08 04:45:15 -08:00
Anees Iqbal 48caeeb155 DegradeNotice::command_buffer: the command buffer whose work announced a notice
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)
2026-11-08 04:45:15 -08:00
Anees Iqbal d5e57f1548 RUNTIME_VERSION 1885: pooled textures past 48 KiB of rows stay shadows
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.
2026-11-08 04:37:05 -08:00
Anees Iqbal 50d7d5ff0c pooled_sample_costs: a tile 1308 texels wide, so its tight rows are a pitch Metal takes (a multiple of 16 bytes)
(cherry picked from commit fcb002d439c4f578b31a109fbc9f45a3a53be2c1)
2026-11-08 04:36:18 -08:00
Anees Iqbal e452fe75ce Lane: pooled_sample_costs weighs caches a frame only samples, shadow against in place
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)
2026-11-08 04:36:18 -08:00
Anees Iqbal 5db4b09d0e Lane: pooled_surface_costs weighs the desktop device cache's passes as a shadow
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)
2026-11-08 04:36:18 -08:00
Anees Iqbal 1697e5e16a Lane: pooled_draw_costs weighs the pooled bound against a frame's draws into each cache
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)
2026-11-08 04:36:18 -08:00
Anees Iqbal 83e621172a Pooled bound: 48 KiB, past which a drawn cache runs faster as a shadow
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)
2026-11-08 04:36:18 -08:00
Anees Iqbal 6690e899f2 Re-pin the runtime sources after Device::identities_with, which changes no answer
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).
2026-11-08 04:06:00 -08:00
Anees Iqbal ff59770ed3 PhysicalDeviceIdentity::recommended_max_working_set_size: the M3 Max's measured heap beside Metal's working set
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)
2026-11-08 04:05:26 -08:00
Anees Iqbal eb9ae5b139 Device::identities_with: every listed physical device's identity, with its largest device-local heap
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)
2026-11-08 04:05:26 -08:00
Anees Iqbal 75f7145da0 exit_guard test: compare the places with a slice of the one place, not a clone
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)
2026-11-08 04:05:26 -08:00
Anees Iqbal 8837ed9aa0 Re-pin the runtime sources after the pooled class's format query fix, which changes no answer
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.
2026-11-08 04:00:30 -08:00
Anees Iqbal f6ca703353 Pooled class: ask a DRM_FORMAT_MOD_LINEAR image's import properties only beside the handle type they answer for
What: modifier_image_limits chained VkExternalImageFormatProperties into every query, but since
the pooled class (ModifierMemory::Own, 99f47fb7e8) it asks some without
VkPhysicalDeviceExternalImageFormatInfo: the driver then leaves those properties untouched, and
the validation layer warns (WARNING-vkGetPhysicalDeviceImageFormatProperties2-missing-external-
info). It now chains them only where it names a handle type, the dma-buf and host allocation
queries, and reads them only there, as before.

Why: on lavapipe every validated device that runs the in-place check asks the pooled class's
query, so 32 lane tests (43 failure lines) of dev 5ce05e1908's lavapipe leg failed their layer
claim on this warning (no_copy_textures, in_place_textures, dma_buf_imports, device_copies,
first_use_writes, linear_alignments, pitched_surfaces).

Verified: at 5ce05e1908 on lavapipe (homelab-um870-1, job m3-max-8135), the lane's
a_texture_made_before_its_verdict_moves_in_place_once_it_passes failed with ten of this warning
and nothing else; the reruns at this commit follow in the tip's report.

(cherry picked from commit d0df1fe68e76ede86d9987d16aad69d3375cfac6)
2026-11-08 04:00:13 -08:00
Anees Iqbal 80f636a5d9 Re-pin the runtime sources after the lock-free bind state, which changes no behaviour
perdraw-12 (75e5e5def1): a render draw reaches its bind state as a borrow beside its lowering instead of
cloning an Arc<Mutex<LiveBind>> and locking it each draw; the work counts are equal on both sides, so
RUNTIME_VERSION stays. Per draw (draws.10k, release): M3 instructions 5159 -> 5052 (-2.05%), ns -2.9%;
gem10 lavapipe instructions flat, ns -3.9% plain and -6.3% with --heap. Verified by perdraw: M3 cost
--check 0 (no gated bound moved) and MoltenVK suite 1845/1845 (8076); lavapipe runtime suite 1875/1875,
validation runtime lanes 1916/1916, clippy x3 and rustdoc (gem10 8073).
2026-11-08 03:55:54 -08:00
Anees Iqbal 75e5e5def1 Render draws reach their bind state with no Arc clone and no lock
Every render draw cloned the encoder's Arc<Mutex<LiveBind>> and locked it:
two atomic counts and a lock and unlock per draw, there only so that a draw
could hold the bind state while it called the lowering's other methods. On
draws.10k the clone, lock, unlock and drop were about 28% of draw_rebound's
own samples (a line-level profile on gem10), and a probe that reached the
state with neither cut about 104 instructions a draw on the M3 (-2.0%).

The bind state now lies beside the lowering instead of inside it: Lowering
holds the boxed RenderLowering and the boxed LiveBind, derefs to the lowering
for every other call, and hands a draw both as two borrows (Lowering::parts,
RenderCommandEncoder::draw_at_call). The draw path takes the state as a
parameter: the lowering's draw entry points, draw, draw_again, draw_rebound,
draw_resident, the extended shadows' re-recording, the execution replays and
their settles. Ending the encoder gives the state back to the device
(Lowering::ending); SpareLiveBinds keeps the boxes, so an encoder's open and
end still move and allocate none. An execution's encoders, and its chunks
recorded apart, carry their bind state beside the encoder as before.

Verified: pending (build, clippy, A/B on the M3 and lavapipe, suites).
(cherry picked from commit 7692b71ca46440c42ead3f3b1061428559ba85d5)
2026-11-08 03:55:35 -08:00
Anees Iqbal 8a974ab605 Re-bless the authored compile census at 5ce05e1908
Its product fingerprint follows development's versions at 5ce05e1908. Blessed on the
M3 (s37-pl.sh censusbless --bless, dv-m3).

(cherry picked from commit 9e61c5d2f10c45b53d8943725f6bed7f9a62b9e0)
2026-11-08 03:42:42 -08:00
Anees Iqbal 43c7dd3adf Bump RUNTIME_VERSION to 1884: a device's teardown racing the exit leaves the device to the process's end
holds-exit: a device whose last reference drops on a handler thread while the program exits was torn
down in full under the exit hook, and vkDestroyDevice (the validation layer, then NVIDIA) took 0.3-2.6 s
on the 5080, past the hook's 2 s bound (round 9bd38c7994 lane 10, handler_learns_exit 2.08 s). The
teardown now checks the guard before its wait for idle, its pipeline caches and memory, and
vkDestroyDevice, and once the exit has closed it leaves the rest to the process's end; with no exit
racing it nothing changes. Past half its bound the hook now names where the sections it waits for
began. Verified by holds on the 5080 (holds-exit-3, 60 runs each): exit median/p90/max 478/932/1130 ->
206/411/590 ms, exits of 500 ms or more 29 -> 1, hook wait 0.17-1.03 s -> 1-7.5 ms; tests::exit_guard
46/46 on gem10 (8041).
2026-11-08 03:42:42 -08:00
Anees Iqbal df2d326289 A device's teardown leaves the device to the process's end at its next step once the exit began
runtime_lane::exits::exits_right_after_learning_of_completion_are_clean failed on the RTX 5080
in lane 10 of development's round at 9bd38c7994: handler_learns_exit's exit took 2.08 s, against
the lane's EXIT_LIMIT of 1.5 s. In that case the program drops its device while a command buffer
is in flight, then exits once the command buffer's completed handler has run. The device's last
reference goes on the handler thread, so its teardown (DeviceShared::drop, one section of the
exit guard) runs while the program's exit begins, and the exit's hook waits for that section.

Each step of that teardown was timed in a scratch build (b5080 entry holds-exit-2, beside another
process's lane on the GPU). vkDestroyDevice, through the validation layer into NVIDIA's driver,
took 0.3 to 2.6 s; every other step took under 0.25 s in all. 86 of the 120 exits ran past the
hook's 2 s bound and ended at once. In each stack taken 1.2 s after the child's last line, the
teardown's thread was in vkDestroyDevice. The same tail showed with 47174c4775 (the queue-switch
check's round hold) reverted: entry holds-exit-1, 30 exits a tree, the two trees' exits in the
same two modes (about 25 ms, and 150 to 250 ms with a tail to 0.6 and 0.95 s).

The teardown now reads the guard at three points: before its wait for idle, before its pipeline
caches and memory go, and before vkDestroyDevice. Once the exit has closed the guard, the device,
its objects and its memory are left to the process's end, as where the exit began before the
teardown, so the exit waits for no more than the teardown's step in progress. A teardown that no
exit races is unchanged. exit_guard's module docs ("Once closed", BOUND), the teardown's comments
and docs/API.md's process-exit difference say so.

Verified, RTX 5080 Laptop GPU, b5080 entry holds-exit-3 (a shared batch). Runtime_lane::
framebuffer_fetch looped beside on the GPU. handler_learns_exit's child ran as the lane runs it,
alternating two builds 60 times each: development dc064aec27 with the step timings, and the same
with this change. Each exit was measured as the lane measures it, less the exiting thread's wait
for a CPU:

                              before (dc064aec27)   this change
    teardown on the handler   43 of 60              41 of 60
    left at wait-for-idle     -                     41 of 41
    hook's wait (handler)     0.17 to 1.03 s        1 to 7.5 ms
    exit, median              478 ms                206 ms
    exit, 90th percentile     932 ms                411 ms
    exit, longest             1130 ms               590 ms
    exits of 500 ms or more   29                    1
    exits of 1 s or more      2                     0

- With this change, an exit whose teardown ran on the handler still takes 0.17 to 0.59 s past the
  hook. That time is in the exit handlers registered before the hook's last registration (the
  driver's and the layer's), with the device left to them. Before, that remainder was 24 to
  138 ms.
- exit_guard's unit tests passed 46 of 46 (homelab-gem10-1, m3-max-8041).
Not run before this commit: the exits lane whole (development's round runs it), and the change
beside the heavier GPU load of holds-exit-2 (queued: holds-exit-4).

(cherry picked from commit 4ee7b0934a7e2db25b2262cf9c03d84313336be3)
2026-11-08 03:41:48 -08:00
Anees Iqbal f5da0934bf exit_guard: past half its bound, the hook names where the sections it waits for began
An exit that waited for the runtime's work said nothing about what it waited for until its bound
ran out, and then only that the driver still ran it (the at-once notice). An exits-lane exit
that took 2.08 s on the RTX 5080 (runtime_lane::exits, handler_learns_exit, development
9bd38c7994) left no sign of the call it waited for.

Each thread's outermost section now keeps its caller's place while it lasts (Guard::places, a
slot of 64 each, Location::caller through the #[track_caller] doors: enter, Guard::enter,
Guard::enter_making, driver_making, and so release::object's caller). Once its wait has passed
half its bound, Guard::close says on standard error, once: "metal2vulkan: the exit has waited N ms
for M section(s) of the runtime's Vulkan work, begun at: file:line, ...". A section that begins
while every slot is taken goes unnamed. exit_guard's module docs and docs/API.md's process-exit
difference say so.

Tests:
- tests::exit_guard::the_sections_in_progress_name_where_they_began: an outer section's place
  is named, a nested section's is not, another thread's section is named with its own place,
  and an ended section is gone.
- a_busy_exit_past_the_bound_ends_at_once_with_its_status now reads the naming line before the
  notice for a section in progress, and no such line for a CPU device's work.

Verified: tests::exit_guard on homelab-gem10-1 (plain build), m3-max-8041: 46 of 46 passed.
(cherry picked from commit edee4b49637eddd2f6f2daf83ce2b2246b9fc6a5)
2026-11-08 03:41:48 -08:00
Anees Iqbal 5ce05e1908 Bump RUNTIME_VERSION to 1883: a padding-unobserved buffer's texture lies in place at its own pitch where the device takes a pitched linear modifier
inplace-modifier: where the device enables VK_EXT_image_drm_format_modifier and its natural linear image
misses the buffer's pitch, a texture over a padding-unobserved buffer of the runtime's own memory is a
DRM_FORMAT_MOD_LINEAR image with an explicit row pitch at the buffer's, judged by a new pooled-memory
check class (the first move from UNDEFINED, as for host pages) and Access::UnobservedRenders (a render
round that changed only its rows' own padding); past 256 KiB it stays a shadow
(TextureShadowReason::LinearCost: a linear image renders and samples slower there, Iris sweep 7957).
Private buffers count lines from their memory object's offset. CHECK_VERSION 11, 56 verdicts. New:
WorkCounts::pooled_pitched_images. Verified by inplace on the Iris (ms01 8057): reims's 93-cache mix
86 in place / 7 shadows (the 7 past the bound), median frame 4137-4140 -> 3823-3840 us (-7.2..-7.6%);
device and unit tests 18/18; negative controls 7965 and 8028 gave 0 of 93. M3 43/43 (8058). The 780M
is unchanged (RADV refuses the modifier off a 256 multiple, sweep 7949). Clippy, rustdoc and the Linux
suites run on development after the merge.
2026-11-08 03:30:55 -08:00
Anees Iqbal 048c919248 In place: a Private buffer's texels lie in the device's lines from their offset in their memory object
Texels::rows and Texels::padding answered InLines and Kept for any buffer the CPU does not address,
so a texture over a Private buffer that declares its padding unobserved asked the strict Renders
verdict, which the Iris Xe fails for rows ending mid-line: the pooled_pitched_costs lane (Private
buffers, as the consumer's device caches are) made 0 of 93 caches in place at a8b823e90e/c92b83ba5d
(job 8028) while the Shared buffers of the padding_unobserved device test went in place.

A buffer of the runtime's own memory now counts its lines from its offset in its VkDeviceMemory
(Buffer::memory): a VkMappedMemoryRange's offset is a multiple of nonCoherentAtomSize from the
memory object's start, and the runtime maps each block from 0, so a Shared buffer's address and
that offset agree modulo a line. Only a buffer over the caller's VkBuffer stays InLines and Kept.
Product effect: Private pooled buffers' textures (the only ones without contents that reach the
in-place verdicts) take the verdicts of their real row ends and padding.

(cherry picked from commit c5a9b1db0a292cb8d83f8bc7a7ebf05864bdd589)
2026-11-08 03:29:52 -08:00
Anees Iqbal ef00ba1b1d Pooled class: the bound's comment cites the Iris sweep's crossover and RADV's refusal
The Iris Xe sweep (job 7957, four textures each, a frame's clear-and-store pass and a draw reading
each): 47-166 KB textures run faster in place, 256 KB alike, 530 KB and up slower, so the bound
stays 256 KiB. The Radeon 780M sweep (job 7949) found RADV refusing DRM_FORMAT_MOD_LINEAR images at
pitches off a multiple of 256 bytes (ERROR_INVALID_DRM_FORMAT_MODIFIER_PLANE_LAYOUT_EXT) for every
such shape, and its own linear image already aliases at those multiples: no crossover there, and
no texture on it takes a pitched image. Comment only.

(cherry picked from commit f9f354681b85527402b10f94d41841587b3ad181)
2026-11-08 03:29:51 -08:00
Anees Iqbal dd55a623b7 In-place check test: the 172x67 shape makes nine of the check's shapes whose texels share a 64-byte line
The assertion counted eight (its comment said six, stale since the four shapes at a driver's own
pitch were added); 2ff1e3e39a added the 172x67 shape at a 704-byte pitch, whose rows end inside a
line. Verified: M3 job 8008 failed this test alone (left (7, 9), right (7, 8)) among 42.

(cherry picked from commit 5ce0f7f80f09350726f04c5f060e61f11025057a)
2026-11-08 03:29:51 -08:00
Anees Iqbal 7e5821d9d1 In place: renders over padding a buffer declares unobserved take a verdict that lets that padding change (Access::UnobservedRenders)
What: a new check access, UnobservedRenders, that the renders rounds answer beside Renders, as the
storage-write rounds answer BufferWrites beside Writes. Where a shape's rows' padding is free
(Shape::padding), a renders round that changed no byte but of that padding (after a row's last
texel, before its pitch, the last row's included) fails Renders for its row ends and keeps
UnobservedRenders. A byte past the last row's pitch, or a texel, fails both. A new Padding variant,
Unobserved (Free padding over a buffer that declares padding_unobserved, Texels::padding), makes
in_place() ask UnobservedRenders in the stead of Renders (Access::rendered); the wider render-target
plan of an image in place asks the same. The check's SHAPES gain 172x67 BGRA8 at a 704-byte pitch,
whose last row's pitch ends 64 bytes past a multiple of 128 and 256, so a device that writes back
more than a line around a row's last texels changes a byte past the image and fails both.
VERDICTS 48 -> 56 (7 accesses), the record 56 bytes; CHECK_VERSION stays 11 (unlanded).

Why: on the Iris Xe (job 7965 at c4eeeba7e8), the pooled class's Renders verdict failed for rows
ending mid-line (the clear and store, and draws, write back the 64-byte line holding a row's last
texels whole), so none of the 93 device caches went in place (93 shadows, frame 4145 us declared
and undeclared alike), and the item's case (a padding-unobserved texture at a 64-aligned pitch, rows
ending mid-line, rendered) stayed a shadow (CheckFailed{Renders, InLines}). The declaration already
lets a render pass's load and store write those bytes; no byte past the last row's pitch may change,
and Padding::of guarantees the last row's pitch ends on a line.

Also: a padding-unobserved buffer in fresh pages takes the same rule; BufferDescriptor's doc says so.

Tests: unit cases for the compare (the line write-back of each row's padding is Padded; a 128-byte
write-back past the last row's pitch, a byte past it or a texel is Changed), Padding::declared, the
tally (Renders answers two), the decision test over Unobserved padding, the shadow-cause words; the
device test asks the UnobservedRenders verdict and asserts the texels' padding is Unobserved. Device
evidence follows on the Iris.

(cherry picked from commit 990d744ec71269663e292c7f2f3e4148d166bacb)
2026-11-08 03:29:51 -08:00
Anees Iqbal 9aece0574f Validation lane: the device caches' frame cost as shadows and in place at their pitch (pooled_pitched_costs)
A guest's device caches on the Iris Xe (eight of its most common small shapes at their counts
and its large ones, 93 textures that render over Private buffers) over buffers that declare
their padding unobserved and over ones that do not, the check settled under the in-place
policy: each form's caches in place and as shadows and its frame GPU time, one command buffer a
frame clearing every cache and reading each whole.

Verified: cargo fmt; runs follow.
(cherry picked from commit 9e1d61c34408c297c937836386f314e95084f504)
2026-11-08 03:29:51 -08:00
Anees Iqbal 6717cac4ea Pooled class: a bound in bytes past which a texture over pooled memory stays a shadow (TextureShadowReason::LinearCost)
Measured on the Iris Xe (probe 7933): a small cache's shadow costs a fixed 3.5-4.3 us a
command buffer that writes it, which a linear image at Metal's pitch saves, while caches of
1.4 MB and more render and sample 8-18% slower as linear images than as shadows with their
copies. Over Private memory both forms give the same answer (no CPU reads the bytes, the check
judges the first move), so this chooses between two speeds and takes no FAST-PATHS row or
switch. in_place::POOLED_PITCHED_BYTES bounds a texture's rows to their pitch, the same on every
device; past it the cause is ShadowCause::LinearCost, which the placement query answers as the
new public TextureShadowReason::LinearCost { bytes } through the shared route. docs/API.md (the
padding-unobserved reason) and HOWTO say why.

The bound's value here (256 KiB) is provisional: the size sweep on the Iris and the 780M places
it at the measured crossover in a following commit.

Verified: cargo fmt; api signatures re-blessed (one variant added); REFUSALS.md regenerates
unchanged; builds follow.

(cherry picked from commit 366e098c15c7227006ba7633ecda574da224690e)
2026-11-08 03:29:51 -08:00
Anees Iqbal 85bf1ef03d Narrow writes device test: count the narrow report lines from the classes, not a fixed three
The pooled class adds four narrow lines (two accesses, two row ends). Correction to
44fa96d151's message: WorkCounts is not #[non_exhaustive], so a consumer building it with a
struct literal breaks on the new field; its docs say it is for the lanes, not part of the API.

Verified: the M3 run 7901 failed here (16 lines, asserted 12); rerun follows.
(cherry picked from commit f430e4a52279d588cf73cbf2b89bb52a69d997dc)
2026-11-08 03:29:51 -08:00
Anees Iqbal e7ca3efeda API signatures: WorkCounts::pooled_pitched_images
A new public counter field; nothing breaks for a consumer (WorkCounts is non-exhaustive to
construct). Verified: scripts/api-signatures/signatures.py --bless, one line added.

(cherry picked from commit 1b18926fc7ad570e0cb075d767a3716a2addd413)
2026-11-08 03:29:51 -08:00
Anees Iqbal 703eca0dba Pooled class: tests and docs
The padding-unobserved device test settles the check and holds the answer to the making's
(NotHostPages exactly where the texture aliases, else the shadow's cause); a new device test
renders textures of the guests' cache shapes (64-aligned pitches, rows ending inside a 64-byte
line) over declared buffers and checks that a pitched image appears only where the pooled
class passed for reads and renders, that the CPU's texels read back through the texture, that a
clear reaches the buffer's rows, and that the bytes after the last row keep the CPU's. The
validation lane reads 48 verdicts. Docs: in_place.rs and in_place_check.rs module docs,
FAST-PATHS row 41, API.md (placement answers, the shadow reasons), HOWTO's padding-unobserved
paragraph, the runtime README, BufferDescriptor::padding_unobserved, TexturePlacement's
NotHostPages and Pending (a pooled texture made before its verdicts stays a shadow).

Verified: cargo fmt only; builds and the device runs follow.
(cherry picked from commit ae31d0fd3841b136c692897cbdf425633e9344c3)
2026-11-08 03:29:51 -08:00
Anees Iqbal ada21454ee Pooled class: the host-texture count and the unplaced image name it, as no texture over host pages
(cherry picked from commit abca36b828f0147f2a1043ff34ac84a492ccacc3)
2026-11-08 03:29:51 -08:00
Anees Iqbal 99f47fb7e8 In place: a texture over the runtime's pooled memory whose rows the device's linear image lays out otherwise takes a DRM_FORMAT_MOD_LINEAR image at Metal's pitch, where the device's check passed
A texture over a buffer of the runtime's own memory aliases it only where the device's own
linear image lies at the buffer's pitch. ANV lays linear rows tight, so a padded row (the
guest's device caches at 64-aligned pitches, rows ending mid-line) never aliases on the Iris
and every such texture is a shadow, copied in at each command buffer that uses it after a
write.

Where the device makes DRM_FORMAT_MOD_LINEAR images, such a texture now takes one with an
explicit plane at Metal's pitch (VkImageDrmFormatModifierExplicitCreateInfoEXT), no external
memory, bound in the buffer's memory. The image is made by the builder dma_buf.rs already has
(ModifierMemory gains Own: no external chain, no import check). Binding it to memory of no
external handle type is valid (VUID-VkImageCreateInfo-tiling-02261 asks only the modifier's
create info; VUID-vkBindImageMemory-image-01445 only a dedicated allocation where required,
which the runtime refuses), and a DRM_FORMAT_MOD_LINEAR image is linear, so in GENERAL it
aliases the buffer's bytes as host-accessible subresources do. It is made UNDEFINED
(VUID-VkImageCreateInfo-initialLayout-12478: PREINITIALIZED is for linear tiling alone), and a
move from UNDEFINED may discard the bytes: so the device's check gains a class for its pooled
memory (PagesClass::Pooled: a Shared buffer under half a pooled block that declares its padding
unobserved, its textures' images at Metal's pitch alone), and the image is taken only where its
verdicts pass for the texture's accesses, under HostPageTexturePolicy (Shadow turns it off).
CHECK_VERSION 11; the record holds 48 verdicts. The placement query answers a texture over the
device's own memory by the making's steps up to the bind (Device::alias_image_made): an
aliasing image (NotHostPages), or the shadow's cause. Counted: WorkCounts::pooled_pitched_images.

Verified so far: cargo fmt only; builds, tests and the device evidence follow.

(cherry picked from commit 25aa0cfda816f91a8148d4afbf81b19e7c870c07)
2026-11-08 03:29:50 -08:00
Anees Iqbal 7a562f0522 reserved_queues: a raw copy whose fill's signal was reached as it asked waits for nothing
a_raw_copy_on_a_reserved_queue_moves_the_runtime_s_own_buffers asked
SharedEvent::vk_wait(10) once the first command buffer was scheduled and
panicked unless it answered Counter. On an RTX 5080 the two 4 KiB fills can
complete before the question, and vk_wait then answers Reached, which its
contract defines as 'the submission needs no wait'. The test failed so in
2 of 10 runs alone (perdraw6-rawcopy-a, at 37637be4d4) and once in a whole
runtime suite beside the exits lane's making_exit (the 5080 exit entry):
'a submitted signal's counter: Reached' at reserved_queues.rs:279.

The raw copy now waits for counter 0 (none) where the signal was reached, and
for the counter as before where it was not; its line names which it saw. Only
NotYet, which a scheduled signal never answers, still fails the test.

Verified: pending, the test 30 times on the RTX 5080 (b5080 c entry), its
line counting Reached and Counter runs; clippy in the m2v_gpu cfg.

(cherry picked from commit 39b2a53adcb6e2b61dffef7f9d342c39e999dd1e)
2026-11-08 03:10:19 -08:00
Anees Iqbal dcaf3085a0 Container: functions of a shared-module library may share one empty metadata record
macOS 11's own Core Image libraries (file type 1, format 2.5; reims's 11.7.11 guests, 118977 and
320632 bytes) name one 8-byte private-metadata record, a size word and ENDT, from every function, over
the one module they share; the parser refused the second function's entry with BadOffset (at 245 and
223), so the guest's Core Image got "Invalid library file". In a library whose functions share a module
(Core Image kernel, dynamic), a function may now name exactly the record the previous one did when it
holds no tags; a shared record holding a tag, and any sharing in an executable library, stay
BadOffset, so parsing stays linear in the file size. Test: a 2.5 Core Image library sharing one empty
private record parses with no private tags; the tagged and executable variants are refused.

(cherry picked from commit 200ca7984d84dde9aba214115e4df5745ade5123)
2026-11-08 03:06:55 -08:00
Anees Iqbal 563ddcdaab host_import_counts: wait for the in-place check's imports' frees before reading a gauge
tests::host_import_counts::copies_between_a_buffer_and_a_texture_never_read_apart failed once in
development's lavapipe leg on msi-laptop at edde5779b1 (lavapipe of LLVM 23.1.1): at its first
copy (host_import_counts.rs:268) left (23, 0, 1), right (23, 0, 2): an import live as the test read
its gauges before that blit, besides its own buffer's, went during it. settled_device waited for
the device's in-place check to settle and for host_imports_read_apart to reach 0. A buffer of the
check's counts its import's read apart off as it goes, but where a keep-alive alone waits for the
import's free, that free goes to a handler thread (HostImport::drop, buffer.rs), and
host_imports_live falls only once it ran; the check settles right after its last class's buffers
went. settled_device now also waits until no import is live and no posted release is pending: a
device made just now holds no import of its own.

Verified (lavapipe, --cfg m2v_cpu_icd, homelab-um790-xtx-1, Mesa 26.2.6 with LLVM 23.1.4):
- A posted release was still pending as the check settled in every run printed (16 of 16, a
  scratch print at 96ba9a104c, m3-max-7851). There it was the dma-buf class's, whose memory
  host_imports_live does not count (an import of the class's own exported allocation), so the
  gauges the test reads did not move: the failure did not reproduce there (0 of 424 runs at
  dc064aec27 under four runs of the freed_memory in-place check test, eight of this one and 20
  busy loops, m3-max-7902; 0 of 498 at 96ba9a104c). On msi-laptop's lavapipe the check made
  fewer commits that used its imports before it settled (22, against 40 on um790), and the
  import whose free was still pending was one host_imports_live counts.
- this change: 0 of 784 runs under the same load (m3-max-7985).
Not run: the test on msi-laptop's lavapipe, where it failed (msi-laptop takes no CPU jobs of
ours now).

(cherry picked from commit ef98c2917e32e77d79f1cbf91bcacc80ef09acf8)
2026-11-08 03:06:03 -08:00
Anees Iqbal c1bd13193e freed_memory: the in-place check test bounds each step of the check, not its whole run
tests::freed_memory::the_in_place_check_s_buffers_delay_no_deallocator_behind_batches_in_flight
keeps a batch of 16 fills of 64 MiB in flight from its first command queue until the device's
in-place check settled and its imports went, and failed once 60 s (WAIT) had passed since it
began. On a device of one queue (lavapipe) each of the check's submissions waits behind such a
batch, so the check runs as long as its submissions times a batch, which a loaded host
stretches: 27 to 29 s alone, and past 60 s in development's lavapipe leg on msi-laptop at
edde5779b1 (FAIL at 60.3 s, "the check's buffers never went"). Nothing was stuck: the check was
still going.

The bound now holds for each step of the check the test sees: a new verdict, an image of one of
its rounds (ObjectChurn::vk_images_made, which the fills on a private buffer never move), a
release of its imports posted (host_import_releases_posted) or one of them freed
(host_imports_live). A step must come within 60 s of the one before. The test prints its longest
step.

Verified (lavapipe, --cfg m2v_cpu_icd, homelab-um790-xtx-1, 16 threads, Mesa 26.2.6; each run
a process, under the same load each time: four runs of this test at once, eight of
host_import_counts::copies_between_a_buffer_and_a_texture_never_read_apart and 20 busy loops):
- development dc064aec27, m3-max-7902 (the two trees' loops side by side, two and four runs of
  each): 16 of 20 runs failed ("the check's buffers never went"); the four that passed took
  53 to 60 s.
- this change, m3-max-7985: 0 of 40 failed, in 51 to 63 s; longest step 3.1 s; delayed 0 and
  posted 8 in each run.
- The same at 96ba9a104c with 12 busy loops, m3-max-7783: 44 of 48 failed.
Not run: the test on a GPU (its steps are the same counters there).

(cherry picked from commit efda039eef9ab6c165f192785d81c8c6ff30a15b)
2026-11-08 03:06:03 -08:00
Anees Iqbal fed6316115 Bump RUNTIME_VERSION to 1882: a tiled texture's later levels copy nothing, its merges fetch, and a detach keeps its image
amdperf-33 (the three tiled-mips follow-ups): a command counts as a use of a multi-level tiled
texture's level-0 shadow only where its range touches level 0, so generate_mipmaps and blits or passes
into levels 1+ copy level 0 in and out no more; the multi-level image takes the level-0 unorm and word
views, so its merges fetch instead of copying back by dispatch; while its bytes are detached, the tiled
texture keeps its own image (levels 1+ unchanged, level 0 its bytes' last texels) where a texture over
the pages alone reads zeros. Verified by amdperf: M3 320/320 (7858) with the negative control failing
the 4 new tests (7865); 780M (7898). Clippy, rustdoc and lavapipe run on development after the merge.
2026-11-08 02:58:28 -08:00
Anees Iqbal e925a35d5d Print every shape's level-1 blit and generate_mipmaps counts before asserting them
The later-levels test asserted the level-1 blit's counts before it ran
generate_mipmaps, so a build without the fix (the negative control) printed no
generate_mipmaps counts. It now runs both for each shape, prints them, checks the
texels, and asserts the counts after the loop.

(cherry picked from commit 565fa393e25d2c3078a9b61a171dbcd29b1e84a8)
2026-11-08 02:57:36 -08:00