web3d calls generateMipmapsForTexture: once in each stream, which the player skipped and counted
(mipmaps 1). It is built as Apple defines the call: each level below the texture's first made
from the level above it, over each slice, a view's levels and slices its own.
- BlitCommandEncoder::generate_mipmaps: one vkCmdBlitImage a level with VK_FILTER_LINEAR, the
first level read and the rest written whole (their old contents discarded) behind the copy's
first barrier, one barrier between each level and the next, and the last bringing every level
home, the last level's writes visible to every later command. A texture of one level records
nothing.
- Refusal::MipmapFormat for a format Apple defines no mipmaps of (a depth or stencil, compressed,
YCbCr or integer one: not colour-renderable and filterable); Gap::MipmapFilter where the
device's format query lacks blits from and to the image's format or its linear filtering,
where the image holds the pixel format through a conversion, and for a view in another format
than its image's, whose blit would filter the image's.
- PrecisionNote::DeviceFilteredMipmaps, the static note BlitCommandEncoder::GENERATE_MIPMAPS_NOTE
carries: the filter is the device's, where Apple states none. The old runtime announces it as
its existing device-filtered-mipmaps kind; validation allows it unbounded; codec and
ARTIFACT_FORMAT_VERSION 541, fast_paths' list, API.md's catalogue entry.
- The conformance rt side plays Step::GenerateMipmaps and announces the note; the replay player
plays the call and its skipped_mipmaps counter is gone (REPLAY-STREAM.md).
- Test: an 8x8 RGBA8Unorm texture of four levels, each level below the first within one code of
the box of the four texels it halves in the level above as the device left them, its first
level kept, one submission and the chain's four barriers besides the segment's end; one level
records nothing; RGBA8Uint is Refusal::MipmapFormat. REFUSALS and api_signatures regenerated.
Check 49376 at 96340f0f9d: clippy under --cfg m2v_gpu and m2v_cpu_icd refused
Hook::unmaps's return type (tests/command.rs). The rest of that check passed:
clippy with all features and none, the rt and harness tests (135 passed), the
API tests, the docs and the archives.
What: two gauges, the bytes of each class's live pool allocations (blocks handed
out, the free ranges between them and the idle allocations). Each allocation
carries its class; make_allocation raises its class's gauge by its length and
free_allocation lowers it, so teardown returns both to 0. The replay player
prints both on its per-frame end line beside the idle, reserve and long-reuse
gauges; Metrics::zeroed_bytes_used is on its per-frame counters line.
Why: the planner ruled that at the cutover everything the guest's driver side
allocates lives in the pool, so the pool's footprint per class is a number the
plays must show each frame.
Verified: nothing yet. The hold test asserts the gauges after a long take
(at least the long allocation plus the Shared unit, and the Private unit), and
every device test's teardown asserts all gauges at 0.
What:
- One mechanism. A block given back is a free range of its allocation at once. The kept list, the
returned fast path, unkeep and the take's wait for the block-maker thread are deleted.
- A take is the first free range that fits whose bytes are all zeroed, else the first that fits,
in the order the allocations were made. It runs under the pool's lock, with no Vulkan call and
no hook (Metrics::takes_from_free_ranges).
- A long allocation, which a take longer than 16 MiB made for itself, serves only takes of exactly
its length. Metrics::shared_long_reuses and private_long_reuses count such takes after the
first. Gauges::shared_long_reused_bytes and private_long_reused_bytes count the bytes of long
allocations that hold one.
- The block-maker thread zeroes free Shared bytes that are not clean in 256 KiB steps, the
allocations in the order they were made (Metrics::free_bytes_zeroed, free_zeroing_nanos). It
starts no step while a consumer memset runs (Pool::fill, Metrics::zero_steps_held), the rule of
76c6f5d071.
- Metrics::zeroed_bytes_used counts the bytes of zeroed Shared buffers that a zero mark covered,
so the buffer's memset skipped them: the block-maker thread's zeroing that a buffer used,
against Metrics::bytes_zeroed, the consumer's thread's. Per stream, the two decide whether the
thread's zero steps are worth keeping.
- The hooks are per allocation:
- BlockMappings::map(&AllocationInfo) runs before any block of an allocation goes out, outside
the pool's lock: in Device::new for each class's first, on the block-maker thread ahead of
need (Metrics::allocations_mapped), and inside a take that made its own
(Metrics::allocations_mapped_on_takes).
- A refusal frees the allocation, hands out none of its blocks and fails the take with
Limit::AllocationNotMapped (Metrics::allocation_map_refusals).
- BlockMappings::unmap(AllocationId) runs before vkFreeMemory, outside the lock. Quiesce and
teardown go through it.
- The per-block hook, BlockMappings::unmap(BlockId), is deleted. Its consumer, reims-vgpu,
promises (its merge batch 232):
"reims-vgpu's pool calls release_block only after the block's piece is out of the guest's
address space (the host answered pool_removed; at the device's release the host has
removed every piece first, as the API requires) and no thread of the device holds it, and
it never touches the block afterwards, so the runtime may free any block it gets back at
once, with no call into the consumer."
- BlockInfo carries its allocation's number and its offset there.
- One VkBuffer per allocation:
- a block's commands reach it through Memory::range(offset), which gives (allocation buffer,
base + offset);
- the block's address is set at carve, with no Vulkan call;
- the per-block VkBuffer, texture blocks' included, is deleted.
- The reserve: the newest idle 16 MiB allocations with free bytes that keep 8 MiB free. With no
kept blocks, an idle allocation's bytes are all free, so the reserve is one 16 MiB allocation of
each class at most.
- The README states the contract: the pool's allocations are in the guest's range whole, free
ranges included; the consumer hands the guest blocks only; a guest kernel that writes a free
range damages only its own later buffers.
Why: the planner's pool ruling. Each allocation costs a VMM ask once:
- WHPX: about 0.55 ms to map and 0.8 ms to unmap per 16 MiB;
- HVF: 3 us to map and 71 us to unmap;
- KVM: 116-124 us of BQL per ask.
A take from an allocation already made costs no Vulkan call and no VMM ask. The kept list held
blocks by exact length for the device's life and gave their bytes back only through an unkeep.
Tests (memory::on_device):
- each allocation mapped before its blocks go out, on the thread that made it, and a take not
mapped refused, its allocation freed;
- zeroed bytes taken first, given-back bytes taken as written;
- a long allocation taken again at once, counted;
- idle frees, oldest first, the first fit taken again;
- the long allocation never the reserve;
- the zero mark on a long allocation's free bytes, in steps, and a zeroed buffer over it counting
the mark's bytes as used;
- the zero hold beside a consumer memset;
- seeded takes with every block's allocation mapped.
The command tests' quiesce and teardown check each allocation mapped is unmapped once, on the
right thread.
Verified: nothing yet; the check job, the device legs and the measures follow.
On the Ryzen 7 7840HS nodes the cores' mean clock tracked the frame rows' pass time (r = -0.88
over twelve passes of one build on the Radeon 780M, job m3-max-49287), so the host time of a
frame row measures the clock its passes found, and the legs there read VOID or venue unstable on
it. The planner's ruling: on such a node the frame rows of every card it hosts are judged by the
new runtime's instructions per frame, their time kept as a cross-GPU outlier check.
results.CLOCK_FOLLOWS_LOAD lists the CPU by potluck's cpu_model fact, which the leg's note now
keeps (`cpu`). There, harness_budget names a frame row's time and judges nothing on it (the
instructions gate judges it; a latency from idle row by its workload's count), the leg re-times
none of them (RETIME_SELECT's skipre, results.retime_skip), base_spread leaves them out, and
over_rows lists only their counts. time_outliers is unchanged and still judges their time
across GPUs. The verdict line names the rule that judged each row. docs/VALIDATION.md states it.
Verified: PYTHONDONTWRITEBYTECODE=1 python3 -m unittest discover -s scripts/matrix, 70 tests OK
(new: the budget, re-time, spread and over-table reading on and off the listed CPU; the verdict
line's rules; the harness job's skip pattern).
set_stage_in_region (setStageInRegion:) accepted the region and changed nothing, on the reading that no kernel rt dispatches reads it. That reading missed [[grid_origin]] and [[grid_size]]: they read the region without a [[stage_in]] argument. A recorded stream makes a compute state whose kernel reads both, and the old runtime plays it; rt refused the state (Unsupported{IdentityDomains}) until the translator admitted the field. The encoder now keeps the region as its push field's 32 bytes, the origin and the size each a uvec4 with a zero w, as the binder writes them. Every later dispatch writes those bytes where the kernel's StageInRegion field sits (FieldValue::StageInRegion). The interface takes RuntimeFact::StageInRegion. A dispatch of a kernel that reads the region on an encoder that set none is the new Gap::NoStageInRegion: what Metal's kernel reads then is not established, as the binder's MissingStageInRegion says. A [[stage_in]] fetch stays Gap::KernelInput.
The player plays setStageInRegion: on rt. The conformance rt side sets each direct region before its dispatch; the indirect form stays unavailable.
README, the gap's docs, api_signatures and docs/REFUSALS.md updated.
Only a kernel that reads the region copies it into its parameters; any other dispatch passes the encoder's region by reference and copies nothing.
Test: translate's every_device_pushes_the_stage_in_region_a_kernel_reads runs engine/kernel_stage_in's stage_in_region_short. A dispatch before any region is set is Gap::NoStageInRegion. Two dispatches under two regions each store their own origin and size at every thread, and nothing past the grid. The sampling device test still sets a region its kernel ignores. compute's every_device_counts_no_instructions_for_a_stage_in_region_a_kernel_does_not_read counts the user-space instructions of a dispatch of a kernel that does not read the region, with no region set and with the setter called before each, less the setter's own: they agree within 2% and 16 instructions.
Verified: check 49270 (msi): the clippy, rustdoc and host suites above clean; rt's device suite on lavapipe 294/294 (3 skipped), each dispatch reading the region set before it. From its archive, the two stage-in device tests on the RTX 3090 (49414) and the Iris Xe (49415) pass with no validation error; user-space instructions a dispatch of a kernel that does not read the region (a debug build): 3090 40190 with no region, 44013 with the setter before each, of which the setter alone 3942 (so 40071); Iris Xe 36082, 40057 and 4058 (35999).
A kernel that reads [[grid_origin]] or [[grid_size]] reads the stage-in region, which the encoder writes into PushField::StageInRegion. The identity domains' admission check took only slot addresses, the dispatch region, integer channel widths and constexpr sampler indices, so such a kernel was refused as Unsupported{IdentityDomains, NotImplemented}. A recorded stream's kernel is refused this way at its compute state, and the old runtime plays that state. The field is a value the encoder pushes, with no descriptor and no address, so the check now takes it. A [[stage_in]] fetch stays out: its stride field and its reach specialization are still not admitted.
SEMANTICS_VERSION 2184: a refusal under the identity domains becomes a module. The same bump covers the earlier change of class of the GPU-encoding kernel's refusal (IdentityDomains to GpuEncodedIndirectCommands), which did not bump it. The old runtime's key of a render descriptor carries the version, so its pinned value in the_old_render_descriptor_key_keeps_its_value moves with the bump (93a63310 to 338f17f9).
Test: engine_identity's the_stage_in_region_is_read_from_its_pushed_field compiles engine/kernel_stage_in's stage_in_region_short under the identity domains on lavapipe and moltenvk-m3. It checks that the kernel takes no descriptor, that StageInRegion is among its push fields and that it passes L3. On the CPU interpreter every thread stores the pushed origin and size, and nothing is stored past the grid.
Verified: check 49270 (msi, at the rt commit on top): cargo clippy of the translator, rt, validation and conformance (all features; --cfg m2v_gpu; rt under --cfg m2v_cpu_icd) clean; rustdoc of the translator and rt clean; the translator's and rt's host suites 3846/3846, the_stage_in_region_is_read_from_its_pushed_field among them; validation's replay tests 60/60; the conformance host suite 1058/1058.
The runtime binds a sampler state with LOD clamps whose samples read as its own (b7ef04ae97:
each clamp held to [0, 15] equals the state's own held the same way) and answers any other with
Gap::LodClamps, binding nothing. The player now plays the four render clamp selectors (vertex
and fragment, one sampler or a range) through set_vertex_sampler_state_with_lod_clamps and
set_fragment_sampler_state_with_lod_clamps. A bind the runtime answers with the gap is skipped
and counted (skipped_clamped_samplers), and draws are skipped while the slot holds it.
Every clamp bind the census found (both web3d streams: the sampler's own (0, FLT_MAX) and
(0, 1000) over (0, FLT_MAX)) reads as its own, so they all bind. Before this, the player refused
setFragmentSamplerStates:lodMinClamps:lodMaxClamps:withRange: (web3d-780m-r1 stopped at frame
391, web3d-3090-r2 at frame 0); the probe players carried a stopgap that skipped any clamp other
than the sampler's own, which this replaces. The compute encoder's clamp selectors stay refused:
no stream calls them.
Test a_sampler_bound_with_lod_clamps_plays_where_the_runtime_takes_them: (0, FLT_MAX) and
(0, 1000) bind and the draw is checked green; (0, 2) is the gap, counted, its draw skipped.
The runtime's compute encoder takes setStageInRegion: (59bb3634d1): it changes nothing a dispatch
of a kernel without a stage-in argument does, the only kernel it builds. glbench-780m-r1's all8
play (m3-max-49209) stopped at frame 438, call 593644, on the player's refusal of the selector;
the census found 158,349 such calls there and 300,832 in glbench-3090-r2, every one on a kernel
with no stage-in argument. The new runtime's backend now plays it through
ComputeCommandEncoder::set_stage_in_region; the old runtime still refuses it.
Test a_stage_in_region_plays_on_a_compute_encoder: an encoder's region plays, nothing skipped.
Reims's read of glbench-780m-r1 (frame 381): the guest gives index 1459 to one swizzled view
after another, and the host releases each about 700 records after the next took the index, so
two views are live at 1459 for that span. The player took an object's index from the placement
alone and kept it until the object's release, so a command buffer that named a displaced view
owed 1459, and the placement of view #71001 waited for (then counted) command buffer #70944,
which names no object holding 1459.
Indices now records, per command buffer not yet committed, the index each named object holds at
the naming (it is the object placed there last), and owes those indices at the commit; a command
buffer released uncommitted owes nothing. The released-object bookkeeping (pending users) goes:
a naming already holds its index. The backend's users map keeps buffers only, the one thing
still read from it (Places).
Tests: the Indices unit test gains two live objects at one index (a naming of the earlier one
owes nothing, of the later one owes); device test
a_command_buffer_naming_an_object_after_a_later_one_took_its_index_owes_it_nothing plays the
shape (two live holders, release after reassignment) and expects no wait and no count.
Check m3-max-49144 failed a_resource_id_s_high_word_is_checked_against_the_documented_word on
the line it expects: 0x0002_0000_0000_0007 prints as 0x2000000000007, not 0x200000000007. The
comparison itself passed (the report's ids held as expected).
The planner's ruling on resource IDs: the new runtime's layout stands (index | word << 32,
docs/RESOURCE-ID.md). A recording made on the old runtime holds that runtime's high word, so a
whole-ID comparison reported every texture whose word is not 0 as differing.
Backend::resource_word gives the high word RESOURCE-ID.md's own functions give the descriptor the
backend made the object of: TextureWord::of(pixel format, swizzle) for a texture, SamplerWord::of
for a sampler state. Where a backend gives one (the new runtime's), the player compares the ID's
low word with the recording's and its high word with that word, never with the recording's high
word. Where it gives none (the old runtime's), the whole ID is compared as before. A differing
ID's line carries the word: 'id #N RECORDED PLAYED word WORD'.
Test a_resource_id_s_high_word_is_checked_against_the_documented_word: an ID with the recorded
index and the word passes over a recorded high word of 0 or 1; another index or another high
word is reported with the word.
What: Device::new_buffer's memset of a zeroed Shared buffer's bytes now holds a guard
(Pool::fill). While any guard is held, the block-maker thread starts no zero step of a kept Shared
block. It waits, and the last memset to end wakes it, only where it held a step back: the thread
sets fill_held before it reads the count, and the memset reads fill_held after it leaves the count
(SeqCst on both), and the notify is under the pool's lock. A step that already runs ends first, at
most 256 KiB. Metrics::zero_steps_held counts the steps held back; the replay player prints it.
Why: the harness's create_64MiB row regressed on the 2080, from about 905 us to 1008.6 us (1.147 of
old's 879 us; entry's bisect, m3-max-49153). The harness keeps a second 64 MiB block live, as a
guest does, so the takes alternate:
- one take finds a block the block-maker thread zeroed whole (about 1 us);
- the next finds mark 0, and the consumer memsets all 64 MiB.
That memset took 2.0-2.2 ms against about 910 us alone, because the thread's 256 KiB steps on the
other kept block ran at the same time (about 15 GB/s) and both shared the memory bus. Entry's
controls ruled out the memory type and the write method: with no kept-block zeroing the row was
911 us, and with the steady loop started 600 ms after the warm-up's release it was 906 us.
Test: every_device_holds_its_zero_steps_while_a_consumer_memset_runs. With a fill guard held, a
Shared block written and given back is kept with mark 0, the thread holds its step back (counted),
and no byte is zeroed for 20 ms. Once the guard drops, the block is zeroed to its end. Without the
fix the steps run beside the guard: the held count never rises and the mark moves.
Verified: nothing yet; the check job, the device legs and the 2080's create_64MiB timing follow.
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.
refuse() refused every descriptor whose tessellation was Some as
RenderPipeline{Tessellation}, even with a plain vertex function. Metal reads the
tessellation state only for a post-tessellation vertex function and ignores it
otherwise, and the translator documents and does the same; once the recorded
render pipelines carry the tessellation fields with their defaults, the player
would map them to Some and every render pipeline would be refused.
The refusal moves to the translation's answer: unbuilt() names Tessellation
where the pipeline holds a tessellation or an emulated tessellation, which the
translator states exactly for a post-tessellation vertex function, ahead of
the other synthesized stages. A post-tessellation function stays refused until
tessellation is built.
Test: a plain vertex function's pipeline is made with Metal's default
tessellation state and with another (every field moved but the one-valued
factor format).
Three cuts to what a draw records of the depth and stencil tests and the bias:
- set_depth_stencil_state marks the depth test and the stencil test apart (DEPTH, STENCIL),
and only the part whose value differs from the state it replaces;
- set_depth_bias marks the bias only where the constant or the slope scale differs;
- a draw records, of a marked part, only the fields that differ from the ones the encoder last
recorded (the depth test's enable, write and compare; the stencil enable and each face's
operations, compare mask and write mask), every field before its first draw.
Measured with the instruction test, which gains an arm whose state and bias are set again
unchanged every draw and holds that arm within a quarter of the draw under a test set once.
Before (d61f008e4e, lavapipe, 49142): 10074 no depth, 10601 set once, 44426 changing every
draw, 414 the setters alone. After: in the commit's checks.
newTextureViewWithPixelFormat: and its forms of another pixel format were a
gap. glbench makes 1,524 (780M stream) and 2,970 (3090 stream)
BGRA8Unorm_sRGB textures' BGRA8Unorm views; Metal views a texture as its sRGB
sibling with no usage asked (MTLTextureUsage.pixelFormatView: "Don't set this
option if your texture view only converts between linear space and sRGB"), and
with PixelFormatView usage as any colour format of the same bit length
(makeTextureView(pixelFormat:)).
The translator states Metal's rules: metal::format::srgb_sibling (srgb_raw_twin
both ways, ASTC's LDR and sRGB forms, the extended-range pairs),
views_without_usage (itself, the sibling, a combined format's stencil) and
views_with_usage (those, and uncompressed colour formats of the same bytes a
texel by byte_format).
An image lists, its own format first, the formats Metal views its texture as
that the device holds for the usage in a viewed form of the image format's
compatibility class: the sibling always, and with PixelFormatView every such
format. Such an image is MUTABLE_FORMAT with a VkImageFormatListCreateInfo, in
its creation, its format queries (optimal and linear) and its heap size query;
any other image is unchanged. plan() splits into form() (what a texture holds
in its views) and the image's own part, so a view takes form() alone, with no
image query.
A view of another format is built where the image lists it, else
Gap::TextureView{PixelFormat}; a format Metal does not view the texture as is
Refusal::TextureViewFormat, which no longer refuses the sRGB sibling of a texture
without PixelFormatView usage. Its image views take the image's usage that the
view format's features hold (VkImageViewUsageCreateInfo,
VUID-VkImageViewCreateInfo-usage-02274/02275/08931): it has a storage element
only where the image has storage usage, and renders where its format holds an
attachment, else Gap::TextureFormat at the pass.
Tests: the translator's sibling is mutual over every format and its view rules
take and refuse as Apple's pages say; on devices, an sRGB view of a texture
without PixelFormatView usage and an R32Uint view of one with it each read
their parent's bytes, and R16Float and BC1 views are refused.
The planner's ruling on the status form: without the wait bit Vulkan lets vkGetQueryPoolResults
answer NOT_READY for a query not yet available, and only the wait bit defines a dependency on the
writes, so a signal says nothing about a query's availability. The read's doc still argued from the
signal's scope that a submission that ran has its pair available at the read; it now says what the
README's known gap says, and names the host wait each form asks (the wait alone with one value
pending, after the counter read with more), as the README's counter paragraph now does too.
Docs only. Verified in the job named in the landing message.
The counter read and then the zero-timeout wait (the commit before) put the 780M's frame row 10%
and frame_5cb 11% behind the tip without the wait, and the XTX's frame_5cb 3.4% (48824; the 2080
within 1.6%, the bursts within 1.7% or faster). So, while every retiree in flight has the one
progress value, the round asks only the wait with a timeout of 0 on that value and skips the
counter read: one call, as before the wait. With more values pending, the counter read finds the
highest value reached and the wait on it confirms it, retiring every batch reached in that one
round; a wait behind the counter is counted (Metrics::waits_behind_counter).
Timing: the harness at 5849a7f029 without the wait (BASE), this form (W2), and the planner's other
shape (S4: one zero-timeout wait on the front value after each blocking wait, retiring one batch a
round), each pass a process of its own on frame, frame_5cb, burst_160 and burst_2000 at 200 runs,
four passes an arm in the order BASE W2 S4 S4 W2 BASE BASE W2 S4 S4 W2 BASE, each card's leg alone
on its node (exclusive). Each cell is the arm's median against BASE's. The reading rule: a leg
whose BASE spread over its passes ((max - min) / median) passes 10% on any row is void and is run
once more at another time; a leg void twice is read by the rows whose own BASE spread is under 3%.
RTX 2080, um790 (48957), valid (BASE's worst row 2.9%):
row W2 S4
burst_160 -0.1% -0.0%
burst_2000 +0.1% +0.0%
frame +0.5% +0.0%
frame_5cb -0.8% -1.2%
frame_5cb_from_idle +0.5% -0.1%
frame_from_idle +0.2% +0.1%
RX 7900 XTX, um790: void in 48957 (13.7%) and 49066 (10.2%), and in 49157 (12.8%, the leg run
alone); its rows under 3% of BASE spread:
48957 burst_160 (0.5%) W2 +0.3% S4 +2.1%
49066 burst_2000 (1.3%) W2 +0.5% S4 +0.6%
49066 frame_5cb (2.4%) W2 +3.9% S4 +4.4%
49066 frame_from_idle (2.8%) W2 +1.7% S4 +0.0%
49157 burst_160 (2.0%) W2 +0.6% S4 +4.9%
49157 burst_2000 (1.0%) W2 +0.7% S4 +0.2%
49157 frame_from_idle (2.1%) W2 +0.5% S4 -1.4%
Radeon 780M (1002:15bf): void on um790 in 48957 (27.9%) and 49066 (32.0%), and on gem10's
780M in 49182 (26.8%; the frame rows 16-27% on both nodes, the same Ryzen 7 7840HS):
49182 burst_2000 (2.99%) W2 -1.2% S4 -4.5%
49182, every row: W2 at most +1.2% (frame_from_idle), S4 frame_5cb +5.2%
The planner's condition, W2 within 3% on the other 780M and on the XTX by the rows under 3%
spread, holds for 49182 and 49157; S4 misses on both. stamps_not_available and
waits_behind_counter were 0 in every pass of every arm. Rebased onto development 81ac953676; the
build, checks and device legs are named in the landing message.
A retirement tells the guest its command buffer completed and lets it read what the GPU wrote
(and reads the command buffer's timestamps). Vulkan orders that after the signal only through a
host wait on it: "signal operations happening before host operations that wait on them" (the
memory model's note under System-Synchronizes-With). The completion thread learned values from
vkGetSemaphoreCounterValue, for which 7.4.4 states no such order, only that the value "may
immediately be out of date"; its blocking wait (VK_SEMAPHORE_WAIT_ANY on progress, events and its
wake) covers only the front value, and only when that is what woke it.
Now, once the counter read returns V and anything at or below V is due, one vkWaitSemaphores on
V with a timeout of 0 comes first ("If the condition is satisfied when vkWaitSemaphores is
called, then vkWaitSemaphores returns immediately"). On VK_TIMEOUT nothing retires that round,
Done::completed does not move, the round is counted (Metrics::waits_behind_counter) and the
thread's next blocking wait is for V itself, so it sleeps until the wait agrees rather than
reading the counter again. An error is the loss, as a failed counter read was.
The count is printed where stamps_not_available is: `M2V-MATRIX metric <test>/waits_behind_counter`
from rt's device loop, `harness-<runtime>/device/waits_behind_counter` from the harness, and the
player's `waits_behind_counter` counter. Above 0 on a venue is that driver's counter running ahead
of its wait.
A device test checks the wait's two answers: the value the progress semaphore holds is reached,
and a value far past any the device signals is not, without blocking.
readback.rs's doc now rests the pair's availability on the host wait alone; the README names the
count. Public surface: Metrics::waits_behind_counter (signatures.py --check run here, clean).
Not yet compiled or run.
A recorded stream's frame 199 draws lines with a render pipeline state that until then drew only triangles. On the 780M under RADV, rt made that state's line pipeline at the draw in 214 to 226 ms, all of it in the driver's compile. It went through the same VkPipelineCache the triangle pipeline was made through, with no cache replacement between. The other contents' line pipelines took 0.9 to 1.5 ms there, and the Intel driver's took 0.1 ms. RADV reports dynamicPrimitiveTopologyUnrestricted false, so a pipeline made for one topology class cannot draw another, and its stages are compiled anew for the second class. With NGG culling off (RADV_DEBUG=nonggc) the line pipeline still took 225.0 ms, so culling is not the cause. Linking from graphics pipeline libraries would make that pipeline in milliseconds, but the floor does not require them, and rule 2 allows no second form for them. The planner ruled a known gap with this wording and no build.
Verified: the 225 ms and the other contents' 0.9 and 1.5 ms are the probe player's line-make splits in job m3-max-49109 (780M, RADV, nonggc, a cold play to frame 201), and the 0.1 ms is job m3-max-49089's (Iris Xe, ANV, to frame 320). Docs only.
Rows and refusals recorded by one build (executor vulkan-engine-v183, product
bff16df145e093d75e4fe9571806f306b5de880a4dd9754b4b37d6990a37d2a2, semantics 2183, oracle metal-literal-resources-v49), installed at b3ea68febcb77839a827a8100706969193fbebea by
scripts/rerecord-commit. Only candidate and refusal shards change, so the product,
and every row installed here, stays current.
- intel-irisxe-rplp-anv (vulkan): 16 rows, 0 refusals
Rows and refusals recorded by one build (executor vulkan-engine-v183, product
bff16df145e093d75e4fe9571806f306b5de880a4dd9754b4b37d6990a37d2a2, semantics 2183, oracle metal-literal-resources-v49), installed at 81ac953676 by
scripts/rerecord-commit. Only candidate and refusal shards change, so the product,
and every row installed here, stays current.
- amd-780m-radv (vulkan): 16 rows, 0 refusals
What: the README said each class's reserve is one 16 MiB allocation at most. It now states the
bound today's pool keeps:
- the reserve is the newest idle unit allocations with free bytes, taken until the class's free
bytes reach 8 MiB;
- an allocation that holds kept blocks counts only its bytes outside them, so the reserve may hold
several;
- a long allocation is never the reserve (42ddd3f966).
Why: "one at most" is false today. u3, played on the 780M to frame 1178 with the reserve fix
(m3-max-49187), held 64 MiB of Private reserve on 2 frames. The player before the fix held at most
16 MiB, and both ended with 16 MiB of Private reserve and none of Shared. Which allocations made up
the 64 MiB is not confirmed. The pool build, where an idle allocation's bytes are all free,
restores the one-allocation bound, and its commit restates it with plays as evidence.
Verified: docs only (the README is not compiled into the crate).
The half-division fixture now takes its dividends' base as function constant 0, and its one case is
eight cases, an eighth of the dividends each. Its golden hash rows (.ll and .air.ll), its air_input
golden printout and the authored compile table's rows move with it. They are re-blessed on
development, as CONTRIBUTING.md asks.
Done in one potluck job on the M3:
- golden_hashes.tsv by bless_golden_hashes, with xcrun metal-as;
- tests/air_input by tests::air_input's bless, with Homebrew's LLVM 21, the pinned major;
- authored-compile.tsv by corpus-triage --audit authored-compile --bless.
The job's output lists every changed row.
What: aging() counts an idle allocation as its class's reserve only where it is a unit
allocation, of 16 MiB (ALLOCATION_LEN) or less. A long allocation, one a take longer than the unit
made for itself, is always weighed by the idle rule and freed at its idle age.
Why: the reserve is the newest idle allocations with free bytes that keep the class's free bytes
at 8 MiB (MAKE_BELOW), so the block-maker thread does not free what it would make again. Once a
long block's bytes were given back to its allocation (an unkeep: a take that no free range fits
asks the kept blocks of other lengths for their bytes), that allocation was idle with free bytes
and the newest: it became the reserve and was never freed, holding its whole length (64 MiB in the
test, hundreds of MiB in a play) for the device's life, while the older unit allocation was freed
instead.
Test: every_device_frees_a_long_allocation_whose_block_s_bytes_are_free_at_its_idle_age.
1. A Shared block of 64 MiB is taken and given back, and a take of 20 MiB makes its bytes a free
range of their allocation (the unkeep).
2. The 20 MiB block is given back too, and the test waits twice the idle age.
3. Only the class's unit allocation stays, as the reserve: blocks, Shared idle bytes, Shared
reserve bytes and Shared idle age are (zero source + 2, 16 MiB, 16 MiB, 0).
Verified:
- Check m3-max-49062 at this tree (trial commit ad1321382c, the same tree on the same parent):
fmt, clippy in every configuration, Rustdoc and the suites, green.
- Negative control m3-max-49102 (the fix reverted, the test kept) fails as intended. The reserve
holds the 64 MiB allocation: left (3, 67108864, 67108864, 0) against right
(3, 16777216, 16777216, 0).
- Device legs at ad1321382c, memory::on_device, green:
- lavapipe 49100
- RTX 2080 49105
- RX 7900 XTX 49111
- M3 (KosmicKrisp) 49104
- RTX 3090 49103 and 49147
- Iris 49134
- UHD 630 (Windows) 49118
- RX 550 49106
The 780M's leg, 49181, is queued.
- r3 played on the 2080 to frame 1137 (m3-max-49135): the players before (a47e4abe53) and after
(this tree) both end with Shared and Private idle bytes 0 and reserve bytes 0. Neither reserves
more than 16 MiB on any frame, so r3 does not show the bug. u3's play on the 780M follows as
evidence after the landing.
The idle bytes gauges count the reserve with the allocations idle under 250 ms, so they cannot
show which idle allocation the idle rule keeps for the device's life. aging() now returns the
reserve's bytes beside the allocations it weighs, settle() stores them per class, and teardown
sets them to 0. The replay player's live counters print both, so a play shows the reserve's
bytes at each frame's end.
A read of the pool (memory.rs aging()) found that a single-object allocation, one a take longer
than the 16 MiB unit made for itself, can become the reserve once its block's bytes are given
back to it (unkeep): it is then never freed. The fix follows in its own commit; these gauges are
its evidence in plays, before and after.
Verified: nothing yet; the check job follows.
Without the display library, newLibraryWithSource:options:error: is skipped as an object, and
newFunctionWithName: on the skipped library is a call on a skipped object, which the player
counts under skipped_calls, not skipped_objects. The test expected 2 skipped objects; check
m3-max-49041 failed it there (DEVICE=100, lavapipe). It now expects (1, 1), and (0, 0) with
the library.
The planner's condition on the display sidecar: every play states which
display library it ran. The report's display library line now gives the
sidecar's length, its SHA-256, and its git blob id (the SHA-1 of
"blob LENGTH\0" and the bytes). The blob id names the file in the host's tree:
every stream so far holds blob b1aea1f0, 47,426 bytes. The doc also says the
sidecar holds the host's display shaders alone, and that a player makes only
the device's library from source of no arguments from it.
The validation crate takes sha1 0.11 (RustCrypto, MIT OR Apache-2.0; the same
digest family as sha2 0.11) for the blob id.
Test: the integration test expects the 5-byte sidecar's SHA-256 and the blob
id `git hash-object` gives for the same bytes (8d7ffd7e). Verified by the lane
check named in the hand-over.
webdiv-780m-3's record 11498, newLibraryWithSource:options:error: on the
device with no arguments, is reims's host loading its own display shaders.
The players skipped every library from source, and with it the host's 773
present draws, so both plays of webdiv-780m-3 ended as no verdict. A
program's own libraries reach the stream as data, never as source.
The decided form is a sidecar beside the stream, NAME.display.metallib, like
NAME.range:
- command-replay reads the sidecar (replay::display_library) and gives it to
either backend (with_display_library).
- The report says so in the line after `range`: `display library the
stream's sidecar, N bytes`, or `display library none: the host's library
from source is skipped`.
- Both players make a library from source of no arguments from the sidecar,
as from data. Any other library from source, or one without a sidecar,
stays skipped and counted.
docs/REPLAY-STREAM.md sections 1 and 10 state the sidecar and the line.
Tests:
- An integration test reads the line without the sidecar and with a 5-byte
one; the range test's line positions follow the new line.
- A device test makes a function of the host's library with the display
library and skips both without it.
Verified by the lane check named in the hand-over.
A placement whose index is owed to a command buffer that no record played so far lets
complete (its event wait is signalled only by a later record) stopped the play with
PlayError::Held. In the recording that order proves the recording device gave the index to the
new object before that command buffer completed: that is its index policy. The player now plays
what the device did: it takes the index without waiting and counts the placement on its own
report line ('indices given while a commit they owe is held N: ...'). The index stays owed to
the held commit. Where the owed commit is not held, the player still waits for it.
PlayError::Held, held_error and HeldBuffer's queue and unmet waits are deleted: nothing reads
them now. Backend::held takes the held command buffers' stream ids.
The rt_replay test that pinned the stop now expects the index taken (16) and the count of 1.
Verified by the check job named in the hand-over.
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.
They are generated from the whole case set, and the set grew on `development`
while this branch was in flight, so the copy committed here counted a smaller
one.
Verified: regenerating at this tip leaves no change beyond the `Generated at`
stamp.
The clamp device test of e75e9e7f4b passed the device's name by value where finished takes a
borrow (a compile error under --cfg m2v_gpu, job 49121), and lod_clamps_read_alike's doc linked
the private LAST_WORD_LEVEL (rustdoc's private-intra-doc-links, same job). Verified in the job
named in the landing message.
glbench's streams call setStageInRegion: 158,349 times (780M) and 300,832 times (3090), every call
on an encoder whose kernel has no stage-in argument; neither stream makes a compute state with one
(replay's census over 204 and 148 states). Metal's region is what a kernel's [[stage_in]] argument
fetches by, and rt refuses a kernel with one at its state's creation (Gap::KernelInput,
pipeline.rs), so no state the encoder dispatches reads the region: `set_stage_in_region` accepts
it and changes nothing, as a kernel without the argument ignores it on Metal. No stage-in fetch is
built; the refusal stays.
Test: the sampling device test sets a stage-in region before its dispatch and checks the samples
as before. README and the signature table updated. Verified in the job named in the landing
message.
The replay streams bind sampler states with Metal's bind-time LOD clamps
(`setFragmentSamplerStates:lodMinClamps:lodMaxClamps:withRange:`): web3d on the 780M makes 2,635
such calls and on the 3090 2,627, every one over a state made with clamps (0, FLT_MAX), half of
them binding (0, FLT_MAX) and half (0, 1000); glbench makes none (replay's census). rt had no
such form, so the player skipped and counted the second kind.
A sample's level is clamped into the clamps and then to the texture's levels, at most 14 (Metal's
largest textures have 15 levels), and a level below 0 is level 0. So two clamps read alike where
each bound held to [0, 15] (the translator's LAST_WORD_LEVEL) is equal: in Metal's sampler, in
the device sampler `vk_sampler` makes (Vulkan clamps into [minLod, maxLod] and then to the view's
levels) and in the sampler word. The translator states the rule
(`metal::sampler::lod_clamps_read_alike`); rt's compute encoder (`set_sampler_state_with_lod_clamps`)
and render encoder (`set_vertex_sampler_state_with_lod_clamps`,
`set_fragment_sampler_state_with_lod_clamps`) bind the state as it is where the clamps read as
its own, which covers every call the streams make at no cost, and refuse others as the new
`Gap::LodClamps`, binding nothing (no stream makes one; a variant or a shader clamp is built when
one does). Each range form is a loop of its single form.
Tests: the translator's unit test pins the rule (1000 and infinity over FLT_MAX, -1 over 0 alike;
14, a raised lower bound and NaN not) and that every alike pair gives the descriptor's word, query
level and device lods; a device test binds on the three forms and gets the gap on each; the
sampling test binds its state with (0, 1000) and checks its samples as before. REFUSALS.md
regenerated; the signature and surface tables take the new items. Verified in the job named in the
landing message.
The landed packet changed a runtime-sources input, so the committed digest no
longer described the sources and `the_runtime_sources_are_the_committed_ones`
would fail. Recomputed over the same inputs and committed by land-pkt.sh.
The gap was found from the slot's hazard access, which the translator gives by use: a
read_write slot the function only reads is a read there, so a swizzled view bound to it
passed the check and its read answered the texel unswizzled. The device test caught it on
lavapipe (49090: the read_write read of the view returned no gap).
The translator now states the declared side: TextureSlot::storage, true where the function
declares the slot write or read_write and so reaches a storage image, whose view maps each
channel to itself. rt keeps the slots read through one (storage with a read) for kernels
and for draws, and the gap is found from that list. The cache encoding carries the field
(ARTIFACT_FORMAT_VERSION 540); api_signatures gains the field; REFUSALS regenerated.
Verified: to follow in the build, tests and touched stages.
Main asked what the changing arm's extra is made of. A fourth arm calls
set_depth_stencil_state and set_depth_bias as often with no draw between, so
the changing arm less the set-once arm and the setters is what a draw records
of the changed state: ten dynamic-state commands for the depth-stencil state
(depth test, write, compare op, stencil test enable, and each face's stencil
op, compare mask and write mask) and two for the bias and its enable.
Apple defines the swizzle for reads and samples. A write through a swizzled
view, and a render pass into one, store the texels unswizzled: Metal's
documented answer, so that half leaves the README's known gap. A read() of an
access::read_write slot reads through the texture's storage element, which
maps each channel to itself as Vulkan requires of a storage image
(VUID-VkWriteDescriptorSet-descriptorType-00336), and would answer the texel
unswizzled where Metal reads it through the swizzle: a wrong answer, which no
static note covers.
Such a draw or dispatch is now Gap::SwizzledReadWrite { slot }, found with the
bind-time facts (the draw's Facts::find, the dispatch's alignment check), so
the test runs once per pipeline-state or binding change and only for the
translated interface's read-write texture slots. The players count it as they
count every gap.
Test (tests/swizzle.rs, on devices, the owned fixture rrp_swizzled_storage):
an access::read read through a [B,G,R,1] view of (10,20,30,40) answers
(30,20,10,255); an access::write write through it stores (0.2,0.4,0.6,0.8)
unswizzled at each texel; the read_write kernel bound to the view is
Gap::SwizzledReadWrite { slot: 0 } and over the texture itself reads its
texel.
newTextureViewWithPixelFormat:textureType:levels:slices:swizzle: is
Texture::new_texture_view_with_swizzle. The view's swizzle combines with the
parent's as Apple states it (each channel the view takes from red, green, blue
or alpha is the parent's as the parent's swizzle reads it; Apple's example
[R,G,A,B] over [R,1,1,G] is [R,1,G,1]), so a view of a swizzled texture is
built too and TextureViewKind::Swizzle goes. The view's descriptor holds the
combined swizzle and its resource ID that swizzle's TextureWord.
Metal takes the call whatever the parent's usage: glbench-780m-r1's 128
non-identity views are of textures of shader-write, and most of render-target,
usage. A view takes its descriptor's checks but the swizzle-with-writes
refusal, which Metal makes of a texture's own descriptor alone (prepare's
checks split into checked()). The sampled element takes the combined swizzle;
the storage element and attachment views map each channel to itself, as
Vulkan requires (VUID-VkWriteDescriptorSet-descriptorType-00336, the rendering
attachments' identity VUIDs). A read of an access::read_write texture and a
write through such a view therefore reach the texels unswizzled where Metal
swizzles them (and, recorded by swizzled-storage-*, undoes the swizzle on
writes): a known gap in the README.
The rt player maps the selector and its resourceIndex form; the conformance
rt side makes the requested swizzled views instead of answering unavailable.
Tests: the combination (Apple's example, identity on either side, constants,
a rotation twice); on devices, a view's descriptor and word for Apple's
example, a view without a swizzle keeping the parent's, and a swizzled view of
a shader-write, render-target texture made.
The count compared the draw path with no depth attachment against draws that set a depth-stencil
state and a bias before each draw, which counts the setters too. A third arm sets the state once,
so the depth path's own cost a draw reads beside the current draw path's.
glbench's recordings set their one viewport and scissor rectangle through the list calls (36,051
and 76,107 of each) and the depth clip mode through setDepthClipModeSPI: (65,318 and 125,276
calls; selcensus, m3-max-48834 and 48836). Each list element maps as the one-element call does,
through two helpers, to the encoder's set_viewports and set_scissor_rects; the SPI selector as
setDepthClipMode:.
The render-state lane's depth step (the planner's step 1).
- A depth-stencil state's depth test, write and compare operation are dynamic state, recorded
where they changed; DrawKind::DepthTest is gone. A pipeline bakes the depth format alone, so a
change of depth-stencil state or bias makes no pipeline. In a pass without a depth attachment
Vulkan skips the test, where Metal's documentation states no answer.
- set_depth_bias (setDepthBias:slopeScale:clamp:): the bias and slope scale as given, enabled for a
draw of triangles where either is not zero and never for lines (Metal biases triangles alone).
A clamp other than 0 is Gap::Draw of DepthBiasClamp (no stream sets one).
- Static notes, carried by the operation: PrecisionNote::DeviceDepthBias
(RenderCommandEncoder::DEPTH_BIAS_NOTE: the slope measure, and a fixed-point attachment's unit,
are the device's; Apple states neither; read from Vulkan's Depth Bias section and Apple's
setDepthBias page), and PrecisionNote::DepthDenormals (DepthStencilState::precision_note, a state
that tests or writes depth: every driver measured but MoltenVK on an M4 compares a denormal
depth otherwise than Metal; RADV and ANV store one as zero). The old runtime maps DepthDenormals
to its own depth-denormals kind and takes device-depth-bias as a note kind; codec, fast_paths,
validation's allowance (Unbounded), API.md and ARTIFACT_FORMAT_VERSION 539 follow. No signed-depth
note: no clear, viewport or upload gives rt a negative or NaN depth, and Vulkan leaves a depth
past the viewport's range undefined.
- MTLStoreActionUnknown stores (Vulkan fixes the store as the rendering begins); the encoder's
set_color_store_action, set_depth_store_action and set_stencil_store_action change nothing the
device does and refuse a resolving action (Resolve). On a tile-based device this stores a
target Metal would have discarded (README).
- set_triangle_fill_mode, set_depth_clip_mode, set_viewports and set_scissor_rects take Metal's
defaults (Fill, Clip, one viewport or rectangle) as nothing and refuse the rest, typed
(FillMode, DepthClamp, Viewports): replay found every stream at the defaults.
- The conformance rt side plays the depth bias, fill, clip and viewport-count steps and announces
the encoder's notes; the replay player maps setDepthBias:slopeScale:clamp:, the three store
action setters, setTriangleFillMode: and setDepthClipMode:.
- Tests: a depth attachment cleared to 0.5 with its store action unknown, tested under Less with
writes, failing at 0.375, passing Greater by its bias alone, every mode setter's refusal, and no
pipeline made by the state changes; the instructions a depth-tested draw retires beside a plain
one, printed. REFUSALS.md regenerated, the API table blessed.
The indirect-command census's shards still run alone. With the division of every pair of half
values split into eight cases, one per eighth of the dividends, no census case's dispatch or
command waits a tenth of the old runtime's 20.2 s watchdog on lavapipe. The comment now says so,
with the eight cases' times.
Verified: job m3-max-49010 on the 24-CPU builder ran the runtime lane on lavapipe (LLVM 23.1.1,
Mesa 26.2.4, LP_NUM_THREADS=1, the carried validation layer) at aa748188c7. It printed 583 census
lines and none waited over 2020 ms. The eight cases' dispatches waited 828 to 1363 ms, 0 to 119 ms
of it for a CPU; their commands waited 822 to 1329 ms, 0 to 19 ms of it for a CPU.
The planner's ruling on the lavapipe leg's hang: no single command buffer on a CPU device should
need more than about a tenth of its watchdog with the host idle. The one case that divided all
2^32 pairs of half values took 7.4 to 8.9 s of lavapipe's 20.2 s alone (LP_NUM_THREADS=1, a
24-CPU host), and 20.3 s beside other jobs, past Metal's bound as the old runtime's watchdog holds
it (m3-max-48580).
The fixture's kernel now takes its dividends' base as function constant 0 and covers 8192
dividends on a 1024 x 128 grid, each by all 65536 divisors as before; the eight cases of the bases
0, 8192, ..., 57344 replace the single one, which is deleted with its observations, and the eight
are qualified on Metal (apple-m3-max-macos27.0.1). The fixture's companions are regenerated from
its source on the M3 (scripts/regen-air-fixtures). The device rows and the authored compile table
are re-blessed on development.
Done in one job on the M3: regen-air-fixtures, corpus-case-check --delete-air/--delete-name and
--install of the eight manifests, corpus-metal of each, whose output this commit holds.
Each case over the half-division fixture takes 64 dividends a grid row from its base, function
constant 0, each by all 65536 divisors; the test holds their dividend ranges to tiling the 65536
half values with no gap and no overlap, 2^32 pairs in all, in eight cases. The cases come in the
next commit, made on the M3.
The planner ruled that the status form (a signalled command buffer whose timestamp pair reads
unavailable fails as one the device did not finish) does not land: without the wait bit Vulkan
lets vkGetQueryPoolResults answer NOT_READY for a query not yet available, only the wait bit
defines a dependency on the writes, and a signal says nothing about a query's availability. An
Intel UHD 630 on Windows read such a pair in a burst with its device going on (matrix 749c939440,
the old runtime). The counter (`Metrics::stamps_not_available`) stays as the guard, and the case
is recorded where a user reads it: the queue's known gaps say such a command buffer reports no GPU
times and is counted.
Docs only; no build.