The stack's heap half reads merge their class arms as the texel's half bits (bfc5a95e03), which
changes that read's SPIR-V on every profile, so the engine inventory, the AIR input printouts and
the golden hashes are blessed on the stacked tree.
Verified: the bless leg's check of the five fixture tests (metal_as part 2 of 4, llvm_as part 7 of
8, golden_hashes_match_the_table, engine_fixtures_match_their_golden_printout,
inventory_lists_every_fixture_in_order) passed after the bless.
The staging wait (7647e46008) and the heap half reads (bfc5a95e03..141c0787ad) change hashed
runtime and translator sources. RUNTIME_VERSION moves once at the stack's end.
Verified: the pin is pin-compute.py's hash of this tree's runtime sources.
What: the MetalHalfConversion paragraph of the driver-facts record states the two gate lanes'
results on the M3 Max: a heap's half read of every code of the five forms it holds by raw texels
(BGRA10_XR, BGR10_XR, R16Bfloat, RG16Bfloat, RGBA16Bfloat) is the nearest even half of the same
read as float, and the slot's half read, in all 262,144 channels of each; and every one of the
2,170 lanes of an argument buffer's reads of a member of another class (the half ones among them,
a NaN's bits included) is the slot's words. runtime-sources.sha256 moves for this doc edit, which
changes no behaviour of a run.
Why: the previous two commits count a decoded texel's half rounding as the measured conversion
and merge a heap half read's class arms as bits; these are the runs that measure both.
Verified (potluck m3-max-960, --gpu m3max, MoltenVK 1.4.2, at 1757bd7866):
runtime_lane::(cross_class_reads|heap_extended_reads|half_conversions|alpha_in_red)::, 25 tests,
25 passed; HEAP-HALF-ROUNDING: 0 of 262144 channels for each form, note false; CROSS-CLASS
argument-buffer reads: 2170 lanes checked, 0 differ, 0 hold a half NaN of the device's bits,
announced {SetPastLayoutSupport, DeviceNanEncoding, HalfTexelConversion}. Negative control
(m3-max-971, at a scratch commit on 1757bd7866 whose half read merges its arms' widened values
again): the same lane fails with the stack 28 gate's 66 of 2170 lanes (R8Sint as half
[00007e00, ...] against [0000fff5, ...]), and engine_cross_class's
an_argument_buffer_half_read_merges_its_arms_bits fails there too (m3-max-961).
(cherry picked from commit 2ff2ed23f56110fcc2d066b84ff99077275abeee)
Re-applies 384734851d (reverted in the stack by 5dbf6f3be3) on top of the previous commit, which
merges a heap half read's class arms as the texel's half bits.
What: narrow::round_texel rounds through round_measured, so in QuantizeForm::Converted the
conversion pair's narrowing is recorded as measured. On a profile that takes
DriverDeviation::MetalHalfConversion (MoltenVK on the Apple M3 Max's macOS 27 identity) a texel's
half rounding records no PrecisionNote::NativeHalfConversion, and the module requires
VkProperty::MetalHalfConversion instead: a texel the module decodes itself
(extended_range::decode), a merge of texels (a heap read's phi of its fetched texel and its decode
routine's) and an image instruction's. The note stays for roundings by narrow::round: half
operations and functions computed in float, filter sums, packs and the rest. Other profiles never
read the measured set, so they are unchanged by construction, and round_measured emits the same
pair, so the SPIR-V is unchanged. SEMANTICS_VERSION 1967: recorded notes change on moltenvk-m3.
Why: reims-vgpu's strict Mac tests die on native-half-conversion at a kernel that reads an
argument buffer's texture as half (their ycbcr_probe.metal read_held, over BGRA8Unorm). Every heap
half read carries the decode routine of the seven extended-range/padded/bfloat forms, and its
merge, so it recorded the note whatever the texture. MetalHalfConversion measured the device's
conversion as Metal's half(float) for loaded and computed floats; where Metal's half texel is not
the nearest even half of the texel's value, the access's own note states it: HalfTexelConversion
(outright for a heap element, by the bound class at a slot) or DevicePackConversion (a decoded
texel). The stack 28 gate's cross-class lane failure that reverted it came from the heap read's
merge of widened halves, not from a rounding: an integer texel's bits read as half go through no
rounding, and the previous commit merges them as integers, so they keep their bits without a note.
Kept from 384734851d: the core tests heap_half_texels_round_by_the_measured_conversion and
decoded_half_texels_round_by_the_measured_conversion, the M3 lane
heap_extended_reads::heap_half_reads_of_every_code_round_their_float (half_conversions::half_of
made pub(super) for it), and the docs: the PrecisionNote, DriverDeviation and VkProperty rustdoc,
API.md's native-half-conversion exemption, the driver-facts record (which now also says the
argument buffer's cross-class half read rounds nothing and names its lane), narrow's docs.
runtime-sources.sha256 moves for the doc edits in driver_facts.rs and requirements.rs, which change
no behaviour of a run.
Verified: pending in this commit; the next jobs run the core and M3 lane checks on it.
(cherry picked from commit 1757bd7866aa87c4e38ab83f0b4c4d83e68c75bb)
What: a half read of a texture an argument buffer holds, whose class arms read a member of
another numeric class (Read::heap_cross), now hands its merge each arm's half bits in u32 lanes
(narrow::to_bits: a sibling's noted bits, its words' low 16; the own arm's texel narrowed by the
device), zero where the handle is null, and widens the merged bits once after the merge
(narrow::from_bits). Before, each arm widened its half and selected it against the null handle's
zero, and the merge carried the texel structs of those floats. emit::read is split into
read_texel (the texel, the handle's liveness, the status word) and the null select and status
word, which read_crossed's half arms apply to the bits instead. The read's word estimate counts
the arms' narrowing and the widening. SEMANTICS_VERSION 1966: the SPIR-V of every such read
changes on every profile.
Why: the stack 28 gate's M3 lane
runtime_lane::cross_class_reads::argument_buffer_cross_class_reads_are_the_native_words, run with
a texel's half rounding counted as measured, answered 0x7e00 where the slot's read keeps an
integer texel's NaN bits (R8Sint, RGBA8Sint, RG16Sint, RGBA16Sint, RGBA32Sint, RGBA16Uint and
RGBA32Uint as half, 66 of 2170 lanes). The module (the lane's held half read, translated through
the CLI on moltenvk-m3 at a1c2a5f52e) merged OpPhi %_struct of
OpSelect(live, OpFConvert(bits as half), 0) from the Sint and Uint arms with the own arm's
texel, then narrowed the extracted float for the store: the merge of a widened half selected
against zero with another widened value that Metal's compiler does not fold back to the bits
(narrow::merges_mixed_selects' measurement: 2045 of 2046 NaNs 0x7E00), which the analysis did
not see through the struct. With the bits merged as integers, the value after the merge is the
slot's shape (the words' low 16 bits widened, then moved and stored), which keeps every NaN's
bits on the M3. The NativeHalfConversion the module recorded for its texel roundings had been
letting the lane accept those NaNs.
Verified: pending in this commit; the next commits' jobs build and run it (the new core test
engine_cross_class::an_argument_buffer_half_read_merges_its_arms_bits: a u32x4 phi and no texel
struct phi for a half read on every committed profile with a sampled heap, a struct phi for a
float read, inside the word estimate, L3).
(cherry picked from commit 3e9fedbf34cb1ff78f7a32c2322fdd67b5fc36db)
The once-per-VkQueue change joined two of its lines into one of 134
columns; the text is unchanged.
Verified: cargo fmt; no added line over 100 columns in the branch's diff.
(cherry picked from commit 91f8b186c1e89253891749fa5b74245a901aa597)
The module doc named the guest program whose start made the 1776
replaceRegion burst; it now says what the burst is (1776 calls back to
back, each into a small texture of its own), and that a staging submission
is waited for by the first batch on each VkQueue after it.
Verified: cargo fmt; doc comments only.
(cherry picked from commit 1bda154285a9333989da080f38463b5004c7f1c3)
Every batch took a GPU wait on the staging queue's last submission for as
long as the host had not seen it complete, so each batch committed during a
copy carried its own semaphore wait: on an RTX 5080 Laptop GPU, about 3.3
batches per staging submission (1691 to 2097 waits for 539 to 573 staging
submissions in 240 frames of 100 command buffers beside a thread uploading
7 MiB of Shared and Managed texels every 8 ms). A batch with a wait cannot
join a group, and on drivers whose submissions stall on semaphore operations
every extra wait is another chance of a stall.
One wait per VkQueue is enough: a semaphore wait's second synchronization
scope holds every command later in submission order on that queue, so the
copies are visible to every later batch there. The scheduler already keeps,
per VkQueue and per timeline, the value a batch there last waited for
(State::waited, with the staging queue's place after the VkQueues and the
internal submissions); the staging wait now reads and sets it. A held group
goes to its VkQueue before any later batch there, and a failed submission
puts the values back, so the mark never runs ahead of a made wait. Internal
submissions keep their own wait.
New lane runtime_lane::staging_batches::batches_after_one_that_waited_for_a_
staging_copy_follow_its_wait: one 64 MiB replace_region, then 32 command
buffers on one queue that each blit a square of it; every square reads the
call's bytes, and the staging waits are one, not one per batch.
Verified on the RTX 5080 Laptop GPU (release, --cfg m2v_gpu, this change on
top of a lane-only commit): the new lane passed 3 of 3 (gpu_waits 1, every
square's bytes right); the same tree with command_buffer/submit.rs as before
this change failed it 3 of 3 (32 waits, the bytes right); the staging_batches
module passed 9 of 9. In the uploading frames, staging_gpu_waits fell to the
staging submission count (548 to 558) and NVIDIA's over-1 ms submits on the
graphics queue from 25 to 24 per 240 frames; frame times did not move (p50
6811 to 6828 us against 6839 to 6889 us, one frame in flight 6876 to 6934
against 6911 to 7006). Not run: clippy, rustdoc and the suites on this
commit.
(cherry picked from commit 516d31e3d47c3c238ec7e6666f5e03097e5b9ca4)
The census on the stack 28 tree (corpus-triage --audit authored-compile, 2262 cases, 21 profiles,
47502 cells) found no failed cell, no difference and no regression: 46395 compiled, 1107 refused,
327 uncovered (host-replayed command buffers). 1391 cells' SPIR-V digests had moved with the
stack's translation changes (the struct table shared by content, the MoltenVK precision notes),
every outcome class unchanged. --bless wrote the table at this build.
Verified: the audit ran on the M3 (potluck) with the main checkout's private corpus; failed=0,
differences=0, regressions=0, blessed=true.
The stack's runtime changes move counts across the suite (kept host steps and indirect record
copies, queue sharing and waiters' submissions, resident uses looked at once per identity, the
pass-start cleared copy and the fixture pipelines it no longer makes, among others), and its new
cases (the subnormal pixel samplers, the YCbCr gathers, the composited pass-start row) had cost
records with no contrast behind them. A whole-set run (`conformance cost --runs 8 --write`, 1150
cases, 1141 measured and 9 written down with the reason the venue could not measure them) then a
run of each of the 643 changed cases alone (`cost --runs 8 --alone --write`) re-recorded them on
the Apple M3 Max.
Verified: both runs exited 0 on the M3 (potluck m3-max-1009); the conformance suite and
`conformance cost --check` rerun on this tree.
- A render draw looks for the textures an argument buffer holds once per change of what its
encoder made resident, as compute already did (draw_resident_textures_looked_at).
- The program's last drop of a device stops the runtime's own holds of it (the in-place check's
class check, the warm pass's pipeline creation) and waits for them, so an adopted VkDevice is not
destroyed while they run; Device gains a private field, a hand-written Clone and a Drop.
- A draw's heap part is worked out into a released part's storage, ResidentOf::compared is a fixed
array, the heap elements' Arc and the debug checks' storage are kept: frame_costs reads 18.71
allocations a draw in debug (bound 20) and 6.88 in release (bound 9) on the M3.
Nothing public is removed.
Verified: the cherry-picked commits carry their own evidence; this stack's gate reruns on the tree.
runtime_lane::frame_costs' draw allocations, built with debug
assertions, were 20.33 a draw on the M3 after the two commits before
this one. The bound, DRAW_ALLOCATIONS_DEBUG, is 20.
Where the last 0.5 came from: in builds with debug assertions,
command_uses_into checks the resident uses a draw kept against uses
made whole (command_uses). That made a new CommandUses at each check,
3 allocations: the uses, their sources, and the positions of the
plan's other uses. 5ab66c0e6b keeps the uses at a switch to a plan
that lists the same uses, so more draws keep them, and each such draw
runs the check. A backtrace of every allocation of the counted frame's
draws (a diagnostic, not committed) put these 3 at 201 of the frame's
402 draws, 3 draws in each pass of 6. The +0.5 is one more such draw
in each pass.
Now the check makes the uses whole over the last check's storage, a
CommandUses this thread keeps (WHOLE_USES). They are made through
uses_into for no kept plan, as command_uses makes them. A remake
empties every compared field first or sets it whole: resident_uses_into
empties the uses, sources, others and reaching, and settle_resident
sets resident from reaching. So the compared fields (uses, sources,
used, resident) are those a new CommandUses gets. The kept storage
holds resource keys alone (ResourceKey is a u64), nothing alive.
Measured, frame_costs on the M3:
- debug, --cfg m2v_gpu: 18.71 allocations a draw, from 20.33 (19.83 at
fdb282e3ae, before the heap part). The check's 3 allocations are gone
at every checked draw: 1.5 a draw at those 201 draws, and 0.12 more,
the same 3 sites at 16 other draws of the frame;
- release, without m2v_system_alloc: 6.88 a draw, against
DRAW_ALLOCATIONS, 9 (7.38 with the first of these three commits
alone).
The negative control is the two commits before this one: 20.33, over
the bound.
Verified on the M3 (potluck), on this tree:
- clippy --cfg m2v_gpu of the runtime and the validation crate, all
targets;
- the runtime suite, debug, --cfg m2v_gpu, hazard filter: 1627 of
1628, the one failure exit_guard's known base failure;
- the lanes, hazard filter: 247 of 247, frame_costs included.
(cherry picked from commit 50c59a440c1b85c1b2d05218c126ff8824b14e91)
A heap part held where its heap writes go as an Option<Arc<HeapElements>>.
A part worked out again went into the storage of one let go of, or of the
part drawn through longest ago. Where that part's plan had no heap, the
part held no Arc, so the next plan with a heap allocated a new one.
Now HeapPart holds the elements as an Arc<HeapElements> always, and a
flag, heap, that says whether its layout has a heap set. A part worked
out again writes the elements into the Arc in place (Arc::get_mut). It
allocates a new Arc only while a draw still holds the old one. A draw
of a layout without a heap gets None, as before.
Measured, frame_costs on the M3, debug, --cfg m2v_gpu: 20.33 allocations
a draw, the same as before. That tree also held a later change (a
draw's facts of its plan worked out once a settle), which moves no
count: 20.33 with and without it on the commit before this one. The
window-shaped frame's layouts have no heap set: a backtrace of every
allocation of its counted frame's draws (a diagnostic, not committed)
shows no heap elements made.
Verified with the commit after this one, on the tree that holds both
(see its message).
(cherry picked from commit 815720023cd9a72a92e5e10e8f7f82fbdb9f762a)
A draw that switched to a plan whose uses differ pushed the plan into
its ResidentOf's compared list (5ab66c0e6b), allocating the list. It
then made its uses again under a new ResidentOf, dropping the list. In
runtime_lane::frame_costs' window-shaped frame, whose draws switch
pipeline state from draw to draw, that was an allocation at nearly
every draw.
ResidentOf::compared is now an array of COMPARED_PLANS slots.
Measured, frame_costs on the M3, debug, --cfg m2v_gpu: 20.33
allocations a draw, from 20.83.
Verified on the M3 (potluck), on this tree:
- clippy --cfg m2v_gpu of the runtime and the validation crate, all
targets;
- the runtime suite, debug, --cfg m2v_gpu, hazard filter: 1627 of
1628, the one failure exit_guard's known base failure;
- the lanes: 246 of 247, the one failure frame_costs' debug bound at
20.33.
(cherry picked from commit 1c237630db1b4273faa14068c653e926952f62fe)
12f8301c62 and 5ab66c0e6b raised runtime_lane::frame_costs' draw
allocations, built with debug assertions, from 19.83 a draw on the M3
(at fdb282e3ae) to 21.50. The bound, DRAW_ALLOCATIONS_DEBUG, is 20. The
window-shaped frame's draws switch pipeline state from draw to draw, so
an encoder works out a heap part for each of its plans. Two of the
allocations were these:
- Each part worked out allocated its tables' list, what it is made of
(samplers, function tables, slots) and its listing anew.
- A kept part's check allocated a list for the tables it worked out
again.
Now:
- KeptHeap keeps the parts an ended encoder let go of, emptied (the
module docs). Their plan is let go of, and what a part holds
otherwise is plain data, so they hold nothing alive.
- A part worked out goes into the storage of one of those, or of the
part drawn through longest ago where it keeps as many as it may.
- PastHeap keeps its list's storage (PastHeap::forget, which empties
it in place).
- The check works the tables out into a list the KeptHeap keeps.
Measured, frame_costs on the M3:
- debug, --cfg m2v_gpu: 20.83 allocations a draw, from 21.50;
- release, without m2v_system_alloc: 7.38 a draw, against
DRAW_ALLOCATIONS, 9.
Verified on the M3 (potluck), on this tree:
- clippy --cfg m2v_gpu of the runtime and the validation crate, all
targets;
- the runtime suite, debug, --cfg m2v_gpu, hazard filter: 1627 of
1628, the one failure exit_guard's known base failure (a547d0ce33);
- the lanes: 246 of 247, the one failure frame_costs' debug bound at
20.83. The commits after this one address it.
The same results, 1626 of 1627 in the suite, came on this change over
5ab66c0e6b without 60bb566cdc.
(cherry picked from commit fcb0f1885b8fb69fedd9d138bc4a7f00a0dd276a)
The runtime's own holds of a device (bd779ba8c8) give Device a second, private field (holds::Share)
and write its Clone by hand, and Device now implements Drop: the program's last drop stops the
runtime's own holds and waits for them. For a consumer nothing breaks: Device is still Clone, and
its fields were private, so no program could destructure it or move a field out of it.
Verified: python3 scripts/api-signatures/signatures.py --check passes after the bless (2 added, 1
changed, none removed).
The device's check of textures over host pages (in_place_check.rs) and its warm pass (warm/pass.rs)
upgrade a weak handle on threads of their own and hold the device while they make objects on it:
the check across a class's rounds (its device and its class's buffer), the pass across a record.
A program that drops its last handle meanwhile leaves the holder the last share, so the device is
torn down on the holder's thread after the program's drop returned. A consumer that adopted the
VkDevice destroys it once its last drop returns, and Vulkan requires every object made from it
destroyed first (VUID-vkDestroyDevice-device-05137). The same class as the queue-switch check's
(de2554f1ac), whose thread could be made to hold no device handle; these two make buffers,
textures and pipeline states that hold the device, so they cannot.
What (device/holds.rs):
- Every device handle is counted as the program's or as a holder's. WeakDevice::hold takes a
holder's handle; a clone of one is a holder's too (the device of every object the holder makes);
every other handle (the device's own, its objects', a runtime thread's upgrade) is the
program's. The handle carries its kind (Share: the registry where it is a holder's), so a
Device is 16 bytes, and its first field stays the Arc (the auto-trait walk that
consumer_auto_traits holds to the default recursion limit keeps its depth).
- The drop that leaves the program no handle stops the holds; on a thread of the program's it
waits until the holders' handles went, each counted gone only once its share of the device
went, so the device's last share is the program's and the teardown runs on its thread before
the drop returns. On a runtime thread it waits for nothing (those threads serve the work the
holds may wait for).
- The holders read the stop between their steps (Device::holds_go_on): the check before each
round, the warm pass before each record. The wait is at most the check's round in progress and
its release of its buffer, or the record the pass is making; only at teardown.
- A stopped device is gone: no holder takes it, and Device::system_default_with makes a new
device rather than revive it (WeakDevice::revive).
- exit_guard::on_runtime_thread tells the runtime's threads apart.
- Device's rustdoc and the runtime README state the last-drop contract.
Tests (tests/teardown_threads.rs, behind the crate's existing gated hold, freed_memory::held):
- a_running_in_place_check_leaves_the_device_to_the_program_s_thread: the check held before a
round while it holds the device and its buffer; the program's last drop tears the device down
on its own thread before it returns, having waited for the check. Skipped, saying so, where
the device takes no texture in place or its check makes no round.
- a_running_warm_pass_leaves_the_device_to_the_program_s_thread: the same for a warm pass held
before its first record.
Not the queue-switch check's wait: its test (de2554f1ac) is unchanged here.
Verified, at this tree (scratch 016ea26f28), --cfg m2v_gpu device tests:
- Apple M3 Max, MoltenVK 1.4.2, macOS 27.0.1: tests::teardown_threads three
times, 10 run, 10 passed each ("the last drop took 7.55ms, of which the
wait for InPlaceCheck 991µs"; the warm pass's wait 22 to 113 µs). The
runtime suite: 1636 run, 1636 passed, 5 skipped. cargo clippy plain and
under --cfg m2v_gpu, and RUSTDOCFLAGS='-D warnings' cargo doc, clean.
- RTX 5080 Laptop GPU, NVIDIA 615.71.09 (b5080, the hazard filter):
tests::teardown_threads three times, both new tests passing in each
(the wait for InPlaceCheck 3.98, 5.35 and 7.06 ms; for WarmPass 84,
208 and 239 µs); 10 of 10, 9 of 10 and 10 of 10, the one failure the
unchanged queue-switch test's 16 ms bound (it waited 26.5 ms, beside
the runtime suite; 13.4 and 14.3 ms in the other runs), followed up
apart. The runtime suite: 1653 run, 1652 passed, 5 skipped, the one
failure srgb_fetch_images::an_srgb_attachment_is_fetched_through_its_
unsigned_integer_view (an image plan's view formats at 4 samples; no
hold is involved), attributed apart.
- Negative control (the last drop waits for nothing: one line removed,
built into a separate nextest archive): both new tests FAIL on the M3
and on the 5080, "the device was not torn down on this thread before
its last drop returned" (left: Err(Empty)).
(cherry picked from commit 4ca5040b55afcd816e22b4f2c9ddae6e675006b3)
A profile of the replayed textured page at 5ab66c0e6b:
- RTX 5080 (perf, cycles:u): 32.5% of all samples in
pvrtc::held_for_copies, plus 3.2% in image_plan::block_family, which
it calls.
- M3 (sample, the steps thread): 32.6% under
pvrtc::degrade_unreadable.
Every render draw or tile dispatch whose functions read texture handles
(RenderLowering::command_encoded) asked held_for_copies of every
texture its encoder made resident. That is 5002 textures at each of
the page's 5001 draws, yet whether a carrier holds a texture's bytes is
fixed at the texture's making.
Compute's dispatches already looked once per change of what their
encoder made resident (pvrtc::ResidentUnreadable). That memo now keeps
every such texture, with the render stages it was made resident in, and
a render encoder keeps one too. A draw looks among those alone, in the
order they were made resident, so the texture it announces, where it
announces one, is the one it announced before.
Residency::textures_reached gives way to textures_made_in.
WorkCounts::draw_resident_textures_looked_at counts the looks, and the
replayed-frames lanes print it. api_signatures is blessed for the new
field, an addition.
Measured on the M3 Max (MoltenVK 1.4.2), release, the replayed textured
page, 3 frames, interleaved with 5ab66c0e6b over two rounds:
- host_step_ms a frame: 391-485 at 5ab66c0e6b, 214-237 with this change;
- draw_resident_textures_looked_at: 2 a frame;
- pixels e3306dc52a1c9e86 in both.
The tree measured also carried the next commit's allocation changes,
which build no less at a draw than before.
Verified on the M3 (potluck), the tree measured:
- clippy --cfg m2v_gpu of the runtime and the validation crate, all
targets;
- the runtime suite, debug, --cfg m2v_gpu, hazard filter: 1627 of 1628,
with the new test passing. The one failure is exit_guard's known base
failure (a547d0ce33).
- the lanes: 246 of 247. The one failure is frame_costs' debug draw
bound, which the next commit addresses.
- Negative control: with the textures found again at every command, the
new test fails at the first encoder's draw 1 (1 look, expected 0).
(cherry picked from commit 60bb566cdcc30ea10d6b49dedbb9557c0158bfac)
RUSTDOCFLAGS='-D warnings' cargo doc failed on the stack 28 tree: the public module doc linked the
private subnormal_grid (rustdoc::private_intra_doc_links). It is named in code text now; the
public subnormals case list stays linked.
Verified: the stack 28 gate's doc step failed on exactly this link; the docs leg reruns.
abi::tests::deeply_nested_layouts_are_refused_without_recursing and
layouts_at_the_nesting_cap_decode_on_a_small_stack decode a chain of `cap` layouts beside a second
parameter's leaf layout, a node of its own that decodes like the chain's innermost layout. Since
layouts that decode alike share one entry (4edc720908), that leaf is the chain's entry, so the
table holds `cap` layouts, not `cap + 1`; the cap and its refusal one level past it are unchanged.
Verified: both tests failed in the stack 28 gate's core leg with 64 against 65 (cap 64); they
rerun in the gate's next leg.
The revert (5dbf6f3be3) changes translator sources the runtime pin hashes (narrow.rs, driver_facts.rs).
RUNTIME_VERSION stays 1766: that version is not landed yet, and the revert gives back the notes
development records today for a texel's half rounding, which the 1766 bump never listed.
Verified: the pin is pin-compute.py's hash of this tree's runtime sources.
This reverts the stack's pick of 384734851d ("Count a texel's half rounding as the measured
conversion on MetalHalfConversion profiles"); SEMANTICS_VERSION goes to 1965, since the recorded
notes change back.
The stack 28 gate's M3 lane run failed
runtime_lane::cross_class_reads::argument_buffer_cross_class_reads_are_the_native_words: an
argument buffer's half read of an integer texture (R8Sint, RGBA8Sint, RG16Sint, RGBA16Sint,
RGBA32Sint, RGBA16Uint, RGBA32Uint; 66 of 2170 lanes) answers the device's quiet NaN 0x7e00 where
the slot's read of the same texel keeps its bits (0xfff5 and the like). The heap read rounds its
texel through float, and that rounding's narrowing no longer recorded NativeHalfConversion on
moltenvk-m3, so the stage carried no note that leaves a half NaN's bits to the device (the notes
were SetPastLayoutSupport, DeviceNanEncoding and HalfTexelConversion). The commit's measurement
covered the extended-range forms' codes, not an integer texel's bits read as half. Until a fix
keeps those bits or notes them, the note stays as it was before the change.
The doc conflict in driver_facts.rs (a later pick's measurement paragraph for the reverted rule)
takes the text from before the change.
Verified: not yet; the gate reruns the core suite and the M3 lanes on this tree.
The ICB vertex-encode textured fixture's fragment takes the same `Entry` layout that the vertex
function's argument buffer holds. Its typed spelling (metal-as) gives the two uses different
holder types, so the decoder, which memoizes by layout node and holder, built the layout twice
(StructRef 1 and 3) where the opaque spelling (llvm-as) shared one, and
tests::air_abi::typed_and_opaque_spellings_decode_the_same_abi and
tests::air_canon::typed_and_opaque_fixtures_specialize_identically failed on stack 28's tree.
A finished layout is now looked up by the hash of its members, and one equal to an earlier layout
is that layout, so the table depends only on what the layouts decode to, not on how the module
spells or uniques their nodes. Nested layouts are built first, so equal members name the same
nested entries and the shared entry's height is the same. SEMANTICS_VERSION goes to 1964: a
module with layouts that decode alike now has fewer entries, which its translation sees.
Verified: both tests failed in the stack 28 gate's core leg with exactly this difference; the
rerun follows in the gate.
clippy::single_range_in_vec_init (with --cfg m2v_gpu) rejected `vec![at + page..at + 2 * page]`
as a one-element Vec of a range; the test means a list holding one run, so it now names the run and
passes std::slice::from_ref of it. No behaviour changes.
Verified: the stack 28 gate's clippy --cfg m2v_gpu leg failed on exactly this line; it reruns next.
The join retry (45ea28feae) uses both in joined(), which every build of the lane compiles, but on
the stacked tree the opt-in hazard tests' change had put both imports under
cfg(any(m2v_cpu_icd, m2v_gpu_hazards)), so the plain --cfg m2v_gpu build failed (E0433 at the
retry's start time and its fills' status). Both are now imported unconditionally; the hazard-only
imports stay gated.
Verified: the stack 28 gate's lane build failed with exactly these two errors; the rebuild runs in
the gate's next lane leg.
The stack's MoltenVK precision notes add the subnormal and in-place gather fixtures
(ycg_sample_gather, ncw_constant_colors) and move SEMANTICS_VERSION to 1963, so the engine
inventory, the AIR input printouts and the golden hashes are blessed on the stacked tree.
Verified: the bless leg's check of the five fixture tests (metal_as part 2 of 4, llvm_as part 7 of
8, golden_hashes_match_the_table, engine_fixtures_match_their_golden_printout,
inventory_lists_every_fixture_in_order) passed after the bless.
Correction to the bump's message: max_buffer_length's device-local heap bound is not in this stack
(it is on the 5080 lane's branch); everything else it lists is.
Verified: the pin is pin-compute.py's hash of this tree's runtime sources.
- Host-replayed ICBs keep a step's chunks where two steps read the records alike, and put the copy
of a chunk off where its records changed at two steps in a row (one step in 8 copies it). Each
batch's footprint is built once. New counters: host_step_chunks_kept,
host_step_chunks_recorded_again, host_step_records_compared, host_step_compare_nanos,
host_step_chunk_copies_put_off, indirect_record_bytes_copied, footprints_built,
footprint_lock_waits, commit_refusals_held.
- A draw's heap part is kept while what it is made of holds, and plans that list the same resident
uses share them; resident writes, indirect reads and geometry writes are added once per identity.
New counters: draw_heap_parts_made, resident_uses_unordered_writes, resident_uses_indirect_reads,
resident_uses_geometry_writes, resident_uses_geometry_checked.
- A pass-start read of the clear alone reads a copy cleared to the clear instead of splitting the
pass (attachment_read_clears).
- Device-local allocations that fail fall to other memory types with the device-memory-overflow
degradation (device_memory_overflows); max_buffer_length follows the largest device-local heap.
- Fresh Private textures: unfilled or zero-filled as the presented fact says (MacClass,
private_textures_unfilled, private_textures_zero_filled).
- Copied no-copy buffers join host memory (run_bound_buffers_made, run_imports_live), with the
MoltenVK aliased-import blit ordering recorded as RuntimeDriverDefect::AliasedImportBlitsUnordered.
- MoltenVK precision notes: bound sampler words and unary denormals (DriverDeviation and VkProperty
MetalUnaryDenormals).
Nothing public is removed (api_signatures: 35 rows added, none removed).
Verified: the cherry-picked commits carry their own evidence; this stack's gate runs on the tree.
The coverage document is generated from the suite's sources and recordings; the stack's picks
each regenerated it on their own base, so it is derived again here once over all of them.
Verified: python3 -I scripts/conformance-coverage/coverage.py --check reports it as derived.
times::every_case_is_timed::every_case_carries_its_timing failed on the new row (potluck
m3-max-792, the conformance suite's one failure in 1018): conformance times --runs 8 --write
pass-start-barrier-private-composited on the M3 Max (m3-max-797, exit 0) writes its record, 1
call within 10x and none over over 8 rounds. The command notes the instrument read 10.38 of its
own costs at Metal's cheapest call on this run, against 1.0 the gate would allow; a time is
reported and never gated.
The same job replayed the 14 rows at 3dc1d0b38d on the M3, exact and default policy, exit 0 both,
with render-pass-split declared on the two draw-barrier-read rows alone.
(cherry picked from commit 1f34f423b4732890567d8367e1a8a52594a66377)
The pass-start family's 39 wasted creation pipelines were its cases making all five of the
fixture's pipelines and drawing with one to three (fixed in c8d97b90c4 and 2ca0c09fd6, which make
each row the pipelines it draws with), not a misprediction: in the stack-27 records the rows with
no split wasted as many as the split rows, every row's creation_pipelines_drawn was the number of
pipelines its draws bind, and variant_pipelines_made equalled the creation's 5, so no draw made a
variant.
The family's cost records are measured afresh on the M3 Max (potluck m3-max-774): the records the
rows carried were dropped first, since a re-measure keeps a held record's alone-run ceilings and
creation_pipelines_made stayed at 5 through a plain --alone write (m3-max-695, m3-max-753); then
conformance cost --runs 8 --write and conformance cost --runs 8 --alone --write over the 14 rows,
both exit 0, 14 measured. Each row now reads creation_pipelines_made equal to
creation_pipelines_drawn: 2 and 2 on the 11 rows of two pipelines, 3 and 3 on
pass-start-barrier-new-texture-chain, 1 and 1 on pass-start-barrier-new-texture-tile, and 3 and 3 on
the new pass-start-barrier-private-composited. They also carry the cleared copy: 1
attachment_read_clears on the seven barrier rows whose read comes before any draw, 2 on the chain
and the composited row, and attachment_read_splits 1 on the two draw-barrier-read rows alone.
The census of cost::the_creation_prediction over the committed recordings (read off them by a
replica of census(), which reproduces the table before this change exactly) reads the draws class
at 184 rows, 846 made, 799 taken, 47 by none, and all classes at 529 rows, 1,377 made, 848 taken,
529 by none: the ceiling goes back to 47 and the module's table and paragraph say so.
The same job's replays of the 14 rows on the M3 exited 0 under both policies. Their cost half
reads unmeasured, as every selection's does (cost::judge holds a case to its record only in a
whole-set replay), so these bounds are next judged by a whole-set replay.
Verified: the census above; the conformance crate's tests not yet run on this commit.
(cherry picked from commit 3dc1d0b38df80f4fa12f1a3a9d1e630bd996a130)
With the cleared copy and its shadow made at the decision (e0399e2ed3), a read of the clear before
any draw of its pass no longer splits. The family's replays at 0147b3a386 announced
render-pass-split on the two draw-barrier-read rows alone, and the allowance went unfired on the
seven other barrier rows (private and over-buffer barrier-read and barrier-sample, display, chain,
tile) on every venue that ran them: the M3 Max (potluck m3-max-753, exact and default policy),
lavapipe on the msi (m3-max-775, both policies) and the RTX 5080 Laptop (batch entry
pass-start-cc-5080-011619, both policies), every replay exit 0. The allowance now names those two
rows alone, and the module docs say which rows announce what.
Verified only as above, with the old allowances: the replays with these allowances are next.
(cherry picked from commit 637fe40bad9475799b7437489b4c9dc5f5500ed4)
python3 scripts/conformance-coverage/coverage.py over the tree with
pass-start-barrier-private-composited's recording: one more recording, case and Metal-run answer,
and the Metal items the row reaches counted once more.
(cherry picked from commit 0147b3a386081175dfaffa7c72513efac6def034)
On the M3 (potluck m3-max-695) runtime_lane::attachment_reads::
a_draw_after_a_barrier_at_the_pass_start_reads_the_clear failed: its target, a new texture, split
(splits 1, cleared copies 0), and the conformance row pass-start-barrier-private-composited
announced render-pass-split from its first pass, where the compositor's-shape cost run, whose
first command buffer is untimed, cleared its copy from its second on. Texture::cleared_copy asked
for the texture's usage shadow through usage_shadow_copies, which answers only once a binding has
made it, and a draw decides before its own binding makes it: the first read of every texture split.
Texture::attached_shadow_copies makes the shadow as the draw's sampled binding of a texture that
presents an attachment of its instance makes it (that binding makes it moments later in any case),
None where it is not served. cleared_copy asks for it last, after the structural tests, and takes
the draw's call for its errors.
Unverified: not built yet. The failing lane test is the regression check.
(cherry picked from commit e0399e2ed36795f6ac03b7eccf1d0b53844befd6)
The rows make only the pipelines they draw with (Row::functions), which changed their inputs, so
every row's Metal answers are taken again on the M3 Max (macOS 27.0.1, potluck m3-max-695:
conformance record over the 14 rows, exit 0), and pass-start-barrier-private-composited is
recorded for the first time.
The cost records these files carry are the earlier ones and are re-measured next: an --alone
write folded into the old in-order bounds (creation_pipelines_made still 5) and the composited row
has none yet. The replay on the M3 (same job) held every texel of the 13 rows as before; the
composited row's texels matched too, and it diverged on the notices alone (render-pass-split, from
its first pass, whose copy no binding had made yet when the pass decided).
(cherry picked from commit f12fc777c9eef83994557dc8cac03a5088175db6)
Row::barriered_targets was read by the tests alone, and clippy (m3-max-658) failed the library on
it as dead code. The allowances now take the targets they state an answer for through it, where
the zip with every target relied on the answers' list being the shorter.
Unverified: not built yet.
(cherry picked from commit 2ca0c09fd6244a5a23fbc5f0fdd11f9a29106930)
Every row of the pass-start family made all five of the psb_reads fixture's pipelines and drew with
one to three of them, so the creation prediction of each pipeline it never drew with was made for
nothing: 39 over the 13 rows (11 rows of 2 drawn wasting 3 each, the tile row 4, the chain row 2),
the 39 the draws class of cost::the_creation_prediction gained when these rows got their first cost
records.
It is not a misprediction of the split's instances. The stack-27 cost records say so: the rows with
no barrier and no split (private-read, private-sample, over-buffer-read, over-buffer-sample) waste
3 each as the split rows do; on every row creation_pipelines_drawn is the number of pipelines its
draws bind (2, the tile 1, the chain 3), and variant_pipelines_made equals the 5 the creation made
(graphics_pipelines_looked_up 2 for 2 draws): no draw made a variant, so every draw took its
pipeline's prediction.
Row::functions names the functions each row's work draws with; the case makes and fingerprints
those alone, and every_row_makes_the_pipelines_it_draws_with_alone holds that against the pipelines
each row's work binds. The composited row makes psb_solid and psb_sample and its blended pipeline.
The inputs change, so every row of the family is re-recorded on the M3 next, with its cost record,
and the draws class's ceiling goes back to 47 with them.
Unverified: not built yet.
(cherry picked from commit c8d97b90c490c36103d26a2500242eb22b118089)
The declaration in degradation.rs and docs/API.md's catalogue entry both said a draw that reads a
color attachment's texture after a memory barrier splits the pass. A read of the clear alone
before any draw of the pass now reads its copy cleared to the clear in the pass's one instance
where the copy can be (WorkCounts::attachment_read_clears), so both name that exception.
Docs only; unverified beyond cargo fmt.
(cherry picked from commit 1bcf89e89571bc7f65694c10ea34bdde6c3af6b0)
A new row of the pass-start family, pass-start-barrier-private-composited: a 64x40 private
target that an earlier pass leaves as the small rows' targets are left, then two passes in the
one command buffer that each clear it, begin with the barrier over the render targets, sample the
target itself in pixel coordinates over a quad of a quarter of it, and draw three blended quads
that sample three other textures, each overlapping the quad. It is the shape a compositor draws
and the one the cleared copy serves: no draw before the read, the read the pass's first draw, and
a second pass whose copy is cleared again after the first pass's reads of it.
The case states both answers: the Mac2 one in its allowance (the clear, reordered, where the
sample wrote), and the M3 Max's in a test held to the recording (each pass reads the texels from
before its pass, so the quad holds the earlier pass's texels reordered twice). The blended pipeline
is made and fingerprinted by this row alone, so no other row's inputs or transcript move. The row
declares no render-pass-split notice: a cleared copy splits nothing.
Unverified: not built, not recorded on the M3 yet.
(cherry picked from commit 4d3def487fd1fcb564b21800d74cbdb67bc02a1d)
docs/API.md: a draw that reads the clear after a render-target barrier before
any draw of its pass reads its copy cleared to the clear in the pass's first
instance where the copy can be so (WorkCounts::attachment_read_clears), else an
instance after one of the clear alone.
Unverified: documentation of 4259b7f41c, whose runs are pending.
(cherry picked from commit cc9312dcc9a97d5c663efbfea3f0f25374581249)
runtime_lane::attachment_reads:
- Moved counts attachment_read_clears; check() takes a cleared copy for a
read after a barrier, as a split or a snapshot, and asks for a shadow copy
only where none of those served it.
- a_draw_after_a_barrier_at_the_pass_start_reads_the_clear: the texture of
its own image, a whole one-level, one-slice texture the pass clears in
place to whole codes, reads its copy cleared to the clear in the pass's one
instance (one cleared copy, no split, one instance begun) wherever the
device does not snapshot it.
- a_draw_after_one_that_wrote_behind_a_pass_start_barrier_reads_what_it_wrote
(new): the barrier, draw A over [8, 16)^2, then the read through READ_AREA:
A's red inside A's block, the clear around it, and no cleared copy, as the
copy after the instance A drew in holds. A cleared copy would read the
clear inside A's block, so this is the negative control of the rule that a
copy is cleared only before any draw of the pass.
- started_pass takes the optional draw A.
runtime_lane::attachment_read_costs::pass_start_clear_read_costs (new,
ignored, release): 60 passes in one command buffer over a 3840x2400 private
BGRA8Unorm target, each loading Clear and storing, its first command a
render-target barrier from the fragment stage to the fragment stage, then a
quad over a quarter of the target sampling it (psb_sample) and three blended
quads sampling other textures; prints GPU and CPU time per pass and per pass
the splits, instances begun and texels copied in. It reads no counter the
tree before the runtime change lacks, so it runs on both.
Unverified: not built or run yet (potluck jobs next).
(cherry picked from commit 0a45d4a84cdf34cad9f11d235025df3d561151a2)
Texture::cleared_copy compared ImagePlan::samples with an ash constant the
translator's SampleCountFlags does not have; it now reads the raw count, as
snapshot_color does.
Verified: the build error is gone only once the next clippy job runs.
(cherry picked from commit cc7d3deeb2684c58bb23d3b5a95445af7fdf0719)
A pass that clears a color, begins with a memory barrier over the render
targets and then samples that color's texture split off a first instance of
the clear alone, stored it, loaded it again in the next and copied the read's
texels between (3797c098eb). On the M3 Max under MoltenVK that cost 8 to 12%
of a frame of 60 such passes over a 3840x2400 target, about 17 to 27 us of GPU
time and 11k host instructions a pass.
Before any draw of the pass has recorded, the copy the draw reads holds
nothing but the clear. So where that copy can be cleared to it
(Texture::cleared_copy: the texture's shadow is an image of its own, the
texture a single-sampled 2D one of one level and slice that exactly one
color renders whole, in place, in the image's format, inside the render
area, loading it Clear with no clear whose note the load withholds and no
extended-range route, stand-in or sample planes), the draw stays in the
pass's first instance and the copy in before the pass is a clear of the
shadow's image to the pass's clear value (vkCmdClearColorImage, which Vulkan
converts as the load operation). The shadow then holds the truth nowhere, so
no carry takes it and its next use copies in again. Later draws of the
instance read the same copy. Once a draw has recorded (it may have written
the attachment, which the copy must then hold), a tile dispatch ran or the
pass split, a draw that needs a new such copy splits as before.
- shadow.rs: ShadowUse::cleared and ShadowCopy::clear; ShadowSync::before
plans the clear in place of any copy in; a clear copies no texel and is
not counted in shadow_copies; ShadowCopies::cleared_image.
- render/shadows.rs: an instance's gathered clears (InstanceShadows) mark
its shadows' uses.
- render.rs: the draw's decision (cleared_copies) and its gathering.
- WorkCounts::attachment_read_clears counts the draws that brought new such
copies, apart from attachment_read_splits and instance_splits_attached_read.
Unverified: not built yet (no local cargo here; the build and the lanes go
through potluck next).
(cherry picked from commit 685063b3af2fbc64100749bf4f641d077780375c)
The two cross_queue_shadows cases on one VkQueue failed 9 of 12 runs on the
RTX 5080 Laptop GPU across three trees, every time at "the queue joined":
queue 2's command buffer, made after 24 short fills on queue 1 were
scheduled, did not join queue 1's VkQueue. That join is the precondition, not
the claim: queue_share.rs joins a busy VkQueue only while its oldest batch in
flight is younger than 0.5 ms and no long queue holds it, and one try loses
that where queue 1's fills are done before queue 2 looks, or where other
processes' work on the GPU (the module's own 1.5 s spins, run beside it by
nextest) holds the oldest fill past 0.5 ms or spans a fill past 2 ms, so
marking queue 1 long.
joined() now makes its two queues itself and, where the device shares, tries
again with two new ones (the old ones' work waited for, so a long mark goes
with them) until a try joins, for up to 20 s. Each miss prints what the
joiner met: fills seen complete, the GPU's last fill end against the look,
the oldest unfinished fill and its approximate head age, the longest fill,
and the sharing counters' deltas. The data assertions are unchanged.
Verified: clippy (--cfg m2v_gpu, all targets, all features) is clean. The
runs on the M3 Max (no sharing, one try) and the 5080 loop are pending.
(cherry picked from commit 45ea28feae518d91f88d37cbbc0576900f4dcfb3)
On gate/stack27b the HostRam copies (copy_from_host_ram,
copy_to_host_ram) and the run imports compose: a copy reads and writes
a chunk's pages through the chunk's import, and an object over a chunk
not imported yet is bound in an import of its own run, two imports of
the same pages ordered only by their host bytes (host_aliases.rs).
New device test
a_run_bound_buffer_and_a_copy_of_its_pages_order_by_their_host_bytes:
four pages over a chunk not imported are bound in their run's import,
and then, both ways:
- a fill through the buffer before a gather of its second page;
- a scatter into that page before a copy out of the buffer.
Each way runs in one blit encoder (a barrier recorded between them),
in two encoders of one command buffer, and across two queues in commit
order (the writer behind 2 GiB of private fills). The six copies import
nothing, and the run's import stays live. On a device with
RuntimeDriverDefect::AliasedImportBlitsUnordered (MoltenVK) the test
asserts the fallback: no run import, the buffer imports the chunk and
lies in the copies' import.
Docs: copy.rs's module docs and HOWTO said a copy takes a chunk "as an
object does", importing it or waiting for its import; objects no longer
wait, so both now say that a copy makes no run import of its own and
waits. host_ram.rs and HOWTO add the copies to what a run-bound
object's uses order against, and the test module's docs add the
composition.
Verification is pending in this commit: M3 and RTX 5080 device runs.
(cherry picked from commit be6d43fbf2c0a5921a2468038740ef3604a2da9f)
docs/HOWTO.md's "One run inside one chunk" bullet now says what the
branch's runtime does: the window opens in the takes' direction, up or
down the RAM; an object over a chunk not imported yet is bound in an
import of its own run (run_bound_buffers_made, run_imports_live) and
never waits for the chunk's fault-in; the price is up to one more
allocation and pin per such object; and where the object falls back to
the chunk's import (thread stopped, chunk failed or given back,
allocations within the margin, a whole-chunk run, or
RuntimeDriverDefect::AliasedImportBlitsUnordered on MoltenVK).
It adds the measured result from tests/host_ram_window_bench.rs on the
RTX 5080 laptop (NVIDIA 615.71.09), at 2b2419c67c: 256 2 MiB heaps
upward, downward and scattered had no making of 5 ms or more (slowest
1.4, 1.5, 3.7 ms), against 2, 8 and 15 makings importing a chunk
(slowest 8.2 to 8.7 ms) without the change; 128, about 76 and 20 heaps
were bound in their own runs' imports.
Docs only; verified by reading the text against host_ram.rs's
for_object and after_take.
(cherry picked from commit 25572e5af997da7009960fa31bf94c5d478e2370)
What:
- RuntimeDriverDefect::AliasedImportBlitsUnordered (metal2vulkan::error): a
pipeline barrier between two blits does not order them where they reach the
same host pages through two imports, which Vulkan counts as aliases of one
memory ("Memory Aliasing": memory bound through external memory import
mechanisms). MoltenVK has it (driver_defects.rs: its barrier between blits
ends the Metal blit encoder and leaves the order to Metal's hazard tracking,
which is per MTLBuffer, and each import is an MTLBuffer of its own).
- On a device with it, RamOnDevice::for_object never binds an object in an
import of its own run: the object imports the chunk, or waits for the
thread's import of it, so every object over a chunk's pages lies in the
chunk's one import, which Metal orders, as before the run imports.
- The HostRam device tests hold both forms (runs_alone): the window, the
downward run and the ordering test assert the run imports where the device
orders aliased imports, and the fallback (no run import, the chunk imported
by the object, which waited for it) where it has the defect. The ordering
test asserts the order on every device.
- host_ram.rs states the trade the run imports make: up to one more
allocation and pin per object made while its chunk is not imported, for the
object's life (128 of the bench's 256 upward heaps on the RTX 5080 laptop).
- Docs: the defect's variant and table entry, host_ram.rs, Device::use_host_ram,
HostMemory::with_runs, WorkCounts::run_bound_buffers_made; the defects test
lists it for MoltenVK; api_signatures.tsv. REFUSALS.md regenerated
(unchanged: no refusal names it).
Why: on the M3 Max (macOS 27.0.1, MoltenVK 1.4.2) at 2b2419c67c,
tests::host_ram_device::a_run_bound_and_a_chunk_bound_buffer_over_the_same_pages_order_by_their_host_bytes
failed: "run to chunk: the copy in one encoder read the fill" (stale bytes;
the runtime's command barrier was recorded, command_barriers grew). The same
test passes on the RTX 5080 laptop (NVIDIA 615.71.09), in one encoder, two
encoders and across queues. HostRam on a Mac is not a product path (the
consumer uses its Metal arm there), so losing the no-wait gain on MoltenVK
costs nothing real; the ordering holds on every device.
Verified: cargo fmt; scripts/refusal-surface/refusal_surface.py (no change).
Build, clippy and tests run through potluck jobs after this commit.
(cherry picked from commit 3eb01a011f20ac5aa96c134b50b15219c93c1a34)
What:
- An object over one run inside a chunk not imported yet (outside the window,
or the chunk the device's thread is importing) is bound in an import of its
own run alone (RamOnDevice::for_object, a RamChunk of kind Imported::Run made
through the same import_chunk): its pages faulted in and pinned, no more,
on the making thread, while the thread imports the chunk. The objects over
the chunk after that are bound in the chunk's import. The gate is not asked,
as for a chunk. Counted: WorkCounts::run_bound_buffers_made, and the gauge
run_imports_live (a run's import goes with its last holder).
- The fallback is the blocking chunk() as before, where the run is the whole
chunk, the device's thread does not run (held, never started, or ended:
Wake::running, cleared by a drop guard however the thread ends), the thread
failed or gave back the chunk (tried), the device's allocations are within
the margin of maxMemoryAllocationCount the ahead import leaves
(Allocations::room_ahead), or the run's import fails. The making never
fails for it.
- Window: the chunk an object last took is first in it (the thread imports
the taken chunk where an object bound its run alone), then the chunks past
it in the takes' direction: a take inside the window or next to the chunk
last taken opens AHEAD_CHUNKS that way, a jump one chunk in the jump's
direction. So a run of heaps down the RAM finds its chunks imported, as one
up it does.
- chunk() keeps its signature and behaviour (the HostRam copy port waits for
whole chunks through it); import_chunk takes the kind.
- Docs: host_ram.rs (module, Device::use_host_ram, bind_in_chunk),
HostMemory::with_runs, the two WorkCounts fields; api_signatures.tsv.
Why: reims-vgpu measured each chunk's first object over fresh RAM waiting
for the whole chunk's fault-in on the RTX 5080 laptop (p50 39-123 ms, worst
1.46 s) whenever its heaps went down the RAM or jumped, since the window only
followed upward runs and an object outside it imported the whole chunk on its
own thread.
Tests (host_ram unit and device tests):
- a_take_inside_the_window_or_next_to_the_last_opens_it_in_the_takes_direction
and the order test (the taken chunk first, the window below a step down,
nothing below the RAM's start).
- the_window_ahead_moves_with_the_objects_and_imports_no_more: the jump's
heap is bound in its run's import and the thread imports its chunk too.
- a_run_of_heaps_down_the_ram_finds_its_chunks_imported_and_none_waits_for_one:
CPU and GPU bytes through a run-bound heap; the window goes down; the runs'
imports go with their heaps (run_imports_live back to its start).
- an_object_within_the_allocation_margin_imports_its_chunk_and_no_run.
- a_run_bound_and_a_chunk_bound_buffer_over_the_same_pages_order_by_their_host_bytes:
write through one, read through the other, both ways, in one blit encoder
(command_barriers grew), two encoders, and across queues in commit order.
Verified: cargo fmt. Build, clippy and the device tests run through potluck
jobs after this commit.
(cherry picked from commit 9a2fd93d37aaed5dc952bc9f50f905f350ccec9a)