Every venue run refuses the same 45 places of the 77 sampleRateShading cases on rt, and the
ledger listed none of them. memory2's every-stream census 11-19 (all 17 matrix streams on player
db1d5c1929, every dump complete; m3-max-51200 to 51246) counts the three paths rt does not build,
so their rows take "refused: no stream uses it yet" with that census, each followed by its facts:
- 28 extended-range rows (BGRA10_XR, BGRA10_XR_sRGB, BGR10_XR, BGR10_XR_sRGB, the XR10 two-plane
and its sRGB): no stream makes an extended-range texture, and no drawable or layer has one. The
translator holds each raw in an integer format (FormatEmulation::ExtendedRange) and rt's texture
refuses that emulation before the device's format query is asked;
- 12 rows of a plane of a 3D texture as an attachment: no stream attaches a 3D texture or sets a
depthPlane; rt's render pass refuses the texture type and its descriptor has no depthPlane;
- 2 resolve rows: no stream sets a resolveTexture or a resolving store action; rt builds no
resolve.
One extended-range-family row, xr-unwritten-rgb10a2unorm-srgb-no-fragment, names
MTLPixelFormatRGB10A2Unorm_sRGB, which is no public Metal format and which the census does not
count, so its row keeps its facts as words. The off-alignment bind's row quotes Metal's own API
validation, which refuses the bind (the recording's validated fact), and the dispatchType getter's
row is the consumer's own (dispatchType).
Verified at this commit: cargo fmt only; the ledger check and the rt lavapipe replay run in the
lane's check job.
The rows of a runtime's own run after the creation workloads, and only
with the authored workloads; the command's docs now say so beside the
creation workloads', and that a runtime without the row prints "not
compared". Documentation only.
The suite's two timing records read noise in the parallel nextest run. The
planner ruled that their timing moves to harness rows, which run alone,
and that each test keeps its functional part.
- Harness: a row of one runtime's own (authored::OWN_ROWS, OwnRow).
- It runs calls with no Metal counterpart through a new Device::own_row,
on a device of its own on the session's GPU, and checks what it
measured before it reports.
- A runtime without the row answers None and prints "not compared".
That is the old runtime for every row, so the plumbing is general,
not a case for these rows.
- Rows run after the creation rows, are selected by --only/--skip like
any workload, and print their times as
M2V-MATRIX time harness-<runtime>/<row>/<what>. A failed check prints
M2V-FAILED harness-<runtime>/<row>, which fails the leg
(results.py's HARNESS_FAILED).
- idle_frees and idle_frees_under_commits are judged absolute, per the
planner's ruling: a free that began 25 ms or more past its allocation's
idle age fails the row.
- The count is rt's public Metrics::idle_frees_by_age: its 250-275 ms
bucket is on time, every other bucket fails.
- A small block held to the end keeps every allocation weighed, so none
is kept as the reserve.
- Without commits, four 16 MiB blocks are given back 150 ms apart. With
a commit every 2 ms, two are given back, the second once the first's
free ended. Either way no free waits for another, so each is measured
alone.
- These rows record no time, so no ratio or cross-GPU rule reads them.
- export_submit_cost uses rt's public calls only: new_exported_block
(the first handle the device takes), raw, with_present_queue.
- It times vkQueueSubmit2 of one command buffer recording a global
barrier, waited for by a fence, in 3 rounds of 200 with no export and
with 64 live.
- It records the medians, none and exports_64, in us. The matrix judges
them as a cross-GPU outlier, as any time of one runtime; with no old
row there is no budget.
- rt suite:
- memory.rs's two idle tests keep every check of order and age, and
print no time record; assert_freed_at_the_idle_age returns nothing.
- export.rs's exported_blocks_submit_cost becomes
every_device_submits_beside_64_live_exports: the same submissions,
now under the validation layer and untimed, with the exports gauge
at 64 and back to 0 each round.
- validation.rs's doc drops the export test from the layer-less
instance's users.
- rt README names the harness rows where the idle age and the exports'
submission cost are described.
Unverified in this commit: no build yet.
What: the identity domains (the new runtime's) now lower kernels with no lockstep order, which
changes what a cached translation holds and the artifact facts it encodes (the one-row facts are
gone), so both versions rise: SEMANTICS_VERSION 2189 -> 2190 and ARTIFACT_FORMAT_VERSION 546 -> 547.
These are this change's only version bumps; development's 2189 (the alpha test reference) and 546
stay below them. RUNTIME_VERSION stays at development's 2539.
The old runtime's render descriptor key covers SEMANTICS_VERSION (through each stage's
function_compile_key), so the_old_render_descriptor_key_keeps_its_value pins the key these
versions give: 9a3ee09e..., the left side job 51531 printed at the same versions (792f520713, this
change on 90792a2bfa). The fixture's bytes are unchanged.
Verified: cargo fmt; signatures.py --bless, refusal_surface.py and coverage.py --check give no
diff on 951b93a645. The check job named at hand-over compiles it and runs the suites.
f28e9b3060 took the one-row variant out of Compiled::new, but the device tests' constructor
(ComputePipelineState::for_test, compiled only under m2v_gpu or m2v_cpu_icd) still passed a
(kernel, variant) pair, so clippy and the device test builds under either cfg failed to compile
it (E0308). It now passes the kernel alone.
Verified: job 49928 (msi, f28e9b3060 + a33dcf4fed) showed the E0308 at pipeline.rs:1187 in
clippy-gpu, clippy-cpu and both device-test archive builds, and no other error; this commit's
own build is the next check job.
What: under the identity domains (the new runtime's profile) the translator no longer inserts the
barriers that make Apple's SIMD-group lockstep explicit (`lockstep::order`): `OrderKey::of` is
`None` there and `ordered_entry` takes the specialized entry as it is. The resident-table domains
(the old runtime's) keep the order until the cutover. With no lockstep barrier on the new
runtime's path, its one-row machinery is dead and deleted: `Compiled::rows`, `pipeline::one_row`,
`encoder::Module::Rows`, `keeps_rows` and `choose`'s `rows`, the `OneRow` and `RowLockstep` arms,
and the translator's `CompiledFunction::runs_lockstep_barriers_in_rows` with
`KernelFacts::lockstep_in_rows` (the API signature table; the version numbers rise in the
branch's last commit).
Why: documented Metal orders the threads of a SIMD-group only through barriers and atomics; the
Metal Shading Language calls two of them that conflict between barriers a data race. The order was
an emulation of undocumented Apple-GPU behaviour (owner's rule 1). Its barriers made 1,443 of 5,368
distinct kernels of the recorded streams observe their threadgroup partition, every pair of them
unproven, and they stopped partial-threadgroup dispatches the variant cannot run (rt's frame-320 and
frame-335 refusals of the 30-wide kernels). docs/API.md's accepted differences gain one entry, the
conformance case `simdgroup_lockstep` leaves its output words unchecked against it, and
CONFORMANCE-COVERAGE.md and REFUSALS.md are regenerated.
Tests: the identity-profile one-row test becomes `the_identity_domains_order_no_lockstep_pair`
(barriers under the default domains, none under the identity domains, the partial variant in
tiles); the harness's cells test keeps the old domains' one-row facts and adds the identity
domains' none; rt's one-row tests and the row-lockstep tree test go, and `row_cells` runs every grid
on its tiles' pipeline made with the state.
Verified: cargo fmt; coverage.py and refusal_surface.py regenerated. Clippy and the suites run on
the check job named when the branch is handed over.
tests::queue_share_device::a_later_queue_s_command_buffer_takes_its_turn_ahead_of_another_queue_s_burst
holds each of a burst's command buffers to a submission at most 20 ms after the GPU end of the
one before it: a bound other test processes' GPU and CPU work spends. On lavapipe on msi-laptop,
beside two other build and test jobs, the burst's eighth missed it (m3-max-51548, development
951b93a645); the same 64-test set on an idle node passed 3 runs of 3 (m3-max-51697). It joins
the override that already runs the file's other GPU-time-bound tests alone. The frozen crate is
unchanged; the override goes with it at the cutover. No other test in the file carries the bound.
The 2 GiB cap gap's Gen12 sentence named rows and an instruction count. It now says only what the
Iris Xe's probes measured:
- The form's median over the harness's 38 workloads is +0.03%. Three rows are up: alu and long_4cb
14%, image_filter 7.6%. Three are down: zero_products 18%, vote_loop 9%, frame_5cb 7%.
- A change in the code that runs before an otherwise identical loop moves the kernel by -18% to
+14%. The mechanism is not shown, and the probes ruled out four causes:
- Placement: with ANV's instruction compaction off, every loop moves in memory and the gaps hold
within 0.15 points.
- Instruction count: a neutral arm (the sign-extended form plus live instructions before the loop
that touch no address) times at the base's speed in every row.
- The thread payload: the pushed registers and the push ranges are the same in both forms, and
the one pulled load is the same.
- Register numbers: the neutral arm's loop registers are shifted and it times at 0.0%.
- zero_products has the same three bias instructions before its loop as fma_chains, so one change
moves kernels in both directions.
Verified: the A/B rows are from the Iris leg; the ISA comparisons are from INTEL_DEBUG=cs dumps of
both forms and the neutral arm, with the driver's shader cache off; the timings were taken with
compaction on and off. The README is in no crate's rustdoc. The one test that reads it (rt's floor
test) reads its "## Floor" section, which this does not touch.
The planner ruled create_64MiB/first_take 2.30 and create_64MiB/device_first 2.14 on 10de:1e87,
from the medians of the alternated run m3-max-51634 (base 7cda47f536 and head 296e110c0f, the
higher of the two): the driver's own allocation of 64 MiB of host-visible system memory takes
about 12.5 ms where the old runtime imports pages it mapped itself in about 5.8 (m3-max-48212),
and it stays the driver's memory because an import as the allocator costs every submission on
every AMD card. row_limit applies HARNESS_BUDGET on top, as for the 1.40 lines. The 3090 has
no line yet: it takes one from its own rows.
A host can give each process a wall-time level of its own. On the RTX 3090 at homelab-um870-1,
sampling_deep_4x16x252 took about 37 or about 80 us a run, one level a process, at equal GPU
time and CPU instructions, and the old runtime drew the levels as well (rounds b0c08e51b5,
7cda47f536 and 6b535f55c9). The outlier's second pass is already a fresh job, so a fresh
process, but two passes both landed high in 6b535f55c9 and failed the leg on a level the code
does not set: m3-max-51629 timed the row in 39 processes over every commit of the range at 36.8
to 40.0 us.
Now the second pass of a leg with a harness row's cross-GPU outlier also runs each such row
(results.alone_rows, at most RETIME_ROWS, the furthest out first) alone in RETIME_PAIRS pairs,
old then new, then new then old, every process on a fresh driver cache and store, its times kept
as harness-alone/<row>/<pair>/<runtime>. time_outliers judges a row out in both passes by the
lowest of the new runtime's samples (both passes and the alone runs) over the lowest the base
recorded of it: still out, it fails, "high in every process"; brought back, it is parked with
every sample, "levels, no verdict", so a high level grown more frequent stays visible. The alone
keys are never judged on their own. GPU-time rows and counts are unchanged; no ceiling moves.
Verified: python3 test_matrix.py and test_results.py (potluck job named in the landing).
The landed packet changed a runtime-sources input, so the committed digest no
longer described the sources and `the_runtime_sources_are_the_committed_ones`
would fail. Recomputed over the same inputs and committed by land-pkt.sh.
The rung-1 A/B of the compute harness on the Iris Xe (ms01, Mesa's ANV; job 51485: base 6ddf59304d
against the biased form fad6e01c28, --runtime new --runs 100, two rounds of each arm) measured
image_filter +7.56% (1139.3 -> 1225.4 us, base rounds 0.2% apart), alu +14.02% and long_4cb
+14.35% (both the fma_chains kernel, base rounds 0.0% apart), zero_products -17.95% and
vote_loop -8.90%; the median +0.03%. INTEL_DEBUG=cs of binomial3x3 (image_filter): SIMD16 both,
268 instructions (base) against 261 (biased), the same 12 sends, 10 asr gone and the add count
equal (69): on Gen12 the bias is no extra instruction, so the UHD 630 sentence's cause (one more
add) is stated as inferred for Gen9 only, and Gen12's times stand on their own line, cause not
stated.
Three failures of the landed biased slot word (development's suite, job 51276):
- engine_identity::the_binders_edge_regions_set_multi_region_on_from_queries_and_store_metals_grid
trapped out of bounds at 0x6_8000_0000: the translator's own binder
(BindingPlan::instantiate_*) still wrote SlotGuestBase as gpu_address + offset, while a
pipeline compiled under the identity domains adds 2^31 back to that word. This was a code bug in
the landed change. rt was not affected: it writes its own push (pipeline::address_word) and does
not use the binder. The binder now writes the word less 2^31 (bind::instantiate::guest_word)
wherever the plan's device compiles under the identity domains. The flag is
ResourceTemplate::biased_slot_words, set by the compute and render planners. All three writers
read it: slot_field, the render rebind's bases and its loose words. RUNTIME_VERSION
2538 -> 2539: a run of an unchanged plan pushes another word under the identity domains. The
runtime sources' pin moves with the binder's files.
- engine_identity::a_slot_pointer_used_as_a_value_is_its_metal_address was refused at compile
(Unsupported{IdentityDomains}, not implemented). Its ptrtoint makes the slot pointer a wide
pointer, which reads the root table, a push field identity_admits does not admit. The refusal
is the test's premise, not the bias: select and the plan are unchanged by the bias. The test
now covers two address compares and two loads, one 4 bytes below a bind address, with the two
slots on either side of 2^31: their words lie on either side of 0, so a compare of the words
would answer the other way. A new test,
a_slot_pointer_converted_to_an_integer_is_refused_under_the_identity_domains, pins the ptrtoint
refusal on both profiles, where the default domains compile the kernel. docs/API.md section 5
says so; it no longer claims that a converted pointer reads the bias back.
- pipeline::compile::tests::the_old_render_descriptor_key_keeps_its_value: the key moved only
because SEMANTICS_VERSION and ARTIFACT_FORMAT_VERSION moved (2186/544 -> 2188/546); the
fixture's bytes are unchanged. Re-pinned to the value job 51276 computed.
The getters a state rt makes can answer (the planner's ruling).
supportIndirectCommandBuffers is false on every state rt makes, compute and
render: a descriptor that asks for indirect command buffers is refused at the
making (Gap::IndirectCommandBuffers). A compute state's
requiredThreadsPerThreadgroup is its descriptor's size, [0, 0, 0] where it set
none, as Metal answers in the M3 recordings pipeline-facts-compute-plain and
pipeline-facts-compute-described (Apple M3 Max, macOS 27.0.1): kept in the
content's Answers, whose key already holds the size. rt makes no tile render
state, so the two tile getters are not added.
state_answers asserts both on block_scan and sample_down without a size and on
block_scan at 256 (its harness size), and the render state's false. README and
the API signature table updated. Verified: build and device legs follow.
79ca4826ba's device test failed at the state's making on every GPU (legs
m3-max-51395, 51397, 51398): "the translator made no pipeline: unsupported:
IdentityDomains; needs NotImplemented". Under the identity domains, rt's,
lower::select's identity_admits admits only the push fields it lists, and
PushField::AlphaTestReference was not among them; so alpha-test states were
refused by the translator before rt's draws() mapping (which also refused
them) was reached. The read before 79ca4826ba named only draws(); both
refused at the making, so nothing drew wrong.
identity_admits now admits the field: a fragment function under the private
alpha test reads the encoder's reference code from the push window, which rt
fills (FieldValue::AlphaTestReference). Only the identity domains read this
list; the old runtime's binder already fills the field. SEMANTICS_VERSION
2186 -> 2187: a refusal becomes a module under an unchanged key.
79ca4826ba also moved the validation crate's runtime sources hash: it made
bind::alpha_test_code public and documented it (bind/graphics.rs, bind/mod.rs),
which changes no run's behaviour, so the hash alone moves, to
b7be4e58fa981d0d49c20688074a720f6aea24df67a5035ae3e3cadefac5b317 (computed by
the build script's rule over the same 612 inputs; the rule reproduces the
committed 476509a9... at 7c982be9e6). Verified by the next build (the runtime
guard test among its steps) and device legs.
A gap against the old runtime. rt refused every render state whose fragment
runs the private alpha test (PrivateRenderState::alpha_test_enabled with a
compare function other than Never or Always): the translator pushes
PushField::AlphaTestReference there, and render.rs draws() mapped no value for
it, so new_render_pipeline_state answered Gap::RenderPipeline { DrawInput }.
Nothing drew against an unfilled push word; Never and Always states, which read
no reference, were made and drew right.
Now RenderCommandEncoder::set_alpha_test_reference_value(f32) (Apple's
setAlphaTestReferenceValue: SPI) keeps the reference's 8-bit unorm code in the
encoder's state, Metal's 1 until set, not kept across encoders (the old
runtime's rule, from probes on an Apple M3 Max, macOS 27.0.1); draws() maps the
field to FieldValue::AlphaTestReference, and a draw pushes the code. A change of
code refills the push bytes; an equal one records nothing new. The code is the
translator's: bind::alpha_test_code, now public (api_surface row, docs/API.md
line), so rt and the binder compare as Metal does through one function.
Test: tests::alpha_test draws green at alpha 0.6 (code 153) under Greater, one
quadrant a draw through scissor rectangles: the default reference and 0.75
keep the clear, 0.25 (held across draws) draws, and a second encoder starts at
1 again (its whole-target draw changes nothing) until 0 draws. README and the
API signature table updated.
Verified: build and device legs follow.
Metal's answers (an Apple M3 Max, macOS 27.0.1, job m3-max-51288, record and
times in one job): every word stays as it was in both passes, the pass with no
mode and the pass with Disabled at both words, under Reset (0xaa bytes) and
under Accumulate ([100, 7]), as the lane table in cases/visibility.rs states.
docs/CONFORMANCE-COVERAGE.md regenerated.
The two tessellation streams' render passes set a visibility result buffer and
enable no mode; rt skipped every such encoder (Unheld(visibilityResultBuffer)).
On an Apple M3 Max (macOS 27.0.1, job m3-max-51220) a pass with the buffer and
no mode leaves the buffer's bytes as they were under Reset and under Accumulate,
so the planner's minimal form is exact and carries no note.
- RenderPassDescriptor.visibility_result_buffer: checked for its device
(Refusal::OtherDevice) and kept by the command buffer until it retires, as
Metal's pass holds it. It declares no access and joins no hazard set: no
command of the pass reaches it.
- RenderCommandEncoder::set_visibility_result_mode: Disabled at any offset is a
no-op; Boolean and Counting are Gap::Draw of the new DrawKind::VisibilityResults.
- visibilityResultType is not a field: it decides only what an enabled mode
writes.
- Device test: the pass draws, the buffer's gauge holds after the test's handle
is gone and falls once the command buffer retires, its bytes are unchanged,
and the pass takes the submissions, barriers and passes of one without it.
- Conformance: the rt side passes the buffer and the mode; new cases
visibility-disabled-reset and visibility-disabled-accumulate (no mode in one
pass, Disabled at both words in the next); recordings follow from the M3.
- Player: setPass's visibilityResultBuffer goes into the new field (a skipped
buffer still marks the pass unheld).
- rt README, api_signatures and docs/REFUSALS.md regenerated.
Verified: cargo fmt only so far; builds, clippy and device legs follow as
potluck jobs.
Development's Texture::replace_region takes HostBytes since 50e6b0fcf5; the surface form's CPU
write passed a slice (E0308, identity's build 51328 of the surface form on development). The
slice goes in as the runtime's host bytes, as development's other callers pass it.
Verified: to be built by the check job on development's base.
681a736c40 added surface_refill_bytes and surface_refill_gpu_nanos and the longest refill
command buffer on the surfaces line; the doc's list of the counters now names them and says
which frame a refill's GPU time falls in. Doc only.
The video plays report each decoded picture's copies, their share of the play's GPU time and the
longest one: surface_refill_bytes and surface_refill_gpu_nanos count the bytes the refills at
m2v.externalWriteDone copied and the GPU time of their command buffers, read as each completes
(at the frame's counters), and the surfaces line gives the longest command buffer. A surface
texture's entry is found by its shape with find (shapes are one an entry per range), not as the
last of a filter.
Verified: to be built by the check job.
The rt backend played newTextureWithDescriptor:iosurface:plane: as a substitute, an ordinary
texture whose texels are undefined, so two textures over one surface shared nothing and the
3090 chain's rt plays varied where the old arm, which plays the texture over its receiver
buffer, repeated.
It now plays it as the product makes it: one Device::new_texture_for_views texture (an entry)
per receiver range (receiver buffer, plane, offset, bytesPerRow) and shape (width, height,
bytes a texel), with shader read and write, render-target and pixel-format-view usage, and
every recorded surface texture a view of it at the texture's own index. The receiver buffer
holds the pages' bytes as the stream writes them:
- a new entry is filled from the buffer by a blit in a command buffer of the backend's own,
committed at the making: after every earlier commit, with no wait;
- a new shape over a range first downloads the range's newest entry into the buffer at that
entry's extent, then fills the new entry, so bytes map by byte offset; an older shape's entry
goes once no texture of it lives and is not kept current, and the calls that name such a
texture after a newer shape are counted (surface_older_uses), argument buffers unseen;
- a copy from the guest's RAM into a range also copies the range into its newest entry, and a
copy back first copies the newest entry into the range, both in the copy's own blit encoder:
replace_region would land ahead of the encoders already in the command buffer, and get_bytes
would add a wait the old arm does not have;
- a recorded CPU write into a range uploads the texels it covers (replace_region) until the
buffer's first m2v.externalWriteDone, the new record of another API's write landing (a
decoded picture), which refills every entry of its buffer by a blit committed then; the old
backend plays that record as nothing;
- another call naming a receiver buffer as a buffer is refused, and a texture of a format that
reads across a surface's two planes is skipped (skipped_surfaces_across_planes).
The player leaves a receiver buffer's checks and snapshot ranges uncompared on every runtime
(verdict receiver, a receivers line), as the texels live apart from it; the rt backend reads a
texture back for a check, laid out as the old backend lays it out. The surface substitute key
goes; substitutes_read counts the tiled and gap substitutes (and their views) a call named, the
substitutes line naming the first, and the doc's claim that a substitute makes a play no gate
result, which no code made true, now says what holds. The surface record's keys move to args.rs,
shared by both backends.
Census before building (job 51225, gb-3090-r3): 653 entries made, none after an uncommitted
guest-RAM copy into their buffer, so a fill committed at the making misses no copy there.
Tests: the surfaces unit test (the texels a write reaches); the player's receiver test; the
device test of two formats over one surface, a new extent, a copy from the guest's RAM and an
older-extent use. To be run by the check job.
Check 51238 (d4a4482d8f): every build step 0, but RT_DEVICE 100: the late-quiesce test's drop
returned within half a second. The test held the submit thread in a scheduled handler, and a
committed command buffer's work holds the device until it retires (Device::quiesce's doc: what
the work held, the device among it), so the test's handles were not the last and nothing tore
down on the dropping thread. The test now holds the completion thread in a completed handler:
the command buffer has retired, its work holds no device handle, and the test's drop is the
last, the shape of a process that drops its device with a runtime thread still running.
Verified: to be run by the next check job's RT_DEVICE step.
5173050fe4's keep_threads borrowed four fields of the threads' guard mutably at once, each
through the guard's DerefMut: E0499 three times (check 51174, every build step). One
reborrow of the guard as the threads gives the four disjoint field borrows.
Verified: to be built by the next check job.
3ed8095758 made quiesce join every thread past its deadline. That made quiesce unbounded, which
breaks the exit contract (077c9722e3, 0071f33d2c, the README): after a false answer a thread can
still be in the driver, on NVIDIA the completion thread in an unbounded semaphore wait until a
later submission the runtime never makes, and a consumer calls quiesce with its bound from its
exit path for exactly that case. The exit-139 hazard is destruction under a live thread, and
quiesce destroys nothing.
Now, as on development, quiesce waits for each thread up to its deadline and joins one only once
it has ended; a thread past the deadline is left running and its handle kept (halt hands the left
threads back, Device::quiesce keeps them in Shared). The teardown, on whichever thread drops the
last handle, joins every runtime thread with no deadline before it destroys anything a thread can
reach: those its own stop waits for, and those a late quiesce left (join). A thread is never
joined by itself: the reaper running a teardown lets its own handle go and ends once it returns.
The late-quiesce upload test is restored as development has it (fa415d77ce undone): it states the
contract, a quiesce that answers at its deadline while host-held work keeps the GPU. The README's
quiesce section and Device::quiesce's doc are development's again, with one sentence each on the
teardown's join; bf561f5241's sentence is gone with them. The quiesce join test becomes the test
the fix needs: with the submit thread held in a scheduled handler, quiesce(0) answers false at
once and leaves it running; the last handle, dropped on another thread, has not returned half a
second later, the blocks live and the thread holds its slot; once the handler lets it go, the drop
returns and every gauge reads zero (every_device_dropped_after_a_late_quiesce_joins_the_late_thread_first,
under the validation layer as every device test).
Its first form (71a3018b7d) held the submit thread in a later command buffer's scheduled handler
while an earlier one's completed handler waited for it before dropping the last handle. Both
command buffers have nothing for the GPU, so the submit thread, reaching both in one pass, runs
the later one's scheduled handler before it ends the earlier one (submit.rs: scheduled handlers,
then end_all): the earlier never completed while the later held the thread, and the test timed
out in m3-max-51036 (RT_DEVICE=100, command.rs:2360). That order is the runtime's, not a defect.
The test now holds the completion thread in the earlier command buffer's completed handler and
drops the last handle in the later one's scheduled handler, on the submit thread: whichever order
the submit thread takes them in, the reaper's teardown waits for the completion thread. While it
is held, the completion thread and the reaper keep their thread slots, nothing is unmapped and
the blocks live; once it is let go, the reaper unmaps each allocation and every gauge reads zero.
After the join fix the timeout decides nothing but the answer. Nothing is cancelled at it: the
stop ends held work NotRun when it begins (core.work.stop), the submit thread submits what is
ready, and the GPU runs what was submitted to the end, which the completion thread retires before
the stop joins it (complete.rs stop). So a false answer outside a handler or a listener says only
that this took longer than the timeout; the call returns, as on true, once the GPU completed
everything submitted and every thread ended. The late-quiesce test's host-held busy work is
neither finished nor cancelled at the deadline, so the quiesce waits for it, and answers false.
every_device_frees_itself_after_a_quiesce_past_its_deadline called quiesce(100 ms) while host-held
busy work kept the GPU and opened the busy work only after quiesce returned: the old give-up
rule left the completion thread behind. A stop now joins every thread past its deadline, so
the quiesce waited for the completion thread, which waited for the GPU, which waited for the
test: the check jobs 50913 and 50950 sat in that test. The test now quiesces on its own thread
with a zero deadline, opens the busy work once the stop began (the core is closed), and asserts
the late answer; the completion thread retires the copy and ends before the quiesce returns.
The case the join fix left untested: a handler drops the device's last handle on a runtime
thread. Shared::drop hands the teardown to the reaper, which cannot join itself (finish answers
not joined for its own role) but joins the submit, block and completion threads with no deadline
before it unmaps the consumer's allocations. After the teardown returns, the reaper touches only
the core it still holds (its cache writes and the lowerings it marks), then drops its reference;
where that is the last, Core::drop frees the blocks and destroys the VkDevice on the reaper, which
then drops only its end marker and its thread slot in the counters, an Arc of their own. No use
after free, so no new mechanism.
The test holds the submit thread in a scheduled handler while a completed handler drops the last
handle: the drop returns, every thread keeps its slot, nothing is unmapped and the blocks live;
once released, the reaper unmaps each allocation and every gauge reads zero, the reaper's slot
last. To be run by the check job's RT_DEVICE step.
The stream carries no buffer access, so a buffer binding (set...Buffer...) or a useHeap: of the
object's heap counts as a write and takes a cover off. That errs toward comparing; a residual
difference in such an object's later compares may be the covering texture's bytes, not the
play's. The report's covered line now says how many covers a binding took off.
Verified: the covers unit test gains a fourth round (covered again, then bound) asserting
binding_uncovers 1 and the new line; to be run by its check job.
The known-gap line for the pool side's copy at commit wants the classes of the textures the
device's linear image does not take, per card; the report gave only their count. The backend now
keeps, for each texture over a buffer the runtime held in an image of its own (the gauge rose
across the making), its descriptor's pixel format and usage, and prints them, most first, on a
'textures over buffers in an image of their own, by pixel format and usage' line.
REPLAY-STREAM.md lists it.
Clippy (map_entry) refused contains_key then insert in Covers::issued; the entry API asks the
backend once per pipeline state and stage, as before. Found by check 50889 (CLIPPY=101 in all
three configurations; every other step 0).
The tessellation plays reported skipped_encoders=214 (and 205) with no kind, so whether a pass
met NoAttachment, a storage gap or a property the runtime's descriptor does not hold could not
be told from the report. The backend now keeps each skipped render encoder's kind with its count
and first frame and call, and prints `skipped render encoders KIND N, the first at frame F,
call C`: `ParallelRenderCommandEncoder`, `Unheld(KEYS)` for a pass whose descriptor sets
properties the runtime's does not hold, or the runtime's gap for the pass (Debug). The
skipped_encoders count is unchanged. REPLAY-STREAM.md lists the line.
A play's m2v-submit thread segfaulted about 1.5 s after the last commits, during the backend's
end(): an instruction fetch from an unmapped page, the report ended `ok` with no @drop gauges.
Whatever that run's trigger (it ran under a timing layer; a run without it shows whether it
recurs), the structure allowed it: halt() joined a thread only where it ended by the
deadline (finish()), and left a later one running unjoined. A later drop of the device found
the threads already taken, joined none, and went on to destroy the device and, with the core,
the instance, while that thread could still be in the driver or a layer.
Now finish() waits for the thread to end and joins it whether or not the deadline passed; the
deadline decides only the answer (in_time), and how long queued work may take before it
counts late. Nothing a live runtime thread can reach (the device, the instance, a queue) is
destroyed before that thread is joined. The one thread a stop cannot join is the one running
it (a handler's or the reaper's teardown), which ends once the call returns, as before.
The rule it replaces came with the queues and command buffers (077c9722e3: quiesce for a
process about to exit(), "every wait bounded, no join of a thread still running"); the real
case written down later (0071f33d2c, the README) is a GPU fault on NVIDIA's driver, whose
semaphore does not signal until a later submission, so the completion thread stays in
vkWaitSemaphores with no timeout. Under the new form, such a wedged wait keeps quiesce and the
device's drop from returning (a job timeout with the thread in the driver), which is accepted;
the README's quiesce section says so, as the known gap on NVIDIA, in place of the thread left
behind.
Test (tests::command, device): with the submit thread held in a scheduled handler past a zero
quiesce deadline, quiesce returns only after the handler lets it go, answers false, and none of
the device's four threads holds a slot of Gauges::threads by then
(every_device_joins_each_thread_past_a_quiesce_deadline_before_destroying_what_it_reaches).
Metal leaves an aliased resource's contents undefined once another resource is written over
its memory. In a placement heap, a texture write over a buffer's (or another texture's)
recorded range leaves the recording holding its runtime's layout of the texels there, and the
play its own (rt shares the memory as a placement heap does; the old arm makes the heap's
buffers and textures apart and keeps the bytes from before). identity's liveness pass over u4
(to frame 315) found 16,942 covers of a heap buffer's range by a heap texture write and no
read through a covered buffer before its next write or release: the bytes are dead, and a
compare of them is no verdict.
The player now tracks, by structure alone (covers.rs), each object the stream places in a
placement heap (its heap, recorded offset, and length: a buffer's own, a texture's as the
runtime answers its size, read ahead) and the texture writes: a draw's or dispatch's to the
texture slots its pipeline state's interface marks written (Backend::texture_writes; the new
runtime answers from ComputePipelineState / RenderPipelineState::texture_accesses, the old
runtime answers no slot access, so on it only the following count), a render pass's to every
texture its descriptor names, a blit's to its destination, generateMipmapsForTexture:, a
useResource:usage: with write usage and replaceRegion:. A write of a texture over a buffer is
the buffer's. A texture write covers the bytes of every other object placed in its heap that
its range meets; the object is written again by the player's writes into it (m2v.write,
contents at creation, copies from the guest's RAM, a snapshot's bytes before), a blit into it,
and, as the stream carries no buffer access, any binding of it to an encoder, a write-usage
useResource:usage: or a useHeap: of its heap. A check of a covered object reports `covered`
and a snapshot range meeting covered bytes `covered`, neither compared; a `covered N: ...`
line counts the covers and what they left out. REPLAY-STREAM.md says so, and says
gap_pipeline_ids is bookkeeping: nothing is skipped for it.
Test (replay::tests): a placement heap with a buffer and two textures at offset 0; a dispatch
whose state writes slot 0, which holds the first texture, covers the buffer and the second
texture; their checks are `covered`; the buffer written whole is compared again, the second
texture stays covered; a dispatch of a state that only reads the slot covers nothing.
e5848db6ae gave the texture no usage, which rt reads as Metal's unknown usage:
every usage, shader reads among them, so new_texture(&d, None) still answered
Refusal::TextureIndex { index: None } on all five GPUs (legs m3-max-51311,
51312 and 51315 at e5848db6ae). Its message's claim that sampling.rs's
no-index texture has no usage was wrong: that one is new_texture_for_views,
which takes no index whatever the usage. A RenderTarget texture has no shader
usage and so no index; replace_region and get_bytes need none. Verified by the
next build and legs.
The rung-1 A/B of the compute harness on the Intel UHD 630 (Windows), base 6ddf59304d against
this branch, --runtime new --runs 100, two rounds of each arm (job 51296), measured three of
38 workloads slower: image_filter +3.39% (base 3030.2/3031.8 us, branch 3133.4/3134.1 us),
dispatch_chain +2.55% and burst_160 +2.21%; the median moved +0.05%. The known gap on the 2 GiB
cap names them. The cause, one more 32-bit add per access that Gen9 does not fold into the
index's shift, is inferred: the Windows driver gives no ISA.
HawkPoint 780M at 4x the particle kernel's grid (measured, us per dispatch, best of forward and
reverse): the biased form 2630.2 against the zero-extended offset's 2632.5 at subgroup size 32,
1780.9 against 1781.7 at 64; the sign-extended form 2858.6 (8.7% slower) in the same job.
Under the identity domains a buffer slot aligned to its argument was reached as its pushed address
plus the access's 32-bit byte offset sign-extended to 64 bits. The sign extension is what keeps an
offset below the bind address exact, but a device cannot split a sign-extended offset into a
scalar base and a vector offset as it does a zero-extended one. Now rt pushes the slot's address
less 2^31, and an access adds its offset plus 2^31 (modulo 2^32) to that word, zero-extended. That
is the same address for every offset in [-2^31, 2^31), which the 2 GiB buffer cap guarantees, in
one 32-bit add that a device fuses with the index's shift. A unit index x + c with a constant c
folds c into the bias: (x + c) * s + 2^31 = x * s + (c * s + 2^31) mod 2^32. The builder notes
each u32 sum of a value and a constant for that; the note changes no emitted word.
One place on each side:
- rt: pipeline::address_word, used by the compute and render push writers for every
BufferAddress field: a bound buffer, a setBytes copy, or the nil buffer.
- translator: lower::access::pointer.
- biased_slot_address feeds the direct reach.
- slot_address (the word plus 2^31) feeds every other reader: an access from the word below
it, a pointer compare, ptrtoint, the memmove overlap's Metal addresses, and pulled vertex
fetch.
- The bias applies only under the identity domains and only where the word is pushed: a
replay variant reads the true address from its root entry.
Unchanged:
- A texture's or sampler's resource ID and the parameter block's address are not biased.
- A pointer loaded from an argument buffer keeps today's form: the address the buffer holds.
- The default domains, which the old runtime and the golden tables use, take no new instruction:
the readers there load and bitcast the field in the same order as before.
Argument-buffer pointers left in their form (planner's condition):
- They are 19.6% of the corpus's device and constant accesses.
- Time-weighted, they are 0.8% of accesses on the 780M stream gb-780m-u4 and 2.4% on the RTX 3090
stream gb-3090-r5.
- Kernels with any such access take 1.9% and 8.4% of those streams' GPU time.
Slot pointers used as values, in the entry functions of the corpus's 11,580 kernels (census over
the local sources shards):
- 781 (6.7%) use one as a value: 14 convert one to an integer, 46 compare one, and 731 store one.
Every such store but one writes private memory (a pointer cell); the one other writes device
memory.
- 3,511 (30.3%) pass one to a non-inlined function.
- 33 pass one to an air.* call (command encoding, intersect).
A ptrtoint and a compare read slot_address. A pointer parked in a private cell or passed to a
function stays a fat pointer, whose accesses take the forms above. The one store to device memory
makes a wide pointer, which reads the root table, a field identity_admits does not admit. A new
engine test, a_slot_pointer_used_as_a_value_is_its_metal_address,
runs a kernel under the identity domains with biased pushes on the interpreter. It does a ptrtoint
to i64 and to i32, an address compare, and loads 4 bytes below a bind address and 20 above
another, and checks each against the true addresses.
Probe numbers (measured: one particle kernel run alone on RADV 26.2.6, us per dispatch, best of
forward and reverse; the module's two positions accesses changed by hand). Biased form against the
plain zero-extended offset (inexact below the bind address), at subgroup size 32 and at the
driver's 64:
- RX 7900 XTX: 33.6 vs 33.6, 30.8 vs 30.6; at 4x the grid 374.6 vs 374.0, 273.1 vs 272.9.
- PHOENIX 780M: 168.1 vs 168.3, 121.1 vs 120.5; at 4x 2521.9 vs 2522.8, 1744.6 vs 1752.8.
- HawkPoint 780M: 173.3 vs 173.2, 122.5 vs 122.7.
The sign-extended form it replaces measured, at 32:
- HawkPoint: 189.8 (same job), 9.5% slower.
- PHOENIX at 4x: 2735.3 (same job), 8.5% slower.
- XTX: 35.9 (another job), 6.8% slower.
The XOR form with a host-biased word (V7) measured 178.8 on HawkPoint: the add is the one that
fuses.
The tests:
- The identity engine tests push the biased word through engine_word_phases::slot_word.
- rt's three hand-made test kernels (ADD, STEP, WIDE) add 2^31 to each slot word. Their arrays
are regenerated from the doc GLSL with glslangValidator --target-env vulkan1.2 and checked with
spirv-val. Today's GLSL reproduced today's arrays exactly before the edit.
docs/API.md (sections 1 and 5), PushField::SlotGuestBase's doc and rt's README known gap on the
2 GiB cap state the word and the form.
SEMANTICS_VERSION 2186 -> 2188 and ARTIFACT_FORMAT_VERSION 544 -> 546. The identity nolockstep
lane holds 2187 and 545, unlanded; these take the next numbers so the two land separately.
RtSide left Side::static_threadgroup_memory_length at the trait's default, so
compute-threadgroup-simd-scratch ended refused on rt at its first site
(case/static-threadgroup-memory-length, "Unavailable" with the call's name) before it dispatched
anything. rt's ComputePipelineState now answers staticThreadgroupMemoryLength (the translator's
ComputePipelineMetalInfo value, rounded up to 16 as Metal reports it), so the side answers it
from the held state, as the old runtime's side does from its own. The compute module's
held_pipeline is shared with the parent module for it.
Verified at this commit: cargo fmt only; the build, the suite and the lavapipe replay run in the
lane's check job.
The rt side left host_buffer at the trait default, so the host-page cases answered
newBufferWithBytesNoCopy unavailable. The side now maps the pages as the old side does, imports
them with Device::import_host_memory, whose release owns the pages and unmaps them once the
runtime frees the import, and places one buffer over the whole block, its bytes the pages' own.
Metal's private read-only bit (MTLResourceOptions bit 24) has no counterpart in the runtime, so
the read-only form answers that call unavailable.
The rt side left heap_texture at the trait default, so texture-pairs-heap-texture-getters answered
Unavailable at its textures. The heap's newTextureWithDescriptor: places the texture where the
heap's own suballocation puts it, which is the consumer's, as the side already answers an
automatic heap's buffer: the runtime's Device::new_heap_texture binds a texture at an offset the
consumer chose. The row now states that reason instead of the side's missing port.
The rt side left plane_texture at the trait default, so the ten cases that make a texture over a
buffer or over a surface's plane answered Unavailable. The side now makes the buffer form as the
old side does: the buffer's newTextureWithDescriptor:offset:bytesPerRow: of one 2D level at the
first plane's offset and pitch, readable and writable by shaders. The surface form answers
newTextureWithDescriptor:iosurface:plane: unavailable, as the side's render targets already do:
the runtime makes no texture of an IOSurface.
The argument-buffer slot of a sampler reads the side's own held_sampler.
The rt side left compute_pipeline_with_descriptor at the trait default, so the three
pipeline-facts-compute cases answered Unavailable at the state. The side now makes the runtime's
state of the descriptor's kernel with its supportIndirectCommandBuffers and
requiredThreadsPerThreadgroup; the runtime takes no label, which is its consumer's. The facts the
cases then read stay unavailable until the per-field mechanism lands.
The rt side left argument_buffer at the trait default, so the five cases that reach a texture or
a sampler through an argument buffer answered Unavailable. The side now writes each slot's
gpuResourceID (the runtime's ResourceId, index | word << 32) into a buffer, as Metal 3 writes
one, and a dispatch that binds that buffer declares each texture it names with
useResource:usage: Read, as the Metal side and the old side do.
The device test's call list names two of the cases.
The rt side left visible_function_table at the trait default, so its 18 cases answered
Unavailable without asking the runtime. The side now makes the case's state as the old side does
(a compute state, or a drawing state whose vertex function is the entry, with rasterization off),
linking the case's functions in the order it states. The runtime's refusal of that state is the
row's answer. A state the runtime makes answers functionHandleWithFunction: (or its :stage: form)
unavailable, as the runtime has no function handles or visible-function tables; the side answers
for neither.
The device test's call list names a compute case and a drawing-stage case.
zeroed_buffer and read_buffer are Side's methods, so states.rs takes the trait into scope; the
first build of the states port (m3-max-50629) failed on it.
The rt side left compute_pipeline_limits, compute_pipeline_for_commands, queue_slots,
fragment_fill and render_target at the trait default, so their cases answered Unavailable and
were never compared with Metal. Each now calls the runtime's public API as the old side calls the
old runtime:
- compute_pipeline_limits: a compute state of the descriptor's maxTotalThreadsPerThreadgroup, its
answer floored as both sides floor it, or Metal's refusal where the runtime's error is Refused
or the translator's InvalidDescriptor;
- compute_pipeline_for_commands: the state with supportIndirectCommandBuffers set, which the
runtime refuses as Gap::IndirectCommandBuffers, so the row records that typed refusal;
- queue_slots: the shared probe over a queue made with the case's count and another queue;
- fragment_fill: one draw into a Private target of the fill's format, then a blit into a Shared
buffer;
- render_target: the mesh family's Shared RGBA32Uint target.
The device test's call list names a case for each call a case reaches directly.
development fcd860a0ed's tip check m3-max-51271 (lavapipe, msi) failed
every_device_reads_replace_region_bytes_in_place_once at its new_texture:
the descriptor kept Metal's default ShaderRead usage, and a texture shaders
reach takes an index (Refusal::TextureIndex { index: None }, which the same
file's index test asserts). The refusal is right on every device, not
lavapipe's alone; the test was wrong. Its texture now has no usage, as
sampling.rs's texture without an index does; replace_region and get_bytes
need none. Verified by the next build and legs.
The planner asked which M3 measurement the render state's imageblock answers
rest on. They are the conformance suite's pipeline-facts-render-plain,
-two-attachments and -multisampled recordings (Apple M3 Max, macOS 27.0.1 build
26A434, three runs each): RGBA8Unorm answers 4 and 128 at [8, 4, 3];
RGBA8Unorm then RGBA16Float 12 and 384; the same at four samples 12 and 1536.
They also show Metal ignores the depth, which the README now says. Docs only.