A kernel whose tier runs each SIMD group as one subgroup (a pinned subgroup of 32, the device's
own 32, or half of a 64-lane subgroup) runs only threadgroups of whole groups of that width. Such
a state now has its emulated-SIMD-group variant (LoweringInputs::emulated_simdgroups), which the
reaper lowers once new_compute_pipeline_state has returned, through the cache directory like
every lowering (a refusal is kept too). A dispatch whose threadgroup is not whole groups runs that
module at its own size; one that comes before the reaper is done waits for the lowering, which the
reaper takes next (Reaper::hurry), counted as a first-use wait. Nothing translates on an encoding
thread. A state made after quiesce, or whose lowering the reaper's end leaves, is marked not
lowered (Error::Quiesced at such a dispatch).
The emulated module's threadgroup memory is its arena (metal2vulkan::pipeline::arena_bytes, now
public) holding the lengths set, the scratch of each SIMD group, and a vote word: the dispatch's
total is checked against maxComputeSharedMemorySize (Limit::ThreadgroupMemory).
ComputePipelineState::precision_notes returns the emulated module's notes too once it is lowered.
Gap::PartialSimdgroups stays for a state with no emulated module: a kernel the consumer compiled,
or one whose emulated variant the translator refuses. A ragged dispatchThreads grid at such a size
is Gap::PartialThreadgroups: the partial-threadgroups variant does not take the emulated tier.
6f5bd20321 removed the 16-bit `half` color output form on every device. That moved Device::new's
output, which the old runtime builds on: 111 golden cells on each RADV, ANV and MoltenVK profile
(5c47b9c867 -> bfe63b5097). The form comes back for Device::new alone, as a profile fact:
ProfileFacts::half_outputs is HalfOutputs::Sixteen in Device::new's facts (ROWS) and
HalfOutputs::Widened in Device::from_queries' (EVERY). Under Sixteen a `half` color output is
declared with 16-bit `float` lanes where the profile enables storageInputOutput16 and
shaderFloat16, as before 6f5bd20321. storageInputOutput16 is not one of the queries rule 2 lets
choose a second form, so the new runtime keeps one 32-bit form for every stage output. The fact
renders into no ROWS fingerprint, so Device::new's profile keys do not move.
- lower::stage_io: plan::half_variable (now reading the fact and the enabled feature),
IoObject::User::half, the 16-bit store and io_elem's width are back. StageIo::half_outputs and
the link contract's 16-bit lanes are back.
- The HalfOutputPrecision and HalfOutputFastMathBlend note texts, docs/API.md's degrade
catalogue, docs/FAST-PATHS.md and the half-output-blends case say what they said for the old
path, each scoped to Device::new, with Device::from_queries handing every device the `float`.
- known-gaps.tsv: the 52 MoltenVK rows for the M3 Max's half-output-blends-r16f, -rg16f and
-rgba16f go, as before 6f5bd20321: with the 16-bit output MoltenVK stored Metal's codes there.
docs/CONFORMANCE-COVERAGE.md is regenerated (3,783 -> 3,731 ledger rows).
- The Iris Xe's 62 half-output rows (6769c2eaaf) were measured with the 32-bit form on ANV, which
gets the 16-bit form again under Device:🆕 they are owed a re-run with it.
- SEMANTICS_VERSION 2157 (the 111 cells per profile change under unchanged keys) and
ARTIFACT_FORMAT_VERSION 530 (the artifact codec has StageIo::half_outputs again).
- The engine_stage_io test is back. It also checks that the profile from Device::from_queries is
HalfOutputs::Widened and keeps the output 32-bit on MoltenVK, RADV and lavapipe, with no
StorageInputOutput16.
Verified at 8e0e199a12 on 00ca405504, whose tree is this commit's but for SEMANTICS_VERSION (2156
there; development took it meanwhile) and development's later commits (03a3741772 and the
harness's), which touch none of this commit's files:
- msi 41897: golden_hashes_match_the_table with every difference listed, compared with the
tables at 5c47b9c867 and bfe63b5097. All 504 stage-io cells on the .ll rows that Linux compares
(56 on each of the 4 RADV, 4 ANV and MoltenVK profiles) are back at their 5c47b9c867 values,
none elsewhere. On ANV and MoltenVK those are the only cells that moved (280, under unchanged
keys). The RADV and NVIDIA columns are stale under profile fingerprints that development's
e0f567a8bc moved back before this commit (12,705 cells, the table not yet blessed for it); in
them only the stage-io cells above and 185 cells on each of nvidia-rtx50-linux and
nvidia-rtx5080-laptop (e0f567a8bc's NVIDIA restore) moved. No ROWS fingerprint moved with
this commit. The 55 stage-io cells per profile on .air.ll rows need metal-as and wait for the
M3 bless.
- msi 41813: clippy -p metal2vulkan --all-targets --all-features -D warnings, rustdoc
-D warnings, nextest -p metal2vulkan -p metal2vulkan-conformance in full: 4,719 of 4,722 pass.
The failures: golden_hashes_match_the_table, for the bless above;
the_public_signatures_are_the_committed_table, development's degradations! row, fixed since by
489bc24c4e; the_authored_4096_step_kernel_compiles_inside_the_budget, which passed alone on
the same build (41862) and is not in this commit's scope.
- msi 41814: clippy under --cfg m2v_gpu and --cfg m2v_cpu_icd.
a17eb26a6b's matrix run did not report OLD PATH MOVED although its golden test counted 7260
cells under a changed profile fingerprint (the stage-bound change): the check commit's own
message quotes "old-runtime regression fix", and the rule looked for the phrase anywhere in a
message since the last bless. It now takes only a subject that starts with it, as each fix's
does.
Tests: scripts/matrix/test_results.py, 17 pass; the old-path test now also feeds a message that
quotes the phrase in its body and expects the problem to stand.
6e08f5aaef made every stage of implementation-defined reconvergence
record PrecisionNote::DeviceReconvergence on the shared translator
path. The old runtime (Device::new) then announced a second kind,
Degradation::DeviceReconvergence ("device-reconvergence"), for a
tangled stage on a device without maximal reconvergence. Before that
commit it announced ImplementationDefinedReconvergence alone, from the
stage's reconvergence field.
Route (a) of the planner's two: the note is a third profile fact.
- ProfileFacts gains reconvergence_note: ReconvergenceNote::Field for
Device::new (ROWS), ReconvergenceNote::Noted for
Device::from_queries (EVERY).
- pipeline::compile records the note only where the profile notes it.
- A Device::new stage again carries the field alone, its notes as
before 6e08f5aaef.
- The fingerprint renders the facts only off ROWS, so no Device::new
fingerprint moves.
The old runtime's Degradation::DeviceReconvergence kind is deleted: no
Device::new stage records the note. Its catalogue entry in API.md and
its API-table row go with it. from_precision_note maps the note, which
none of its stages hold, onto ImplementationDefinedReconvergence, as the
closed match requires. The note stays in the translator's vocabulary,
codec and validation allowance for metal2vulkan-rt, which forwards it
through ComputePipelineState::precision_notes.
Tests:
- engine_simd's reconvergence_follows_the_profile and
uniform_control_flow_mode_without_maximal_reconvergence assert the
field alone through Device::new and the note through
Device::from_queries; the guaranteed stage records none.
- the_profiles_facts_follow_its_constructor covers the third fact.
SEMANTICS_VERSION 2155.
07e62aa306 deleted DriverWorkaround::HalfConversionPairFolded (NVIDIA)
and HalfConversionFusedWithArithmetic (RADV) on the shared translator
path. That changed the old runtime's modules:
- NVIDIA's moved from the Converted form to the Controlled one: 333
golden cells each on nvidia-rtx50-linux and nvidia-rtx5080-laptop,
bless 7fa6662170.
- The NVIDIA and RADV fingerprints moved (six profiles).
- Every controlled module gained NativeHalfConversion.
Restored for Device::new, as before 07e62aa306: both identity rows,
narrow::quantize_form's fold check (NVIDIA takes Converted),
narrow::rounds_arithmetic, and the note on a controlled pair only where
RADV's row fuses f32 arithmetic into the narrowing. The validation lanes
(half_conversions, native_maths) and the translator's tests go back to
their text before 07e62aa306.
rt keeps what landed, carried with no switch. The note's form is a
second profile fact beside the stage bound:
- device::profile::ProfileFacts holds { stage_bound, half_pair_note }.
- Device::new builds ProfileFacts::ROWS (Defects, Fused).
- Device::from_queries builds ProfileFacts::EVERY (Every, Every).
- pipeline::compile reads half_pair_note: Every records the note on
every module that keeps a controlled pair. Fused is the old rule.
- from_queries profiles name neither row, so quantize_form gives them
Controlled on every device with the controls, NVIDIA's included.
- The fingerprint renders the facts only when they differ from ROWS, so
Device::new's NVIDIA and RADV fingerprints return to their values
before 07e62aa306.
Tests:
- The identity tests are back.
- New from_queries_half_rounding_follows_the_queries_alone and
from_queries_notes_every_controlled_pair.
- The facts test covers both facts.
Docs: PrecisionNote::NativeHalfConversion, API.md's degrade catalogue
and HOWTO.md name both paths; the API table regains the two variants.
SEMANTICS_VERSION 2154.
576a7348bc put one stage bound on every device on the shared translator
path, so the old runtime (Device::new) newly refused what it compiled
before: on the UHD 630 and on every committed profile without maximal
reconvergence, 6 corpus modules (12 rows) went from compiled (emulated
simdgroups, entry weights 104,424 to 188,554) to Needs::StageBound.
Measured on gem10 through Device::new at 9cb90de8cc (job m3-max-41747).
Restored for Device::new, as before 576a7348bc:
DriverWorkaround::SerializedStageWrapsLargeModules and
CompilerMemoryGrowsWithStageSize on ANV's identity row, their bounds
(786,432 and 99,109), the re-plan keeping the widest pin, and the
refusal as Needs::DriverDefect naming the defect; no bound elsewhere.
The old runtime's heap-trim test, warm-refusal kinds and their tests go
back to their text before 576a7348bc.
rt keeps what landed, carried with no switch. The bound is a fact of
the profile (device::profile::StageBound): Device::new builds
StageBound::Defects (the bounds of its rows), Device::from_queries
builds StageBound::Every (99,109 on every device, refused as
Needs::StageBound). stage_bound::emit reads that one field. The
fingerprint renders the fact only when it is Every, so every
Device::new fingerprint is byte-identical to before 576a7348bc. Every
from_queries fingerprint moves, so an rt profile is never one of the
old path's.
Tests:
- The pre-576a7348bc ANV tests are back (both defects' bounds, and the
same profile without them emitting under every bound).
- New every_stage_from_queries_keeps_the_widest_pin_or_is_refused:
re-planned, then StageBound; the serialized bound is none there; RADV
through Device::new is unbounded.
- the_stage_bound_fixture_keeps_the_pin_or_is_refused covers both
paths. Iris pinned through both. Without maximal reconvergence:
StageBound through from_queries, DriverDefect on ANV through
Device::new, and emitted emulated through Device::new under Intel's
Windows driver (the UHD 630's case).
- New the_stage_bound_is_a_fact_of_the_profile checks every committed
profile.
Docs:
- FAST-PATHS' known gap is ANV's again.
- The rt README's known gaps gain the every-device bound.
- API.md and the Needs::StageBound and Feature::StageSize docs name
both paths.
- REFUSALS.md regenerated; the API table regains the two variants.
SEMANTICS_VERSION 2153.
Under the identity domains an argument buffer's texture handle is the gpuResourceID its member
holds: the handle is the ID's index, the element of the class's set-1 array (0 is nil, the null
descriptor), with no handle table, no search and no descriptor. Where the shader checks a read
itself (no robustImageAccess2) the handle carries the word's missing-alpha bit (word bit 12) at
HANDLE_ALPHA_ONE, so the handle form is Lookup::Element or Lookup::Flagged{alpha} only.
The handle tables' variant forms are off under these domains (`texture::tabled`): reads of a
member of another numeric class, raw-texel decodes, storage conversions (red-blue, sRGB alias),
A8 alpha-in-red, unreadable-storage nulls, YCbCr write marks, and the HeapCrossClassNeutral,
HeapStorageReads and HeapResidency facts. A slot and a member of one class index one array, so
the class's volatility now merges the slots' uses with the groups'. The admission takes heap
groups whose declaration is their identity class with no plain, raw or cross classes; anything
else stays Unsupported{IdentityDomains}.
Translation output changes only under the identity domains: the default domains plan and emit
as before (no golden re-bless needed). SEMANTICS_VERSION 2153.
The test kernel `tex` gains an argument-buffer form (`texture_kernel(true)`), checked on
lavapipe, moltenvk-m3 and moltenvk-m3 without robustImageAccess2: same answers at the same
elements, set 0 empty, and the handle form Element or Flagged{alpha} as the profile checks reads.
Verified (this commit's tree, as 657e2245c2 on 2872c419e0):
- msi 41756: clippy -p metal2vulkan --all-targets --all-features -D warnings, rustdoc
-D warnings, nextest -p metal2vulkan -p metal2vulkan-rt in full: 3,701 of 3,702 pass; the one
failure is golden_hashes_match_the_table, stale under development's own profile change.
- msi 41800: that golden test with every difference listed: 7,260 cells under a changed profile
fingerprint (development's at 2872c419e0; this commit changes no profile field), no cell whose
value moved, no cell changed under an unchanged key. Fixtures that need metal-as (macOS) are
not compared there.
- msi 41757: clippy under --cfg m2v_gpu and --cfg m2v_cpu_icd.
- msi 41712, 41713 and 41752: the same at 160a3c5bae on 9cb90de8cc (SEMANTICS 2152 there), the
golden test matching 1,815 rows x 19 profiles.
The device legs of the tile (m3-max-41638/41639/41640) refused every
observing kernel with Gap::KernelInput: the runtime took a kernel's
[[threadgroup(n)]] arguments from PipelineInterface::threadgroup, which the
translator leaves empty, so a TgLength specialization found no argument. The
arguments are now the TgLength constants the module specializes on, by
their index.
With threadgroup memory reaching a pipeline, a dispatch checks it: the
kernel's static part (and a predicated walk's 4-byte vote word,
RuntimeFact::PredicationVote, now accepted) plus each length set rounded up
to 16 bytes must be within maxComputeSharedMemorySize, else the new
Limit::ThreadgroupMemory, Metal's maxThreadgroupMemoryLength counterpart.
The precise kernel's test found on the 780M and the XTX one word apart
between a tile and the app's shape: a NaN/NaN division (0xffb86e83 /
0x7f9fc206) answers the first operand's payload in one pipeline and the
second's in the other. The state carries NativeNanEncoding, so two NaNs are
alike there; every other word must be equal.
README: the threadgroup memory limit, and NVIDIA 615.71.09's sign-extended
narrow clamped sum on GA10x (the planner's wording). REFUSALS.md and the API
signatures regenerated.
DeviceOptions::pipeline_cache_dir names a directory a device keeps two
things in, for compute pipeline states. translations/ holds each lowering,
named by its FunctionCompileKey (the kernel's AIR, entry, constants and linked
functions, its lowering inputs, the profile fingerprint and the translator's
semantics version), in the translator's self-checking encoding; a state reads
a lowering there in place of lowering (Metrics::translations_loaded beside
the new Metrics::translations), and a partial-threadgroups variant the
translator refused is kept as a marker so it is not tried again. The files
take at most 256 MiB, least recently used evicted first. pipelines-<uuid>
holds the VkPipelineCache data, framed with a length and a checksum since
the initial data must be exactly what vkGetPipelineCacheData returned; every
VkPipeline is made through the device's cache, the reaper writes the data 10
seconds after a VkPipeline was made at most once per 10 seconds, and the
device's end writes it a last time. Writes go through a temporary file
renamed over the name; a file that does not check is a miss and nothing the
cache does fails a call.
The tile commit's README, refusal table and API signatures follow here:
direct dispatches past maxComputeWorkGroupCount are split, and
Gap::PartialThreadgroups names the variant refusals by the deciding queries.
Tests: a store filled past its cap keeps the most recently used files within
it, stores on one directory share files, and pipeline data cut short or
flipped is a miss (host); a second device on the same directory lowers
nothing at creation, reading all three lowerings, and the pipeline data file
is there (device). Not yet compiled: the lint follows.
The 7fa6662170 run failed every GPU leg on harness-old/authored/pipelines_created 8 -> 10. That
was the harness itself gaining two workloads (eddc9b80bf), not the runtime. The harness's counts
sum over its workloads, so like its times they now compare only with a base whose harness tree is
the same; the other records still compare.
Its lavapipe leg failed on one old-runtime test that passed in the runs around it, as a different
one did in most runs today (cfa389aa9b, c944d63548, bfe63b5097, 73e0af4b66), the old runtime's
code unchanged between them. The old runtime is frozen and its regressions parked, so the six met
so far join PARKED_TESTS with the run each failed at; they stay named on the leg's line.
Tests: scripts/matrix/test_results.py, 17 pass (the new one: a harness count compares under the
same harness and not under a changed one, while a runtime count compares in both).
The old runtime is frozen until the cutover: the translator's output through Device::new must not
move. Today it moved three times through the shared path (half outputs widened, the half pair
workarounds dropped, the stage-size rows dropped) and nothing caught it, because the golden table's
failure read as "needs a bless" whatever moved.
The golden table compiles through Device::new. Its test's stale message now counts each kind
(new, gone, under a changed fixture source, under a changed profile fingerprint), from one tested
function. The matrix reads the counts: a cell changed under an unchanged key, or one under a
changed profile fingerprint, fails the leg with OLD PATH MOVED, unless a commit since the table's
last bless says "old-runtime regression fix" (the fix of such a move, or a fix the old-runtime
lane lands). New, gone and re-keyed fixture rows still only need a bless.
Tests: scripts/matrix/test_results.py (16 pass; the new one feeds both panics as nextest prints
them, a new-rows-only failure and a passing run, with and without the phrase);
golden_hashes::only_a_cell_changed_under_its_key_needs_a_bump checks the counts' text.
A module whose entry weighs more than COMPILED_STAGE_WEIGHT (99,109, the
heaviest stage measured to compile within host-sized memory, on ANV) is
now handed to no driver, whatever its identity. A kernel that emulated
its simdgroups only in place of the widest mode's pin (the subgroup size
range decides it) is planned again keeping the pin, as before; every
other module past the bound is refused with Feature::StageSize and a new
Needs::StageBound, its symbol naming the weight and the bound. The
refusal is permanent for the input on the device (its plan decides the
weight), so it is not NotImplemented; validation reads it as the
translator's own gap.
DriverWorkaround::SerializedStageWrapsLargeModules and
CompilerMemoryGrowsWithStageSize go, with ANV's identity entries for
them and the serialized bound (786,432), which the single bound sits
far below. Why: the workaround ladder takes one form for every device,
the slowest compiler's; a device whose compiler would take a heavier
stage is refused it, recorded in FAST-PATHS' known gaps.
Measured before this change, with a scratch build that applied the
bounds and the re-plan to every profile: the corpus on the Iris Xe's
description without its identity refused nothing (largest planned
module 91,399, job m3-max-41496), and RADV and NVIDIA nothing either;
without maximal reconvergence 12 rows were refused, 6 distinct
simdgroup-matrix modules of 198 to 285 products whose lockstep pairs
force emulated simdgroups (jobs m3-max-41474, m3-max-41523).
The owned fixture stage_bound/stage_bound_matrix (512 simdgroup matrix
products beside a lockstep pair in divergent flow, our own MSL) has
their structure: on the Iris Xe its emulated module weighs 123,307 and
its pinned one 37,646; without maximal reconvergence it is refused at
123,308 (scratch weighing, job m3-max-41602). The new test
the_stage_bound_fixture_keeps_the_pin_or_is_refused asserts both paths
and that the re-planned kernel is under the bound.
The old runtime's heap-trim test loses its long chain, now refused on
every device; it asks for a trim where the making left more than the
floor free (NVIDIA's compile never does under the bound, 189 MB at
most measured). SEMANTICS_VERSION 2150; REFUSALS.md regenerated; the
API table loses the two variants and gains Needs::StageBound.
Leaving out what the runtime counted while the player's own calls ran
did not keep the split out of the executed counts: the old runtime
records the barriers a split needs at the program's next command and at
the commit. Device legs at 0b882f337c (jobs m3-max-41605, m3-max-41608)
counted 8 barriers on the RX 7900 XTX, RX 550, 780M and lavapipe and 10
on the RTX 2080 for the test stream, against 5 for the same stream
without the records. A background pipeline that landed inside an
uncounted window also left pipelines_made out (RX 550, 780M,
lavapipe).
The runtime's work for a split cannot be told apart from the program's,
so a group whose command buffers held a split now reports no executed
counts. Those counts are added up apart, in Report::split_executed and
on the `split N executed COUNTS` line, and the total leaves them out
with the readbacks. The player's own calls around the dispatch are no
longer measured on their own.
The encoders, blits, buffer and fence the player adds around a dispatch
an m2v.privateBytes record names are its own work: what the runtime
counts while those calls run is left out of the group and total
executed counts, as its readbacks are, and the report counts the splits
(split N). The comparison takes its completed snapshots from a queue.
The host records m2v.privateBytes for each dispatch of a pipeline with
linked functions: each bound Private buffer range's bytes before and
after the dispatch, which no CPU can read and no other record holds.
The player played these records as nothing.
It now reads the stream ahead once (a second reader of the same
segments) and indexes the records by the dispatch each names, since
they come after it, at the command buffer's completion. At that
dispatch it puts each range's bytes before (relocated as a write's
are) in a Shared buffer of its own, ends the guest's compute encoder,
copies them into the ranges in a blit encoder, makes the compute
encoder again by the call that made it with every set.../use... call
the program made on it, dispatches, then ends it, copies the ranges
out in a second blit encoder and makes it again. A fence of the
player's own orders each piece after the one before, so untracked
resources are ordered too. Once the command buffer completed it reads
the bytes after back, counts the 4-byte words of each range that
differ from the recording's, and reports a `private ID DISPATCH
LOCATION+LENGTH match|differs N/WORDS` line; the play goes on.
The readback helper check() and the comparison share now shifts the
group baseline by the readback's own growth rather than setting it to
the counters after it, so work recorded since the last group stays in
the next group's executed counts.
REPLAY-STREAM.md sections 8 and 10 state the read-ahead, the split,
the report line and what the counts include.
The floor requires Vulkan 1.3's subgroupSizeControl, computeFullSubgroups and
robustImageAccess, enabled on every device; the translator's profile takes
them through the enable set. Where a device lists compute in
requiredSubgroupSizeStages with 32 between its sizes, the translator pins a
kernel's SIMD groups to subgroups of 32 (the Direct tier); the compute
pipeline state now takes such a kernel: each VkPipeline chains
VkPipelineShaderStageRequiredSubgroupSizeCreateInfo where the tier pins a size
(the translator pins only a stage the device lists, VUID-...-pNext-02755) and
carries the stage's REQUIRE_FULL_SUBGROUPS. "A stage that pins a subgroup
size" leaves Gap::KernelInput. A flattened tier's LocalSizeConstraint is
supplied: a dispatch whose threadgroup is not whole SIMD groups is refused at
the dispatch as the new Gap::PartialSimdgroups, since the emulated-SIMD-group
variant is not built. With robustImageAccess on, the translator drops its
image write and atomic guards on every device; robustImageAccess2,
robustBufferAccess, robustBufferAccess2 and nullDescriptor stay off.
Tests: the floor names each new missing feature; the translator's enable set
holds robustImageAccess and none of a reported geometryShader,
samplerMirrorClampToEdge or VK_EXT_robustness2 (host); every device's
translator profile has robustImageAccess and none of robustImageAccess2,
robustBufferAccess, robustBufferAccess2, nullDescriptor (device); and
simd_float_products runs Direct, pinned at 32, wherever compute can pin 32,
refusing a 16-thread threadgroup and answering Metal's products (device).
REFUSALS.md and the API signatures regenerated. Verified: cargo fmt; the lint
and the device legs follow.
Under the identity domains a kernel's texture slots now lower. A slot's
gpuResourceID is pushed as its PushField::SlotGuestBase (the index in the
low word, the word in the high one). Its texture is the element at that
index of one of set 1's two fixed arrays: binding 0, SAMPLED_IMAGE x
65,536, and binding 1, STORAGE_IMAGE x 4,096. Each is partially bound,
updated after binding and while unused elements are pending, and seen by
every stage, with the same layout for every pipeline
(BindingSource::IdentityArray). Each image class the kernel declares
(shape, numeric type and depth comparison, sampled, or storage without a
format) is a variable of its descriptor type's binding. The slot binds no
descriptor and declares no specialization constant:
- is_null_texture answers whether the index is 0. Nil needs nothing
else in the shader, since element 0 of each array is a null descriptor
(the device test of ba4454b05b).
- A read the shader checks itself takes Metal's out-of-bounds alpha of 1
from bit 12 of the word (TextureWord::OUT_OF_BOUNDS_ALPHA_ONE).
- The ResourcePresence and OutOfBoundsAlpha facts are not stated there.
No binder chooses a variant under identity, so a slot reads whatever
texture its ID names through the plain form:
- the variant facts (cross-class reads, planes read in place, texel rows,
texture-buffer parts) are not stated;
- a float or half read takes the device's sRGB decode with
PrecisionNote::SrgbTexelDecode (VkProperty::MetalSampler on MoltenVK),
as a heap element's does, with no SrgbTexture twin;
- no texture is sparse (the consumer refuses one): no write-dropping
SparseTexture constant and no ConstantLanes;
- a storage slot is formatless with no StorageTextureFormat fact. Where
the device cannot access it without a format, the slot is refused as
Unsupported{IdentityDomains} instead of asking for an input no consumer
gives there.
Admission stays typed. Under identity, a function is refused as
Unsupported{IdentityDomains}, not implemented, if it:
- samples (any sampler plan; Metal's own sampler as a requirement is
allowed);
- reaches textures through argument buffers (any heap group);
- declares a slot with no identity class: texture buffers, level views,
cube-as-array, planes, extended range, RGBX, ulong, or a storage
image with a format;
- uses a slot whose state comes from anything but its ID: border texels,
sparse residency arms, a half conversion by the bound format, swizzles,
offset bases;
- carries a fact naming such state (identity_unsourced).
That keeps the arm64-only forms (two-plane, extended range, sRGB twins)
out of the identity domains, as the x86 scope wants. The old binder
refuses an identity array as an internal error, since the consumer
writes those arrays.
SEMANTICS_VERSION 2150 (identity output changes), ARTIFACT_FORMAT_VERSION
529 (BindingSource gains IdentityArray). docs/RESOURCE-ID.md says what the
arrays are and what the shader reads of an ID. docs/API.md says what the
identity domains lower. The refusal surface and the API signatures are
regenerated. The blessed table also gains
metal2vulkan-rt::PrecisionNote::CappedLodBias, a variant development's
table lacked.
Verified, on development cfa389aa9b (check commit 564d131163, same tree):
- msi, job m3-max-41519: clippy -p metal2vulkan --all-targets
--all-features -D warnings, rustdoc -D warnings, and nextest of
metal2vulkan's whole suite: 3672 tests run, 3672 passed, 20 skipped.
- msi, job m3-max-41520: clippy of metal2vulkan under --cfg m2v_gpu and
--cfg m2v_cpu_icd, both clean.
- The new test, texture_slots_are_the_set_1_elements_their_pushed_resource_ids_name,
runs on lavapipe, moltenvk-m3, and moltenvk-m3 without
robustImageAccess2. Its words come from tests/resource_words.tsv rows
70 and 10, checked against TextureWord::of. It checks the fixed set-1
layout and that the pushed fields are exactly the buffer, the three
texture IDs and the region. On the interpreter, with the source at
sampled element 3 and the destination at storage element 2, it checks
the reads, the writes, the width and is_null_texture both ways (index
0 and index 1). On moltenvk-m3 without robustImageAccess2, where the
shader checks the read, the source image traps any access outside it
and the out-of-bounds alpha comes from bit 12 of the word: 1.0 for
R8Unorm, 0.0 for RGBA8Unorm. On the other two profiles the device's
robust texel answers.
- The same change on the earlier base 9a3b6587b2 (jobs m3-max-41478 and
41479): 3670 of 3670, clippy clean in all three configurations.
The host now records m2v.privateBytes: a Private buffer range's bytes
before and after one dispatch of a pipeline with linked functions,
written at the command buffer's completion (so after the dispatch,
possibly after the buffer's release), with blobs in the blob directory
alone. The player sent the unknown selector to the backend, which
refused it on a buffer receiver and stopped the play. It now joins the
records the player plays none of; REPLAY-STREAM.md section 8 states the
record's receiver, arguments and order.
Verified: private_bytes_records_play_nothing, a synthetic stream with
the record on a released buffer and absent blobs, plays to the end
with no backend call for it.
What: a half rounded through the device's conversion and its widening under the 16-bit float
controls (QuantizeForm::Controlled) now records PrecisionNote::NativeHalfConversion on every
device, as a static note of the operation. Every profile with shaderFloat16 and those controls
takes that form, NVIDIA's included. DriverWorkaround::HalfConversionPairFolded (NVIDIA, identity)
and DriverWorkaround::HalfConversionFusedWithArithmetic (RADV, identity) are deleted, with
narrow::rounds_arithmetic, which only the second read.
Why: rule 2 of the owner's rules (one path for every device, no identity-keyed branch) and the
planner's ruling on these two rows of the workaround ladder. The pair is Metal's half(float) by
the Vulkan spec, but a driver's compiler may fold it (NVIDIA's) or fuse the float operation into
the narrowing (RADV's). Recording the note statically on every device covers both drivers with no
identity check, and it never refuses. NVIDIA's modules move from the Converted form to the
Controlled one (NoContraction on the pair, the entry declaring the 16-bit modes), so its golden
cells move. ANV's and RADV's modules gain only the note, which is not hashed. SEMANTICS_VERSION
goes to 2149.
Tests: engine_native_half, device::tests::profile (half_rounding_follows_the_queries_alone replaces
the two identity tests), engine_float_call_notes, and the native_maths and half_conversions
lanes, updated to expect the note on every controlled profile. Docs: API.md's
NativeHalfConversion entry and HOWTO.md. api_signatures.tsv loses the two variants, and
REFUSALS.md is regenerated unchanged.
The UHD 630's harness-old/frame time swung to 1.58x its base at a68d520bee and 1.47x at
9af29fbb20, with no change to the old runtime between them; the owner parked the old runtime's
regressions until the cutover deletes it. PARKED_GAUGES becomes PARKED_RECORDS: a key under
one of its prefixes has its gauge flatness and its cross-GPU time outlier named on the leg's
line as parked, failing no leg. A gauge's @drop still fails, and every rt time still fails as
an outlier.
Verified: scripts/matrix/test_results.py, 15 tests pass, one new (a parked time outlier is
named and fails no leg).
DeviceOptions::features takes ConsumerFeature values (SamplerYcbcrConversion
for now). Device::new enables each one the device reports, once, in the
consumer's order, and Device::features lists those enabled, so the consumer
can refuse its own path. The runtime's own work and the translator read only
the floor's features. No Metal counterpart.
The floor test's device creation chains the maximal-reconvergence and
subgroup-uniform-control-flow structures where their extensions are listed,
as Device::new does (the device cfgs failed to compile without the fields).
The consumer-extensions device test also expects the optional extensions the
device lists, and asks for the feature twice.
REFUSALS.md takes the renamed site of VulkanVersion (derive.rs derived).
API signatures blessed.
Verified: cargo fmt. Lint and device legs follow.
A stage whose reconvergence is ImplementationDefined (a tangled instruction in
its entry on a device without maximal reconvergence) records
PrecisionNote::DeviceReconvergence, static per stage and as coarse as the field.
metal2vulkan-rt forwards it through ComputePipelineState::precision_notes and
adds none of its own; metal2vulkan-runtime announces its note kind beside its
existing ImplementationDefinedReconvergence kind. The note is in API.md's
degrade-notice catalogue, the fast-paths ledger's Elsewhere class, the cache
codec (ARTIFACT_FORMAT_VERSION 528) and validation's Unbounded allowance.
SEMANTICS_VERSION 2149: a stage's notes change on devices without maximal
reconvergence; the golden tables are re-blessed on development.
Tests: engine_simd reconvergence_follows_the_profile and the uniform-control-flow
case assert the note exactly where the field is ImplementationDefined.
Identity steps 2 and 3 are on development: ArgumentTableAddress is the ring
block's address in the window, fields placed in the ArgumentTable go to the
block, and every dispatch reads Metal's grid from its pushed region (a zero
grid for an indirect dispatch), with no MultiRegion constant to specialize.
The README gains the pipeline states' section and its known gaps; REFUSALS.md
and the API signature table are regenerated.
The matrix ran the suites but none of the gate's lints, so a public doc linking private items
(eaac55bd36) left the workspace Rustdoc failing on development with every leg green. The lint
leg runs cargo fmt --all --check, clippy -D warnings plain, under --cfg m2v_gpu and under
--cfg m2v_cpu_icd, and Rustdoc -D warnings, each reported as its own suite, in a workspace of
its own on the builder beside its other jobs, so it adds no wall time to the run.
Verified: the script parses; the first run is the matrix on this commit.
Where the presented GPU adds a sampler descriptor's lodBias to every sample's level
(SamplerUse::lod_bias), vk_sampler hands the device device_lod_bias's answer: past the device's
maxSamplerLodBias it adds that limit, and a NaN, or any bias where a portability subset withholds
samplerMipLodBias, adds none. Only the old runtime said so (Degradation::CappedLodBias, announced as
it makes the state); the translator's vocabulary had no note for it, so a runtime built on the
translator alone could not report it. The lab's own reports put the limit at 15 on the 2080 and
both 3090s and 16 on the other target devices.
The translator now states it as PrecisionNote::CappedLodBias, which DeviceLodBias::note gives for
every variant but Exact. It is fixed by the state's bias and the device's limit; no pipeline stage
records it, so translation output does not change (no SEMANTICS_VERSION bump).
Classed where every note is: the artifact codec, tests::fast_paths (Elsewhere: docs/API.md section
9 states it), validation's comparison allowance (unbounded). The old runtime's degradations! macro
maps the note to its existing runtime kind CappedLodBias with one hand-written from_precision_note
arm. That change is mechanical, with no behaviour change: the kind keeps its code, category, cost
and announcement site, and its precision_note() stays None, so the site tests' rule (a kind with a
note is a stage's) still holds. docs/API.md: section 9's intro, the capped-lod-bias catalogue entry
and the accepted difference name the note. api_signatures.tsv re-blessed; refusal_surface.py
--check passes, REFUSALS unchanged.
Test: metal::sampler::tests::the_device_lod_bias_carries_its_note_where_it_is_not_the_bias, over
every committed device: no note for 0, -0 or a bias within the limit, the note past it, at the
infinities and for a NaN, and for every nonzero bias where samplerMipLodBias is withheld.
Verified: cargo fmt; signatures.py --bless; refusal_surface.py --check. Lints and tests follow as
potluck jobs.
The recorder now writes four things a player must read:
- m2v.commitPart answers `cut`: "Cut" where the host committed the command
buffer as a part, "Fails" or {Whole: reason} where it committed nothing. The
player commits only at "Cut", or where the answer is absent, as before.
- The pass descriptor's setters write object 0 for an object property set to
nil (visibilityResultBuffer, rasterizationRateMap, texture, resolveTexture);
nil still means left as it was. The old runtime's backend clears the
property at object 0.
- newBufferWithDescriptor: of a buffer copied from host memory carries its
starting bytes as the descriptor's `contents` (a blob or inline bytes). The
player makes the buffer with the contents nil, then puts the bytes at its
first byte as a write's: relocated where it answered a gpuAddress, counted
in written_bytes.
- `gpuResourceID` records carry the ID the program saw of a texture, sampler,
depth-stencil state, pipeline, ICB or function table. The player compares
each object's first answer with its runtime's ID (Backend::resource_id) and
reports each object where they differ as `id #OBJ RECORDED PLAYED`.
docs/REPLAY-STREAM.md carries the spellings. Each addition has a synthetic
stream test on the player's mock backend, and the old runtime's backend has
two device tests (an attachment set to nil left untouched by its pass; a
copied buffer reading back its contents, with a placed texture's ID matching
and an unplaced one's reported).
At 8a07d62b97 six GPU legs failed on time and one on a gauge, none of them
the new runtime's (rt 38/38 on every leg):
- The harness landed its settled warm-up and steadiest-window time between
the base (b216007f0a) and this run, so most GPUs' times fell to about 0.69x
and the ones that fell less read as outliers. Times now compare only when
the base's crates/metal2vulkan-harness tree is the commit's; a harness
change sets the base for the next run.
- harness-old's memory_blocks gauge went 3 -> 2 between iterations 100 and
200 on the Iris and the UHD 630: the old runtime frees idle blocks when it
will. lavapipe failed two old-runtime tests: cross_queue_shadows' GPU
hazard (its spin ended before the host's write on a loaded host, twice
now) and compute_inherited_buffers' barrier count (2 against 3, which
moves with the old runtime's background pipeline builds).
The old runtime takes no fixes until the cutover, so these are parked:
PARKED_TESTS and PARKED_GAUGES in results.py, each with its reason. A parked
failure is named on the leg's line and in the note's `parked` field and
fails no leg; a parked gauge's @drop still fails. docs/VALIDATION.md says
both rules.
Verified: the rule tests (14, two new: a suite whose failures are all
parked passes and names them, an unparked one beside it still fails; a
parked gauge may move between iterations but must reach zero at drop);
the harness trees differ between b216007f0a and 8a07d62b97 (038009feec
against d25ef7d25d) and match between 8a07d62b97 and the tip.
Under the identity domains a kernel that reads a grid builtin no longer declares the MultiRegion
specialization constant. It tells a region from an indirect dispatch by the region's grid
(RegionSelect::Grid in lower::dispatch):
- Every dispatch the host knows (dispatchThreads, dispatchThreadgroups, and each piece of a split
of either) pushes DispatchRegion with Metal's threads_per_grid in region[1].xyz and its piece's
first threadgroup in region[0].xyz. So the pieces of a split read Metal's whole grid, and every
compute pipeline takes the base offset.
- An indirect dispatch pushes a zero grid. Its kernel then takes the single-region form, its grid
NumWorkgroups times L, which needs its workgroup size to be Metal's threadgroup size.
- One pipeline runs every dispatch of a threadgroup size, with no constant to specialize.
A flat variant (LoweringInputs::flat_grid), bound as any other kernel, reads its grid from the same
pushed field rather than from a record at ReplayRegionAddress (plan_replay, EmitCx::push_field).
The consumer runs non-observing kernels in a fixed shape with it, and invocations past the grid
return before the body. A replay or folded variant keeps its record and stays refused under the
identity domains.
The runtime lane takes this ABI as agreed: the zero grid marks an indirect dispatch, which runs
the per-size pipeline.
SEMANTICS_VERSION 2148: modules under the identity domains change.
Tests (src/tests/engine_identity.rs), on lavapipe and moltenvk-m3:
- every_dispatch_reads_metals_grid_from_its_pushed_region. A generated kernel reads
thread_position_in_grid, threads_per_grid and threadgroups_per_grid. It declares no MultiRegion
constant and passes L3. On the CPU interpreter, with L = (4, 2, 1) over an 8x6 grid, it stores
the same answer at every position in three forms: one whole dispatch, a split into two pieces at
region base (0, 1, 0), and an indirect dispatch with a zero grid.
- a_flat_variant_reads_its_grid_from_its_pushed_region. Its flat variant reads a 7x5 grid from
the pushed region in three workgroups of 16. The 13 invocations past the grid store nothing.
- The buffer-kernel test runs once, with its region pushed.
Verified:
- m3-max-41225 (msi, check commit 7fe9bc780c: this tree's metal2vulkan files, which equal those
here on 1bb5fe5bf8): clippy -p metal2vulkan --all-targets --all-features, rustdoc -D warnings,
and nextest -p metal2vulkan --all-features, exit 0 (every test passed; the count's log was
lost to the scratch path two of the lane's jobs shared, since fixed).
- m3-max-41226 (msi, 7fe9bc780c): clippy under --cfg m2v_gpu and --cfg m2v_cpu_icd.
Under the identity domains the stage's ArgumentTable is not a uniform buffer. It is a parameter
block in memory that the consumer writes for the call, and its device address is the new push
field PushField::ArgumentTableAddress, a u64.
How it works:
- The placement is the one the translator already makes. Fields fill the 128-byte window in kind
order; the first that does not fit, and every field after it, go to the block at
PushLoc::ArgumentTable offsets, and argument_table_size is the block's size.
- ArgumentTableAddress sorts first among the kinds. A kernel whose fields spill inserts it, so the
window always holds it, at offset 0 under the identity domains, where RootTableAddress never
appears.
- The function reads each spilled field through the address (table::read_block): a
PhysicalStorageBuffer load at the field's offset, aligned to its shape.
- No descriptor is declared or counted, and maxUniformBufferRange does not bound the block.
- Selection now admits a kernel whose slot addresses or region spill, with the address in the
window.
The variant goes at the codec's end, since tags are by name. The api_signatures table gains it,
and the kind-order and status-address placement tests name it. SEMANTICS_VERSION 2147: a refusal
under the identity domains became a module.
The new test, slot_addresses_past_the_window_are_read_from_the_pushed_parameter_block, uses a
generated kernel with 20 read buffers and an output. On lavapipe and moltenvk-m3:
- ArgumentTableAddress is at Push{0}, 15 slot addresses fill the rest of the window, and 6 go to a
48-byte block;
- there is no descriptor;
- it passes L3;
- on the CPU interpreter, with the block and every buffer above 4 GiB, it stores the ordered fold
of the 20 words, which a swapped address would change.
Docs: docs/API.md's identity-domain bullet names the parameter block (added after the check
runs; no code differs from what they built).
Verified:
- m3-max-41196 (msi, check commit 9c6102b5ad on step 1's tree: this commit's metal2vulkan tree, with
the same translator files as here on 1bb5fe5bf8, where only the runtime crate's signature rows
differ): clippy -p metal2vulkan --all-targets --all-features, rustdoc -D warnings, and nextest -p
metal2vulkan --all-features, exit 0 (every test passed; the log of the count was lost to a
second job on the node writing the same scratch path, since fixed).
- m3-max-41197 (msi, 9c6102b5ad): clippy under --cfg m2v_gpu and --cfg m2v_cpu_icd.
Under PointerDomain::Identity with HandleDomain::Identity every buffer slot of a kernel is its
device address used directly. Each slot is the Psb form, its address read from its own push
field, PushField::SlotGuestBase(slot): gpuAddress plus the bind offset, which under the identity
domains is the Vulkan device address. No root table is read, and no access is contained, as Metal
contains no device-address access (psb::prepare_at). Selection admits, under the identity domains,
only the plans lowered so far (select::identity_admits): a kernel whose push fields are its slot
addresses and its dispatch region, all in the push window, with no descriptor and every slot
addressed. Anything else is still Unsupported{IdentityDomains}, not implemented, now refused there
rather than for every function at analysis. SEMANTICS_VERSION 2146: a refusal under the identity
domains became a module.
The new tests (src/tests/engine_identity.rs):
- a1_bool_from_float under the identity domains on lavapipe and moltenvk-m3 has no descriptor,
no root table and three SlotGuestBase fields. It passes L3, and it computes the program's
answer on the CPU interpreter, with its buffers above 4 GiB at bind offsets 32, 16 and 4. It
writes nothing past its output, with its region pushed.
- a2_dynamic_texel_offset, which samples a texture, compiles under the default domains and is
refused under the identity ones.
Verified:
- m3-max-41149 (msi, check commit eeecc4492b, the same tree but for the test's region bytes):
clippy -p metal2vulkan --all-targets --all-features, rustdoc -D warnings, and nextest -p
metal2vulkan --all-features, 3664 of 3665. The one failure was this test, which met the kernel's
DispatchRegion field and did not fill it.
- m3-max-41195 (msi, a5dbfd408f, this tree): clippy and rustdoc; tests::engine_identity and the
domain pair test, 3 of 3.
- m3-max-41150 (msi, eeecc4492b): clippy under --cfg m2v_gpu and --cfg m2v_cpu_icd.
The six half-output blend cases differ from Metal on the RTX 3090 (59 sites) and on the Iris Xe
under ANV (62 sites). The ledger had no rows for either venue, so the conformance replay failed
there. Every site is the device's own blend, which the native-arithmetic contract makes the
answer, so each gets a row: 59 scoped `NVIDIA GeForce RTX 3090`, with answers equal to the
RTX 5080 Laptop's rows (no venue pattern covers those two without the RTX 2080, which no run
here measured), and 62 scoped `Iris(R) Xe`. docs/CONFORMANCE-COVERAGE.md is re-derived for them.
How the sites were shown to be the device's blend, by a measurement build (not committed) that
read every stored code back and set it beside plain float models of the blend:
- The `one-zero`, `min` and `max` sites store the source or the destination through the
attachment alone, and store Metal's codes on both devices, so both operands reach the blend
exact.
- RTX 3090 (NVIDIA 620.70.06): the exact blend rounded once to the attachment's precision gives
98.0% of the 16-bit words and 98.7% of the 32-bit ones. Into a 16-bit target the blend colour is
truncated to `half`; the runtime hands vkCmdSetBlendConstants Metal's float colour unchanged, so
the truncation is the device's. Every word that differs from Metal's is within 1.01 ulps of
that model at the largest operand's magnitude. A -0 + +0 sum stores -0, which is the 32768 and
2147483648 of the zero-1msa and sas-1msa rows.
- Iris Xe (Mesa 26.2.6): the float blend truncated toward zero into a 16-bit target gives 97.6% of
those words. The exact blend rounded to nearest gives every 32-bit word.
- On both devices every differing word is within two ulps of Metal's at the largest operand's
magnitude. That is inside the bound of the `half-output-fast-math-blend` precision note (three
half ulps, two float ulps). The note is announced on both devices: the cases' allowance for it
fired on all six cases (3090: 12 of 12 allowances fired; Iris: 6 of 12, the six silent ones are
shared-in-system-memory, which an integrated GPU does not announce).
Verified:
- conformance replay of the six cases exits 0, each run holding one GPU: ms01 RTX 3090
m3-max-41210, ms01 Iris Xe m3-max-41211, um870 RTX 3090 m3-max-41218.
- cargo nextest run -p metal2vulkan-conformance --all-features: 1043 passed (m3-max-41208).
The first run, before the document was re-derived, failed only
the_conformance_coverage_document_is_what_the_sources_derive (m3-max-41199).
- Measurements: m3-max-41151, 41171 and 41176 (um870 3090), 41174 (ms01 3090), 41175 (Iris).
These ran at tree 9326ca7fd8, which this commit's tree equals.
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 new runtime's form: pointers are device addresses used directly and a texture's or sampler's
handle is its gpuResourceID (docs/RESOURCE-ID.md). The variants come beside the old domains,
which stay until the cutover; nothing lowers under them yet.
- PointerDomain::Identity and HandleDomain::Identity.
- Device::new refuses one identity domain without the other (InvalidDescriptor) and the identity
domains on a device without bufferDeviceAddress and shaderInt64 (Unsupported{IdentityDomains},
naming both features as one alternative).
- A compile under the identity domains is Unsupported{IdentityDomains}, not implemented, at the
start of analysis, so no old form is ever emitted under them. Later steps lift it as the
lowering lands.
- The profile fingerprint covers the domains (tested).
- docs/API.md's policy section names the domains; docs/REFUSALS.md and the reach table carry the
new refusal; api_signatures regenerated.
Verified (this commit's tree, rebased with the ledger commit before it onto b216007f0a):
- msi 41071: clippy -p metal2vulkan --all-targets --all-features -D warnings, rustdoc -D warnings,
nextest -p metal2vulkan in full, 3,663 of 3,663 (the golden table included: no cell moved; the
new test the_identity_domains_come_as_a_pair_on_a_device_with_addresses among them).
- msi 41072: clippy under --cfg m2v_gpu and --cfg m2v_cpu_icd.
- msi 41073: the conformance crate's ledger tests, 7 of 7.
A play of one recorded stream on a 780M with an empty translation cache and an empty Mesa
cache (m3-max-41100, at a8ad095897) recorded 2523 dispatches, 71967 draws, 28321 render passes
and 8503 submissions; the two warm plays after it recorded 2079, 71742, 27871 and 7036. The
stream's counts were equal in all three, every group and frame line (0 of 7932 differ); the
executed counts differ in 285 lines cold against warm and in 11 between the two warm plays.
So cold caches change the totals, not only where a few draws land, and the spec now says so.
Each report line (completed group, frame, total) now holds two sets of counts. `stream`: the
calls played, the command buffers committed, the encoders made, the draws and dispatches their
calls issued, and the player's own relocated, misaligned and written counts, all fixed by the
stream, so equal on every play on any runtime. `executed`: the runtime's counters (for the old
runtime, the Vulkan commands it recorded and the pipelines it made). The separate `calls N` line
goes: the total's stream calls are the calls played.
Why: the old runtime's executed counts are not repeatable at one tip. Seven plays of one
recorded stream on a 780M at one tip gave equal totals, but in some plays a few draws (with
their barriers) moved from one group to a group 15 later, and once from one frame to the next.
The moving groups are the ones that make a pipeline, and they differ in `draws_unkept_making`
(2 against 1): draws recorded through a pipeline's general form while its own was still being
made on the runtime's pool, which keep nothing to draw again
(metal2vulkan-runtime's pipeline/render/residual.rs). Where a background making lands is
timing. The commits, submissions per group and the player's waits did not differ. The matrix
compares the stream's counts only.
Step (c) of the new runtime's compute core.
What:
- CommandQueue (newCommandQueueWithMaxCommandBufferCount:, its bound on uncompleted command
buffers), CommandBuffer (enqueue, commit, handlers, waits, status, error), Event and
SharedEvent (signaled_value, set_signaled_value, wait_until_signaled_value,
notify_listener).
- A command buffer records at once into segments split at event waits and signals. The submit
thread holds a segment whose waits are not met, and its queue behind it, while the segments
before it run (reims F1). A wait the host's value meets submits no semaphore wait; a GPU
signal not above the highest value submitted or set is left out, so the semaphore only rises.
- The completion thread retires by a progress semaphore, follows submitted event signals (a
listener runs at a mid-buffer signal, reims F2), runs handlers with no lock held, and is
woken through a host-signalled timeline semaphore only when a wait needs it.
- A command buffer keeps each block it uses until it retires. A zeroed Private buffer's fill is
an upload submitted ahead of every later commit, whose segments start with a barrier; each
segment ends with a barrier to the host.
- Device::quiesce(timeout) (F9), with every wait bounded, no join of a thread still running, no
thread-local that exit() tears down, idempotent, freeing nothing; unmap runs on the caller for
every block handed out, once (a handed set replaces the per-idle flag).
- The last handle dropped in a handler: the completion thread finishes the teardown itself (F8).
- CommandQueue::abandon (F14); a loss ends held work, in-flight work once the device is idle,
host waits on pending signals, and later commits, with DeviceLost { in_flight } (F13).
- Refusals Committed, OtherDevice, NoCommandBuffers with their basis; Error::Quiesced;
docs/REFUSALS.md and the API signature table regenerated; the README's contract.
Verified: cargo fmt; refusal_surface --check. The compile and device jobs follow.
What: refusal_surface.py reads the new runtime's Error and makes a section of
docs/REFUSALS.md for each variant whose payload is one enum the runtime
declares: today Refused(Refusal) and Limit(Limit), and any family added later
(a Gap included) without a list of names to keep. Each of their variants
declares its basis, as Problem's do, and --check fails on one that does not.
The translator's Limit section no longer counts rt's Limit sites. A rustdoc
link [text](path) in a summary reads as its text; three existing rows lose a
link the file could not follow.
Why: AGENTS.md wants every new refusal in REFUSALS.md, and the scan of rt read
the floor's Missing only, so EmptyBuffer, BufferPastBlock, BlockLen and
BlockIds were missing. Their basis lines cite the M3 Max measurements the old
runtime records for the same answers (newBufferWithLength:0 and a placement
past the heap's end answer nil), the device's limits, and our 32-bit numbers.
How verified: the script regenerates, --check and --selftest pass locally;
the refusal_surface test runs in the compile job.
A no-copy buffer plays as a buffer of its length (its host memory is not in the stream), and the
runtime refuses option bit 24 on such a buffer, as Metal ends the process there; b2 stopped at
its 354th call on one. The bit is dropped for a no-copy buffer alone, so the replay keeps the GPU
writes Metal drops from that memory; the spec says so. A heap keeps the bit, which the runtime
takes.
Found by the b2 play on gem10's 780M (job m3-max-40908).
The recorder renames a placement on a block (newBufferWithLength:options:offset:) and keeps its
receiver, the block; the backend took it on the device, and b2 stopped at its 88th call. A no-copy
buffer, [nil, length, options, nil], plays as a buffer of that length.
Found by the b2 play on gem10's 780M (job m3-max-40905).
The stopping call is the one after the count: on a long stream the selector alone does not say
where the play stopped.
Verified by the unit test of a refused selector (the count stops before it).
The spec and the player follow what the recorder writes (reims-vgpu bec103226; b2 was recorded
at 50fc14009, the same format but for refused guest-RAM copies): structs and descriptors are maps
keyed by the recorder's camelCase field names, nil for an unset optional field; f32 values are
f64; descriptors Metal makes as objects (texture and render pass descriptors) are platform
records changed by setter records; a drawable never seen made is a texture of its descriptor;
the host's plumbing (padded, exportable and dma-buf buffers, an unshared queue) plays as the plain
Metal call it stands for; the host's scheduling records play as nothing; no call answers a
resource ID, and a descriptor's resource index places its object.
The guest-RAM copies are [buffer, [[byte, data], ...]] in and [buffer, [[byte, [start, end]],
...]] out. m2v.copyBytes:toBuffer:offset: and m2v.copyToHost: are gone: the host has no such
methods. The gpuResourceID answer check and PlayError::ResourceId are gone with the answers.
The old runtime's backend becomes a module: argument and map readers (args), descriptors
(texture, render pass setters, render and compute pipelines, depth-stencil, sampler, buffer and
heap descriptors, function constants and descriptors, surface planes), and the command buffer,
compute, blit and render encoders' calls. Each mapping follows how the host's platform applies the
recorded value to the runtime.
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 translator declared a `half` color output with 16-bit float lanes where the device enabled
storageInputOutput16 and shaderFloat16: a second form chosen by a query that is not one of the four
the owner's rule 2 allows (the 3090, 2080, RX 550 and lavapipe lack it; MoltenVK, RADV and ANV
have it). Every interface variable is now 32-bit on every device: a `half` output is widened to
`float`, which holds every `half` exactly, and no module needs StorageInputOutput16.
- lower::stage_io: plan::half_variable, IoObject::User::half and the 16-bit store are gone, and
io_elem takes no width. StageIo::half_outputs and the profile's input_output_16bit are gone;
the link contract checks 32-bit float lanes only.
- SEMANTICS_VERSION 2145 and ARTIFACT_FORMAT_VERSION 527 (the artifact codec lost a field). The
golden table needs its re-bless on development: every profile's key moved with the profile's
lost field.
- The HalfOutputPrecision and HalfOutputFastMathBlend notes, docs/API.md's degrade catalogue,
docs/FAST-PATHS.md and the half-output-blends conformance case say what the device receives
now; their statements about the 16-bit form are gone.
- known-gaps.tsv: 52 rows for MoltenVK on the Apple M3 Max. With the 16-bit output MoltenVK stored
Metal's codes at every word of half-output-blends-*; with the `float` output its blend is the
device's own (half-output-fast-math-blend) at 17, 17 and 18 sites of the R16Float, RG16Float and
RGBA16Float cases, largest differences 1 to 1,582 codes at the stored value (the blend-colour
sites the largest). Its 32-bit float cases still store Metal's codes.
Verified (code at c55bc28e43, ledger rows added at 2754676210, this commit's tree):
- msi 40877: clippy -p metal2vulkan --all-targets --all-features -D warnings, rustdoc
-D warnings, nextest -p metal2vulkan in full: 3,661 of 3,662 pass; the one failure is
golden_hashes_match_the_table (every profile's key moved), for the re-bless on development.
- msi 40827: clippy under --cfg m2v_gpu and --cfg m2v_cpu_icd.
- XTX (RADV NAVI31) 40843: runtime_lane color_writes (every `half`, NaN and infinity included),
half_output_blends and extended_range_blends, 16 of 16 pass; the conformance replay of the six
half-output-blends cases exits 0 against the RADV rows, so every row's count and largest
difference held.
- RTX 3090 (ms01) 40844: the same 16 lanes pass; the replay's 59 divergent sites are exactly the
RTX 5080's 59 rows (the ledger holds no 3090 rows; NVIDIA never had the 16-bit form).
- M3 Max on MoltenVK: 40833 before the rows (52 new gaps, all in the 16-bit float cases), 40862
with them (exit 0, every count held on the second run).
- msi 40875: the conformance crate's ledger tests, 7 of 7.
Under the identity binding domains a guest computes a texture's or sampler's gpuResourceID itself,
with no round trip: the index the consumer grants in the low 32 bits and a word in the high 32 bits
that is a pure function of the Metal descriptor. The guest's port needs the word specified and a
file of vectors both sides check.
- metal::resource_word::TextureWord::of(pixel_format, swizzle): bits 0-11 Metal's border texels
after the swizzle (the existing border_texels rule), bit 12 the out-of-bounds alpha of a format
without alpha, bits 16-31 the MTLPixelFormat raw value, so a texture's word is never 0. None for
the placeholders and the formats the translator holds no texture of or only copies.
- The sampler word is the existing SamplerWord, unchanged.
- docs/RESOURCE-ID.md: the ID's layout, the index classes (0 nil; storage-capable textures 1 to
4,095, valid in both arrays; other textures 4,096 to 65,535; samplers 1 to 3,999), both words'
bits and the level rule, and the vectors file. README's documentation table lists it.
- crates/metal2vulkan/tests/resource_words.tsv: 392 vectors (every pixel format with a word under
the default swizzle, each channel of seven formats from each other source, every sampler field
through its values, the level clamps around the points the nearest level turns at, and one
descriptor with every field changed). tests/resource_words.rs recomputes every line through the
public API and holds the file equal to what the generator writes; an ignored test blesses it.
- api_surface lists the new module; api_signatures regenerated.
Verified:
- msi job 40810 at the same tree: clippy -p metal2vulkan --all-targets --all-features -D warnings,
rustdoc -D warnings, nextest 18 of 18 (resource_words, the TextureWord unit test, api_surface,
api_signatures).
- msi job 40811 at the same tree: clippy under --cfg m2v_gpu and --cfg m2v_cpu_icd.
- msi job 40809: the bless test wrote the vectors; the combined sampler line (0x58f6ab53) and the
A8Unorm and R8Unorm texture lines checked by hand against the bit tables.
The recorder writes the host's copies between the guest's RAM and a buffer as blit-encoder
records: m2v.copyFromGuestRam ([runs, buffer, offset, data]), m2v.copyFromGuestRamAt ([placed runs,
buffer, data]) and m2v.copyToGuestRam ([buffer, placed runs]), a run being [start, end] host
addresses of which only the length counts. docs/REPLAY-STREAM.md names them, with the data the
next recording carries. The player relocates the data of every upload (these two and
m2v.copyBytes:toBuffer:offset:) by one rule, where its buffer answered a gpuAddress, and counts its
bytes as written; the old runtime's backend copies them through a staging buffer, piece by piece,
and copies m2v.copyToGuestRam into host memory nothing reads.
m2v.present is now recorded wherever the device's display shows a guest present, a nil texture
where the stream never made it, so frames are counted once: the player closes the frame and
reads nothing (a readback per frame would add a copy Metal does not make).
Tests: a unit test plays the three copy-ins into a block and an addressless buffer (relocated,
counted apart 4 past 8, untouched) and refuses data of another length than its runs; a device
test lays a buffer out with a fill, both guest RAM copies, a fill copy and a copy back, and reads
it back as expected.
What: docs/REPLAY-STREAM.md specifies the binary replay stream (version 2): segments of records
(names, blobs by SHA-256 of the exact bytes, calls), tagged values, the address and resource-ID
model, CPU writes, surfaces before the platform cutover, commits, events and frames. The new
`replay` module of the validation crate holds its reader and writer, the address map, the player
(relocation of 8-byte-aligned address words in live recorded ranges, counting rewritten words and
the 4-mod-8 values it leaves; exact resource IDs; waits only for command buffers that can
complete, so one held on an event never stops another queue; counters per waited group, per frame
and in total, readbacks excluded; SHA-256 checks), and a backend over the old runtime's public API
(compute and blit encoders, blocks as placement heaps, textures at recorded IDs, events). A
selector it does not play is a typed refusal naming it.
`command-replay` now plays and dumps v2 streams; the v1 JSON manifest runner is deleted (nothing
in the tree or the lanes used it).
Tests: unit tests write their own streams (round trip, segments and a cut tail, refused kinds and
versions, the blob directory and its hash check, nested ranges, relocation counts, event-held
command buffers, frames, releases and host splits). Device tests (`runtime_lane::replay_streams`,
under m2v_gpu or m2v_cpu_icd) play written streams on the old runtime: a device pointer written
at a recorded block address is relocated and the kernel's output is the case's Metal output, on
two devices alike; a command buffer held on a CPU-set shared event does not stop another queue's;
textures are made at recorded resource IDs 77 and 5 and read back as written.