Under the identity domains a function's fields past its push window live
in a parameter block at the pushed ArgumentTableAddress, and each was read
by a load of its own size (a slot's bounds: 8 bytes, aligned 8) through a
writable device place. The block is now read in 16-byte lines: each line a
spilled field touches is one uvec4 load, aligned 16, made once where it
dominates (EmitCx::block_line, so load_push_fields' reads at entry share
them), and each field is taken from its line (a word, a two-word shuffle,
a bitcast for an address, whole lines for a region). The place's member is
NonWritable: nothing writes the block while a command reads it, so a device
may read it as read-only memory; device_place_read_only notes that RADV
reads a uniform address of such memory with a scalar load.
The block's address is a multiple of 16 (rt's ring aligns every write to
16) and its size is (argument_table_size), so every line lies in it.
docs/API.md states that contract for a consumer.
Why: wide_bindings spills 23 of its 24 slots' bounds; it read them as 23
loads of 8 bytes, now 12 of 16. In one stream's kept lowerings
(gb-3090-r2) 2 of 424 modules spill: 14 spilled bounds become 7 lines,
2 become 1. SEMANTICS_VERSION 2197 -> 2198: module words change.
Test: engine_identity_spill's vertex function loads each 16-byte line of
its spilled fields once, in its first block, as a uvec4 aligned 16 through
a NonWritable block; its interpreter tests read the spilled bounds as
before.
The RTX 3090 and the RTX 5080 Laptop GPU (NVIDIA 620.70.06) give every plane format's linear
tiling, and its DRM_FORMAT_MOD_LINEAR modifier where listed,
VK_FORMAT_FEATURE_2_LINEAR_COLOR_ATTACHMENT_BIT_NV in place of the colour attachment feature.
Query::plane asked the image format query alone, which offers the colour attachment usage there,
so rt rendered NVIDIA's in-place planes through that bit with the extension off.
- Floor: VK_NV_linear_color_attachment joins OPTIONAL_EXTENSIONS (enabled where listed), and its
linearColorAttachment feature (LINEAR_ATTACHMENTS) is enabled where the device lists the
extension and reports it, which Vulkan requires of a device that lists it. Vulkan 1.3 needs no
other extension for it (its dependency is VK_KHR_get_physical_device_properties2 or 1.1). The
translator is told of neither. Core::linear_attachments carries the enabled feature.
- The plane test (surface::held_usage): a usage is offered where the image format query offers it
AND the plane's own tiling's format features (LINEAR's for an opaque handle, the
DRM_FORMAT_MOD_LINEAR modifier's for a dma-buf, read through VkDrmFormatModifierPropertiesList2EXT)
hold what the optimal image has for that usage (texture::kept_features, the test a texture over a
buffer takes), and for rendering the colour attachment feature itself
(VUID-VkImageViewCreateInfo-usage-08931). The NV bit stands for the colour attachment feature only
where linearColorAttachment is enabled AND the image is VK_IMAGE_TILING_LINEAR: Vulkan sets it
"for renderable color formats in the linearTilingFeatures" alone. So NVIDIA's opaque fd planes stay
in place on the enabled path and its dma-buf planes take the copy form (SurfaceCopy::Tiling).
- The condition, held by rt: a plane accepted through the NV bit is marked at its make
(surface::linear_alone, SurfaceImage and Image linear_attachment, Attachment::linear). A pass's
begin (Pass::check, pass::linear_shape, one mark read an attachment) refuses with the new
Gap::LinearPlanePass { kind: LinearPlanePassKind }: OtherColor, a colour attachment that is not a
marked plane (the extension's rule: "as long as all the color attachments in the render pass
instance have VK_IMAGE_TILING_LINEAR tiling"); DepthStencil, a depth or stencil attachment (not
Vulkan's rule: an RTX 3090 lost the device on that shape, and rt recovers from no loss, so by the
ladder's third rung it is not used; the words name the driver); Resolve, a multisample
attachment resolving into a marked plane. Every colour attachment marked (both planes of a
picture in one pass among them) with nothing else set renders.
- Unchanged: a texture over a Shared buffer keeps its plain-bit test and its counted copy; the old
runtime is not touched.
The rt README: the surface test and the marking (Exported surfaces), NVIDIA's dma-buf planes as a
copy-form known gap, the refusal among the render encoders' known gaps, the extension row and a
Linear attachments feature table (Floor); the clear-reach slip "inside the Metal's render area"
fixed. docs/REFUSALS.md regenerated; api_signatures.tsv blessed: the new variant and enum,
floor::Features::linear_attachment, OPTIONAL_EXTENSIONS' value.
Tests: tests::floor (the extension and feature enabled where listed and reported, the README
table); tests::surface::verdicts (NVIDIA's linear word: held and marked only as LINEAR with the
feature, the copy form without it and under the modifier either way, the plain bit unmarked,
blend and filter held to the optimal image); tests::pass (linear_shape: one and two marked planes
render, the three shapes refused); tests::linear_planes on device (a draw into one plane and both
planes in one pass rendered and compared on every device; the three shapes refused where the
plane is marked and rendered, compared, where it is not).
What: in docs/API.md's compressed-texel-decode catalogue entry, the sentence on the ASTC LDR bound
(up to 1/2048 off Metal's on ANV, Mesa 26.2.6, the Iris Xe of Raptor Lake-P, over the fourteen
footprints) moves from inside the Cost: words to its own sentence after them.
Why: c77d059c68 put it in the middle of the Cost: words. The old runtime announces
Degradation::CompressedTexelDecode with a fixed cost string, and its catalogue test
(tests::degradation_catalogue::a_runtime_kind_s_entry_states_the_cost_it_announces) holds that an
entry's Cost: text begins with those words. It failed at development b676eda182 (tip check
m3-max-56610, the product suite's one failure of 6200). The old runtime is frozen, so the doc
moves, not its string. The bound and the conformance constant that cites it are unchanged.
Verified: the doc diff alone; the test runs in the check job on development after landing.
Metal fetches any render target, and its header gives every texture a handle with no tie to
usage (MTLTexture.h: gpuResourceID, "Handle of the GPU resource suitable for storing in an
Argument Buffer"). rt took an index only for shader-read or shader-write usage, so a colour
target made for rendering alone had no second element and every fetch from it was
Gap::Draw(FetchedAttachment): guest 26's 4,792 refusals, all of that shape.
- The index rule: shaders reach a texture made for shader reads or writes, or a colour render
target (render-target usage of a pixel format with no depth or stencil), which takes an index
exactly where it does (Refusal::TextureIndex), at every maker: new_texture and the heap, buffer
and Managed makers, views, drawables and surface planes. A depth or stencil target made for
neither is unchanged.
- A colour render target not read takes what a shader-read one takes for attachment reads: the
sampled usage, and the feedback usage where the image format query offers both beside its
usage; the shadow on a device without the loop; neither where the query refuses them, and its
draws that read it stay Gap::Draw. Its home stays the attachment layout, so a pass that does
not read it records no move of it, and a fetching pass moves it home, feedback, home with the
existing move code.
- Only its second element is written: its sampled-texture element stays the null one, so a slot
that binds it reads nil as before. place_texture takes the view its second element names in
place of a flag.
- A linear image in place over a buffer takes no sampled usage for a target shaders do not read.
- The in-tree consumers take the rule: the replay player's texture class, the harness's and the
conformance suite's rt side. rt's own tests make their unindexed colour targets with
new_texture_for_views, and give indices where a test needs new_texture's path.
- docs/RESOURCE-ID.md, the runtime README and Refusal::TextureIndex's doc say the rule; docs/REFUSALS.md is regenerated.
Also rides along, from the planner, in the README's known gaps of memory blocks: a block freed
before a submission used it waits on the block-maker thread for its bind, and a ring take that
needs a new ring block can wait behind it.
Verified: see the check job named in the landing.
A lock-budget test on a node that names no M2V_LOCK_EVENT returned early and passed, printing a
LOCKS-UNMEASURED line the matrix's filter dropped with the rest of a passing test's output. The
gem10 and um870 legs passed that way at 1ae9003019 while every leg that counted failed, and the
report could not tell them apart.
Each budget test now names its record (Locks::open takes its key) and prints, where it counts
nothing, 'LOCKS <test>: not counted, the node names no M2V_LOCK_EVENT' and
'M2V-MATRIX uncounted lock_budget/<key>'. The matrix keeps that line as it keeps a record
(KEEP matches 'M2V-MATRIX '), results.parse_suite collects it, leg_entry stores the leg's keys
(results.leg_uncounted), and the leg's verdict line ends in 'not counted: <keys>'. No node
setting changes.
Verified: scripts/matrix's unittest suite, 87 tests, OK locally, with the new
UncountedTests case (a passing test's line through matrix.KEEP, parse_job and verdict_line).
Where a device lists VK_EXT_border_color_swizzle and reports borderColorSwizzleFromImage, device
creation enables the extension with both its features: borderColorSwizzle, which Vulkan requires
of every device that lists the extension, and borderColorSwizzleFromImage. Elsewhere neither is
enabled. Sampler creation is the same form on every device. No sampler chains
VkSamplerBorderColorComponentMappingCreateInfoEXT on any device: a sampler in the arrays meets
every view, and that structure names one mapping. So the struct is left off everywhere, and
VUID-VkSamplerBorderColorComponentMappingCreateInfoEXT-borderColorSwizzle-06437 cannot fire. With
the feature, an opaque-black border sampled through a view whose component mapping is not the
identity reads through that mapping, as Metal's border reads through the swizzle. Without it,
Vulkan leaves that texel undefined; the NVIDIA driver reads (0, 0, 0, 1).
A new static note, PrecisionNote::SwizzledOpaqueBlackBorder, records that difference, decided on
every device by the sampler alone:
- SamplerState::precision_note is Some for a descriptor whose address mode reads the border
(ClampToZero or ClampToBorderColor) with an opaque-black colour (SamplerDescriptor::shape's
opaque_black_border).
- A compute or render pipeline carries it among its precision_notes where a function samples
through a constexpr sampler of such a border. That is decided by the constexpr sampler's own
constants, through the device sampler the translator states for it
(CombinedSampler::constexpr_sampler).
- The conformance rt side collects the sampler state's note with the others.
The rt README records the known gap and the feature table. docs/API.md has the catalogue entry.
The translator's cache appends the variant (ARTIFACT_FORMAT_VERSION 553 -> 554). Validation
derives no tolerance from the note (Allowance::Unbounded).
The old runtime's degradation.rs gains a notes entry, because Degradation::from_precision_note
matches every PrecisionNote. DeviceDepthBias did the same. The old runtime announces nothing new.
Census, GPU-free, over the 31 kept replay streams:
- 0 sampler states read an opaque-black border.
- 0 of 4609 constexpr samplers do, over the 12213 functions of their 322 distinct libraries.
12 functions did not decode under the standard budget and are not counted.
docs/CONFORMANCE-COVERAGE.md derives each case module's tolerances from the Allowance::new calls
in its own text, so the helper in texture_query.rs left the four heap modules reading 'every
field' while they loosen both numbers of every answer on the new runtime. Each module now names
the allowance itself (the same path, loosening and justification); texture_query keeps the entry's
slug, DEVICE_OWN_SIZES, with the rule in its doc. The document is regenerated: the four heap
modules, pass_sequence_actions and astc_textures each read one more tolerance, 26 in all.
metal2vulkan-rt answers heapTextureSizeAndAlignWithDescriptor: with the device's own image
requirements, raised to bufferImageGranularity (its README's heaps), so on the Iris Xe 588 sites
of the heap families read divergent against Metal's numbers. They are not a bug and not ranked
against the old runtime: a consumer places by this device's answers.
So on the new runtime's run the cases stop comparing the two numbers with Metal's and the side
holds each answer to what a consumer places by, before answering it (rt_side/heap_sizes.rs):
1. the alignment is a power of two, for every query;
2. for a Private query, a heap of align + size bytes takes the texture at offset align;
3. there, level 0's first slice written from a buffer at Metal's layout of the level reads back
unchanged.
A Shared, Managed or Memoryless query is held to step 1 alone: rt places heap textures in Private
blocks only, and placing the descriptor in a Private heap would answer another query. A
descriptor whose bytes rt does not move, which its copy answers Gap::TextureBytes (depth and
stencil both, multisample) or Gap::FloatDepthUpload (Depth32Float) for, is held to steps 1 and 2.
A failed step answers its failure, so the site still diverges (Err where Metal answered).
The cases (texture-pairs, heap-sizes, format-footprints, ycbcr-two-plane-format-descriptors)
name an rt-only allowance per query at case/<query>/size-and-align/Ok/*, Unchecked, justified by
a new docs/API.md section 10 entry, "The new runtime's heap texture size and alignment are the
device's own", worded as rt's README words it and naming the three steps. The old runtime's run
compares exactly, as before. A refusal still diverges: the allowance is under Ok.
Tests: every recorded heap answer (18 recordings, 2425 answers) has both numbers under that
allowance and its refusal site under none; every NewRuntimeAccepted slug a case names is a
section 10 entry (the existing check now covers rt-only slugs too).
On the new runtime a linear (_LDR) ASTC texture whose block the device holds is read through the
device's decode, the static note compressed-texel-decode (Texture::precision_note). The case
named only decoded-texel-precision for its linear forms' texels, the old runtime's emulated
decode, so on the Iris Xe its fourteen linear footprints' texels were unlisted rows, up to 0.00049
off Metal's value. The case now loosens each round's texels on the new runtime's run by the
catalogue's bound for that note, 1/2048 plus the float rounding of both values, justified by the
note alone (rt-only; the old runtime's run is unchanged). The catalogue entry states the ASTC
bound and where it was measured (ANV, Mesa 26.2.6, Iris Xe of Raptor Lake-P, fourteen
footprints): 0.00049 is under 1/2048 (0.000488...) only with the rounding allowance, so the
figure is stated with it. sRGB and HDR forms still compare exactly.
A fetch from a target made for shader writes and from one of unknown usage answers as the fetch
from a target made for shader reads, on both runtimes: the same three texel sites a code apart,
with the same counts on each card. Each ledger takes the read case's rows for its venues, reason
text unchanged (the device's conversion into an 8-bit unorm attachment it also fetches). The
coverage document counts the twelve rows the old runtime's ledger gains.
Verified: see the check job named in the landing.
Regenerated by the coverage tool at the cases' commit with their recordings: two more committed
recordings, fetch_ordered's six cases, and the case lists of the items they drive.
Verified: m3-max-56114 (msi) regenerated it, then conformance-host 1090 of 1090 passed, the
coverage document test among them; clippy of the conformance crate 0.
A two-copy stream's Managed buffer has a CPU copy, which Metal's contents answers, and a device
copy, which commands read. The player's check and dump read the CPU copy (Backend::read on the new
runtime), and nothing said so: on a discrete card, two plays' dumps of #106455 agreed as CPU copies
while the device copies the kernel read differed (count word 1848 against 12), and the verdict
'inputs equal' rested on them.
Now a check line of such a buffer ends '(CPU copy)' or '(device copy, read back)', a dump holds
cbC-objO.copy with those words, and compare-dumps compares only the same copy of both plays,
reporting 'copies differ' otherwise and counting the buffers compared as CPU copies and as device
copies in its summary. The new runtime's play reads the device copy with --read-device-copies yes:
through a blit into a Shared buffer of the play's own where the runtime keeps one, through the
buffer's mapping where the device's one copy is the GPU's and the player keeps the CPU's. On a
device that keeps a device copy, the report's 'managed digests' line after its device line says
which copy the play reads. Backend::read_copy names it; the old runtime's backend names none.
Tests: a_read_of_a_buffer_with_two_copies_says_which_copy_it_took (no device: both labels in the
check lines and dumps, the compare of like and unlike copies) and, on a device,
a_check_of_a_managed_buffer_names_the_copy_it_read (a blit's fill reaches the device copy: the CPU
copy reads zeros, the device copy read back reads 7s; the header line where the device keeps a
device copy). docs/REPLAY-STREAM.md section 10 says it.
pass_sequence_actions crosses a store with the next pass's load over a single-sampled attachment;
this case asks the crossing it leaves open: whether the samples
MTLStoreActionStoreAndMultisampleResolve keeps are the samples the next pass loads. Each cell
runs two passes over an 8 by 8 RGBA16Float attachment of four samples: pass A clears it and draws
into each 2 by 2 cell under a sample mask of the cell's index, then stores and resolves into
resolve A (or, in the control cell, only stores); pass B loads it, draws into cell 0 under a
mask of its own and stores and resolves into resolve B. A kernel reads every sample after pass
B, and blits read resolve A and resolve B. The sample mask, not the device's sample positions,
decides which samples a draw writes, and every value is exact in half. A side that resolved in
the pass and dropped the samples answers every resolve right and every later load wrong.
Recorded on the M3 Max, macOS 27.0.1 (26A434), by `conformance record` in job m3-max-55692,
eight runs alike, and timed there by `conformance times --runs 8 --write`. Named among the cases
after the last cost run. CONFORMANCE-COVERAGE.md regenerated (job m3-max-55697: the conformance
crate's clippy clean and its host suite 1090 of 1090).
The executed counters take the runtime's commit_lock_wait_nanos, so a frame's line gives its
commits' waits for the work lock, summed; the backend's lines give commit_lock_wait_max_nanos,
the longest wait in the play, which is a maximum and no frame's counter. The runtime has no
product metric of the other calls' waits for the lock (the surface make's included): only the
device tests' per-thread total times those (crate::submit::waits).
Read with it (player built at this change's first form, 307b1998f9, job m3-max-55631; no
validation layer; the player commits from one thread, so these say only that the runtime's own
threads, submit, completion and block maker, hold no caller long):
- syncview-4k-780m, whole (1501 frames), Radeon 780M (RADV), job m3-max-55670: 0.609 ms of waits
over 8066.2 ms of frames (0.008%), the mean frame's share 0.007%, the worst frame's 0.301%
(0.022 of 7.436 ms), the longest wait 23.3 us, no frame's waits past 1 ms;
- glbench-3090-r2 to frame 300 (301 frames), lavapipe, job m3-max-55669: 3.680 ms over
39383.2 ms (0.009%), the mean frame's share 0.007%, the worst frame's 0.431% (0.015 of
3.370 ms), the longest wait 1.367 ms, in the one frame whose waits passed 1 ms (1786.6 ms long).
Verified: see the check job named in the landing.
A checked access (an access of a slot the identity domains check, at an offset the module does
not hold as a constant) emitted the normative check whole: m + before, len >= n, len - n, a
compare and an and, five instructions (25 words) per access. Two of them depend only on the
slot and the access size. The check is now at = m + before; at < limit, two instructions (10
words), under the slot's limit for n-byte accesses, psb::limit: len - min(len, n - 1), an
OpExtInst UMin and an OpISub (12 words; the length itself for 1-byte accesses), made once per
slot and size. EmitCx::slot_limit makes it in the function's first block where the bounds are
split there (load_push_fields), through FunctionBuilder::in_entry_block, which appends to the
entry block before its terminator, so every checked access of that size in the function
recalls it; elsewhere it is made in the open block. Both check sites (emit::prepare and the
pulled fetch's address_read) take it.
Exact: where len >= n the limit is len - n + 1, and at < len - n + 1 is at <= len - n; below
that the limit is 0, which no offset is under. len is at most 2^31, so nothing wraps.
Tests: psb::tests::an_offset_under_the_limit_is_one_the_normative_check_admits runs the form on
the interpreter harness (offsets around the buffer's ends and near 2^32, n 1, 2, 4, 16, both
widths, buffers of 0 to 64 bytes) against contain::in_bounds;
engine_identity_contain::a_checked_slots_limit_is_made_once_per_size_in_the_first_block reads
the contain kernel's module on every identity profile: two limits in the first block, three
compares under them.
Docs: docs/API.md section 5 and PushField::SlotBounds say how the check is computed.
SEMANTICS_VERSION 2197 (every checked module changes); ARTIFACT_FORMAT_VERSION 553 with it.
python3 scripts/conformance-coverage/coverage.py at ddf7a8ccd2 (job
m3-max-55493 on msi, which then ran the conformance crate's suite on
lavapipe against this document: 1087 tests run, 1087 passed; clippy
-D warnings and rustdoc -D warnings of the crate clean). One more case
module and recording, one more module that loosens a measured value (the
long-of-infinity elements).
The planner's ruling: MSL 8.6 promises round toward zero and NaN to 0 and
nothing past the range, so the translator keeps saturating, the case keeps
every past-range row compared, and declares the long-of-infinity pair under
docs/API.md's row.
The row (the plain-fptosi line this lane added) now says what it covers: a
float past an integer's range converts to the nearest bound, Metal on the
M3 Max answering the same at every width but long, whose two infinities it
converts to 0 (job m3-max-55436), and the plain LLVM cast is the device's
own. Its lead-in moved, so its slug is new; nothing else names it.
The case loosens exactly those elements: at each of the four long-of-float
and four long-of-half sites, the bytes of input 14 (+inf) and 15 (-inf),
each to any of 0 and its bound (AnyOf), justified by that entry. A test
holds the two inputs to be the infinities and the entry to be in the
document.
The translator lowers LLVM's plain fptosi/fptoui to a bare OpConvertFToS or
OpConvertFToU, whose answer for a NaN or an out-of-range value SPIR-V
leaves undefined, while MSL 8.6 sends a NaN to 0. No accepted difference
said so.
Metal's compiler never emits the plain cast: probe job m3-max-55309 compiled
int(), uint(), static_cast and two-lane vector casts of float and half in a
kernel and in fragment functions, with fast math on and off, and every one
is an air.convert call (which the translator saturates). Over the indexed
corpus (29446 modules, job m3-max-55344) and the replay streams on every
node that holds them (jobs m3-max-55344, 55346, 55348, 55349, 55350, 55351)
no function holds a plain fptosi or fptoui; the same walk counting
air.convert float-to-integer calls finds 35606 in the corpus and 19840 in
the M3's streams (job m3-max-55356), so the scan reads real IR.
So the plain cast stays the device's conversion, stated in docs/API.md's
accepted differences under Conversions.
Metal's domain for a buffer argument is the buffer: an access before the bind offset reads the
buffer's bytes there. The containment check measured the offset from the bind offset against
the bytes from there to the buffer's end, so a checked access before the bind offset read zero
and a store there did nothing, where Metal reads and writes the buffer.
- PushField::SlotRemaining (u32) becomes PushField::SlotBounds (uvec2): the buffer's bytes
before the bind offset (the bind offset), then its length; a set*Bytes copy 0 and its length;
nil 0 and 0. The check is psb::in_buffer: (len >= n) && (m + before <= len - n) in u32, m the
offset from the bind offset read as signed. Before the buffer's start the sum wraps to at least
2^31, past every length (no buffer is longer than 2 GiB). One add more per checked access and
one more pushed u32 per checked slot.
- Offsets are signed on every identity form: the word-below form (psb::prepare_at, also the
pulled fetch's) now sign-extends the offset instead of reading it from the slot's window start,
as the direct form already did through its 2^31 bias.
- The new runtime's encoders push the bounds (encoder::bounds, Tables::bounds); the old runtime's
binder writes them from the bound buffer and still refuses ZeroAddress.
- The old runtime's lowering is unchanged; SEMANTICS_VERSION 2195.
Tests: engine_identity_domain (new, interpreter): on both identity forms a run-time -4 at bind
offset 16 reads the word at 12 and at bind offset 0 reads zero, a constant -4 at bind offset 16
reads the word at 12, and the default domains read the word at 12 as docs/API.md says.
engine_identity_contain adds an access before the bind offset (inside the buffer: read and
written) and one before the buffer's start (outside). The identity tests push the bounds.
Docs: API.md sections 1 and 5 and the new runtime's README state the domain and the cost.
On the floor a fragment function's push fields started at the vertex function's push end rounded
up to 8. Where that end is a multiple of 4 and not of 8, the four bytes below the base went
unused, and a fetching fragment function placed its four-byte element index
(PushField::FetchedColor) after its eight-byte fields: a pair that fits the floor's 256 bytes
with those four bytes used was pushed past them. The fragment base is now the vertex function's
push end, and FetchedColor sorts after SlotBindOffset and before the slot addresses
(SlotGuestBase): a fragment function that pushes no parameter block's address places it in those
four bytes. Each field is still placed at the next offset aligned to it, so a fragment function
whose first field is eight bytes, the spilled block's address included, starts where it did, and
the vertex function's window still ends at 248. The fixed windows read no base: the old runtime's
modules are unchanged.
The docs that stated the rounding say the base is the vertex function's end: the push module,
VERTEX_FLOOR_END, LoweringInputs::push_base, docs/API.md section 5, rt's README, and the render
identity test's notes; the spill test reads the base unrounded (its vertex function ends at 248).
A surface plane whose texture is a shader-read render target takes the feedback
usage where the handle's image format query offers it with the export features
alike (Query::plane; a D3D11 import's query the same), and the in-place make
retries without it where the images with it do not hold the layout; a plane
without it reads through its shadow, the counted copy. The fetch and the texture
read choose the loop or the shadow by the image, not the device.
Metrics::attachment_loop_reads counts every draw that reads an attachment of its
own pass through the loop. Device tests (tests/fetch.rs): N fetching draws exact,
N-1 barriers or copies more than one; a surface plane of each fetched format.
RenderPipelineKind::FramebufferFetch removed. SEMANTICS_VERSION 2193,
ARTIFACT_FORMAT_VERSION 550 (PushField::FetchedColor). REFUSALS.md and
api_signatures regenerated; README and API.md.
Draft: the old render key re-pin follows the compile check.
docs/REFUSALS.md and the API signature table regenerated for the resolve
items (m3-max-54897's REGEN and BLESS). Refusal::ResolveFormat's basis named a
device the cluster has no record of; it now cites what metal2vulkan-runtime's
RenderPassProblem::ResolveFormat records: Metal's validation assert for an
integer resolve target. The color resolve test's target took SHADER_READ,
which a texture made without an index refuses (lavapipe, m3-max-54897); a
resolve target needs RENDER_TARGET alone.
Verified: see the check job named in the landing.
A store action that resolves (MultisampleResolve, StoreAndMultisampleResolve, and
Unknown where the attachment names a resolve texture) resolves in the same rendering:
the attachment's VkRenderingAttachmentInfo names a view of the resolve texture's
resolveLevel and resolveSlice and a resolve mode, so the pass adds no pass, copy or
barrier of its own. Color resolves by AVERAGE, the mode Vulkan requires of a float,
normalized or sRGB format, under the new static note PrecisionNote::DeviceRoundedResolve
(RenderPassDescriptor::precision_note) on every device. Depth resolves by its
MultisampleDepthResolveFilter: Sample0 always, Min and Max where the device's
supportedDepthResolveModes has them; stencil by Sample0. Refused as Metal refuses them:
a resolving action with no resolve texture (Refusal::ResolveTexture) and an integer
format's resolve (Refusal::ResolveFormat). Gaps: RenderPassKind::Resolve (another
format, one sample, an emulated encoding, two depth-stencil views), ResolveFilter
(a mode the device lacks, DepthResolvedSample, an unpaired aspect) and LateStore (a
later store that does not resolve an attachment that began resolving).
The old runtime maps the new note to its device-rounded-resolve degradation; the
validation allowance, the conformance suite's rt side and the replay player carry the
resolve fields and filters.
Evidence, draw_full_4x: 64 full-screen draws in one pass into a 4-sample RGBA16Float
target, resolved as the pass ends (MultisampleResolve) into the 1-sample texture the row
checks texel by texel against the draw colour before its timed runs. Each arm records, a
run, 64 draws, 1 pass, 1 barrier and no copy: new's Metrics::resolves 1; old's 1 render
pass instance, 1 vkCmdBeginRenderPass, 64 draws, 1 barrier, no image copy or blit
(m3-max-55061). GPU p50 in us, old,new then new,old, one harness build each:
780M new 259.0/258.7 against old 1933.6/1827.4, new is 86% faster; RX 550 new
1643.5/1643.8 against old 7207.8/7209.3, new is 77% faster (harness at 1ff6574894,
m3-max-55050, 55061); RTX 3090 new 170.0/171.0 against old 188.7/190.0, new is 10%
faster; Iris Xe new 1006.4/1007.7 against old 1022.1/1019.8, new is 1.4% faster
(harness at 5af66e2c4e, m3-max-54928, 54938, 54939). Why old is slower on AMD is not
traced.
Verified: see the check job named in the landing.
The new runtime takes no form of the SPI newTiledTextureWithDescriptor:offset:bytesPerRow:, and the
player made an ordinary texture in its place whose texels were not the program's: on lavapipe the
two runtimes' plays of one stream first parted at the frame whose draws first read such a
texture. Those texels now come from the buffer, as the old runtime gives them.
What the old runtime does, read from its code:
- crates/metal2vulkan-runtime/src/buffer_texture.rs:534-591 (Buffer::new_tiled_texture) and
shadow.rs:228-250 (the module's "Copies taken at use"): a texture of more than one level is one
image of its own. The first command of an encoder that uses any of its levels after the making
(or after did_modify_data, or a replace_region of the first level) takes the copy, before that
command and inside its command buffer. The take copies every texel of the first level from the
buffer at the offset, rows bytesPerRow apart, then makes each later level from the first as
generate_mipmaps makes it. It reads no level past the first from the buffer.
- shadow.rs:386 (LevelsCopy) and :404 (LaterLevels): the later levels come from generate_mipmaps'
plan for the format (the device's blit chain, the compute filter, or the integer picks). For a
format that generate_mipmaps leaves as it is or refuses, they are kept.
- buffer_texture.rs:537-538: a texture of one level is the texture over the buffer that
new_texture makes.
The stand-in, through the runtime's public API only:
- An ordinary texture of the descriptor.
- At the first use since its making, the take is owed to that use's command buffer. A use is an
encoder's command or a render pass's attachment naming the texture or a view of it, skipped
encoders included.
- The take runs as one blit encoder (copy_from_buffer into level 0, then generate_mipmaps) in a
command buffer of the play's own. It is committed on that command buffer's queue, after its
copies from the guest's RAM and just before it, so it reads the bytes as they are when that
command buffer runs. A format the runtime refuses mipmaps of (MipmapFormat, MipmapFilter)
keeps its later levels.
- Counted apart from the stream's work: tiled_textures, tiled_takes, tiled_take_bytes,
tiled_mipmap_generations, tiled_levels_kept, and tiled_gpu_nanos (its GPU time, in no frame's
gpu_busy, as the guest RAM's copies are). The report has a "tiled textures over a buffer" line.
- A tiled texture of one level plays as the public texture over the buffer.
- A replaceRegion of a tiled texture's first level is refused. On the old runtime it writes the
bytes and owes another take; no stream played here has one.
Where it differs from the old runtime: the take runs ahead of the whole command buffer, not just
ahead of the using encoder, so what an earlier encoder of that command buffer writes into the
bytes or the texture lands after it.
The tiled kind leaves the substitutes: substituted_tiled_textures is gone. The "substitutes read"
line now counts gap substitutes alone.
Tested by:
- rt_replay::a_tiled_texture_takes_its_buffer_s_bytes_and_levels_at_first_use (lavapipe, both
runtimes): a 128x2 two-level tiled texture whose 2x2 squares hold one colour each. Blits of both
levels read the buffer's texels and the squares' colours, with equal digests on both runtimes
and one take counted.
- The unit test of the substitute lines, now gaps alone.
The planner's ruling on the replay matrix's rule (c): besides a first parting draw traced to a
function that carries a static precision note, one traced to a counted player substitute (an
ordinary texture the play makes in place of one the runtime cannot make, whose texels are not the
program's) is accepted with its size printed, and its row says where the replay substitutes what.
Docs only.
A digest play that checks a present (--check-presents) now also keeps the shown texture's bytes
as presents/frame-F.bytes in its --out directory, with a `shown ID frame F format P width W
height H` line from the backend's shape of the texture (Backend::texture_shape, old and new
runtime). compare-plays, with no --frame, prints for each frame whose digests differ and whose
bytes both plays kept the texels that differ and their share, the largest difference of each
channel in the format's units (8-bit unorm, 10:10:10:2 and half-float layouts; bytes for
another), and the box the differing texels lie in. The bytes stay on the host that played them.
Each frame's end line gains unix_nanos, the system's clock at the frame's end, so a job wrapper's
own timestamped device samples can be set beside the presents.
REPLAY-STREAM.md gains both, and the planner's two rules: a picture difference at the judged
frame is accepted only when sized and its first parting draw is traced to a function with a
static precision note and no state difference; an NVIDIA time row bins presents by the covering
clock sample's state, at least 30 an arm, else "not comparable by time" with the counts.
Tests: replay::tests::a_kept_present_writes_the_shown_texture_s_bytes_and_each_end_its_time,
a_picture_difference_is_sized_by_texels_channels_and_box,
two_plays_kept_pictures_that_differ_are_sized.
Under the identity domains a vertex or fragment function whose push fields passed its share of
the floor's one 256-byte range was refused (Unsupported{IdentityDomains} needing
maxPushConstantsSize). Once containment added each checked slot's length (SlotRemaining) and the
zero range's address (ZeroAddress), pairs reached 272 bytes and were refused: 3 render states of
windrag-780m-b2 (223 draws) and 4 of syncview (259 draws), and the guest's GL-layer pipelines on
reims's walks. A render function now spills as a kernel does: it pushes its parameter block's
address first (PushField::ArgumentTableAddress) and reads every field past its window from the
block, each loaded once, in the function's first block (EmitCx::load_push_fields). The refusal and
its REFUSALS.md row are gone.
- Order: the check's fields are last in the derived Ord of PushField, after
TessellationFactorAddress (ZeroAddress, then each SlotRemaining), so what every access reads is
placed ahead of what only a checked access reads, and the check's fields are the first to move
to the block. The codec's list is unchanged.
- The vertex function's floor window is [0, 248) (push::VERTEX_FLOOR_END). A vertex function is
lowered without knowing its fragment function, and a fragment function that spills pushes its
block's address (8 bytes, 8-aligned) from the vertex function's end, so the vertex function
leaves that room. Cost: only a vertex function whose own fields pass 248 bytes spills where it
used to fill the last 8.
- metal2vulkan-rt: Draws holds each field's place (the push range or its function's block) and
each function's block (length, the push offset of its address). A draw that fills its pushed
values anew writes each block into the parameter ring and its address into the range;
ring_writes counts it. A block longer than a ring chunk stays Gap::RenderPipeline(DrawInput).
- SEMANTICS_VERSION 2194 (placement changed).
Tests: push.rs's edges (a vertex function ending at 248 with a spilling fragment function, whose
address goes at 248; a fragment base of 244, whose address is still at 248; a vertex function
whose fields would reach 252, which spills); engine_identity_spill: a vertex function of 25 slots
pushes its block's address first and every slot's address, spills only the check's fields, passes
L3, and loads each spilled field once in its first block; the pair with a fragment function from
248 compiles and validates on every identity profile; on the interpreter its sums are Metal's, and
lengths pushed one word short, in the window and in the block alike, read zero.
Docs: push.rs's module text, docs/API.md (section 1) and the rt README state the shares, the 248
and its reason, and the spill.
docs/API.md: the policy's identity-domain text and section 5 state SlotRemaining and
ZeroAddress, the normative check in u32, what an outside load, store and atomic do, that an
offset before the bind offset is outside, and what stays unchecked (constant offsets, pointers
loaded from memory or made from integers). The rt README's known gaps say the same for buffer
arguments, the nil buffer's length 0, and the pulled fetches.
A check of a Private texture (a stream's m2v.check, or the shown texture of a present that
--check-presents lists) read it with getBytes, which the runtime refuses for a Private texture as
Metal does, so a digest play on the new runtime stopped at the first listed present whose texture
is Private ("the CPU reaches no Private or Memoryless texture"; syncview plays on Iris and the
3090 stopped at frame 296). The old runtime's play reads every texture through a blit. The new
runtime's now copies a Private texture's first level into a Shared block on its read queue, as it
reads a Private buffer, and waits for it; a texture the CPU reaches keeps getBytes.
Test: rt_replay::a_private_shown_texture_is_checked_through_a_copy clears a Private 4x4 RGBA8
texture to red, shows it at present 0 and lists that present; the check's sha256 is the 16 red
texels'.
Under RADV (Mesa 26.2.6) an RX 7900 XTX's memory allocated with
VK_MEMORY_ALLOCATE_ZERO_INITIALIZE_BIT_EXT read earlier processes' bytes, so the
form's zeros are not the zeros Metal's newBufferWithLength:options: and a new texture
owe. Metal says a new buffer is zeroed; the runtime now writes those zeros itself on
every device, with no per-device exception and no start check.
The extension leaves the optional list; its feature, the allocation flag and the
zero-initialized image layout go, with Capabilities::zero_initialize_memory,
Features::zero_initialize and ZeroInitializeDeviceMemoryFeatures. BlockInfo::zeroed
and the zeroed-take and zeroed-texture metrics lose their source and go. A placed
texture is cleared in its upload on every device (texture_clears); the harness zeroes
every buffer through new_buffer's zero_from; the player's judged zeroed-texture
metrics are the clears alone. The rt README records why the extension is unused.
Verified: see the check job named in the landing.
Recorded on the M3 Max, macOS 27.0.1 (26A434), by `conformance record` in job m3-max-54229, three
runs each. Metal's side makes the same surface for these cases as for the VA-API ones, and each
recording's outcomes equal its VA-API twin's. CONFORMANCE-COVERAGE.md regenerated.
The surface make now submits and waits for nothing (9c4eca8313): each in-place plane image leaves
the undefined layout in the runtime's next submission, a move that may discard the memory's bytes,
and the consumer calls Surface::wait_until_ready before the other API's first write. The player's
rt arm made video surfaces without that wait, so its plays of a video recording did not do what the
product does between a surface's make and its first picture. It now waits once at the make (the
earliest the player knows the surface's format and size), before any m2v.externalWriteDone
acquires it, and the report's executed counters carry the runtime's surface_waits.
docs/REPLAY-STREAM.md section 10 says so.
Test: runtime_lane::rt_replay::a_video_surface_is_waited_for_at_its_ready_point_once (Unix: one
surface for two plane textures, two acquires, surface_waits equal to the surfaces made in place).
Recorded and timed on the M3 in job m3-max-54332 at 0cd13ee9f9 (record, then times --runs 8
--write, both legs, 8 rounds; Metal's validation ran the case). The coverage document is
regenerated.
A timing verdict between two plays (compare-plays) needs equal digests at the judged frame, and a
stream without m2v.check records (the desktop-and-video recording has none) gave no frame a
verdict. command-replay play --check-presents F,... now checks, at the m2v.present of each listed
frame, the texture the present shows, as an m2v.check of it with no recorded checksum would: a
check line of that frame, which compare-plays reads as the frame's digest. A present of nil
checks nothing. The readback is the player's own work (uncounted) and its time is the frame's
read, so the digests come from a play apart from the timed ones; docs/REPLAY-STREAM.md says so
in the player's section and in the verdict rule.
Test: replay::tests::a_listed_present_checks_the_shown_texture (no checks unlisted; checks at
frames 1 and 3 of the listed 1, 2, 3, frame 2's present being nil; the line's digest is the
backend's bytes; every present still ends its frame).
docs/REPLAY-STREAM.md section 10 now says how the new runtime's backend plays a buffer made as a
video surface's pages (one surface through Device::new_exported_surface, its plane textures' views,
the acquire at m2v.externalWriteDone, no shapes or refills), what --video-handle picks (dma-buf with
the VA-API layout, opaque-fd with NVIDIA's), what the video-surfaces report line and the video_*
counters count, and how the old runtime's backend plays the same buffer; section 4's table says the
same for the two records. Docs only.
Metal on the M3 Max (macOS 27.0.1, job m3-max-53825, three runs, one
outcome) answers metal2vulkan_devtools::threadgroup_start::answer in each
of the six dispatches: no word of the declared array or of the
[[threadgroup(0)]] region read nonzero before the program wrote it, in
the later threadgroups of 2048 of 16 KiB and in the second dispatch;
every pattern read back (0xffa00000); its SIMD groups of 32 in thread
order. docs/API.md states that answer, the engine fixtures' README lists
tgz_reads, and CONFORMANCE-COVERAGE.md is regenerated.
On the new runtime's profile every Workgroup variable that holds a
function's threadgroup memory has a null initializer: the threadgroup
arena (declared threadgroup variables, [[threadgroup(n)]] regions and the
imageblock, memory::arena) and the typed threadgroup objects
(lower::access::local). One form on every device: the Vulkan 1.3 floor
requires shaderZeroInitializeWorkgroupMemory; a profile without it
refuses such a function, Unsupported{ZeroedThreadgroupMemory}.
Device::new's profile is unchanged (ProfileFacts::ROWS keeps
ThreadgroupStart::Unwritten), so the old runtime's SPIR-V is too.
The translator's own Workgroup words get none, as it writes each before
any read: the emulated SIMD-group scratch and vote word, the object
stage's mesh grid, the mesh wrapper's count and staged indices, the
emulated payload and the binder's scan and merge kernels.
The builder refused a null of an array whose length is a specialization
operation (spirv/ir/constant.rs, ConstRule::NullType); an arena with
regions, and the emulated scratch, have such lengths. spirv-val's
IsTypeNullable reads an array's element type alone, so the builder now
takes it. That refusal is what made rt report a probe's emulated variant
as missing (Gap::PartialSimdgroups after Later::lower's Refused).
The profile verifier also refuses a Workgroup initializer other than a
null (VUID-StandaloneSpirv-OpVariable-04734).
docs/API.md states the form with Metal's words on threadgroup memory;
SEMANTICS_VERSION 2192; REFUSALS.md and api_signatures regenerated.
Tests: engine_zeroed_threadgroup (null initializers through from_queries
on four profiles, zeros on the interpreter in both orders and two
threadgroups, the emulated variant's arena zeroed and scratch not,
Device::new uninitialized, the vk12 floor refused),
a_specialization_sized_array_has_a_null, a_workgroup_initializer_is_only_a_null,
the profile facts' fingerprint.
Metal's contract for a Managed buffer (MTLBuffer.h, didModifyRange:): a CPU write makes the range
undefined for the GPU until a didModifyRange: and a commit of the command buffer that reads it,
and it does not reach a command buffer committed before. The capture ring met that by copying
the bytes on the committing thread into 64 MiB of Shared staging, and the commit then waited for
the GPU whenever the ring was full. One recording on an RTX 3090 waited 258 times for 6.7 s
(m3-max-53409). The ring also kept a Managed buffer over an imported dma-buf, a block the runtime
does not map, refused (Refusal::ManagedBlockNotShared). On the XTX that refusal bound nil 2,804
times, and 28.8 million draws were then refused.
The planner ruled one form. The commit records the copy-in into a command buffer of its own:
vkCmdCopyBuffer of each named range from the consumer's block into the device copy, ahead of the
command buffer's commands in its submission, after the copies back owed to textures over the
ranges and before the copies into them. Vulkan's host write ordering guarantee makes the
consumer's writes made before the submission visible to the copies. The copy reads the bytes as
it runs, so a write after the commit may reach it, which Metal leaves undefined. The copy-in
holds each consumer's block and device copy until the command buffer retires.
What goes with the ring:
- capture.rs keeps the named ranges and the copy-in, and loses the ring, Chunk, Overflowed and
the staging blocks of its own;
- submit.rs loses the commits' turn (capture now records under the work lock), the streams of
ring-fulls, the waits and the ring's spans;
- the counters lose capture_waits, capture_streams, capture_overflows, capture_overflow_bytes,
capture_copy_nanos, capture_wait_nanos, Gauges::capture_bytes and the capture ring's site, and
managed_bytes_captured counts the bytes the copies take;
- the player's report and the API table lose the same fields.
A Managed buffer's bytes may be in any Shared block, mapped or not: contents is None over an
import. A Private block is refused as Refusal::ManagedBlockPrivate, since a Managed buffer has a
CPU-side copy ("the data pointer of this buffer's shared copy", MTLBuffer.h) and a Private block
has no pages the consumer can write. docs/REFUSALS.md is regenerated. The rt README's memory
contract says when the copy runs, and its known gap of the ring's waits goes.
Tests:
- the snapshot tests now hold the header's contract: write, didModifyRange:, commit, and that
command buffer reads the bytes, here also behind an event wait with the consumer's handles
gone before it runs. Nothing is asserted of a write under a pending command buffer;
- the ring's tests go;
- a range of three 16 MiB units arrives whole at one commit, with no staging and no allocation;
- a Managed buffer over an imported, unmapped dma-buf (Shared, contents None) reads what the
consumer wrote through its own mapping, on a two-copy card and on a unified one;
- a Managed buffer over a Private block is refused;
- the first named range allocates nothing at any site;
- the commit's lock-wait test marks the start of its count with a test-only flag, where it read
the turn.
Verified: see the check job named in the landing.
A render pipeline record without the tessellation key comes from a recorder
that did not carry it (glbench-3090-r2, glbench-3090-r3 and glbench-780m-r1
hold 19 post-tessellation records, none with the key; the newer recorders
write the key on every record, the defaults included), so the program's
tessellation state there is unknown and the player draws with Metal's
defaults in its place. The new runtime's backend marks each such state at its
making, carries the mark to the encoder at setRenderPipelineState:, and counts
the patch draws it plays through one: patch_draws_unrecorded_tessellation in
each frame line and the total, and a report line saying the state is unknown.
A released state drops its mark. REPLAY-STREAM.md says a record without the
key does not hold the program's state.
Test: a_record_without_the_tessellation_key_is_unrecorded (the key check and
the line). Checked by a potluck check job on msi (clippy in three
configurations and the touched tests).
A frame's `end` line gave only `gpu_busy`, the union of the GPU intervals of the command buffers
the frame waited for, so no report could say how long one submission ran: a frame of 1871 commits
with 12.7 s of GPU time could be one long command buffer or many short ones.
The player now keeps, beside the union, the longest single interval among those it already reads
(`Backend::gpu_interval`, the runtime's completion record) and that command buffer's stream id,
and the line prints them as `gpu_longest=N gpu_longest_cb=ID` after `gpu_busy`: the first of equal
ones, 0 and 0 where the runtime gives none. No query, wait or submission is added.
docs/REPLAY-STREAM.md section 10 states the two fields.
Tests: a new fake-backend test, replay::tests::a_frame_end_names_its_longest_command_buffer, and
the end-line assertion of a_frame_end_counts_overlapping_gpu_intervals_once, which takes the new
fields.
The rt backend's report lumped every translator refusal of a pipeline state under one
`Translation` key, so a play's `skipped render states` and `skipped compute states` lines named
only the first refusal's WHY, and counted gap substitutes with no kind at all. A census that joins
a play's refusals against open refusal sites needs each one's kind.
- `skipped render states` and `skipped compute states` key a translator refusal as
`Translation(KIND)`: `Unsupported(FEATURE)` with the refused feature as Rust prints it for
debugging, `LimitExceeded(LIMIT)`, `Internal(KIND)`, or the error's variant alone. Never a symbol
or a location, which name the program's functions.
- A new `substituted textures KIND N, the first #ID` line per kind of substitute: `Tiled`, or the
runtime's gap as Rust prints it (`TextureView { kind: TextureType }`). The counters
`substituted_tiled_textures` and `substituted_gap_textures` stay as they were.
- docs/REPLAY-STREAM.md section 10 states both.
Tests: two device-free tests in replay::new_runtime::tests. The refusal test fails on the old
single `Translation` key; the substitute test does not build without the per-kind count.
Device::import_d3d11_surface was a typed refusal (Gap::D3d11Surface). It now imports each plane's
NT handle (VK_EXTERNAL_MEMORY_HANDLE_TYPE_D3D11_TEXTURE_BIT) into a dedicated allocation bound to
an optimal image of the Direct3D 11 texture's own format, mutable and listing the descriptor's
format where the two differ (two formats a plane: R16Uint under RG8Unorm), into the first
device-local type the handle's properties and the image's requirements share. Usage is each of
sampled, rendered, copied and storage the import query offers and the view format's features
hold. Each import counts in Gauges::surface_imports, now on every host.
No submission and no wait at the make: Vulkan 1.4 section 12.5.2 says such images "can be
assumed to be in that layout when they are accessed in Vulkan after external access", and its
table gives the D3D11 texture handle VK_IMAGE_LAYOUT_GENERAL. The plane textures start homed in
the general layout; external_writes_done acquires from VK_QUEUE_FAMILY_EXTERNAL in GENERAL
(VUID-VkImageMemoryBarrier-srcQueueFamilyIndex-12332) and release_surface_to_external releases to
it in GENERAL (dstQueueFamilyIndex-12331). No keyed mutex. The consumer's precondition (Direct3D
11 wrote the plane before rt's first use, and external_writes_done follows that work) is stated
in the call's doc and the rt README.
Surface gains an imported kind: Surface::handle is Option<ExportHandle> (None for the import),
and Surface::buffer is Gap::D3d11SurfaceBuffer, its planes lying in memories of their own.
ImportHandle::D3d11Texture names the handle in Limit::NoImport and Limit::ImportType.
Refusal::SurfacePlanes covers no plane or more than four. REFUSALS.md and the signature table
are regenerated.
The tests: on every device, the import's typed refusals (no plane, five planes, a one-byte image
format under a two-byte view). Under m2v_gpu on Windows, two shared Direct3D 11 textures (R8_UNORM
64x32, R16_UINT 32x16 viewed as RG8Unorm) on the DXGI adapter of the device's LUID, bound by hand
from the SDK headers' vtables: the import submits nothing; Direct3D 11 writes picture 1 and rt
reads it exactly; Direct3D 11 writes picture 2, unlike picture 1 at every byte, and rt reads it
exactly and unlike picture 1 at every byte (the negative control); rt writes picture 3 and
releases it, and Direct3D 11 reads it exactly through staging copies.
A timing verdict between two plays of one stream (old against new, or two commits) needs both
plays by a player that serves every read class the stream has, equal player-side counts at the
judged frame and equal digests there. Nothing in the tree checked any of it: the rows were made
by hand from two reports.
The report gains a `managed reads on two copies` line. Counted from the stream's calls alone,
alike on every runtime and device, it gives the GPU's reads of Managed bytes that no
announcement took to the GPU copy, in two kinds apart:
- made-with reads, of the bytes a buffer was made with, which the player serves on both
runtimes since d88af7befe (the line says "served");
- stale reads, of bytes an m2v.write put in with no didModifyRange:, which Metal leaves undefined
and both runtimes play by one rule ("played as recorded").
With no identity record, a no-copy buffer's writes before its first use are served
(fb183b48f7) and not counted. A one-copy identity record counts none. The count lives in
replay/stale.rs and is fed from the player's make, write, commit and release.
Each check line now names its frame (`check #ID frame F SHA ...`), so a digest can be matched to
the frame it judges.
`command-replay compare-plays --a REPORT --b REPORT [--frame F]` (replay/compare.rs) reads two
reports and prints:
- whether each player serves every read class (it has the managed reads line);
- the frames whose player-side counts differ: stream calls, draws and dispatches, and every
executed skip and refusal count;
- the frames whose digests differ, naming the stale reads as the first suspect on a two-copy
play;
- with --frame, the verdict (GPU-busy and wall time, "b is P% faster|slower than a") or why there
is none.
docs/REPLAY-STREAM.md states the verdict rule as the planner ruled it. Stale reads bar no
verdict.
Tests (replay::tests):
- a_two_copy_stream_s_managed_reads_are_counted_by_kind
- a_no_copy_buffer_s_writes_before_first_use_are_not_stale_with_no_identity
- two_plays_compare_for_a_verdict_only_where_counts_and_digests_agree
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.
Recorded and timed on the M3 (53768 at 280632f1bd: record, then times --runs 8 --write; Metal's
validation ran every case). Each of the 1,200 recorded samples is the colour its way cleared at the
level and slice under it, which every_recorded_sample_is_the_colour_its_way_cleared now holds. The
coverage document is regenerated.
Verified: built and tested in the jobs the landing message names.
The replay streams' gap substitutes were all one view: newTextureViewWithPixelFormat:
textureType:levels:slices:swizzle:resourceIndex: as a 2D array of a cube's six faces, which rt
answered Gap::TextureView (TextureType) and the old runtime makes. Vulkan views a cube-compatible
image, as a cube's and a cube array's are, as a 2D, 2D array, cube or cube array of its layers, and
any image as a 2D array of one layer, with no query, so each is one form on every device.
Texture::new_texture_view now builds those of Metal's casts (Apple's makeTextureView page): a cube
or a cube array to a 2D texture, a 2D array, a cube or a cube array, a cube array's whole cubes as
a cube array, and a 2D texture to a 2D array of its one slice, beside the 2D array to 2D it built.
A cube or cube array view of a 2D array needs a cube-compatible image the 2D array is not made as,
and stays a gap that says so (TextureViewKind::CubeOfArray). A slice count the view's type does not
take (one for 2D, six for a cube, a multiple of six for a cube array) is Metal's validation's stop,
now Refusal::TextureViewSlices where it was a gap. The descriptor answers Metal's: the type, the
extent of the first level, the levels, and the array length in cubes for a cube type.
The device test every_device_views_a_cube_s_faces_as_metal_casts_them makes seven such views and
reads each one's first level and slice by a blit against the parent's bytes under them; the old
expectations move with the rule. REFUSALS.md, the API signature table and rt's README follow.
Verified: built and tested in the jobs the landing message names.
The new runtime's backend plays a stream with no identity record under
--managed two-copy by its first-use rule. A no-copy Managed buffer made with
no bytes is fresh until the command buffer that first names it commits, and
a write into it while fresh reaches its GPU copy too (did_modify_range). That
write is the nearest record the stream has of the buffer's bytes at its
making (docs/REPLAY-STREAM.md, Managed buffers). The old backend had no
such rule. Those writes reached only its CPU copy, so on a device that keeps
two copies its GPU copy read zeros where the new runtime's read the bytes.
The old backend now follows the same rule. It notes each encoder's command
buffer, marks a buffer's first use when an encoder names it, drops the mark
at that command buffer's commit, and announces a fresh buffer's writes. Its
managed line counts the buffers whose contents came from first use, as the
new runtime's does. docs/REPLAY-STREAM.md states the two-copy rule for both
runtimes: which writes before first use reach the GPU copy, and what an
identity record changes.
Found by a synthetic stream of our own on the RX 550 (m3-max-53813): with no
identity record under --managed two-copy, rt read the write and old read
zeros. Recordings it touches: gb-3090-r2 (641 Managed objects read without
them, the first in frame 0) and windrag-780m-b2 (15), where played as two
copies.
Test: a_two_copy_stream_with_no_identity_gives_a_no_copy_buffer_its_writes_
before_first_use (replay_streams), which fails without the fix on a device
that keeps two copies. The made-with test's managed line now carries the
count.
docs/REPLAY-STREAM.md says a Managed buffer that plays with two copies has
a GPU copy that starts from the bytes it was made with: a copied buffer's
contents, or a no-copy one's bytes at its making. Neither backend did so.
The player stripped every newBufferWithDescriptor: descriptor's contents
before the backend's making and wrote them afterwards as a CPU write. So
the new runtime's new_buffer, written to take them, never got them, and the
old backend made every such buffer zeroed. Under two copies neither GPU
copy held the bytes, and a draw reading the buffer before any
didModifyRange: read zeros where the recording's GPU read the bytes.
This changes the new runtime's plays too, not only the old runtime's. The
player now passes the descriptor to the backend with its contents and still
writes them once the buffer is made. The new runtime's backend takes them
as it was written to. The old backend's making takes them, both a
descriptor's contents and newBufferWithBytesNoCopy's pages. Where the buffer
plays as the runtime's Managed buffer, it writes them and announces them
(didModifyRange: over them).
Found by synthetic streams of our own on the RX 550 (m3-max-53813): under
a two-copy identity record, a no-copy and a copied Managed buffer made with
7s read zeros through a blit on both backends. The GPU-free count has the
recordings this touches: glbench-3090-r2, r3 and r4, gb-3090-r3, r4 and r5,
web3d-3090-r2 and r3, nvdec-3090 and nvdec-3090-wd.
Tests: a_two_copy_stream_s_managed_buffers_start_from_the_bytes_they_were_
made_with, in rt_replay (new runtime) and replay_streams (old runtime). Both
play one stream, rt_replay::made_with. They fail without the fix on a
device that keeps two copies.