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.
A default-off diagnostic (METAL2VULKAN_LOG_MEMORY). Where the process's
allocator is glibc's (Linux, the GNU environment), each line of the memory
log now ends with glibc's heap at that moment, every arena's, as mallinfo2
states it (bytes in use, bytes free, what its arenas hold, what it mapped
apart) and the malloc_trim calls the process's large makings made so far
(a process-wide count beside WorkCounts::heap_trims). A resident set that
grows and stays then reads, in one run, as free heap glibc keeps, heap in
use, or memory malloc did not map. Elsewhere the lines are unchanged.
Test: the_memory_log_states_glibcs_heap_where_it_is_the_allocator.
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.
A rate-mapped draw whose triangles reach at most four region pairs now fans out through a
four-copy draw variant, chosen from the probe's measured triangle span (never by device). Other
draws keep the sixteen-copy variant, and the commit's settle begins both. The translator's link
and codec gain the tier (SEMANTICS, ARTIFACT_FORMAT), and the runtime picks it (RUNTIME). Counted:
WorkCounts::rate_map_fanned_few_draws.
Verified by the change's own runs: clippy and tests 24351 (0 messages, 20 passed). 780M warm
29.7/30.8 against 36.8/34.5 ms (24369), cold 40.2/43.9 against 61.9/62.7. Iris holds at 47.7/40.0
(24317) and the 3090 at 28.6/6.1 (24316). rate_mapped_fan_out draws 6 of few copies, 0 made at
the step, on all three.
A host step's fanned-out draw went through one geometry-stage variant that
declares the output of the most copies (up to 16) for every triangle, though
most draws' triangles touch only a few regions. The declared output size is
what the 780M's geometry stage pays for.
- The translator: RegionFanOut::DrawFew, the draw variant whose loop emits
at most FEW_COPIES (4) copies and whose geometry stage declares 3 x 4
output vertices; its codec name and compile-key word (" region_fan_out
few"); the link and engine tests cover the three modes.
- The probe: each draw's words grow to 1 + 2 x PROBE_COUNT_WORDS (65): its
flag, the 32 count lanes, and 32 wide lanes, where a triangle whose
widened pair count exceeds FEW_COPIES stores 1 (picked by PrimitiveId
mod 32, as the counts are). The host reduces them to (flag, copies, wide).
- The runtime: a fanned-out draw no triangle of which is wide draws
through DrawFew, else through Draw; commit's settle begins the three
variants (probe, few, most). Counted:
WorkCounts::rate_map_fanned_few_draws.
- The pieces lane prints the count. The runtime test's 8 commands add one
whose triangle covers four tiles a side (more regions than four, no more
than the most copies), drawn through the most copies, and assert the
other 6 fanned-out draws took four; the pixels are still the encoder's
region-by-region draws'.
- docs/FAST-PATHS.md: the fan-out row names the variant and its count, and
its cost cell carries the numbers below. bind/fan_out.rs: FEW_COPIES's
numbers.
Verified, release binaries, runtime_lane::rate_mapped_pieces and
tests::rate_mapped_fan_out, the command buffer's GPU time, cold then warm:
- Radeon 780M (Mesa 26.2.6), m3-max-24369, this change plus a scratch
switch (never landed) drawing every fanned draw through the most copies,
interleaved in one job: 4 copies 40.2/29.7 and 43.9/30.8 ms; the most
copies 61.9/36.8 and 62.7/34.5 ms. Warm about 5.4 ms (15%) less.
64 of 64 draws of four copies.
- Iris Xe (Mesa 26.2.6), m3-max-24317: 47.7 ms cold, 40.0 ms warm (40.5
warm through the most copies in an earlier run); 64 of 64 of four copies.
- RTX 3090 (NVIDIA 620.70.06), m3-max-24316: 28.6 ms cold, 6.1 ms warm
(6.2 ms before); 64 of 64 of four copies.
- tests::rate_mapped_fan_out on all three: 3 passed, 6 drawn of few
copies, the fan-out's pipelines 3 ready plus waited, 0 made at the step.
The Iris and 3090 runs are of the same change at base 9c30ffd263; the
780M's at bfcd63c5e2. Clippy (translator, runtime, validation,
conformance, --cfg m2v_gpu and m2v_gpu_hazards, all features) and the
translator's fan_out and api_surface tests: m3-max-24351, at bfcd63c5e2,
0 messages, 20 passed. signatures.py --check passes; REFUSALS.md
unchanged.
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.
A draw is now kept under the outside state another thread may change (no-copy moves, sampler
slots, rebinds, the host alias version) as of the start of its steps, not as of its keeping. So a
change landing meanwhile, such as the in-place check making a no-copy buffer over host pages,
makes the next draw take every step instead of replaying a draw kept under a state it never read.
In debug this panicked "a draw again kept no draw" (draw_again.rs:994). That changes runtime
behaviour.
Verified by the change's own runs on lavapipe: the forced repro panics without the fix at
draw_again.rs:994 and passes with it (24375); draw_again, lone_fetch and pass_end_tiles 44/44
(24375); runtime suite 2443/2443 (24363); clippy 24376 and 24340.
What: the maker thread is a plain thread holding its own handle on the device. It makes the
buffer over host pages, sends it to the hook, and ends. The hook keeps the buffer until the
test ends.
Why: before this fix, the test's negative control printed the check's panic ("a draw again kept
no draw", render/draw_again.rs:994) and then hung. The scoped maker waited for the run's end,
and the panicking test's scope waited for the maker (job 24363, 120 s timeout). A failing test
must fail, not hang.
Verified: as a potluck job on lavapipe, the negative control (the fix's files reverted) and the
fix; reported with the shas.
What: the test takes the page's HostMemory, which is Send and Sync, on its own thread and moves
it into the maker thread. Before, the maker thread borrowed the Page, whose pointer is not Sync.
Why: the test did not compile (E0277, job 24330).
Verified: as potluck jobs on lavapipe with the fix's negative control; reported with the shas.
What: record_again (render/reroute.rs) calls draw_began before it records a kept draw again
into a new instance. A draw it keeps is then kept under the outside state as its own steps
began, not as the last direct draw's began.
Why: the previous commit keeps a draw under Outside as noted at draw()'s start. A rerouted
draw reaches the same keeping through draw_resident without draw(), so it read a stale start.
That was conservative: the next draw took every step. The rerouted draw's own start is the
exact one.
Verified: with the previous commit's jobs, as potluck jobs on lavapipe.
What: render/draw_again.rs gains Outside: the parts of a kept draw's Under that another thread
may change while a draw takes its steps:
- the no-copy buffers' moves;
- the sampler slots' changes;
- whether the device has buffers over host pages, and the host aliases' version.
RenderLowering::draw_began notes them as draw() begins. kept_under answers Under as of now, but
with those parts as of the draw's start. Both the plain draw's keeping (render.rs) and a draw
rebound (rebound.rs) keep their draw under kept_under. The plain keeping weighs its uses' noting
against that state: EncoderCore::noted_now now takes the NotedInto to compare with.
So a change made meanwhile on any thread makes the next draw take every step. Before, the keep
read the moved state, so one of two things happened:
- the draw kept nothing;
- or it was kept under a state its bindings and noting never read: a version that moved after
noted_now but before Kept::under, or a sampler state made after the draw listed them.
The debug check (Checked::check) compares nothing where Outside moved while the checked draw took
every step: its steps read another state than the kept draw's. The module docs say both.
Why: the device's in-place check (in_place_check.rs) makes and lets go no-copy buffers over host
pages on the program's device from its own thread. When one landed between a checked draw
again's noting and its keeping, the draw kept nothing and the check panicked with "a draw again
kept no draw" (render/draw_again.rs:994). That was the intermittent failure in lone_fetch and
pass_end_tiles on lavapipe (jobs 24214, 24235). The skip of first-move zeros was not involved:
neither test's Private texture registers an overwrite.
Verified: as potluck jobs on lavapipe, the previous commit's test and the draw_again tests, the
runtime suite, and clippy; reported with the shas.
What: tests::draw_again gains
a_buffer_over_host_pages_made_while_a_draw_takes_every_step_is_met_by_the_next_draw. A new
test-build hook, Hooks::at_keep (device/line.rs, with the recovery tests' hooks), runs once on
the lowering thread as the n-th draw that takes every step reaches its keeping, after its uses'
noting. The test holds the run's first draw again there (in a debug build, the first draw again
takes every step for its check) while another thread makes a no-copy buffer over host pages.
That moves the host aliases' version and the device's "has buffers over host pages" flag, which
a kept draw's Under reads through NotedInto. The test asserts that the next draw takes every
step (draws_unlike_kept_under 1), one draw fewer draws again than the reference run, and the
pixels match.
Why: render/draw_again.rs:994 "a draw again kept no draw" fired intermittently in
lone_fetch::a_lone_fetched_bgra8unorm_color_over_host_pages_reaches_them (jobs 24214, 24235) and
in pass_end_tiles. The device's in-place check (in_place_check.rs) runs on a thread of its own
and makes and lets go no-copy buffers over host pages on the program's device. When one lands
between a checked draw again's noting and its keeping, noted_now compares the noting's alias
version with the moved one and the draw keeps nothing. The hook forces that moment, so the test
fails without the fix instead of waiting for the race.
Verified: expected to fail here (the panic) and pass with the next commit, as potluck jobs on
lavapipe; reported with the shas.
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.
A ragged dispatchThreads now runs as the threadgroups its threads fill, at the call's
threadgroup size, on a partial-threadgroups variant of the kernel: Metal's partial threadgroup,
with invocations past the grid returning or walking predicated to each barrier. That replaces a
pipeline per grid remainder, so a kernel needs at most 2 VkPipelines per threadgroup size. The
cases that can't take it keep the exact split. The translator emits a new variant (SEMANTICS),
the artifact codec gains RuntimeFact::PartialThreadgroups (ARTIFACT_FORMAT), and the runtime
picks it (RUNTIME). A declined variant probe now logs as declined, not as refused.
Verified by the change's own runs: engine tests on five profiles (24285); XTX runtime tests in
debug and release (24289, 24315), words equal to the split's and Metal's model, 1 VkPipeline vs 6;
lavapipe (24296); broad metal2vulkan tests 2682/2683 with the one failure fixed (24303, 24325);
lint 24327 and 24329. XTX proxy: 1 pipeline in 0.90 s against the split's 6 in 6.14 s.
refusal_outcome names a flat, folded or partial-threadgroups variant's
Unsupported refusal declined (the probe's answer: settle_flat, settle_folded,
replay_variant and settle_partial take it as one), and a creation's or any
other variant's refusal refused.
On lavapipe the simdgroup-sum kernel emulates its simdgroups, so both states
split, and the second state found the first state's VkPipelines made (job
24288 failed on 'the split: 0 made').
The cooperative slice write (texture::cooperative) strides its cells over
every invocation of the workgroup; past a partial threadgroup's threads they
run none of the body, so its cells would go unwritten. Such a kernel keeps
the split. The warm pass's docs name the variant it settles.
The runtime's partial_threadgroups test dispatches five ragged grids of a
kernel with a threadgroup barrier (with and without a simdgroup sum) on the
variant and on the same kernel made to split (split_ragged_grids, test-only),
comparing both with Metal's model and counting VkPipelines; under m2v_gpu a
heavy kernel times the creations. flat_simdgroups' two-row grid and barrier
kernel now take the variant's one VkPipeline. api_signatures.tsv and
REFUSALS.md regenerated.
A dispatchThreads grid that is not a whole number of threadgroups split into
its interior and an edge region per axis, each edge a VkPipeline of its
remainder's local size: a kernel dispatched at many remainders made one
pipeline per remainder (Blender's Cycles on an RX 7900 XTX: 249 s of a
265 s warm render was 11 such creations).
LoweringInputs::partial_threadgroups (VariantKey::partial_threadgroups,
RuntimeFact::PartialThreadgroups) runs such a grid as the threadgroups its
threads fill at the call's size, the region flagged NONUNIFORM, the last
threadgroup along an axis answering Metal's partial threadgroup with the
object functions' machinery: threads_per_threadgroup, positions and indices
over the threads left, invocations past them returning before the body or
walking it predicated to each barrier, every lane read balloting its live
lanes. A tile function, a stage-in region, compute derivatives, emulated
simdgroups, the flat/folded/replay forms and a vote word that does not fit
are refused (GpuEncodedIndirectCommands, NotImplemented): they keep the
split. The runtime takes the variant after the flat one (settle_partial,
refusals remembered per state); the pipeline creation log names a probed
variant's refusal declined.
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 after-merge check m3-max-24293 failed clippy (useless_conversion) on the two primitive-type
.into() calls of render/executions.rs's trail_draw: the record's field is a u32 already.
Verified: clippy, all features and under --cfg m2v_cpu_icd, in the check job.
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.
For the 3090 hang, where a shadow pass's host step and a rate-mapped pass's fan-out ran in the
same second: the trail now counts, per host step, the route each draw took (plain, the fan-out
probe, fanned out, region by region) and the executions recorded in their GPU form, and its stall
line names the device's pipeline pool's makings waiting and under way, so a driver compile
running beside a hung batch shows. Default off.
Verified: encoder_trail::tests and tests::stall (the line names the pool) in the check job.
A stalled host-stepped render encoder's trail line named its states but not what its step
recorded from the records and range buffers the GPU wrote, which is where a wrong count would
come from. With the trail on, a host step now notes each range it read from a buffer (location and
length as the bytes held them, and the commands it ran), its draws, their vertices or indices
times instances summed, the draw of the most of those (primitive type, count, instances), and the
kept chunks it ran again, whose draws it did not read. Default off: nothing is read or formatted
with the trail off.
Verified: the trail unit test (encoder_trail::tests) covers the line's new part.
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.
A recovery now marks the loss's hang on its command buffer, so that command buffer fails as
GpuHang (Metal's timeout, code 2) whichever failure finishes it, even when its front batch is not
its last. The notice counts every victim of the loss. Before, the culprit read
GpuRecoveryVictim when the scheduler or a later watch failed its last batch. That changes
runtime behaviour.
Found from reims's 3090 watchdog rerun (m3-max-24105): 19 victims, no code 2. The test fails
without the fix and passes with it on lavapipe (24259, 101/101 in the stall set) and on the 2080
(24281). Lint 24264.
The completion named the hang from its front batch, but answered GpuHang only to a command
buffer whose last batch that same failure took. A command buffer is often several batches
(each event wait splits one): where the front batch was not the last, its last batch was held
by the scheduler (an event value no signal reached) or watched after the take, and finished
later through the scheduler's fail_lost or failed_with_loss, whose answers are victims alone.
So on the RTX 3090 the 23-encoder command buffer the notice named the hang read
GpuRecoveryVictim, as did the 18 others, and the notice said 0 victims.
Now name_hang marks the command buffer (hang_of_loss) as the loss names it. complete_seen
turns a loss's error of that command buffer (DeviceLost, which a refused or failed-with-loss
batch leaves in its state, or GpuRecoveryVictim) into GpuHang, counted against its queue as
before. Every failure of the loss answers GpuRecoveryVictim, and each victim is counted on
the line as it fails (Line::victim), so the notice counts the victims of every failure of
the loss, not of the first take alone.
Verified: tests::stall's new leg the_watchdog_s_hang_fails_as_the_hang_with_its_last_batch_held
fails at the previous commit and passes here (lavapipe and the 2080; shas in the report).
A command buffer whose first batch waits on its VkQueue for a reserved signal and whose
second waits for a plain event's value nothing signals: the scheduler holds the second, the
first goes past the watchdog's bound. The test asserts the command buffer fails as the hang
(GpuHang), one committed behind it as its victim (GpuRecoveryVictim), and the recovery's
notice counts that one victim.
On the RTX 3090 the watchdog fired and the notice named a 23-encoder command buffer the hang
with 0 victims, while every command buffer's handler, that one's included, read
GpuRecoveryVictim. This test reproduces the shape: it fails here, before the fix.
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's settle now keys a region-batched draw's pipeline by the same multi-draw viewports
the host step uses, so the step finds it instead of making it. The fan-out region table is
uploaded by the first draw that binds it, not at the settle as well, counted in
WorkCounts::rate_map_fan_tables_uploaded. Both change runtime behaviour.
Verified by the change's own runs on the Iris (24278): Exact and FanOut both make 0 pipelines at
the step (before: 1); Exact cold host step 27.1 ms (before 33.4); 2 region tables uploaded per
frame (before 3). Clippy (m2v_gpu + hazards) 0 messages (24242).
The commit's settle of an execution over a rate-mapped pass asks whether
the fan-out takes each draw, which needs the regions to make a region
table; finding that, it uploaded the table (about 8 KB for 2074 regions) to
the command buffer's uploads, though its encoder records nothing. The
encoder now keeps the table's bytes (render/fan_out.rs FanTable) and its
first probe or fan-out draw that binds them uploads them; a new count,
WorkCounts::rate_map_fan_tables_uploaded, counts each upload.
The device test a_host_step_fans_out_the_commands_the_probe_does_not_flag
checks the frame uploads two: the host step's probe and its fanned-out
draws, each its own encoder; the settle's made it three.
Verified on an Iris Xe (Mesa 26.2.6; m3-max-24278): the device test passed,
"2 region tables uploaded".
A host step that draws a rate-mapped pass's regions several at a time
(VariantKey::region_viewports) keys the draw's VkPipeline with as many
viewports as each multi-draw command sets (MultiDraws::batch); the
commit's settle of an execution keyed it with the encoder's one. The key
missed at the step, which made the pipeline itself on the first frame of a
state: under RateMapRegionPolicy::Exact for every command, under FanOut for
a draw the probe flagged. One function now decides the batch for both
(render.rs region_batch), and the settle keys the viewports by it.
The device tests a_host_step_fans_out_the_commands_the_probe_does_not_flag
and exact_regions_draw_every_command_region_by_region check that the host
step makes no pipeline (WorkCounts::host_step_pipelines_made); before this
change each made one on the RTX 3090, the Iris Xe and the Radeon 780M
(m3-max-24111, 24112, 24113, the FanOut test's flagged draw).
Verified on an Iris Xe (Mesa 26.2.6; build m3-max-24241, run 24278, with
the next commit): both device tests passed, the step making none; the
pieces lane's cold frame under Exact made none at its host step (27.1 ms;
33.4 ms and one made before, m3-max-24112), under FanOut none (9.8 ms).
Clippy of the runtime, validation and conformance crates (m2v_gpu,
m2v_gpu_hazards): 0 messages (m3-max-24242).
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.
A new Private texture skips its zero fill when the first encoder of its batch writes every
texel and names it in no other use. That is a Clear load on every aspect over the whole extent,
or a blit writing its whole extent. That changes runtime behaviour, so recorded runtime results
from before it are stale.
Verified by the change's own runs: lavapipe first_overwrite and memoryless_fresh pass, and the
runtime suite passes 2440/2440 (24235). Clippy and rustdoc 24247 and 24248, lanes 358/358 (24205),
Iris 9/9 (24243). Saves about 0.1-0.2 ms per 2048^2 depth texture on the Iris; colour is within
noise. Open: lone_fetch and pass_end_tiles each failed once in debug ("a draw again kept no
draw"); being chased.
What: a new zero-filled Private texture's first move is marked overwritable
(FirstMove::mark_overwritable). An encoder notes each such texture it writes
whole before any of its commands reads it, decided from its own description,
never a shader's (encoder::Overwrite, on its first part):
- a render pass that loads every aspect of it Clear (as the descriptor set
it, before DontCare loads take clears) and stores it, rendering it itself
(no stand-in, sample planes or separate depth and stencil scratch) over its
whole extent, the image of one level and one layer
(PassLayout::overwrites);
- a blit command whose box covers its whole extent in every aspect
(BlitCommandEncoder::scrub).
At a batch's take (command_buffer/submit.rs, first_overwrites), an
overwrite counts where its part has no segment, only blit parts with no
segment that name nothing of the image come before it (any other encoder may
reach a texture through its resource ID, unnamed), and the part's own uses
read nothing of the image but its attachment's own reads (a pass) or
nothing at all (a blit). FirstMoves::take_holding then takes that move
without its zeros (unzeroed, undone if the submission is given back): the
layout move stays, and batches on other VkQueues wait for this batch as for
any first work. A part that runs nothing drops its overwrites (fail_part).
DontCare and Load first uses, and partial writes, keep the zeros. Counted:
WorkCounts::private_textures_overwritten_unfilled (new public field,
signatures re-blessed); the runtime README and docs/API.md say so.
tests::first_overwrite checks both paths (whole pass, depth pass, whole
copy, a recycled image's clear; DontCare, Load, a partial copy, a clear after
another pass) and first_overwrite_costs (ignored) prints OVERWRITE-COST,
for textures made together before the first commit (the first submission
takes every waiting first move, so only its own texture goes unzeroed) and
for textures each made just before its own command buffer (every one does).
Why: the zeros are for isolation only (main's plan for pin 64): a first use
that writes every texel before anything reads one never shows them, and
they cost the Iris Xe up to 0.22 ms a 2048² depth texture (job 24088).
Verified: before this replay onto development, at 9ab0b01426 (on a67e1e3d55):
the validation lanes touching first moves, recycling, clear reach, resolves,
blits and heaps on lavapipe (job 24205, 358 passed); on the Iris Xe (job
24218) tests::first_overwrite, memoryless_fresh and recycle (9 passed;
FIRST-OVERWRITE whole: 1 each) and OVERWRITE-COST zeroed against skipped:
made together, 8 RGBA8 1024² 2.136 against 2.100 ms median, 2 Depth32Float
2048² 1.693 against 1.487 ms, one texture a burst unzeroed. At this commit,
tests::first_overwrite and the runtime suite on lavapipe, clippy (plain and
m2v_gpu) and rustdoc, and the each-made-before cost on the Iris, reported
with this sha.
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.
A device recovery now carries its rasterization rate maps, so a pass over a map made before
the recovery encodes on the new generation instead of being refused MadeBeforeRecovery. That
changes runtime behaviour, so recorded runtime results from before it are stale.
RasterizationRateMap::device() now returns an owned Device, as the other carried objects do.
Found from reims's 3090 watchdog rerun (m3-max-24105): the rate-mapped Offscreen pass was refused
every frame after the recovery. The test a_rasterization_rate_map_goes_on_past_a_recovery and its
negative control run as m3-max-24240, clippy as m3-max-24239 (after-merge checks).
A rate map held its device as the generation handle it was made on. After
a recovery from the loss of the VkDevice, a render pass over a map made
before it met that handle in its descriptor's check (rate_mapped_pass.rs
check_descriptor: map.device().same(device)) and was refused,
NotImplemented(MadeBeforeRecovery), at every encoder, as Metal's map goes
on: a consumer's offscreen pass was refused every frame after a real
recovery on an RTX 3090, the pass's 938 textures carried.
A map holds no Vulkan object, so it now holds its device as a fence or a
depth/stencil state does (LineDevice): the recovery carries the handle, a
pass's and a copy's checks match its root handle by its line, and its
reads (the zero-layer notice, a reset's registry of command buffers to
encode again) take the generation it was carried to last. Its public
device() answers that generation's handle, owned, as the other such
objects' do (it answered a borrow). The recovery also carries the
device's note that a map of layers was released, which a later map of no
layers reads.
The device test a_rasterization_rate_map_goes_on_past_a_recovery encodes
a pass over a map made before a recovery, commits it and waits for it to
complete, copies the map's parameter data into a buffer of the next
generation and resets the map; an_objects_device_keeps_meaning_its_
generation_past_a_recovery takes the map's device among the others'. The
recovery notice's, the refusal's, the README's and docs/API.md's lists of
what a recovery carries name the maps.
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.
After a large pipeline making, the runtime hands glibc's free heap back (malloc_trim) when more
than 256 MiB of it is free, counted in WorkCounts::heap_trims. A new memoryless texture in real
memory is cleared to zero by its first move, counted in WorkCounts::memoryless_textures_zeroed,
so its resolve never reads a released texture's samples. Both change runtime behaviour, so
recorded runtime results from before them are stale.
Verified by the changes' own runs. Trim on the XTX: 103 -> 262 -> 215 MiB with 3 trims (24184);
the negative control grew to 5456 MiB (24197); lint 24188 and 24192. Memoryless: the test fails
without the fix on lavapipe (24186) and the Iris (24195), and passes with it. The runtime suite
passes (2429), the lanes 287/287 (24187), clippy and rustdoc 24189 and 24190. Iris steady state:
Depth32F 4x 1080p 1.145 ms, the same as before.
What: Device::new_texture_image gives a new memoryless texture whose memory
is not lazily allocated its zeros at its first move (zero_memoryless). A
transient attachment takes no transfer, so for each level a render pass of
that level's view alone (render_target::clear_alone, the reach clears' pass
shape, loaded and stored in GENERAL) clears every aspect with
vkCmdClearAttachments over its layers, in runs of the device's framebuffer
layers. FirstMove::zero_in_passes holds the passes and framebuffers until
the submission that records them completes, and Taken::record follows them
with a barrier from every stage. A level larger than the device's
framebuffers is no pass's attachment and takes none. Counted:
WorkCounts::memoryless_textures_zeroed (a new public field, signatures
re-blessed). Lazily allocated memoryless memory (MoltenVK) keeps what it
does today. tests::memoryless_fresh now also asserts the count.
Why: a memoryless texture held what its image's memory held, and its first
pass's DontCare load kept that, where the depth and stencil tests or a
resolve read it. That memory may hold a released texture's samples, of
another process of a consumer whose processes share the device. A per-pass
clear of every DontCare memoryless depth cost the Iris Xe 1.17 ms a 4x
1080p pass (job 24160); one clear at the first move costs the texture's
first frame alone, and later passes load as before.
Verified: tests::memoryless_fresh and the runtime suite on lavapipe, and the
Iris's MEMORYLESS-COST, reported with this sha.
What: tests::memoryless_fresh (a device test). A memoryless 4x BGRA8Unorm
color and a 4x Depth32Float depth are each cleared by a pass of no draw call
and resolved, then released. A memoryless texture of the same descriptor
takes the parked image (images_recycled). A pass of no draw call that loads
it DontCare and resolves it must write zero into its resolve texture, never
the earlier clear. It prints MEMORYLESS-FRESH with what it read.
memoryless_dont_care_pass_costs (ignored) prints MEMORYLESS-COST: commit to
completion of one such pass over a 1920x1080 4x attachment, made once,
after warm-up passes.
Why: a new memoryless texture held what its image's memory held, and a
DontCare load left it there. Its resolve, or a draw's depth and stencil
tests, read it. That memory may hold a released texture's samples, of
another process where a consumer's processes share the device.
Verified: the neg ran as 1e042c1a00 (an earlier form expecting the clear
depth): lavapipe job 24146 and Iris job 24160 ("MEMORYLESS-FRESH
BGRA8Unorm on Intel(R) Iris(R) Xe Graphics (RPL-P): other bytes").
A driver's compiler frees what it took when the making returns, and glibc's malloc keeps
what a thread frees in that thread's arena, so a process whose threads each made a large
pipeline holds each one's compile peak as free heap until it ends. On an RX 7900 XTX (RADV,
Mesa 26.2.6) a kernel of 200,000 fused multiply-adds with 600 values live, made as 9
VkPipelines, took the process's resident set from 105 MiB to 7.3 GiB; malloc_trim handed
back all but 327 MiB, and the VkPipelines and live VkPipelineCaches held about 170 MiB of
that (a probe, m3-max-24140). A guest's Blender run on the XTX grew about 0.5 GiB per large
compute variant until its VkDevice went, and died at its cgroup's cap.
Now a large making (65,536 SPIR-V words or more, the makings pipeline/compile_memory.rs
already holds words for) whose return leaves glibc more than 256 MiB free (mallinfo2's
fordblks, every arena's) calls malloc_trim(0) on its thread before it gives its words back,
counted in the new WorkCounts::heap_trims. It trims glibc's arenas process-wide; on any
other allocator nothing is called. The trade, in compile_memory.rs's docs: the next large
making faults its working set in again (about 1 s per 3.5 GiB).
For a consumer: WorkCounts gains a field (api_signatures.tsv blessed).
Test: tests/heap_trimmed.rs (m2v_gpu, Linux GNU): three large makings of one kernel keep
the resident set within 1 GiB of where it began, and count a trim.
The census at the pin-64 tip (m3-max-24201): 2351 cases, 21 profiles, 48292 compiled, 1079
refused, 0 failed, 0 differences, 0 regressions. Only the product fingerprint moved. The golden
tables at the same tip (m3-max-24200) needed no change.
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.
Driver records of 256 KiB or more are stored as manifests over content-defined chunks, each
shared run kept once (driver::VERSION 4). The sweep removes the version 3 records. That changes
the cache's on-disk form, so recorded runtime results from before it are stale.
Verified by the change's own runs: on um790's NVIDIA records the measure gives 8,061 MB -> 180 MB
(24117). Load times in release on um790 (24178): worst case +0.55 ms cold, +0.32 ms warm. clippy,
rustdoc, 44 shader_cache tests and the runtime suite (1512) pass (24179).
NVIDIA's pipeline cache data (620.70.06, an RTX 3090) held one 1,851,552-byte section, the same
bytes, in 3,565 of um790's records: its 11,853 NVIDIA records were 8,061 MB. A read-only measure
of that node's 42,860 records (cut as below, averages of 16, 32 and 64 KiB) stores them in 296 MB
at 32 KiB (NVIDIA's in 180 MB, 2.2%); 64 KiB keeps each shared run's end chunks apart (634 MB),
16 KiB doubles the files a read opens for 1.3x the bytes.
shader_cache/chunks.rs (new), store.rs, driver.rs:
- A content record of 256 KiB or more is cut by a gear rolling hash (FastCDC's normalized cut,
8 KiB to 128 KiB around 32 KiB): boundaries from the bytes alone, nothing of any driver's
format read. Each chunk is kept once at <root>/chunks/<2 hex>/<SHA-256>, outside <root>/v1, so
a build whose scans know nothing of chunks never removes one. The record's file is a manifest
(M2VCHNK1, length, count, each chunk's SHA-256 and length, its own SHA-256); a read joins the
chunks and the record's decoder checks it end to end as before (a driver record's checksum, a
library's content hash). A missing or short chunk is a miss; the next write brings it back,
and a chunk whose bytes are not its digest's is written again. Smaller records stay whole.
- Crash-safe: every chunk (temporary + rename) before the manifest's rename. An advisory lock
(std File::lock, <root>/chunks/lock): writers hold it shared from their first chunk look to
their manifest's rename; the cleanup takes it exclusively with try_lock and removes only
chunks no manifest names. Neither waits: a writer that meets a cleanup writes its record
whole.
- Bounded cleanup, in the scans the store makes already: the sweep at device creation where no
cleanup ran yet or the chunks grew past 110% of what the last kept, and after a cap scan that
freed chunks. It reads each content record's first 8 bytes (a manifest whole) and lists the
chunks once. The chunks count against the cap; a removed manifest frees the chunks only it
named.
- Upgrade: driver::VERSION 3 -> 4, its frame's magic M2VPPLC -> M2VPPL4 (an older build names
and frames otherwise, never misreads one). The old records are removed by
Store::sweep -> Chunks::due (no state yet) -> Chunks::cleanup -> Chunks::manifests, which
removes each content record whose magic is in driver::RETIRED. Each family pays one cold
making after the upgrade. The validation lanes read the new magic.
- Linux reads: every chunk opened first and posix_fadvise(WILLNEED) on each, so cold chunks
are read together.
Tests (tests::shader_cache_chunks, 8): round trip and the 256 KiB bound; a shared 1.5 MiB run
kept once (the second record wrote 95,310 of 1,580,864 bytes); no manifest when its chunks
cannot be written; a missing or damaged chunk; the sweep removing a synthetic v3 tree (four
M2VPPLC records, one of 2 MiB), unnamed chunks and a dead writer's temporary; a writer's
shared lock putting the cleanup off; a cleanup's lock making a writer write whole; the cap
evicting the older record with its own chunks.
Verified on msi (m3-max-24179, at this tree's code): clippy -D warnings all features, rustdoc,
shader_cache tests 44 passed, the runtime suite 1512 passed.
Load time, release mode on um790 (NVMe), a store load with a SHA-256 decode in both
(m3-max-24178; the SHA-256 of 1.85 MB alone is 0.80 ms), median of 20 cold (every file dropped
from the page cache) and 200 warm:
- 1.7 MB, 40 chunks (NVIDIA p90): cold 1.56 ms whole, 1.47 ms chunked; warm 0.77 / 0.95 ms.
- 2.5 MB, 67 chunks (worst): cold 2.07 / 2.62 ms (+0.55 ms; one of 20 at 12.1 ms); warm
1.12 / 1.44 ms (+0.32 ms).
- 20 families sharing the section, all cold, in turn: per family median 0.86 ms whole,
1.13 ms chunked (first 0.94 / 1.65 ms); whole's slowest 138.6 ms, chunked's 1.18 ms.
A family's later makings on the device use its live cache and read nothing.