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.
Coverage readers now take their queries from one shared pool (SparePools) instead of a query pool
made for each pass: reims's Launchpad walk made 246 query pools in 8 s, about 13.8 ms of CPU a
second in vkCreateQueryPool and vkResetQueryPool. A texture's memorylessness is set when it is
made, so is_memoryless takes no hold (resource_options took two on every check). WorkCounts gains
encoders_uncarried_*, one count for each of the 13 ways a render encoder ends carrying no kept
draw, to name why the walk's encoders carry none. The pass and draw benches gain a window
server's small passes (draw_costs pass1/pass17, --states, --worker) and examples/pass_costs.rs
times a render pass instance by how it is recorded. That changes runtime work.
Verified by the change's own runs: learned_coverage::readers_in_flight_together_take_queries_of_one_pool
on the 780M gives 8 queries and 0 pools made with 8 passes in flight, and the old coverage.rs makes
7 pools and fails (25161); carried_draws::an_encoder_that_carries_nothing_counts_why passes; lint
green in every configuration (25150). Bench, lavapipe pinned (25046): a pass of one draw 85,100 ->
83,140 instructions, 10.99 -> 10.85 us; a draw of a pass of 17 27,258 -> 26,910 instructions.
Public surface: the coverage Query gains a Drop impl (a query goes back to its shared pool), blessed
in api_signatures.tsv; a consumer that destructures a Query by value can no longer move its fields out.
The walk's vkCmdBeginRenderPass took about 6.8 us each (profile), the
bench's 1024x1024 loaded instance well under 1 us: the extent and a clear
load are the first two of the walk's passes' differences to measure.
clippy's extend_with_drain on SparePools::release (c6d4cc8d18).
Verified: lint3 job m3-max-25060 named this as its only error under
all three configurations; rerun follows.
A bench of its own Vulkan 1.3 device, no runtime: 150 passes a frame of
one draw each, 6 to a vkQueueSubmit (the walk's averages), recorded as
the runtime records them (a primary per pass, its 17 dynamic states set,
a VkFramebuffer made per pass for vkCmdBeginRenderPass) and as the
alternatives: a primary per submission, a framebuffer kept, dynamic
rendering. It prints each shape's CPU time a pass to record, submit and
reclaim, and the differences between shapes that differ in one thing:
the costs of the structural items in one run on one device.
Verified: cargo fmt only so far; built and run in the 780M job.
Each pass that measured a reader took a whole pool of 64 occlusion queries, held until
its command buffer completed, from 16 spares: with a frame's many passes and frames in
flight, most passes made a pool (a window server's walk on the XTX made 222 in 14 s,
each a RADV buffer object, about 1.2% of its encoding threads with the host resets).
Readers now take the next query of the device's current pool, whichever pass and
command buffer they are of; a pool whose every query was taken waits for its last to
come back, then is a spare, reset on the host as it becomes the current one. Each
reader's query is read alone before it goes back. Answers unchanged.
Test: learned_coverage::readers_in_flight_together_take_queries_of_one_pool (8 passes'
command buffers encoded before any commit make at most one pool).
Every render pass asked each attachment whether it is memoryless five or more times
(the layout's actions and targets, the inline open and its area, the inline begin, each
draw's memoryless writes, each texture bind), each through resource_options, which takes
two holds of the texture's parts (four mutex round trips) and resolves the hazard
tracking mode too: about 3% of a small pass's encoding thread on lavapipe (draw_costs
pass1). No storage a texture moves to or presents changes its storage mode, so the
texture keeps it from its making and is_memoryless reads it with no hold; the render
path's checks (render_pass, render, clear_reach, sample_planes, resolve, resource) ask
it. Answers unchanged.
A Launchpad walk on RADV counted no kept draw carried and no carry let go: every
encoder's carried_out declined silently, so each of its first draws per state took
every step (draws_none_kept, 53% of its draws). The encoder now counts the first
reason it carries none (encoders_uncarried_*): no draw, no kept draw at its end, an
unsettled bind state, a split, colour groups or a rate map, a replay, executed
commands or pending pipelines or tile dispatches, shader-side tests, imageblocks, a
visibility result, an instance of reformats, views or storage, a kept draw that does
not rebind, or a failing depth/stencil state. What carries is unchanged.
Test: carried_draws::an_encoder_that_carries_nothing_counts_why.
The census at the pin-67 tip (m3-max-25189): 2369 cases over 21 profiles, 48670 compiled, 1079
refused, 0 failed, 56 differences, 0 regressions. The slowest compile took 2.4 s and the largest
worker 235 MiB, inside the 20 s and 500 MiB ceilings.
The golden tables at the pin-67 tip (m3-max-25188): 21 golden hash rows move under unchanged keys
with the native fp8 change (SEMANTICS_VERSION 2082, the shaderFloat8 device facts) and the
flagged rate-mapped parts (2083), and the engine fixture expectations' tns_mm_fp8 rows on the two
RTX 50 profiles go from Unsupported{Tensors; NotImplemented} to ok, since that refusal is gone.
Test data only.
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.
Under RateMapRegionPolicy::FanOut, the probe now also records each flagged draw's first and last
flagged triangle (PROBE_DRAW_WORDS 1+2*32 -> 1+4*32), and a flagged triangle list of one instance
that reads no [[primitive_id]] and writes no memory is drawn in its place in up to three parts:
the triangles before the flagged range fanned out, the range region by region, the rest fanned
out. Parts of a 16-bit index list begin at even triangles. Other flagged draws are drawn region by
region whole, as before. Wide marks count only triangles the probe does not flag, so the fanned
parts can take the four-copy variant. New counters: rate_map_parted_draws,
rate_map_parted_region_triangles and rate_map_probe_wait_nanos. Exact is unchanged. The probe
stage's SPIR-V changes (SEMANTICS) and the runtime draws flagged draws otherwise (RUNTIME).
Verified by the change's own runs: rate_mapped_fan_out's four flagged draws go in parts and match
the region-by-region frame pixel for pixel, and Exact draws none in parts with equal pixels; every
tests::rate_map* test 21/21 on an RTX 2080 and a Radeon 780M; nextest of metal2vulkan and the
runtime 5053 passed, the 2 failures the known golden re-bless rows; clippy clean. The pieces
lane's frame with wide triangles, warm GPU: RTX 2080 39.6 -> 30.9 ms (Exact 68.5), Radeon 780M
373 -> 223 ms (Exact 566, a shared machine); the frame without wide triangles unchanged.
docs/FAST-PATHS.md row 50 gains the pieces lane's frame with wide triangles
(rate_mapped_pieces_host_step_wide), warm, at ed46f36fba's change (built at its pre-rebase commit
22b6697ba0) against the lane-only commit (8bd88bf0ac's pre-rebase 8da477a56c), each one run:
- RTX 2080 (NVIDIA 620.70.06): 30.9 ms in parts, 39.6 ms with flagged draws region by region
whole, 68.5 ms under Exact.
- Radeon 780M (Mesa 26.2.6): 223, 373 and 566 ms, on a machine running other jobs.
23 of the 64 draws are flagged; 106,519 of their triangles lie between the first and the last
flagged one and are drawn region by region.
Under DevicePolicy's RateMapRegionPolicy::FanOut the probe flags a draw that has a triangle
crossing w = 0 or reaching more regions than the geometry stage's copies. The whole draw was then
recorded region by region, once per region of the map (2074 for a 61 by 34 map), however few of
its triangles were flagged.
The probe now also records each flagged draw's first and last flagged triangle. A flagged list of
triangles of one instance, whose pipeline reads no [[primitive_id]] and writes no memory (the
conditions under which a draw is already cut into index ranges), is drawn in up to three parts in
its place: the triangles before the first flagged one fanned out, those from it to the last
region by region, and those after fanned out. Each part is a range of the draw's vertices or
indices, so each triangle keeps its vertices, vertex_id and order. Parts of a 16-bit index list
begin at even triangles, so their ranges start 4-byte aligned as the draw does. Any other flagged
draw is drawn region by region whole, as before.
The probe words grow from 1 + 2*32 to 1 + 4*32 per draw (bind::fan_out::PROBE_DRAW_WORDS). For a
flagged triangle the probe raises one of 32 words to u32::MAX - PrimitiveId and one to
PrimitiveId + 1, picked by PrimitiveId as the counts are, so no single word takes every atomic.
The wide marks that choose the variant of four copies now come only from triangles the probe does
not flag, so the fanned-out parts can take that variant.
Also: WorkCounts::rate_map_probe_wait_nanos sums the host's wall time from each probe's
submission until it saw it complete, so a walk can split host_step_nanos into the probe's round
trip and the host's own recording. rate_map_parted_draws and rate_map_parted_region_triangles
count the draws in parts and their triangles drawn region by region.
An earlier attempt drew a flagged draw through a geometry stage of 32 invocations, each taking a
block of up to 16 regions, in 5 passes over the map. On the pieces lane's frame with wide
triangles it made no GPU gain on an RTX 2080 (41.0 against 42.9 ms warm). On a Radeon 780M (RADV)
it went from 182 to 1900 ms, with one piece of 1.1 s. That attempt is not in this change.
Tests: render::fan_out's unit tests check that the parts take each triangle once, in order, with
no flagged triangle in a fanned-out part, and that the probe's words decode to the first and last
flagged triangle. The link test checks the probe's two atomic raises. The runtime's
rate_mapped_fan_out test adds two commands that draw the grid with one triangle over half the
target, one indexed and one without indices, and a triangle across w = 0 over the whole target.
Under FanOut all four flagged draws are drawn in parts and the frame is compared pixel for pixel
with the encoder's region-by-region frame. The pieces lane's wide frame checks that every flagged
draw is drawn in parts.
One triangle of every 8192 of the lane's grid becomes one 48 quads a side, about 1061 by 504
pixels over the 3648 by 1734 screen, which touches more regions than the fan-out's copies. The
probe flags every command whose indices reach one, about a third of the 64, as a guest's
rate-mapped frame on an RTX 3090 and a Radeon 780M had about a quarter of its probed draws
flagged (rate_map_flagged_draws 698.8/s against rate_map_fanned_draws 1972.9/s; 280.4/s against
788.7/s). rate_mapped_pieces_host_step_wide fans the frame out and rate_mapped_pieces_host_step_wide_exact
draws it region by region; the fanned-out frame asserts that the probe flagged a draw, and the
small frames that it flagged none.
Measurement only (ignored, run by name); no product 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.
What: two fields on WarmStatistics, which stays Copy + Eq + Default.
- record_in_making: the record's place among every record handed to the device's
Device::warm calls, in the order handed (each call notes its first's place). While it is
made, that is the six record counts' sum. None between records and while no pass runs.
- record_in_making_nanos: how long that making has worked.
How the time is kept (warm/pass.rs):
- Each record's making now has its own Pass. The Pass shares the call's byte count and holds
a clock: the wall time while one thread or more works for it. That is the pass's thread
inside `within`, or a piece of the record's that it handed the pool, which captures that
record's Pass when handed.
- warm::waiting stops the clock around this thread's waits. It is wrapped around:
- a thread's wait for its budget turn (thread_turn_in);
- without_turn's lend and retake, which covers compile_memory's words wait and the flight
and library waits;
- making.rs's waits for a making in flight;
- pool.rs's full join.
A nested wait is the outer one's, and a thread works once for a pass it already works for.
- The warmer keeps the record in making (index and Pass) from just before its creation until
just before its outcome is counted, so the index and the counts' sum agree whenever it is
Some.
- A test-only gate (warm::gate) holds a chosen record's making, working, at its start.
Why: reims's warmbound lane needs to find a warm record whose making never ends (an ANV
making on ms01's Iris) and tombstone it once it has worked 60 s. A record starved by a
program's storm must never look like that.
Verified: not run at this commit. Tests added:
- pipeline::budget::tests::a_warm_making_s_time_holds_still_while_it_waits_for_a_turn
- pipeline::budget::tests::a_warm_making_s_time_holds_still_while_its_piece_waits_for_a_turn
- tests::warm::the_record_in_making_names_its_place_and_how_long_it_worked
Signatures blessed.
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 Managed two-copy buffer whose host copy is its pages alone, where a guest RAM's chunk imports
hold every page of it (a buffer across a chunk end), now keeps pieces of those imports, and its
copies in are GPU copies from them: no CPU staging, no bound and no submission. Before, its named
ranges were staged by the CPU at each commit. AtCommit still stages a named range at the commit.
New WorkCounts name the path: managed_bytes_staged_in, managed_bytes_copied_in_from_ram,
managed_pages_alone_refused, managed_pages_alone_over_imports, managed_pages_alone_unwritable and
managed_pages_in_ram_chunks. That changes runtime behaviour.
Verified by the change's own runs on the RTX 2080: the equality tests (a 4 MiB buffer across a
chunk end, both policies) pass, checking the counts, the bytes the GPU reads after a CPU write
across the end and which path copied them; MANAGED-RAM-COPY-IN at 32 MiB across the end, commit
call 2.139 -> 0.035 ms and completion 19.41 -> 17.40 ms (0.257 -> 0.010 ms at 4 MiB);
host_ram_device 29/29, managed_copy_device 30 passed. lavapipe suite 2472/2472; clippy plain,
--cfg m2v_cpu_icd and --cfg m2v_gpu and rustdoc green.
What: a Managed no-copy buffer on a device without unified memory can have
a host copy that is its pages alone, because its own import would map pages
a live import holds or the device refused it. Where a guest RAM's chunk
imports hold all of those pages, it now keeps the pieces of those imports
(host_ram.rs RamOnDevice::pieces_of, ChunkPiece). The caller's resolver is
still asked once: its answer is kept for the pieces.
- Its copies in (as it is made, at a rebind, and each range
did_modify_range names under AtSubmission) are GPU copies from those
imports' VkBuffers, one per piece. They are held as a host copy
(Keeps::HostCopy): nothing is staged, no bound applies, no submission is
made. AtCommit still stages a named range on the CPU at the commit.
- New public WorkCounts, so a pass can tell the paths apart:
- managed_bytes_staged_in, the bytes the CPU staged for copies in;
- managed_bytes_copied_in_from_ram;
- managed_pages_alone_refused, managed_pages_alone_over_imports and
managed_pages_alone_unwritable, why a host copy is its pages alone;
- managed_pages_in_ram_chunks.
- Tests: tests/host_ram_managed.rs, a buffer across a chunk's end with
both chunks imported, under both policies. It checks the counts (pages
alone over imports, held by the chunks, nothing imported, gate unasked),
the bytes the GPU reads as the buffer is made and after a named CPU
write across the end, and which path copied them.
- Docs: managed_copy.rs, managed.rs, buffer.rs, HostMemory::with_runs,
docs/API.md, and FAST-PATHS row 51. Signatures blessed.
Why: such pages were staged by the CPU at every commit that took a named
range. That is a CPU copy and staging memory, on the commit's thread, for
bytes the device already maps through the chunk imports. Zero copy first.
Verified: not run at this commit. The 2080 equality tests and the bench
(before at the bench commit, after here) and lint follow on the rebased
branch.
What: tests/host_ram_managed.rs, a new device-test module for Managed
no-copy buffers over a guest RAM, with one ignored release bench,
MANAGED-RAM-COPY-IN. Its buffer is 32 MiB centred on the end of the RAM's
first chunk, and both chunks are imported. Ranges of 256 KiB, 4 MiB and
32 MiB across the chunk end are written and named before each of 20
commits. Each commit reads the range's first and last bytes, and they are
checked. It reports the commit-call and to-completion medians and the
bytes copied in, on the default device and on one of exact_answers().
host_ram_device.rs exposes its RAM helpers and gains held_device(policy).
Why: such a buffer's host copy is its pages alone, because its own import
would be over pages the chunks' imports hold. Its copies in are staged
by the CPU at the commit today. This bench measures that before the GPU
copies them from the chunks' imports.
Verified: not run at this commit. It is run on the 2080 before and after
the change.
A commit's take of the ranges did_modify_range named now asks its encoder records only about the
owners that have noted ranges (CommandBuffer::may_use, State::named_among), stopping once all are
found, and walks only those owners' keys: no scan of every noted range and no Weak upgrade of
unused ones. Noted ranges are indexed by buffer key and owner; those of buffers that are gone are
replaced on note and swept when the set doubles. Before, every split part of a commit scanned
every noted range: reims's Launchpad walk spent 14% of commit_and_submit there. That changes
runtime work.
Verified by the change's own runs on the RX 7900 XTX (MANAGED-STALE-TAKE, 200 commits of 24 blit
encoders and one Managed range each, bytes checked every commit), median commit call before ->
after: 0.0061 -> 0.0066 ms with no stale buffers, 0.874 -> 0.0070 ms with 1,000, 9.16 -> 0.0062 ms
with 10,000. managed_copy_device 30 passed on the XTX; lavapipe suite 2470/2470; clippy plain,
--cfg m2v_cpu_icd and --cfg m2v_gpu and rustdoc green.
What: managed.rs's Noted keeps each buffer's ranges by its key and indexes them by what owns
its memory (used_resources::owner_of, asked as the range is noted). Modified::take_at_commit
asks the committing command buffer once which of the noted owners it may use
(CommandBuffer::may_use, State::named_among: every encoder record's keys read once, under one
lock of each registry, until every noted owner is found; all where a command reaches memory no
use names or the last encoder's end is not lowered), then takes those owners' buffers' ranges
and those no owner holds, in the order each buffer was first noted. used_resources::names_of
and HeapKeys::names_of answer for a set of owners where names_any answered for one. A note
drops buffers gone once the buffers noted pass twice their count at the last sweep, and a key
noted again whose buffer went starts anew, so ranges of buffers no commit uses do not pile up.
A note looks at its own buffer's ranges alone (it compared every noted range's buffer).
Why: a consumer's compositor frame commits in 27 parts; the take was 14.9% of
commit_and_submit (Noted::take 14.1%, the uses closure 8.1%, HeapKeys::names_any ~5%): every
commit upgraded every noted range's buffer and asked every encoder record of each, and ranges of
buffers no commit uses stayed noted, scanned at every part. Now a commit costs one read of its
own uses where an owner's ranges are noted, and nothing where none are. Which ranges a commit
takes, and so which bytes each command buffer reads, is unchanged.
Verified: tests::managed's take-rule test rewritten for the new rule (stale gone buffers swept);
the bench before and after follows on the RX 7900 XTX.
What: tests::managed_copy_device::stale_ranges_take_bench (ignored, MANAGED-STALE-TAKE):
the median commit call of 200 command buffers of 25 blit encoders, one reading a Managed
buffer whose range each commit takes (its bytes checked at each), beside 0, 1,000 and
10,000 Managed buffers whose ranges are named and that no commit uses.
Why: a consumer's compositor frame commits in 27 parts; Modified::take_at_commit was 14.9%
of commit_and_submit there (Noted::take 14.1%, the uses closure 8.1%): every commit scans every
noted range and asks each encoder record of each, and ranges of buffers no commit uses stay
noted. This bench measures that per-commit cost before and after the next commit.
Verified: run with the next commit's change, before and after, on the RX 7900 XTX.
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.
Each device's idle sweep thread now looks at glibc's heap every 5 s (HEAP_EVERY), whether or not
a sweep is due, and trims (malloc_trim, counted in WorkCounts::heap_trims) when free heap stands
more than 256 MiB (FREE_FLOOR) above the least free it read since its last trim, on two looks in
a row. Before, the free heap went back only after a large pipeline making: an Iris Xe guest boot
held 3-4 GiB of free arena untrimmed (reims 24852). On hosts without glibc the thread makes no
look. That changes runtime behaviour.
Verified by the change's own runs on lavapipe (24983): 11/11, among them idle_heap_trim, which
frees 768 MiB of 64 KiB chunks but one in 16 and reads resident 941 MiB fall to 223 MiB after
9.8 s idle with 1 trim; with the heap look removed (24994) 946 MiB stays for 30.1 s with 0 trims
and the test fails. Lints green (24957, 24958).
compile_memory's TRIMS counter and its atomic imports are read and written only by the glibc
forms of trim() and heap(). On a host whose allocator is not glibc's (macOS), the static was never
used and Ordering never imported, warnings that -D warnings makes errors. Both now carry the
same cfg as the code that uses them. No behaviour changes on any host.
Verified by reading: every use of TRIMS, AtomicU64 and Ordering in the file is under
cfg(all(target_os = "linux", target_env = "gnu")). Not compiled on macOS here; the macOS lint
is CI's.
glibc keeps what the process's threads free as free heap, its pages resident, until
malloc_trim hands it back, and only a large pipeline making's return called it. The memory
log of one Iris Xe cold boot at pin 66 (reims's 24852) shows the cost: 1.4 GiB of glibc's 4.0
GiB of arenas free at its end, after 3 trims in all, all from large makings.
Now each device's idle sweep thread also looks at glibc's heap every 5 s (HEAP_EVERY), whether
or not a sweep is due, and trims once the heap holds more than the floor (FREE_FLOOR, 256 MiB)
free above the least free a look read since the last trim, at two looks in a row
(idle_sweep::HeapLook). The least-free rule, not the bytes free alone, because glibc still
counts a trimmed chunk free: a plain fordblks rule would trim again at every look. A trim
counts in WorkCounts::heap_trims, as a large making's does. compile_memory gains heap_bytes()
and trim(), which return_free_heap now uses. Only on Linux with glibc; elsewhere the thread
makes no look and waits as before.
Docs: idle_sweep.rs and compile_memory.rs module docs, WorkCounts::heap_trims, the memory
log's paragraph in docs/API.md.
Tests: tests::idle_heap_look (the look's rule: trimmed at the second look, not again for what
a trim left, again for what was freed after it); tests::idle_heap_trim (device test, m2v_gpu
or m2v_cpu_icd, Linux gnu): 768 MiB of written 64 KiB chunks, all but one in 16 and the last
freed, then idle; the device's thread trims and the resident set falls by 512 MiB or more. The
lavapipe run and its negative control (no heap look: the test must fail) follow this commit.
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.
Only copies in from real staging now count against the staged-copy bound (STAGED_BYTES,
STAGED_COPIES). A copy in from a host copy (the runtime's own mirror, or an import of the
caller's pages) holds no staging memory, counts toward no bound and makes no submission of its
own: Buffer::upload no longer calls submit_internal, and a commit's uploads go with its own
batch. Before, a commit naming more than 256 MiB of Managed ranges crossed the bound, submitted
internally and waited on the GPU inside the commit call: Geekbench's Photo Filter, Video Filter
and Path Tracer paid about 137 ms once an iteration on an RTX 3090 (internal_submissions +23,
about 137 ms outside the commit phases each). AtCommit's staging keeps the bound. When a commit
submits changes, so this changes runtime behaviour.
Verified by the change's own runs on the RTX 2080: ranges_past_the_bound_go_with_the_commit_s_batch
(528 MiB of ranges over the runtime's own buffer and an import) fails before the change with 2
internal submissions and a 280.7 ms commit, and passes after with 0, no bytes staged and a 28 us
commit, the GPU reading the right bytes; the AtCommit leg keeps its 2. Bench at 265 MiB a commit:
the commit call 140.2 ms -> 0.028 ms, completion unchanged at 140.5 ms. managed_copy_device 30
passed on the 2080 and on lavapipe; clippy plain, --cfg m2v_gpu and --cfg m2v_cpu_icd and
rustdoc green.
What: tests/first_moves.rs passes Keeps::Staging to register_bytes, whose keeps the previous
commit typed.
Why: the lib test target did not compile at 9637bb69f9 (E0308 at first_moves.rs:56 and :113).
Verified: clippy --cfg m2v_gpu and --cfg m2v_cpu_icd failed there with exactly these two
errors (jobs 24857, 24858); the rebuild follows.
What: texture/first_move.rs's FirstFill marks whether its source is a staging buffer of its
own (Keeps::Staging) or a host copy the buffer holds anyway (Keeps::HostCopy: a Managed
buffer's mirror, an import of the caller's pages). past_bound counts only staged fills toward
STAGED_BYTES and STAGED_COPIES, and a registration answers past the bound only where it staged.
Buffer::upload (the runtime's own mirror) and CallerCopy::copy_in from an import register
HostCopy and never call submit_internal; stage_in (pages no import maps, and AtCommit) and
Buffer::fill_first_from register Staging and keep the bound. Docs: first_move.rs's Bounded
bullet, managed_copy.rs's Copies in, Buffer::upload and copy_in_from.
Why: a commit's copies in of the ranges did_modify_range named counted toward the 256 MiB bound
of staged memory though they hold no staging memory; past it, Buffer::copy_in_from made an
internal submission on VkQueue 0 behind the GPU's queued work and waited for it inside the
commit call. A workload naming ~265 MiB of Managed ranges an iteration spent ~137 ms of each
iteration's commit there on the RTX 3090 (internal_submissions +23 a run, the commit phases
7-14 ms of 2.88-3.00 s). The copies now go with the commit's own batch, which the call does not
wait for; real staging keeps its bound. Which bytes a command buffer reads is unchanged.
Verified: see the evidence sent with the branch (the 2080 run of the previous commit's tests
before and after, the unit test, lint).
What: tests::managed_copy_device gains ranges_past_the_bound_go_with_the_commit_s_batch
(the default AtSubmission: a commit of a command buffer that reads ranges did_modify_range
named, 2 x 264 MiB over the runtime's own Managed buffer and an import of the caller's pages,
makes no internal submission and stages nothing, and the GPU reads the CPU's bytes) and
ranges_past_the_bound_at_the_commit_are_staged_within_it (AtCommit: the commit stages them,
the bound holding for that staging, and the GPU reads them). The copy-in bench gains a 265 MiB
range a commit.
Why: on the RTX 3090, three compute workloads spent 21 x ~137 ms a run in commit calls
outside every commit phase (perfscout2, w-3090 24751 at e5876e36b1: internal_submissions +23
each, the six phases summing to 7-14 ms of 2.88-3.00 s). Each iteration named ~265 MiB of
Managed ranges; the commit's copies in from the host copies counted toward the 256 MiB bound of
staged bytes though they stage nothing, so the copy that passed it made an internal submission
behind the GPU's queued work and waited for it inside the commit call. This commit is the
failing test; the next makes it pass.
Verified: not run yet at this commit (it fails without the next commit by design; the run on
the RTX 2080 follows with 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.
On a device with VK_EXT_shader_float8 (shaderFloat8), 8-bit floats now widen through the
device's own Float8E4M3EXT and Float8E5M2EXT types: air.convert's f8e4m3fn and f8e5m2 sources,
simdgroup-matrix fp8 cells and matmul2d's fp8 elements all go through one decode, which bitcasts
each lane to fp8 and converts it with OpFConvert. That's the device's native form (owner rule 1).
IEEE-like f8e4m3 has no device encoding and keeps the integer decode, as do devices without
shaderFloat8. A tensor format widened natively records PrecisionNote::NativeFloat8
(native-float8): the device's e4m3 reads 0x7F and 0xFF as NaN where Metal reads a number, and
its e5m2 NaNs carry other bits. The float8 products refusal is removed.
The translator's output changes (SEMANTICS), the precision-note codec gains NativeFloat8
(ARTIFACT_FORMAT), and the runtime enables shaderFloat8 (RUNTIME). The golden tables and the
compile census are re-blessed at the next pin.
Verified by the change's own runs: 993 of 994 touched tests (24812), the one failure fixed and
rerun 59/59 (24835); matmul2d fp8 on nvidia-rtx50-linux declares Float8EXT and records the note,
and on MoltenVK, RADV and lavapipe gives exact words with neither; lints green (24813, 24814).
RTX 5080 against the M3 Max rows (24815, 18 fp8 cases): 4 equal, 14 differ only in NaN words,
each row carrying NativeNanEncoding and NativeFloat8 and the runtime announcing
metal2vulkan-degrade-native-float8.
ash_interop::tests::every_feature_has_a_source reads every VkFeature from a fake device that
lists every extension; it lacked VK_EXT_shader_float8, so ShaderFloat8 had no source (24812). The
RTX 50 profiles' 8 opened validation contexts now chain VkPhysicalDeviceShaderFloat8FeaturesEXT
(one member more each), blessed by bless_opened_chains on msi (24812).
Owner rule 1: where a device has a native 8-bit float type, its conversion is the only form.
VK_EXT_shader_float8's shaderFloat8 (the SPIR-V capability Float8EXT, SPV_EXT_float8) is now a
VkFeature the device enables and the profile reads (leaf.float8); the SPIR-V IR has
Type::Float8 { encoding } (OpTypeFloat 8 with its FPEncoding, from the regenerated grammar items),
and the interpreter reads OCP's E4M3 and E5M2.
The shared decode, narrow::fp8_to_f32, widens through the device's type where the layout names
one (Fp8Layout::on): each u32 lane bitcast to four 8-bit floats, the low byte's widened by
OpFConvert, so no 8-bit integer type is needed. f8e4m3fn and a tensor's e4m3 take Float8E4M3EXT,
f8e5m2 and a tensor's e5m2 Float8E5M2EXT; the IEEE-like f8e4m3 has no device encoding and keeps
the integer decode. Every site takes it: air.convert's 8-bit float sources, simdgroup-matrix fp8
cells, and matmul2d, whose expansion now widens each element by an air.convert of the tensor's
format (Fp8::TensorE4M3, Fp8::TensorE5M2: Metal's reading, qualified on the M3 Max, e4m3 with no
specials, e5m2's NaNs 0x7FC00000; never parsed from a name, built by Out::air_call). A device
without shaderFloat8 decodes with integers, as before.
Where a tensor's element widens natively the stage records PrecisionNote::NativeFloat8
(native-float8): the device's e4m3 reads 0x7F and 0xFF as NaN where Metal reads 480 and -480,
and an e5m2 NaN's bits are the device's. Validation classes it Unbounded; the conformance suite
lists it among the native notes; FAST-PATHS.md has its device-gap row and API.md its catalogue
entry. The other formats record none: Metal on Apple M3 does not compile them.
The refusal of a matmul2d of 8-bit floats on such a device (Entry::float8_products, the select
check) goes. REFUSALS.md and api_signatures.tsv regenerated.
Tests: matmul2d's fp8 fused sums on the RTX 50 profile (Float8EXT declared, the note recorded,
e4m3 NaN sums) beside MoltenVK, RADV and lavapipe (neither); air.convert widenings on the RTX 50
profile and lavapipe; simdgroup-matrix fp8 cells on the RTX 50 profile too. Not yet built here:
the build and these tests run next on the cluster.
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 memory block the runtime makes ahead of need no longer takes the device's last allocation
slots from a caller's allocation. An allocation made ahead is admitted only where one more still
leaves the margin, checked in the same step as the count; it never waits at the limit and never
counts as refused. A making counts as work ahead unless a placement waits for it, and the
give-back thread now also frees blocks made ahead and not yet added that no call waits for
(Memory::give_back_ahead), counted in blocks_ahead_unused and memory_frees.kept_for_room. Before,
a speculative make-ahead could pass the margin check while live allocations were low, take the
last slot, and leave a caller's buffer refused at the limit with no block ever given back. That
changes runtime behaviour.
Verified by the change's own runs on lavapipe: the new forced test
blocks_ahead::an_allocation_at_the_limit_takes_back_the_blocks_made_ahead passes (24845, 1 buffer
of a room of 1, 1 block given back) and fails without the fix every time (24844, 0 of 1); the
guest-RAM test that failed 4 of 4 passes (24825, 3 of 3); clippy default and --cfg m2v_gpu,
runtime lib 1514/1514 and rustdoc green (24826).
A guest's buffer at the device's allocation limit was refused while blocks the runtime had
made ahead of any object held allocations: on lavapipe,
tests::host_ram_device::an_allocation_at_the_limit_waits_for_the_untaken_chunks_to_go_back
failed 4 of 4 (2 buffers made of a room of 3, then TOO_MANY_OBJECTS at 5 of 5). A probe of every
vkAllocateMemory by site and thread showed the cause. After the give-back of the untaken
chunks left 2 live, the speculative making of the images' pool passed the margin check at 3
live, and its zero-initialized allocation was still under way when the guest's third buffer was
refused. keep_room's making for the encodings' pool took the other slot: a creation call's wait
counted as "wanted", so it bypassed the margin. The pooled blocks made ahead were never given
back at the limit; only the host-RAM chunks were.
- allocations.rs: an Ahead mark on the thread admits an allocation only where one more leaves
the margin, in one step with the count (no check-then-allocate), and it never waits at the
limit or counts as refused. It marks the give-back due.
- memory/ready.rs: a making is the runtime's work ahead unless a placement waits for it
(Waits::Placement against Waits::Room). keep_pool_room's own making is marked ahead too.
- The give-back's thread also frees the blocks made ahead and not yet added that no call waits
for (Memory::give_back_ahead). Their makings are stopped and joined; a making under way is
ahead, so it never waits at the limit and takes no memory lock. The frees count as
blocks_ahead_unused and memory_frees.kept_for_room.
- Tests: allocations::tests::an_allocation_ahead_takes_the_room_past_the_margin_alone_and_is_given_back,
and blocks_ahead::an_allocation_at_the_limit_takes_back_the_blocks_made_ahead. The second forces
the order: blocks made ahead are held, and the limit leaves no room ahead even once they go.
Without the fix it fails every time.
Verified on lavapipe (msi):
- blocks_ahead's forced test passes: 1 buffer of a room of 1, with 1 block made ahead given
back. On development without the fix (negative control) it fails every time: 0 of 1.
- The test that failed 4 of 4, host_ram_device's
an_allocation_at_the_limit_waits_for_the_untaken_chunks_to_go_back, passes: 3 buffers of a
room of 3, with 2 waits for the give-back.
- So do the rest of host_ram_device, blocks_ahead, posted_frees and allocations' unit tests
(46 of 47; the 47th is the forced test, since fixed).
- Clippy (default and m2v_gpu), the runtime lib suite (1514 of 1514) and rustdoc are green.
device_recovery_exportable compared the inode of a dma-buf export taken before a recovery with
one taken after it. On an RTX 3090 the two inodes differ. The recovery exports the block again
from the lost VkDevice, and NVIDIA's driver answers a new dma-buf to each export. Vulkan does not
say that two exports of one memory answer one file, so the inode check relied on undocumented
behaviour.
What the runtime documents is that the other API's imports still reach the carried buffer's
memory. The test now checks that instead. For each handle type, a second VkDevice imports the
export taken before the recovery. After the recovery it fills the memory and releases it to the
family the runtime acquires from (VK_QUEUE_FAMILY_EXTERNAL for an opaque descriptor,
VK_QUEUE_FAMILY_FOREIGN_EXT for a dma-buf). After Buffer::external_write_done, a copy of the
buffer and a copy of the texture over it both read the import's bytes. The allocation size,
offset and memory type are still compared; the inode is not.
The test does not check the other direction, the import reading what the runtime wrote. The
runtime releases nothing to the other API, and Vulkan leaves the contents undefined for an
entity that takes ownership without a release (External Resource Sharing). The module docs say
the same.
tests/exported_memory.rs's Writer now takes the handle type. For a dma-buf it enables
VK_EXT_external_memory_dma_buf and VK_EXT_queue_family_foreign. It imports as a memory type that
vkGetMemoryFdPropertiesKHR answers, preferring the exported one. The import is dedicated where
the allocation is, where the device imports only so, or where the buffer requires it; a
dedicated buffer spans the allocation (VUID-VkMemoryDedicatedAllocateInfo-buffer-02965).
Verified: the lib test binary under --cfg m2v_gpu at this change, each test in its own process,
passed device_recovery_exportable (OpaqueFd and DmaBuf both printing "the import before the
recovery wrote the carried buffer", allocation (67108864, 0, type) the same before and after) and
both exported_memory tests on an RTX 3090 and an RTX 2080 (NVIDIA 620.70.06) and a Radeon 780M
(RADV, Mesa 26.2.6).
The census at the pin-66 tip (m3-max-24777): 2369 cases over 21 profiles, 48614 compiled, 1135
refused, 0 failed, 18 differences, 0 regressions. The slowest compile took 3.0 s and the largest
worker 232 MiB, inside the 20 s and 500 MiB ceilings.
The golden tables at the pin-66 tip (m3-max-24776): 73 golden hash rows move under unchanged
keys and 4 are new, from the translator changes since pin 65 (half division and square root at
16 bits, SEMANTICS_VERSION 2080; whole grids on the partial-threadgroups variant, 2081; the fp8
matmul fixtures). The engine fixture expectations gain the tns_mm_fp8 and tns_coop_fp8 rows, and
tns_mm_fp8 gains its printout. Test data only.