The landed packet changed a runtime-sources input, so the committed digest no
longer described the sources and `the_runtime_sources_are_the_committed_ones`
would fail. Recomputed over the same inputs and committed by land-pkt.sh.
The three commits before this one. Blender's kernels on RADV made several large pipelines at once, and the driver's
compile memory (a curve kernel alone peaks at several GiB) added up past the host. A making whose stages hold 65,536
SPIR-V words or more now holds its words of a process limit around its driver call (pipeline/compile_memory.rs):
counted makings in flight hold at most 4,194,304 words, a larger one runs alone, and one that does not fit waits for
those in flight, lending its turn while it waits (budget::without_turn); waiters go in turn-rank order, none
overtaking. Applied to compute makings, whole render pipelines (their stages' words) and pipeline library parts (their
own stages). ShaderModule carries its word count. New counters WorkCounts::makings_held_for_compile_memory and
compile_memory_held_nanos (the conformance cost half classifies the count with the other making counts; host_ab lists
both; api_signatures.tsv +2 fields).
Verified (on the branch, msi): clippy -D warnings, runtime and conformance, all targets and features (m3-max-23004);
runtime budget/pool/flight tests 79 passed, conformance cost tests 17 (23004); the 4 compile_memory tests (m3-max-23041):
a making below the floor is not held, two large ones never hold at once, nothing overtakes a waiter and waiters go in
rank order, a waiter lends its turn and takes it again. Not run: clippy under m2v_gpu, a GPU run of the limit.
A guest's run on RADV made kernels of up to 4.5 M SPIR-V words several at
once; on the Radeon 780M one such making alone peaks at 3.6 to 10.3 GiB
resident (1.9 to 4.5 M words). Nothing bounded how many large modules the
driver compiled at once beside the budget's turns, which count makings and
not their size.
The process now keeps a limit of SPIR-V words in flight
(pipeline/compile_memory.rs): a making whose stages hold 65,536 words or
more holds its words around its driver call, the counted makings in
flight holding at most 4,194,304 words, a larger one alone. One that does
not fit waits for those in flight, lending its turn (budget::without_turn)
and taking one again after; the waiters go in their turns' rank order and
none passes one waiting before it, so a large making never starves. The
compute making (objects.rs) holds its kernel's words, a whole render
pipeline its stages', a pipeline library its own part's. Each module
carries its words. WorkCounts counts the makings that waited
(makings_held_for_compile_memory) and their wait
(compile_memory_held_nanos); the conformance cost half reads the count
with the other making counts.
Unit tests: a making below the floor is not held; two that do not fit
never hold at once; no counted making passes a waiting one, waiters going
in rank order; a waiter lends its turn and takes it again.
The landed packet changed a runtime-sources input, so the committed digest no
longer described the sources and `the_runtime_sources_are_the_committed_ones`
would fail. Recomputed over the same inputs and committed by land-pkt.sh.
The two commits before this one. After a device recovery every new buffer in a slot of an AddressPool reserved before
it was refused (MadeBeforeRecovery): newBufferWithLength:options: under a page answered nil for Shared, Managed and
Private buffers (a consumer's Iris recovery, m3-max-22983). A pool is only a span of the line's address space: it
holds no Vulkan object, memory block or mapping; a slot's buffer takes its own memory and only its Metal address from
the slot. The refusal's one cause was the pool's handle of the generation it was reserved on, compared at
new_buffer_with_descriptor_now with the serving generation; the same handle kept the lost VkDevice alive while the
pool lived. The pool now holds the device's root handle and the line's address space: Device::same takes a root and
any generation of its line as one device, so a slot buffer made on the next generation passes; a pool of another
device is still refused (ForeignObject); the pool's drop gives its span back to the shared space directly.
Pooled Shared and Managed buffers made before the recovery outside page blocks stay refused: their contents pointer
is a mapping on the lost VkDevice. Docs: AddressPool, MadeBeforeRecovery, the device-recovered cost (degradation.rs,
API.md), the runtime README, carry.rs.
Verified (on the branch; lavapipe, m2v_cpu_icd, m3-max-23017): an_address_pool_takes_buffers_past_a_recovery fails at
the test commit (the first Shared slot buffer after the recovery refused, MadeBeforeRecovery) and passes with the fix:
Shared, Managed and Private buffers in slots 1-3 are made on the new generation at the pool's address plus their
offsets, filled by the GPU and read back; the Private buffer placed in slot 0 before is carried (same address, zero);
the lost VkDevice goes while the pool lives. All 20 device_recovery* tests and passing_holds' pool-slot test pass.
Clippy plain, m2v_gpu, m2v_cpu_icd (m3-max-23018..23020).
What: `AddressPool` holds a root handle of its device (`Device::root`) and the device's
address space, instead of a handle of the generation it was reserved on. A buffer placed in
one of its slots after a recovery passes the same-device check (`Device::same` answers a root
and any generation of its line alike), and the pool's drop gives its span back to the address
space, which every generation shares, without reaching a generation.
Why: a consumer found that after a recovery every new buffer in a slot of a pool reserved
before it was refused (`MadeBeforeRecovery`), which refused all of its buffers under 16 KiB.
A pool holds no Vulkan object and no memory: it is a span of the line's address space
(`AddressSpace::reserve_pool`), and a buffer in a slot takes its own memory as any buffer
does, only its Metal address from the slot. Holding a generation handle also kept the lost
`VkDevice` alive while the pool lived.
Docs: the recovery lists in `MadeBeforeRecovery`, the device-recovered cost (degradation.rs
and docs/API.md), the runtime README and device/carry.rs name address pools; the pool's own
docs say it goes on. docs/REFUSALS.md regenerated with no change.
Verified: the lane run of the test commit before and this one after is reported with its sha.
What: a device test (device_recovery_states.rs) that reserves an address pool, places a
`Private` buffer in its first slot, recovers the device, then makes a `Shared`, a `Managed`
and a `Private` buffer in the pool's later slots. Each must be made on the next generation
at the pool's address plus its offset and be filled and read back by GPU work there; the
carried first buffer keeps its address and reads zero; and the lost `VkDevice` must go while
the pool lives.
Why: a consumer found that after a recovery every new buffer in a slot of a pool reserved
before it is refused (`MadeBeforeRecovery`): the pool holds a handle of the generation it was
reserved on, and the buffer's making checks the pool's device is its own generation. A pool is
only a reservation of the line's address space, which every generation shares.
Verified: expected to fail at this commit (the first buffer made after the recovery is
refused); the fix follows.
The landed packet changed a runtime-sources input, so the committed digest no
longer described the sources and `the_runtime_sources_are_the_committed_ones`
would fail. Recomputed over the same inputs and committed by land-pkt.sh.
The two commits before this one. On ANV (aliased imports unordered) an object over a listed chunk keeps its own
import (RUNTIME_VERSION 2157), so the chunk stays held back while it lives, and a copy by runs that needed the chunk
refused with an Invariant ("a guest RAM chunk a live import of an object's own holds pages of"; a consumer's Iris
walk at pins 59/60), degrading to a view copy. copy_take now answers CopyTake::CpuOnly for a chunk the device refuses
or objects' own imports hold back, and stages() stages every copy over such a chunk, as scatters already were. A
gather over bytes an object may write gets a part of its own (its GatherStage counts as gpu_written): the work before
it is submitted and completed before its host step reads the pages (counted in host_ram_staged_fills_gated), and an
encoder holding such a gather keeps no log. Residency is unchanged: objects keep their imports, chunks stay held back.
Verified (on the branch): the new test fails at d0e7383688 with the exact Invariant on lavapipe (m3-max-22993) and
passes at d0f6c5f508 (m3-max-23005; suites 153/153 incl. shadow and copied_log): the object ImportedByPointer, the
chunk held back 4 times, 0 chunks imported, 2 gathers staged after the GPU, 1 scatter staged. Iris Xe ANV
(m3-max-23013): the same line; 780M RADV (m3-max-23014): the beside test passes (1 chunk imported beside 1 dma-buf),
the held test skips (RADV copies a pointer-only object). One failure on both GPU runs is the carried nextest archive's
compile-time fixture path (CARGO_MANIFEST_DIR of the build host); that test passes in place (23005, 22976). Lint
(m3-max-22995): clippy three ways, rustdoc, api tables.
On ANV an object over a listed chunk keeps its own import (residency flat), which holds
the chunk back from the copies over it, as an object's pointer import at the RAM's own
addresses does on every device. copy_take answered such a chunk ThroughCpu, but
stages() still declined a gather some use may write the bytes of (an object lies over
them) and any copy that also touched a chunk it would import (Waits); those went to
the chunk's import and failed with the invariant "a guest RAM chunk a live import of an
object's own holds pages of" (a consumer's IOSurface block on the Iris Xe).
Now copy_take answers CopyTake::CpuOnly for a chunk the device refuses or objects' own
imports hold back, and stages() stages every copy over one, whatever else it touches
(Staging). A gather over such a chunk whose host bytes some use but a copy's read may
write takes a part of its own (Deferred::gpu_written for its GatherStage), so the work
before it in its command buffer is submitted and completed before its host step reads
the pages; its uses are noted again at that part's start, where its copy lies, and it
counts as a gated fill. An encoder holding a gather over such a chunk keeps no log
(Deferred::recorded_by_an_encoding_again), since an encoding again would copy it
through the imports.
Docs: copy.rs ("First touch", stages, record_staged, Staging), host_ram.rs
(CopyTake::CpuOnly, copy_take), deferred.rs, HOWTO.md.
A device test, failing before the fix that follows: on a listed plan, an object at the
RAM's own addresses whose own import (of its pointer, which lavapipe and ANV take)
holds its chunk back; a gather by runs over the chunk with more ranges than a copy
imports alone, over the object's bytes, failed with "a guest RAM chunk a live import
of an object's own holds pages of". The test expects the gather, a fill through the
object followed by a gather in one command buffer, and a scatter, all through the CPU
(no chunk imported, both gathers stepped after the GPU), with the bytes right.
The landed packet changed a runtime-sources input, so the committed digest no
longer described the sources and `the_runtime_sources_are_the_committed_ones`
would fail. Recomputed over the same inputs and committed by land-pkt.sh.
The five commits before this one. Since RUNTIME_VERSION 2144 an object on a listed plan over a chunk not imported
takes its own import at the RAM's addresses, which the aliases registry noted as holding the chunk back, so a copy
that needed the chunk refused with an Invariant ("a guest RAM chunk a live import of an object's own holds pages
of"; a consumer's Iris walk at pins 59/60, absent at pin 58) and objects made before the copies kept the chunks from
being imported (a 780M walk: held_back 4 -> 45). held_back now answers Free, BesideDmaBufs or Back: on a listed plan
whose device orders aliased imports, a chunk whose pages only dma-buf imports hold is imported beside them as one
dma-buf of the RAM's source, with no pointer fallback (RUNTIME_VERSION 2134's dma-buf-beside rule;
dma_buf_imports_beside_live). An object such a RAM routes outside its chunks imports its dma-bufs alone
(Routed::own_dma_bufs), never its pointer. On ANV (aliased imports unordered) objects keep their own path; the CPU
staging of copies over chunks so held follows separately.
Verified (on the branch, at a5c31b269c): the new test fails on the base with the exact Invariant (m3-max-22963) and
passes after; lavapipe (m3-max-22973) 112/112 over host_ram_dma_buf, host_ram_copy_device, host_ram_device,
dma_buf_beside, import_overlap_hazard, host_residency, device_recovery_no_copy, one_import, no_pointer_import,
copied_device; Radeon 780M (m3-max-22976) 63/63 (object ImportedAsDmaBuf, chunk held back 0 times, 1 chunk imported
beside 1 live dma-buf); lint (m3-max-22974): clippy three ways, rustdoc, api tables.
7536aa8c75 had an object over a listed chunk not imported import the chunk where the
device's barriers do not order two imports of the same pages (ANV), or where the
object had no source of dma-bufs. With a consumer's run resolvers on every object, that
pins every 512 MiB chunk any object lies in, the residency regime RV 2144 left. Back to
RV 2144's object path on every listed plan: the object takes its own path (its import
of dma-bufs alone where the aliases are ordered, 345302afc2). On ANV its own import
still holds the chunk back from the copies over it; the CPU path that takes those
copies follows separately.
The beside test now runs where the device orders the aliases only, and the listed
idle test's first object takes its own import on every driver, as before.
So that, before the fix, the gather's failure (the chunk held back by the object's
own import) is what the test reports, wherever the device took the object's pointer
first (lavapipe) or its dma-bufs (RADV).
The object's own path on a listed plan whose device orders two imports of the same
pages (7536aa8c75) took its pointer first wherever the device takes it, as every own
import does (lavapipe takes a shared mapping's pointer; RADV refuses it, so its imports
there were dma-bufs already). An import of the pointer at the RAM's own addresses holds
the chunk back (one page, one import), so the copies over the chunk could still not
import it. Now pages a guest RAM routes that no chunk binds in, where the RAM's chunks
may be imported beside them (Routed::own_dma_bufs: listed plan, ordered aliases), are
imported as the caller's dma-bufs alone, never by the pointer and the gate not asked,
as pages beside live dma-buf imports are since RV 2134; a failed import of them is a
copy. At the buffer's making and at a rebind.
Found by the new test on lavapipe (m3-max-22946): the object's own import was
ImportedByPointer where the test expects ImportedAsDmaBuf.
Since RV 2144 an object over a chunk not imported on a listed plan takes its own path,
outside the RAM's routing. At the RAM's own addresses its import is noted in the
aliases registry, which held the chunk back (RamOnDevice::held_back): the chunk could
not be imported while the object lived, and a copy by runs over it that no CPU stage
takes (a gather over bytes an object lies over) failed with "a guest RAM chunk a live
import of an object's own holds pages of" (a consumer's IOSurface block on the Iris Xe,
Mesa 26.7.2; on the 780M the hold-backs went from 4 to 45 in a walk once every object
got a run resolver, the copies falling to run lists).
Two cases, by whether the device's barriers order blits through two imports of the
same pages:
- They do (RADV, lavapipe): held_back now answers Held::{Free, BesideDmaBufs, Back}.
Where every live import holding the chunk's pages is of dma-bufs and the plan is
listed, the chunk is imported beside them as one dma-buf of the RAM's source, never
by its pointer (import_chunk's new beside flag drops the pointer fallback): two
aliases of external memory, ordered by the host bytes they lie over, the rule
Device::imports_beside applies to objects' own dma-bufs since RV 2134. Counted as
ObjectChurn::dma_buf_imports_beside_live, not host_ram_chunks_held_back. Imports of
a pointer, and claims in flight, still hold the chunk back.
- They do not (ANV, AliasedImportBlitsUnordered): the chunk's import beside an
object's would be unordered, so an object there takes the chunk's import (made or
waited for), as it did before RV 2144 and as on plans that import ahead. So does an
object with no source of dma-bufs of its own pages, whose own import would be of its
pointer. for_object takes the object's `sourced` (HostWindow::source) through
bind_in_chunk.
Docs: host_ram.rs (module, Held, held_back, for_object, copy_take, import_chunk,
use_host_ram), WorkCounts::host_ram_chunks_held_back and chunk_bound_buffers_made,
ObjectChurn's two import counters, HOWTO.md.
A device test, failing before the fix that follows: on a listed plan (the import tax
forced held), an object over a chunk not imported, at the RAM's own addresses and with
a source of dma-bufs of its own pages as a consumer's objects come, takes its own
import; a gather by runs over that chunk which no CPU stage takes (the object lies over
its bytes) and whose ranges are more than a copy imports alone then takes the chunk's
import. The object's import held the chunk back (RamOnDevice::held_back), so the copy
failed with "a guest RAM chunk a live import of an object's own holds pages of", as a
consumer's IOSurface block's copy by runs did on the Iris Xe.
The test expects, where the device's barriers order blits through two imports of the
same pages, the chunk imported beside the object's import (no hold-back, one chunk
imported, dma_buf_imports_beside_live +1), the file's bytes gathered, and a gather
after a fill through the object in one command buffer reading the fill; on ANV's
driver, the object lying in the chunk's import, which it made.
The listed-idle test's first object now expects, on ANV's driver, to lie in the chunk
it imported; the runs_alone helper's doc no longer describes the object path RV 2144
removed.
The landed packet changed a runtime-sources input, so the committed digest no
longer described the sources and `the_runtime_sources_are_the_committed_ones`
would fail. Recomputed over the same inputs and committed by land-pkt.sh.
The four commits before this one. A depth/stencil state, a library and its functions hold no Vulkan object, only a
generation's device handle, so after a recovery the next generation refused them (MadeBeforeRecovery): a render
encoder setting a depth/stencil state made before, or a pipeline state made from a function made before. They now
hold the device's root handle; a depth/stencil state's gpu_resource_id asks supports_family of the serving
generation; a library's sampler-ID holds are on the line's resource IDs. MadeBeforeRecovery no longer lists them.
Docs: MadeBeforeRecovery, the device-recovered cost (degradation.rs, API.md), the runtime README, carry.rs.
Verified (on the branch): lavapipe (m3-max-22955): the depth/stencil test fails at its test commit (end_encoding),
the library test at its (new_compute_pipeline_state_with_function), and all 19 device_recovery* tests pass at the
tip; clippy plain, m2v_gpu, m2v_cpu_icd (22956-22958).
What: a library holds a root handle of its device (Device::root) rather than the generation
it was made on, and its functions take that handle, as a fence does. A library is the
compile layer's parsed library and a function the compile layer's function with its
constants, no Vulkan object; their sampler-ID holds are the line's resource IDs, which every
generation shares. So a pipeline made from them on any generation passes its device check
(same matches a root handle by its line), and they no longer keep the lost VkDevice alive.
Docs: library.rs, carry.rs, MadeBeforeRecovery (libraries leave the refused list), the
device-recovered cost (degradation.rs and docs/API.md), the runtime README. REFUSALS.md
regenerated: unchanged.
Why: after a recovery a pipeline made from a library or function made before it was refused
NotImplemented(MadeBeforeRecovery); Metal's library goes on.
Verified: see the lane run reported with this sha (the test commit before it fails, this
one passes).
What: a device test (m2v_gpu / m2v_cpu_icd; the loss is marked by Device::recover_for_test)
that makes a library of the public runtime_examples fixture and a function of it, recovers,
makes another function of the library, and makes a compute pipeline state of each function
on the next generation, set in a compute encoder. It expects every call to be accepted, the
command buffer to complete, and one live VkDevice while the library and functions live.
Why: a library and its functions held the generation they were made on, so after a recovery
a pipeline made from them was refused NotImplemented(MadeBeforeRecovery), and they kept the
lost VkDevice alive, though they hold no Vulkan object (the compile layer's library). Metal's
library goes on. This test fails until they are no generation's.
Verified: not yet run; the fix's commit carries the run.
What: a depth/stencil state holds a root handle of its device (Device::root) rather than
the generation it was made on, as a fence does. The state is its descriptor and the compile
layer's Vulkan depth/stencil state, no Vulkan object, so a render encoder of any generation
accepts it (check_device matches a root handle by its line), and it no longer keeps the lost
VkDevice alive. gpu_resource_id asks supports_family, which goes to the serving generation,
instead of the "now" form a root handle has no generation for. Docs: depth_stencil.rs,
carry.rs, MadeBeforeRecovery, the device-recovered cost (degradation.rs and docs/API.md),
the runtime README. REFUSALS.md regenerated: unchanged.
Why: after a recovery a state made before it was refused NotImplemented(MadeBeforeRecovery)
at set_depth_stencil_state; Metal's state goes on.
Verified: see the lane run reported with this sha (the test commit before it fails, this
one passes).
What: a device test (m2v_gpu / m2v_cpu_icd, beside the other recovery tests; the loss is
marked by Device::recover_for_test) that makes a depth/stencil state, recovers, and sets the
state in a render encoder of the next generation over a color and a depth target made
after the recovery. It expects the encoder's calls and the commit to be accepted, the
command buffer to complete, and one live VkDevice while the state lives.
Why: a depth/stencil state held the generation it was made on, so after a recovery its
set was refused NotImplemented(MadeBeforeRecovery) and the state kept the lost VkDevice
alive, though it holds no Vulkan object. Metal's state goes on. This test fails until the
state is no generation's.
Verified: not yet run; the fix's commit carries the run.
The landed packet changed a runtime-sources input, so the committed digest no
longer described the sources and `the_runtime_sources_are_the_committed_ones`
would fail. Recomputed over the same inputs and committed by land-pkt.sh.
The two commits before this one. A fence made before a device recovery held its generation's device handle, so
waitForFence:, waitForFence:beforeStages: and updateFence: of the next generation refused it (MadeBeforeRecovery):
a consumer's boot after two GPU recoveries on a 780M counted 15,389 + 9,115 such refusals, and its encoders faulted
at the first. A fence has no Vulkan object, only an identity key, so it now holds the device's root handle
(Device::root): update_fence and wait_for_fence of any generation take it, and it no longer keeps the lost VkDevice
alive.
Verified (on the branch): lavapipe (m3-max-22931): device_recovery::a_fence_goes_on_past_a_recovery fails at the test
commit (Err(MadeBeforeRecovery) at update_fence) and passes with the fix, with all 17 device_recovery* tests;
clippy plain, m2v_gpu, m2v_cpu_icd (22933-22935).
What: a fence holds a root handle of its device (Device::root) rather than the generation
it was made on. A fence has no Vulkan object, only the key the tracker orders on, so
update_fence and wait_for_fence of any generation's encoder now accept a fence made before
a recovery (check_device matches a root handle by its line); an update made on a lost
generation went with that generation's work, so a wait on the next one finds none, as for a
fence never updated there. The fence no longer keeps the lost VkDevice alive. Docs: fence.rs
module and item docs, carry.rs, MadeBeforeRecovery, the device-recovered cost (degradation.rs
and docs/API.md), the runtime README. REFUSALS.md regenerated: unchanged.
Why: after a 780M gfx ring timeout and a recovery, a guest's waitForFence: calls were
refused NotImplemented(MadeBeforeRecovery) about 2,000 times; Metal's fence goes on.
Verified: see the lane run reported with this sha (the test commit before it fails, this
one passes).
What: a device test (m2v_gpu / m2v_cpu_icd, beside the other carry tests; the loss is
marked by Device::recover_for_test) that makes a fence and a Private buffer, recovers, then
in one command buffer fills the buffer and updates the fence in a blit encoder and waits for
the fence in a later one. It expects every call to be accepted, the command buffer to
complete, the label kept, and one live VkDevice while the fence lives.
Why: a fence held the generation it was made on, so after a recovery update_fence and
wait_for_fence were refused NotImplemented(MadeBeforeRecovery) (about 2,000 refused fence
waits in one guest run after a 780M ring timeout), and the fence kept the lost VkDevice
alive. Metal's fence goes on. This test fails until a fence is no generation's.
Verified: not yet run; the fix's commit carries the run.
The landed packet changed a runtime-sources input, so the committed digest no
longer described the sources and `the_runtime_sources_are_the_committed_ones`
would fail. Recomputed over the same inputs and committed by land-pkt.sh.
The two commits before this one. After a device recovery a heap made before it stayed with the lost generation, so
its newBufferWithLength:options:offset:, newBuffer and newTexture were refused (MadeBeforeRecovery) where Metal makes
them (a guest's heap sub-allocations after an amdgpu soft recovery on an RX 550). Each live heap is now carried
(Heap::carry): a Private heap's own buffer is made again in new memory placed so its textures can lie there too,
zeroed, keeping its ObjectId, address, range, range token and label; each live buffer placed in it gets a link on the
new generation at the same offset, keeping its identity, its old link letting go of the lost generation at rest; the
heap's textures made before stay refused and are forgotten by the heap; the carried heap is in the new generation's
registry, so a later recovery carries it again. Shared, no-copy and sparse heaps stay as they were. The recovery
notice counts carried Private heaps (bytes, buffers) and left heaps by kind, and splits "buffers over the caller's
or exportable memory" into buffers over the caller's VkBuffer and buffers in exportable memory. Docs: carry.rs,
degradation.rs and API.md's device-recovered cost, MadeBeforeRecovery, the runtime README.
Verified (on the branch): lavapipe, m2v_cpu_icd (m3-max-22922): device_recovery_heap::a_recovery_carries_private_heaps_with_their_buffers
fails at the test commit (no heaps in the notice) and passes with the fix, with all 16 device_recovery* tests: a
Private placement heap and a Private automatic heap, one buffer placed in each, identities kept, bytes zero;
new_buffer_at_offset, new_buffer and new_texture after the recovery work; the texture made before is refused;
use_heap commits; used_size drops by exactly one buffer on release; the lost VkDevice goes once the old texture is
dropped. clippy plain, m2v_gpu, m2v_cpu_icd (22923-22925). No real GPU recovery was run (recover_for_test).
What: a device's recovery now carries each live heap to the new VkDevice (Heap::carry,
called from Device::carry_to after the buffers, or by a heap's maker where the recovery
took the generation first). A Private heap's own buffer is made again in new memory placed
where the heap's textures can lie (place_heap_buffer), zeroed as a carried Private buffer
is, keeping its ObjectId, hazard key, Metal address and range, range token, label and
purgeable state; the heap is registered by its key there and kept in the new generation's
registry for a later recovery. Each live buffer placed in it gets a new link on the new
generation (Buffer::carry_placed) at the same offset of the carried bytes, with the same
ObjectId, address, label and a shared aliasable flag; its old link lets go of its live-list
entry and device handle at the lost generation's rest (LostPlaced). A placed buffer's drop
gives an automatic heap's range back only from the link carried to last, so a carried
buffer frees its range once. A buffer placed while the heap is being carried carries itself
under the heap's placed lock. The heap's textures made before stay the lost generation's
(no recovery carries a texture); the heap forgets them (keeping their numbering), so a
use_heap on the new generation never makes an old image resident. Shared heaps (their bytes
are pooled host-visible memory, never the runtime's own pages), no-copy heaps and sparse
heaps stay left, with their buffers.
The recovery notice now counts carried heaps ("N `Private` heaps (B bytes) with the M
buffers placed in them") and left heaps by kind, and splits the old "buffers over the
caller's or exportable memory" into "buffers over the caller's `VkBuffer`" and "buffers in
exportable memory" (Left::Caller / Left::Exported). Docs: carry.rs module docs, the
Buffer::carry docs, heap.rs, MadeBeforeRecovery, the device-recovered cost (degradation.rs
and docs/API.md), the runtime README. REFUSALS.md regenerated: unchanged.
Why: after a GPU recovery a guest's MTLHeap newBufferWithLength:options:offset: was refused
NotImplemented(MadeBeforeRecovery) and the guest got nil; Metal's heap goes on.
Verified: see the lane run reported with this sha (the test commit before it fails, this
one passes).
What: a device test (m2v_gpu / m2v_cpu_icd, as the other recovery tests: the loss is
marked by Device::recover_for_test, no GPU fault) that makes a Private placement heap and
a Private automatic heap, places a buffer in each, makes a texture in the automatic heap,
then recovers. It expects the recovery notice to count both heaps and their buffers, the
heaps and buffers to keep their ObjectId, Metal address and label on the new generation
with their bytes zero, new buffers and textures made in them to serve, the texture made
before to stay refused (MadeBeforeRecovery), a use_heap on the new generation to commit,
a carried automatic buffer's release to give its range back once, and the lost VkDevice
to go with the texture left on it. The carry test's fill/read/live_vk_devices helpers are
shared with it.
Why: after a GPU recovery a guest's MTLHeap newBufferWithLength:options:offset: was
refused NotImplemented(MadeBeforeRecovery): no recovery carried heaps. Metal's heap goes
on. This test fails until heaps are carried.
Verified: not yet run; the fix's commit carries the run.
The landed packet changed a runtime-sources input, so the committed digest no
longer described the sources and `the_runtime_sources_are_the_committed_ones`
would fail. Recomputed over the same inputs and committed by land-pkt.sh.
The four commits before this one. A heap sample whose sampler is one of several constexpr candidates with
consecutive handles branched into one arm per candidate (8 on a guest path tracer's kernels: 1.82M of one kernel's
4.5M words). Where the device has non-uniform sampled-image indexing (which heap images already need), the
candidates are now one set-0 array of immutable samplers (ResourceKind::SamplerArray / BindingSource::SamplerArray),
indexed NonUniform by the handle's candidate number, zero outside the array as the switch's null arm. Candidates
that differ only in reading one texel merge: the element's sampler word decides that test (OneTexel::Table), and the
raw emulation reads each element's state word from a constant table (State::Table). Same answers: each element is
exactly the sampler its arm used. Elsewhere, and for non-consecutive handles, the switch stays. Runtime: per-element
immutable samplers in the shared layouts, the set-0 hash and the pushed set 0. Docs: API.md section 5, api tables,
REFUSALS.
Verified (on the branch): nextest -p metal2vulkan (m3-max-22886) 4997/4998, the golden failure the pending SV 2061
cells of the old base (blessed at pin 59), none moved by this change; lint (m3-max-22911); lavapipe lane
(m3-max-22900) 30/30 with the new heap_sampler_array device test (each lane equals its sampler alone and the
address-mode definition, a linear mirrored third sampler taking the word-decided path); census over 3,781 rows
(m3-max-22912): 0 defects, amd-780m-radv 3374 translated (slowest 537 ms, peak 279 MiB), vk12-floor 1647 unchanged.
Guest kernels (780m profile, m3-max-22884): words -15% to -21% (4,495,595 -> 3,809,280 on the largest), every site
on the array (106/106, 176/176), translate+validate peak 506 -> 433 MiB. Create time on the 780M (m3-max-22898)
pending.
The 8 constexpr samplers a heap sampling chooses among in the large
kernels are 4 nearest and 4 linear; their arms differed only in
Sampling::one_texel (Always for nearest, Never for linear), so the
array never formed (106 sites in one kernel, 176 in another, each
switch of 8 arms kept; probe print on the 780M profile).
OneTexel::Table(n) states that the word of the constexpr sampler at
the array element the handle names decides whether the sampling reads
one texel, as OneTexel::Word does for a runtime slot. The array now
carries each element's SamplerWord (ConstexprArray::words), which both
that test and the raw emulation's word (heap_raw::State::Table, now its
element count) read through emit::array_word. The tests' third sampler
is linear, so the device test checks the word-decided reads.
A heap texture sampled through one of several constexpr samplers that a
sampler handle names at run time (a table of constexpr samplers read at a
computed index) was a switch-at-use with one arm per candidate: each arm
its own heap sampling and raw-texel emulation. On large kernels that
multiplies the sampling code by the candidate count.
Where every candidate is a constexpr sampler, their handles are
consecutive, each candidate's sampling is the same but for its sampler
and the state its raw emulation follows, the use is not tangled, and the
device indexes a sampler array non-uniformly
(shaderSampledImageArrayNonUniformIndexing, which heap textures already
need), the sampling is now one sampling through a set-0 array of the
candidates' samplers (ResourceKind::SamplerArray,
BindingSource::SamplerArray): element handle - first, NonUniform, its
immutable samplers each made as the heap sampler of that candidate alone
would be (DescriptorBinding::immutable_samplers, listed per stage in
StageInterface::sampler_arrays). A handle outside the array reads zero,
as the switch's null arm. The raw emulation reads the element's sampler
word from a constant table at the same index (heap_raw::State::Table),
through the runtime-word path. Elsewhere the switch stays.
The runtime bakes one sampler per element into the set layout, pushes
each element's own sampler where set 0 is pushed, and keys the set-0
shape on them.
Tests: the array form on every profile with the sampled heap (one
sampled image, L3), the switch kept for non-consecutive handles, each
element equal to the immutable sampler of the candidate sampled alone and
never written by the plan, and a device test (lavapipe under
m2v_cpu_icd) that each lane reads what its sampler alone reads and what
the address modes define.
Docs: API.md section 5, the sampler module doc, api_signatures,
api_surface, REFUSALS regenerated.
The landed packet changed a runtime-sources input, so the committed digest no
longer described the sources and `the_runtime_sources_are_the_committed_ones`
would fail. Recomputed over the same inputs and committed by land-pkt.sh.
The commit before this one. A rate-mapped draw recorded every region, even one whose scissor is empty after the cut
to the guest viewport and render area. Those are no longer recorded (rate_mapped_pass.rs draws()); where no region
keeps a pixel, the first region alone is recorded through its empty scissor so the vertex function still runs.
Exact: the scissor test drops every fragment of a skipped region, and vertex side effects are already refused for
plans of more than one region. Docs: rate_mapped_pass.rs, regions.rs, API.md, FAST-PATHS.md.
Verified (on the branch): rate_mapped_passes 12/12 on Iris Xe (m3-max-22799) and lavapipe (m3-max-22766); new
a_viewport_over_part_of_the_screen_draws_only_the_regions_it_reaches (left quarter: 12 of 36 regions, pixels equal
to the region-by-region indirect draw). Iris cost lane (3840x2160 map, 2,624 regions) hashed before and after: full
viewport 215d7bad5f31fed5 both, quarter viewport e977c7565cdeff42 both; quarter viewport 164 -> 39 multi-draws per
guest draw, GPU 175 -> 33 ms (light draws), 968 -> 217 ms (dense). Full-screen draws unchanged.
Each draw of a rate-mapped pass was recorded once per region of the map's plan, even where the
region's scissor, cut to the pixels whose centres lie in the guest's viewport and to the render
area, held no pixel. Such a recording shades nothing (the scissor test discards every fragment),
and its vertex function repeats nothing observable (a plan of several regions refuses a vertex
function that writes memory), so it is now left out. Where the cut leaves no region a pixel, the
first region alone is still recorded through its empty scissor, so the vertex function runs as
Metal's does. A draw whose viewport covers part of the screen now records only the regions it
reaches; one over the whole screen records what it did.
The new lane test draws the case's fullscreen triangle over a 256-pixel map at the falling
quality with a viewport over the screen's left quarter: fewer regions than the whole screen's,
from an indirect buffer region by region, and the direct (batched) draw shades bit for bit the
same pixels, inside the left half of the physical columns.
The landed packet changed a runtime-sources input, so the committed digest no
longer described the sources and `the_runtime_sources_are_the_committed_ones`
would fail. Recomputed over the same inputs and committed by land-pkt.sh.
The commits before this one. On a device made with DeviceOptions::gpu_times_from_host, a command buffer's
GPUStartTime was its kernel end, the call of its LAST submission, so a command buffer whose batches went as several
submissions dropped its earlier work from its GPU window (a consumer's profile: 2-8 s of work reported as 0-240 ms,
kernel end to GPU start 0.00 ms). KernelTimes now records the first driver submission call that carried a batch of
the command buffer (its own vkQueueSubmit or its group's call); the host-clock start is that call where it came
before the kernel end, else the kernel end as before, raised to the queue's latest GPU end where later. A command
buffer of one submission answers as before; devices that write timestamps were already right. Docs: gpu_time.rs,
gpu_start_time, DeviceOptions::gpu_times_from_host, the GpuTimesFromHost cost text and its API.md entry. Also: the
queue-times test holds heads, kernel starts and ends, and returns each in commit order (grouped batches can return
from one call).
Verified (on the branch): runtime_lane::gpu_times::a_command_buffer_of_two_submissions_is_timed_from_its_first_work_to_its_last
(a fill, a wait for an event the host signals 200 ms after the commit, a fill; timestamps and host times): lavapipe
(m3-max-22756) fails before the fix with host times (start +0.376 ms after the signal, the kernel end) and passes
after (-199.8 ms); Radeon 780M (m3-max-22792) passes both ways. lavapipe gpu_time + kernel_end_device 16/16, lane
gpu_times 12/12 (22782), degradation catalogue 17/17 (22797); 780M lane gpu_times 12/12, runtime 16/16 (22811).
Lint (m3-max-22812): clippy every feature, m2v_gpu, m2v_cpu_icd, rustdoc, api tests.
queue_times_are_noted_in_the_order_of_a_queue_s_submissions_and_only_where_asked
held each command buffer's kernel start after the return of the one
before it. Batches that wait in a group for one kernel submission begin
and are held before the call that carries them all returns: on the 780M
(RADV, job 22793) the second and third of three back-to-back fills
returned from one call, the third's kernel start 66 us before it. The
test now holds heads, kernel starts and ends, and returns each in commit
order.
Verified: pending the 780M rerun.
A command buffer whose work went as several submissions (a wait for an
event the host signals, an execution its host step records) answered,
on a device made with gpu_times_from_host or a driver whose timestamps
wait for every queue's, the call of its LAST submission (its
kernelEndTime) as its GPUStartTime: its window missed the work of its
earlier submissions. Metal's GPUStartTime and GPUEndTime span the whole
command buffer's GPU work. A consumer that answers GPU times from the
host read windows of 0 to 240 ms on an Iris Xe for command buffers whose
kernel start to end spanned 2 to 8 s, each GPU start at the kernel end.
KernelTimes keeps the call of the first driver's submission that carried
a batch of the command buffer (the batch's own vkQueueSubmit, or its
group's), and the host-clock start is that call where it came before
the kernel end, else the kernel end as before, or the queue's latest GPU
end where later. A command buffer whose work went as one submission
answers as before. Devices that write timestamps already started at the
first batch's timestamp (lavapipe, job 22670: GPU start 173 ms before
the signal its second batch waited for).
Docs: gpu_time.rs (the host-clock bullet, rule 2), gpu_start_time,
DeviceOptions::gpu_times_from_host, the GpuTimesFromHost notice's cost
and its API.md entry.
Verified: pending lavapipe before and after, the 780M, lint.
The lane test runs on the device as made and on one made with
gpu_times_from_host, whose GPU start is answered from the host's clock:
there a command buffer whose work goes as two submissions must start
before the host's signal its second waits for, as its first fill's work
ran then. The runtime test of a command buffer a pipeline's making
splits goes: on lavapipe its batches went as one submission at the
commit (kernel end 299.9 ms before the hold's end, job 22710), so it
tested no split.
Verified: pending the lavapipe run at this commit and the fix after it.
A command buffer whose draw's pipeline is still being made at its commit
(PipelineWaitPolicy::Exact, the pool's test hold dropped 300 ms after the
commit) goes as more than one submission: the fill before the pass at
once, the pass once its host step recorded it. Its GPU start must be the
fill's, before the hold went, and its end after it. Run with the merge
check as found and forced to hold, so its batches may wait in a group.
Verified: pending the lavapipe and 780M runs.
A command buffer whose work goes as two submissions 200 ms apart (a fill,
a wait for a shared event the host signals 200 ms after the commit, a
fill) must answer Metal's GPUStartTime at its first fill, before the
signal, and its GPUEndTime at the second, after it. A guest profile on
an Iris Xe read GPU start..end spans of 0 to 240 ms for command buffers
whose kernel start..end spanned 2 to 8 s, the GPU start at the kernel
end.
Verified: pending the lavapipe and 780M runs.