The rounding commit was written before the aside and the two-copy Managed GPU copies took places;
they passed no granule and did not compile. The aside is the play's own (no recorded slack), a GPU
copy takes its buffer's recorded granule. Check follows.
The backend packed buffers first fit at Metal's 256-byte alignment, so a program's write past
a buffer's end landed in the next buffer. A recorded stream's program did that: an append
list of 4000 records took about 870 more on one play, and the overrun went 17340 bytes into
twelve 4-byte counters and the start of a 48000-byte buffer that the player had packed behind
it. The recording had given each of those buffers its own 32 KiB-granular range, so the same
overrun landed in the list's own slack there. The clobbered counters then feed the next
rounds; a 780M page fault past a 64 MB buffer and a hang on a 3090 follow them (expected, the proof plays pending).
Each buffer's place now spans its length rounded up to its recorded granule: the largest
power of two that divides its recorded gpuAddress, from 256 bytes to 64 KiB, and 256 bytes
where the stream records no address (the player's own staging included). Both copies of a
two-copy Managed buffer take it. A buffer past the class's block length takes a block of its
own of the rounded span. The backend's new "places by recorded granule" line counts the
places by granule and gives the most bytes of slack held at once.
Test: rt_replay's buffers_keep_the_slack_of_their_recorded_granule plays two 4-byte buffers
recorded at addresses of 32 KiB and 64 KiB granules and reads back their relocated addresses
from a third: they lie apart by at least the lower one's granule (256 bytes apart before).
docs/REPLAY-STREAM.md says how the backend places buffers.
On the RTX 2080's broad device suite (job 48082) two tests failed only beside the parallel suite:
- a_compositor_beside_a_queue_waiting_on_the_gpu_for_long_work_keeps_its_latency: p99 9.92 ms
with 91 stalls. The device took its least plan of 3 VkQueues after the driver refused 18 under
the parallel load;
- an_unshared_head_behind_an_earlier_commit_of_the_held_queue_holds_nothing: "held for
isolation 0".
Both are timing tests like the two isolation tests that already run alone. Each holds a bound of
the GPU's time, which other test processes' work spends too.
Run alone, each test passed 3 times in every job:
- 2080: job 48237;
- 3090 on ms01: job 48236;
- 3090 on um870 (the gpu-wait test): job 48259.
In those runs the gpu-wait test's p99 was 1.84 to 2.70 ms with 0 stalls, and the held-head test
printed "held for isolation 2, behind an earlier commit 2". Both now join the override that runs
queue_share_device's isolation tests alone.
The doc of every_case_of_buffers_alone_runs_from_a_command_as_its_dispatch now states it in so
many words: a run whose command buffer fails as Metal's timeout (GpuHang) is hung, whatever the
other run gave, never agreement and never a refusal, and that fails the shard.
Doc comment only.
A case whose command buffer runs past Metal's bound fails as Metal's timeout: the old runtime's
watchdog (20.2 s of wall time with the queue not advancing) fails it with
CommandBufferError::GpuHang. The census counted any two failures as "refused alike", so a case
whose two forms both hung passed without ever running: on lavapipe the longest case, a division
of every pair of half values, hung in both forms in the lavapipe legs of 8a39262627 (job 45876)
and e632e01478 (47186), and the shard passed. In 140714ceae's leg (48145) its dispatch completed
in 18.6 s and its command hung at 20.35 s, 8.6 s of it waiting for a CPU, and the shard failed.
1. Classification. unfinished() decides how two runs stand where one did not complete, a hang on
either form first: Unfinished::Hung, its own list, which fails the shard with both forms'
clocks. A hang is never agreement and never a refusal. The test
a_hang_on_either_form_is_hung_and_never_refused_alike holds it without a device.
2. Fewer neighbours. The 64 shards run alone (.config/nextest.toml, threads-required =
num-test-threads), so the case's work has the host's CPUs against the watchdog. Alone, at
051236c0c2 (job 48258, msi-laptop, 24 CPUs, LP_NUM_THREADS=1), the case took 7.4 to 8.9 s in
each form, with and without the validation layer (4 runs), 0.4 s at most of it waiting for a
CPU: 11.3 s inside the 20.2 s bound. The census serialized costs about 325 s of the leg.
The old runtime is untouched.
a_copy_back_splices_by_the_device_s_check makes its buffer over dma-bufs (over_dma_bufs, which
asserts the buffer lies over them), so where the device's types refuse a Shared dma-buf import it
fails the same way the other two shadow write-back tests did before their guard. It was hidden in
47947 and 47957 behind the 30 failures shown. The guard returns before the device's check runs,
on the check's own device.
Verified: cargo fmt; the 2080's full log (48082) shows this failure at shadow_write_lines.rs:339
with "the buffer lies over dma-bufs". Compiled and run by the next check and the NVIDIA legs.
The Shared-refusal guard sat in dma_buf_shared_files::on_device, so every test of that device
skipped on NVIDIA, including four that import nothing a Shared refusal stops and passed on both
NVIDIA cards with the refusal in place (47947, 47957): private_storage_is_refused,
one_piece_off_the_granule_binds_a_plain_buffer_at_its_offset, two_pieces_off_the_granule_are_refused
and a_piece_off_the_request_s_alignment_is_refused. The guard moves to a new `importing` helper,
which the ten tests that import a Shared dma-buf call; the four keep `on_device` and run on every
device again.
Verified: cargo fmt. Compiled and run by the next check and the NVIDIA legs.
The rt player waited on command buffers with the runtime's own
wait_until_completed, which has no bound, and its wait record named the
waitUntilCompleted selector as a literal: the bounded-wait test
(gpu::tests::device_waits_exist_only_in_the_bounded_wait_module) failed
on it.
gpu::wait gains new_runtime: a command buffer's Retired flag, set by its
completed handler, and wait_until_retired, which sends the command
buffer (the queue's send_now, as the runtime's own host wait does) and
waits on the flag for at most the process's bound. Past it the hang is
recorded and the process ends with the hang exit code, as every bounded
wait does. How the command buffer ended stays the caller's to read, so
the player reads its error into the verdict as before, and a device
fault writes no tripwire (the old player's path writes one).
The player keeps each in-flight commit's queue with its flag; both of
its waits (an index's owed commits, and a command buffer the player
drains) go through it. NewRuntime::new takes the device's kind, which
names the waits' backend.
Verified: see the check job (clippy in both configurations, the replay
and gpu unit tests, the rt_replay device tests on lavapipe).
identity's group 4 (SEMANTICS_VERSION 2182, ARTIFACT_FORMAT_VERSION 537)
changed the product fingerprint. The census re-blessed at development
795c834ded (job m3-max-48278, census-exit=0) changes only the artifacts_at
line's product fingerprint. No row's outcome changed.
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.
Take a kernel whose only partition observations are lockstep pairs that are apart wherever each
SIMD group lies within one row. It ran every dispatch at its own threadgroup size with the
order's barriers, one VkPipeline per size, though in a threadgroup whose SIMD groups each lie
within one row those barriers order nothing.
Where an observing kernel holds no threadgroup memory (which every variant of it would observe
the partition through) and its plain module runs a lockstep barrier where each SIMD group lies
within one row (CompiledFunction::runs_lockstep_barriers_in_rows), the state now asks the
translator whether its one-row variant of partial threadgroups (LoweringInputs::one_row)
observes the partition. A kernel whose lockstep barriers all order pairs that meet only across
rows is not asked: its own module runs them only where its size lets a SIMD group span two rows,
a test the driver folds, so the variant would leave out nothing more, and its modules and
pipelines are what they were. The translator answers that the variant observes the partition
for any observation besides the order's own barriers: a barrier of the kernel's own (where a
thread may read what another row's thread stored before it), a fence or atomic of threadgroup or
SIMD-group scope, a SIMD-group or quad function, or a builtin of the partition. Such a kernel
keeps its own size.
Where the variant does not observe it, the variant is lowered with the state (or read from the
cache directory, its refusal kept like a lowering), and its tile VkPipeline is made with it. A
direct dispatch whose threadgroups keep each SIMD group within one row runs that module in
tiles, as a kernel that does not observe its partition runs. That means no threadgroup of more
than one row, or every threadgroup's rows a multiple of 32 threads wide, the grid's edge
included (encoder::keeps_rows). Any other dispatch, and every indirect one, runs the plain module
at its own size, its order kept. The interface accepts RuntimeFact::OneRow, which the variant
states. The README states the form, the rule and the pipelines it makes.
Tests:
- choice tests of keeps_rows over one-row, whole-row, ragged and breaking shapes, and of the
choice with and without the module;
- every_device_makes_a_one_row_module_only_for_a_kernel_whose_lockstep_barriers_run_in_rows: the
harness fixture's lcg_step, whose one barrier orders only pairs across rows, has no one-row
module and makes no pipeline with its state, and runs 256 threads in 64 at its own size, a
pipeline by a first-use wait, every word the program's; the fixture's row_cells keeps its
module, its tiles' pipeline made with the state;
- every_device_runs_grids_in_rows_of_an_observing_kernel_on_its_one_row_tiles checks every
answer of the fixture's row_cells: in 32 x 2, 64 x 8, 512 x 1, 64 x 4 and 48 x 1 (the last
three ragged) on the one pipeline made with the state, no other made and no first-use wait;
and in 16 x 4 at its own size, one more pipeline by a first-use wait;
- every_device_keeps_a_kernel_that_reads_across_rows_after_a_barrier_at_its_own_size runs the
fixture's row_barrier. Its state makes no one-row module and no pipeline. It runs 512 x 4 in
32 x 2 on the plain module, and 512 x 3 in 32 x 2 and 96 x 5 in 32 x 4 on the partial variant,
each a pipeline by a first-use wait; the first of those two waits once more, for the variant's
lowering. Every word is Metal's: the probe row_barrier_reads.m ran
the same source over the same grids on the M3 Max under macOS 27.0.1, and none of the 1,536,
2,048 and 480 words differed from the formula the test checks (jobs 47871, 47948).
Verified:
- Check 48214 (msi) at this series' tip on development 50719da96b: the runtime's clippy (default,
--cfg m2v_gpu, --cfg m2v_cpu_icd) and Rustdoc are clean; the runtime's host suite
passes, and its device suite on lavapipe passes 275 tests (3 skipped), the three device tests
of this change among them.
- The harness's rows, arm A (development 4da77d8518 with a dispatch-time probe) against arm B
(A with this series), GPU p50 over six rounds of each:
- row_cells: 25,179 us -> 23,484 us on the UHD 630 (48181, B/A 0.933), 5,112 -> 5,094 on the
RX 550 (48021, 0.996), 1,096 -> 1,083 on the RTX 2080 (48022, 0.989); 3 pipelines made and 3
first-use waits in A, 1 pipeline (made with the state) and none in B, on each;
- every other of the 38 rows within 3% of A on the RX 550 and the 2080 (the largest frame,
6.3 -> 6.4 us, and draw_full 1.019), and the lcg_step rows and bind_2000 within 1% on the
UHD 630; lcg_step's rows make the same pipelines in both arms.
- Plays of a recorded stream to frame 1137, cold, A B then B A: pipelines made per play 645 -> 585
and first-use waits 277 -> 214, on the 780M (48223) and the 2080 (48217). Per-dispatch medians
of the row-indexed kernels, A -> B: 0001b9f3 12.14 -> 6.37 us and 99.85 -> 75.60 us on the 780M,
6.48 -> 6.30 and 18.80 -> 19.28 on the 2080; 08d86a3b 439.7 -> 435.4 (780M) and 86.13 -> 85.78
(2080); 65f87e88 4.11 -> 3.93 (780M) and 4.56 -> 5.01 (2080).
The harness fixture gains three kernels.
- row_cells, a measured workload: over a 2048 by 1024 grid, its width and height given and its
rows 2048 cells apart, each thread inside the width and height reads its word at
y * stride + x and writes three words at (y * width + x) * 3; the rest return first. It runs
in threadgroups of 32 by 2, 64 by 8 and 512 by 1, four dispatches of each, with a CPU
reference. The cells are int arithmetic past the bounds test, as the streams' row-indexed
kernels are written: Apple compiles that to steps that carry nsw, from which the lockstep order
proves two threads of one row apart, and the order's barriers stand in the block past the test,
so they are SIMD-group barriers (barrier.lockstep.simdgroup, emulated on lavapipe), the kind the
four such kernels of the streams hold, which run in one-row threadgroups.
- row_cells_uint, its control: the same in uint. Its steps carry no flags and may wrap, so the
order does not prove them apart in rows. The test
the_int_cells_kernel_is_apart_in_rows_and_its_uint_control_is_not holds both answers on
lavapipe's from_queries profile under the identity domains: each kernel observes its partition
through SIMD-group barriers alone, which run in rows, and with partial threadgroups; in its
one-row variant row_cells does not observe it while row_cells_uint still does.
- row_barrier: each thread stores its word, waits at threadgroup_barrier(mem_flags::mem_device),
and reads the word its column's thread in the other row of its pair (y ^ 1) stored. It holds
no threadgroup memory and observes its partition through the barrier. The new runtime's
device test runs it against Metal's reading, which the probe
metal2vulkan-conformance/probes/row_barrier_reads.m takes from the same source.
The companions are regenerated with scripts/regen-air-fixtures --dir harness (TOOLCHAIN records
the compiler, unchanged).
Verified:
- The companions were regenerated on the M3 Max under macOS 27.0.1 (job 47948), which also ran
the probe row_barrier_reads.m over the runtime test's grids.
- Check 48214 (msi) at this series' tip on development 50719da96b: the harness crate's clippy
(default and --cfg m2v_gpu) and Rustdoc are clean; the host suites pass but for 4
tests that all name engine/oor_texture_reads, development's fixture without its golden-table
and inventory rows (603634f9f9), which development's re-bless owns.
- The harness's rows ran on the RX 550 (48021), the RTX 2080 (48022) and the UHD 630 (48181), six
rounds of each arm, before and after the runtime's change.
LoweringInputs::one_row's lockstep order cleared the pairs that meet only where a SIMD group
spans two rows only where Lockstep::rows held, which needs maximal reconvergence on 32-lane
subgroups without the device's own lockstep: the old binder's condition for asking the variant.
On a device without that tier (lavapipe's 8-lane subgroups, the UHD 630 without the extension,
GCN's 64-lane waves) a one-row compile kept every barrier, though the clearing is exact there
too: in a threadgroup whose SIMD groups each lie within one row, those pairs never meet,
whatever runs the SIMD groups. The order now searches the pairs under the rows facts for every
one-row compile and clears them wherever every pair left wants a threadgroup barrier at most.
Lockstep::rows and RowLockstep keep their meaning, so Device::new's plans, and the old binder's
one-row compiles, which it asks only where rows holds, are unchanged.
CompiledFunction::runs_lockstep_barriers_in_rows (KernelFacts::lockstep_in_rows) says whether a
kernel's lockstep order inserted a barrier that runs where each SIMD group lies within one row:
any but the threadgroup barriers that order only pairs meeting across rows
(Lockstep::across_rows), which the module runs only where its local size lets a SIMD group span
two rows, a test the driver folds. Only where it holds can the one-row variant run fewer
barriers than the kernel's own module at a one-row size, so a runtime asks the variant only
there. It is decided from the plain compile's order and changes no module. docs/API.md states it;
the api_signatures table gains its row.
SEMANTICS_VERSION 2181 -> 2182: a one-row compile on a device without that tier changes. The old
runtime's render descriptor key is re-pinned under it (b3d05d42). ARTIFACT_FORMAT_VERSION 536 ->
537: KernelFacts gains lockstep_in_rows.
Test: a_one_row_variant_clears_the_pairs_apart_in_rows_without_a_32_lane_tier, on lavapipe's
from_queries profile under the identity domains. Three kernels, each with its stores in its entry
block and past a bounds test (six in all), keep lockstep barriers in their plain module and state
no RowLockstep:
- one storing the three words 3 cell + k of its cell y * stride + x in int arithmetic, as Apple
compiles it (nsw on every step, the index sign-extended);
- the same in uint arithmetic, whose steps carry no flags;
- one whose threads store at x and x + 1.
In the one-row variant the first has none. It states OneRow, takes no simd class, does not
observe its partition with partial threadgroups (the variant without one_row does), and runs its
grid in tiles. The other two keep their barriers: the wrapping index is not proved apart in
rows, and the neighbours meet within one row. Every plain module runs its lockstep barriers in
rows but the unguarded int cells kernel's, whose barriers all order pairs across rows.
Verified:
- Check 48214 (msi) at this series' tip on development 50719da96b: clippy with -D warnings of
metal2vulkan, metal2vulkan-rt and metal2vulkan-harness (default, --cfg m2v_gpu and, for the
runtime, --cfg m2v_cpu_icd) and their Rustdoc are clean; their host suites pass 3,863 of
3,867, and the 4 that fail all name engine/oor_texture_reads, a fixture development added
(603634f9f9) without its golden-table and inventory rows, whose re-bless development owns; the
runtime's device suite passes on lavapipe (275 run, 3 skipped).
- The translate probe (jobs 47932, 47952; lavapipe's from_queries profile and three device
profiles): lcg_step's plain and partial-threadgroups modules are byte-identical before and after
this change (SPIR-V 3226775232d06722, 649 words, and 991ee4501d037271, 1202 words), and
runs_lockstep_barriers_in_rows is false for it. The harness fixture's row_cells holds two
barrier.lockstep.simdgroup (barrier.lockstep.emulated.simdgroup on lavapipe), the kind the
streams' four row-indexed kernels hold; it runs them in rows, and its one-row variant holds none.
The oor_texture_reads fixture landed (8646e2d9c9, "companions follow";
603634f9f9) without its rows in the golden hash table, the engine inventory
and the air_input printouts. So the matrix round at 140714ceae (lavapipe leg,
job m3-max-48145) failed four tests:
- engine_fixtures_match_their_golden_printout (no oor_texture_reads.txt);
- inventory_lists_every_fixture_in_order (1268 listed against 1270 fixtures);
- golden_hashes_match_the_table (19 new cells);
- llvm_as::part_7_of_8 (one new row).
This commit only adds: two golden rows, one inventory row (ok on every
profile), and the fixture's printout. No existing row changes.
Verified: blessed on the M3 at development 051236c0c2 by bless-job.sh
(job m3-max-48256, inventory=0 golden=0 printouts=0); the patch removes no
line.
Beside the Shared/Private table: the host link's rate does not touch the
programs the replay streams come from. identity's census of the two
discrete-GPU recordings (r3 frames 1-1138, r4 whole): 0% of bound buffers
Shared, the rest Managed apart from 1.8-3% Private, and the top kernels'
buffers all Managed. The planner closed the Shared-on-discrete item with that
number and asked for this sentence.
Docs only.
u3 stopped at player frame 259: the placement of a sampler state at index 16 waited for commit
1614 (#20713), which rt held at Committed because it waits for event #35 to reach 309, which only
command buffer #20439 signals, encoded 20 records later. The program had released #10401 (index 16,
bound directly by #20713) and made #20822 with the same descriptor the next call; Metal gave it ID
16 again. Nothing changed for the work in flight, and the original run did not wait (it could not:
#20713's signal was not yet encoded).
- A sampler state whose recorded descriptor is the one placed last at its index takes the index
without waiting, counted on the indices line; the index stays owed for another sampler state.
- The player tells the backend, at each look for command buffers to wait for, the committed ones
no record played so far lets complete (Backend::held: their unmet event waits, or a held one
ahead on their queue). A placement owing its index to one of those stops with PlayError::Held
naming the chain, instead of waiting for ever.
- docs/REPLAY-STREAM.md says what record order does not promise (a committed buffer may wait on a
later record's signal) and what the indices line and the stop say.
Tests: a unit test of the equal rule in Indices; rt_replay device tests of our own sequence: an
equal sampler state at an index a held commit owes plays through without a wait; another
descriptor there stops with Held naming #6 and its unmet wait. Check follows.
The owner's order (relayed by the planner, Telegram message 1924): "Remove
unused lines from the rules." The eighth second form of rule 2, a small zero
image or the default sampler where a device lacks the null descriptor, is
unused: nullDescriptor is a floor feature (crates/metal2vulkan-rt/src/
floor.rs requires robustness2.null_descriptor), so no device above the floor
takes the zero-image form and no code holds it.
Verified: a grep of the tree's Markdown and Rust for another statement of
eight forms or of the zero-image form finds none outside AGENTS.md. The rules'
other named items (the attachment feedback loop's counted copy in
crate::over and the attachments' copies, the optional features in
floor::OPTIONAL, DevicePolicy, tests::fast_paths, docs/FAST-PATHS.md) exist.
A program may release a sampler state that a pending command buffer still binds and make an
equal one at its index: no Metal rule forbids it. The new state takes the same VkSamplers from
the device's table, and its placement displaced the old state and wrote every element of the
index again with the same handles. vkUpdateDescriptorSets on a pending set is allowed only for
descriptors no pending shader invocation uses, with no exception for an equal write, so the
placement updated descriptors the pending work reads.
Set 1 now keeps the sampler each sampler array's element holds at each index, as last written
(SAMPLERS x 3 handles, fixed), and write_samplers writes only the elements that change. A
handle kept there is a default or one the index's owner holds, so it is never a destroyed one.
The owner word still moves to the new state, so the displaced state's going touches nothing, as
before. A different sampler at an index that work in flight reads stays the program's duty; the
README says why an equal one is safe.
Metrics::sampler_element_writes counts the elements written. Test
every_device_writes_no_element_for_an_equal_sampler_at_an_index_work_reads: a command buffer
held at an event wait ahead of a dispatch that samples through SA; SA released and SB of the same
descriptor made at its index: no element written, the device-sampler gauge unchanged, and the
held work's result is the linear filter's once released; a nearest state at the index writes.
Without the comparison, SB's placement writes three elements and the first assertion fails.
Signatures table blessed (Metrics gains a field of a non-exhaustive struct).
rt's CommandBuffer::wait_until_completed returns a Result since its scheduled-handler and
own-thread refusals (ea8e7843b7, b70c5fb618), and waited_for dropped it, which is
unused_must_use: workspace clippy -D warnings failed on development at
crates/metal2vulkan-conformance/src/rt_side.rs:355 (job 48163, its only error). The waiting
thread now sends the status word after a wait that returned, as before, and the refusal's text
where the runtime refused the wait, so a refusal reads as what it is rather than as a status.
Verified: see the landing message's job (workspace clippy, the conformance suite, its rt replay
on lavapipe).
The render encoder has no use_heap: useHeap:stages: joins the README's list of what is not built
and so is not a method. Where a replay stream calls it (command-replay shapes counts a stream's
calls of each selector), it is built in the compute encoder's form: the command buffer keeps the
block, and no access is declared.
Docs only.
The floor now requires maxColorAttachments of at least 8, Metal's eight colour attachments
(MAX_COLOR_ATTACHMENTS, the render pass descriptor's slots). Vulkan 1.3 requires only 4: the
spec's Required Limits table (Table 76, vkspec 1.4.366) lists maxColorAttachments as "4 (Vulkan
Core) 7 (Vulkan Roadmap 2022) 8 (Vulkan Roadmap 2024, Vulkan 1.4)", min. A device below 8 is now
named below the floor at creation ("maxColorAttachments 7, below 8"), so a pass's colour
attachments, at most the descriptor's eight slots, never reach past the device's. The check in
pass.rs and its refusal, Limit::ColorAttachments, could no longer fire and are deleted.
Breaking, intended: the public variant metal2vulkan-rt::Limit::ColorAttachments { count, max } is
removed (api_signatures.tsv loses that one line, blessed). docs/REFUSALS.md is regenerated (the
new runtime's Limit goes from 10 to 9 variants). The README's limits table gains the row and the
Limits paragraph the spec's minimums; the render pass passage says a pass may use all eight.
The floor test's low-limit cases go from 16 to 17 with the maxColorAttachments case.
The own-thread test formatted `made.as_ref().map(drop)` (a Result<(), &Error>) through a
closure taking Result<(), Error>, which failed to compile under --cfg m2v_gpu (check 48115). It
formats the borrowed result directly now. The test gains one answer: in a completed handler,
wait_until_signaled_value(1, Duration::ZERO) for a value not reached is WaitOnOwnThread, not
false at its timeout: the thread that would observe the value is the one waiting, so a false
there would be the runtime's artefact. The refusal already applied to every timeout; the README
and the event's doc now say so.
The completion thread runs a device's completed handlers and listeners, and it is the thread
that marks a command buffer completed, an event's GPU value observed, and a queue's place free.
A wait there for any of those not yet done could only end by that thread's next step, so it hung
by construction. Each is now Refusal::WaitOnOwnThread, and a wait already met answers at once:
- wait_until_completed: Ok for a command buffer completed or ended, the handler's own among
them, else the refusal; nothing is sent.
- wait_until_scheduled: the refusal for one not yet scheduled.
- SharedEvent::wait_until_signaled_value: Ok(true) for a value reached, else the refusal.
- CommandQueue::command_buffer on a queue whose maximum count are made and not yet completed:
the refusal on the completion thread and on the submit thread (a scheduled handler), whose
next steps free the place.
The condition is the program's own state (what it committed, what has completed), never a
ring's fill. Outside a handler every wait answers as before.
Test: every_device_refuses_in_a_handler_each_wait_its_own_thread_would_have_to_end checks 15
answers in a scheduled handler, a completed handler and a listener. REFUSALS.md regenerated and
the signatures table blessed: Refusal gains WaitOnOwnThread (a new variant of a non-exhaustive
enum; no consumer breaks).
number_samplers released a state's constexpr samplers' elements only when hold_constexpr failed.
It returned early without releasing when a later constexpr sampler's device sampler was refused
(the translator's Err, or the caller's gap for a use with none). So the elements and device
samplers of the constexpr samplers numbered before it stayed held, with their indices, and no
state owned them.
Each sampler's uses now resolve in one function. Every refusal from them, or from the hold, takes
the single release path.
The new device test numbers two constexpr samplers, a linear one and the same state with a NaN
level bias. The second fails. The test asserts that the arrays' descriptor slots are back at
their count before the call, that the reaper frees the linear device sampler (the device
sampler gauge returns to its count before the call), and that the grant's indices release.
A pipeline cannot reach this through the public API today: constexpr_sampler refuses only what
translation for the same profile refused first. The test calls number_samplers directly.
Three changes the rt side's first whole-set run on lavapipe asked for, so its divergent rows are
each a named answer:
- known-gaps-rt.tsv gets the 54 rows where lavapipe's own answer differs from Metal's (rule 1),
over 31 cases: the half NaN families (half-texel-nans, half-read-nans, half-write-nans,
half-storage-writes, math-frexp-ilogb-half), the half tanh, the sRGB pass bytes, 16-bit depth
reads and nearest sample positions. Each row says what Metal and the device answer at the
first differing element and names the static note that records it, every one of which the
run announced for its case. Venue: llvmpipe (LLVM 23.1.1, 256 bits).
- The `read` rows of half-texel-nans' six float formats answer what read-through-sample answers,
where the old runtime on this venue answers them otherwise (R16Float: 0x7e00 against the old
runtime's 0x7e01). Mesa's SPIR-V dump of both runtimes' modules shows the same ops for each
read (OpImageFetch of a sampled float image, then OpFConvert to half). The old runtime reads
each slot through its own set-0 binding, and rt reads it through set 1's sampled-texture array
at the slot's resource ID. In one dispatch, the old runtime's two bindings of the one texture
answer 0x7e00 and 0x7e01, so lavapipe's fetch answers a NaN by descriptor. The rows say so.
- depth16-texel-reads, nearest-sample-positions and the six half-read-nans cases declare
pixel-sampler-scaling (`replay::pixel_sampler_scaling_notice`). rt's pipelines record that
note for every sample through a runtime sampler slot, because under the identity domains no
binder specializes the slot by its bound state. A declaration loosens the notices site alone.
- indirect-private-type-getters pushes a refused read-back's error leaf under the type's own
node. At the root, a refusal read as a site only ours observed.
Verified: the device-answer rows are read from the whole-set runs of the rt side on msi's
lavapipe (the same 54 rows in both). The two read paths are from Mesa's SPIR-V dump of
half-texel-nans-r16f through both runtimes.
The status, the four times and the work's completion are the runtime's and are
compared. A queue's label and a command buffer's device and commandQueue never
reach the GPU: the runtime leaves them to its consumer, so the rt side answers
TheConsumers at those three sites (CommandBufferFacts::the_consumers), a class
of its own rather than a gap. The resource state encoder is the sparse
family's, which the runtime does not make: a typed refusal at its site
(CommandBufferFacts::without_resource_state_encoder). The other sides build the
facts as before.
Verified by the next job.
compute_pipeline_with_stage_input states the stage input on the descriptor as
the old runtime's side does (its helper is now crate-visible, unchanged) and
records the runtime's own answer, a typed refusal where the runtime does not
supply the fetch. texture_2d_in_role makes one Shared level in the role's
usage, at a texture index where a shader reaches it; sampler makes the state
at the next sampler index, and a dispatch binds the case's samplers.
Verified for the parent commit (job 47946, msi, lavapipe): clippy, Rustdoc and
the suite's 1053 tests green; replay --rt of the slice: math-frexp-ilogb-float
exact, math-frexp-ilogb-half divergent at the half NaN mantissa as the old
runtime's llvmpipe rows hold, empty-command-buffers divergent at two time
orders, command-buffer-facts refused (no call); the whole set under the
validation layer with 0 errors and 0 warnings. This commit's run is next.
RtSide answers the case vocabulary through metal2vulkan-rt alone: libraries,
compute pipelines (constexpr samplers numbered as Metal gives an equal one the
same ID), Shared buffers each in a block of its own length, 2D textures at
granted indices, dispatches, bounded waits, buffer and texture reads, and the
empty command buffers' handlers, statuses and times. A call it does not answer
yet answers Unavailable with its name, so its case ends refused at that call.
It announces the codes of the precision notes of each state its case
dispatched.
`conformance replay --rt [--cpu]` replays through it, held to its own
ledger, known-gaps-rt.tsv (empty: the first run's rows go in next), since
known-gaps.tsv's rows are the old runtime's. Failure::of_rt and
Failure::of_translation record the runtime's and the translator's typed errors.
The old runtime's side is unchanged.
Not yet verified: compiled and run by the next job.
Refusal::InScheduledHandler's doc linked crate::Event::wait_until_signaled_value, which is a
method of SharedEvent (event.rs, impl SharedEvent), so rustdoc -D warnings failed on development
since ea8e7843b7: 'unresolved link to crate::Event::wait_until_signaled_value' (job 48098, the
only rustdoc error there). The link now names SharedEvent. The refusal table quotes only the
doc's first clause, so docs/REFUSALS.md is unchanged.
Doc comment only.
What a kernel pays for Shared storage on a discrete card, beside the read-only table already
there: a kernel reading 64 MiB and writing 64 MiB in order (the harness's scale_offset), and a 3x3
filter over a 1920x1080 float4 image (binomial3x3), each with both buffers Shared or both Private.
A Shared buffer on a discrete card is system memory by Metal's contract, so its rate is the host
link's: 2.7 to 11.6 GB/s here, 20 to 316 times the Private time.
Measured with the harness's Shared twins of bandwidth and image_filter on probe 3cb938bd4b (on
6fbc7ab91a, build 48059, never landed), two processes per runtime, the old runtime level with
the new on Shared: RX 7900 XTX and RTX 2080 in job 48061, RTX 3090 in jobs 48063 and 48064 (two
hosts), RX 550 in job 48062. The figures are the new runtime's.
Docs only.
The marker cfe2dc8994 keeps (m2v-observes) is named, like every lowering, by the
partial-threadgroups variant's FunctionCompileKey: the kernel's AIR, entry, constants and linked
functions, its lowering inputs, the device profile's fingerprint and the translator's semantics
version. So everything that can change the translator's partition answer moves the key. The
semantics version's contract now names that answer among the facts whose change bumps it.
The marker is 12 bytes, queued under the reaper's pending bound and written and counted in young
like a lowering, so it stays within the store's existing cap. The old runtime's path is
byte-equal: nothing under crates/metal2vulkan-runtime changes, and the translator's change is
this doc comment.
Comments only; no behaviour changes.
A state of a kernel that observes its partition lowers only its plain module at creation, so the
store held no partial-threadgroups variant to answer the partition question, and every device on a
warm directory asked the translator again: kernel_observes_partition decodes and specializes the
kernel's AIR. On the 780M (probe 3cb938bd4b, job 48062) that was 1546 us (median of 3 warm-store
processes) inside the device's first state of lcg_step, which the translator answers as an
observer: rt's creation call 1780 us against the old runtime's 499. A kernel that does not observe
its partition paid nothing there, as its kept variant answers it.
The answer is now kept like the translator's refusal of the variant: a marker under the variant's
key (m2v-observes), written by the reaper after the translator answers, read before asking. The
observer's variant, lowered at the first ragged grid, replaces it under the same key; that lowering
states the observation itself. Bytes a lowering never encodes to: an earlier build reads the marker
as a miss (its decode fails) and asks again, and a directory without markers reads as before.
The cache-directory device test now asserts the second device decodes no stage entry.
Verified: see the job named in the landing message (clippy plain, m2v_gpu, m2v_cpu_icd; rustdoc;
unit tests; lavapipe device tests; negative control).
With robustImageAccess2 on the floor, the translator leaves an image read's bounds to the device.
On the UHD 630 the nc rows (a pass that loads its target and samples another texture at
1920 x 1080) drop by 27 to 33% and run faster than the old runtime. Harness, release, GPU p50
a pass, median of three rounds, base 4a0d6abc1e and F 3575c4e3c3 (each with the same probe
rows), exclusive job m3-max-47748:
nc_first_hd rt 670.0 -> 449.3 us, old 570.5
nc_after_hd rt 895.1 -> 632.5 us, old 808.2
nc_first_hd_rt rt 647.0 -> 450.5 us, old 583.1
nc_after_hd_rt rt 896.4 -> 656.6 us, old 807.5
texture_read rt 3621.2 -> 3616.7 us, old 3702.5
On the XTX (m3-max-47580) the same rows are unchanged within noise (nc 11.0-13.8 us both arms,
texture_read 79.0 -> 79.2 us). On the 3090 (m3-max-47611) nc_first_hd_rt goes 18.1 -> 16.4 us,
the others are unchanged (texture_read 123.9 us both).
new_compute_pipeline_state asks for one index per numbered sampler, and a
texture read() numbers NumberedSampler::Read. The test gave none, so the state
failed to build (job 47598 on the 2080). It now checks the read is the one
sampler numbered and gives it index 0, as the sampling tests do.
each_missing_feature_is_named holds one case per REQUIRED feature, and the
floor's new member had none (m3-max-47542: 'a required feature has no case').
The conformance suite records no out-of-range texture read and runs on the
old runtime alone, so this device test stands in for it. The engine fixture
oor_texture_reads (companions regenerated in m3-max-47528, metal 32023.922,
SDK 27.2) reads ten texels in one thread, each at the coordinate and level of
a buffer word so the compiler sees no constant: of an RGBA8Unorm texture of
4 x 4 with two levels (inside at levels 0 and 1, past the width, the height,
the texture's levels, level 1's own width, and at x = u32::MAX), of a view of
its first level alone (past the view's levels, where the texture has the
level), and of an R8Unorm texture (inside, past the width, past its levels).
The expected texels are Metal's, not the documentation's alone: the same
source compiled at run time and run on an Apple M3 Max under macOS 27.0.1
(m3-max-47527, carry oor-metal.swift): the texel inside; (0, 0, 0, 0) for
every RGBA8Unorm read out of range, the view's past its levels included; and
(0, 0, 0, 1) for the R8Unorm reads out of range, a format without alpha. That
is the translator's contract (zero, alpha 1 where the format has none), so
there is no rule 1 question. Under robustImageAccess2 the device answers them
with no check in the shader.
The plan's image-robustness ruling, built into rt. Every sampled read() took
ReadCheck::Shader on rt: lower/texture/slot.rs read_check asks
memory/contain.rs device_reads_texels, which is true only where the profile's
images.robust_image_access2 is, and floor.rs had robustImageAccess2 in neither
REQUIRED nor OPTIONAL, so from_queries never saw it (shader_enables passes only
what rt enables). The shader's check is a levels query, a size query, the
in-bounds test, a clamp and a select per read; the device form answers Metal's
out-of-range texel exactly (zero, alpha 1 for a format without alpha, a fetch
past the view's levels included). Measured before on the old runtime: the
device form costs nothing, the shader check 3%, 11% and 17% on the UHD 630,
XTX and 3090.
robustImageAccess2 is now a REQUIRED member of VkPhysicalDeviceRobustness2-
FeaturesEXT (VK_EXT_robustness2, which rt already requires) and enabled;
robustBufferAccess2 stays off, so a texel buffer's read keeps the shader check.
The translator is unchanged: from_queries derives the feature from what rt
enables, so Device::new (the old runtime's path) is byte-equal by construction.
Every leg reports it (vulkaninfo, no GPU timing): 2080 and 3090 (NVIDIA
620.70.06), XTX, both 780Ms and lavapipe (Mesa 26.2.6) in m3-max-47473 and
47475; the UHD 630's Windows driver (API 1.3.215, VK_EXT_robustness2 only) in
47477; KosmicKrisp (Mesa 26.3.1) on the M3 in 47478; the committed local
captures of the Iris Xe RPL-P, the 780M and the RTX 5080 laptop; RX 550 in
47476.
Tests: the floor fixture reports it; the translator sees robustImageAccess2
enabled and robustBufferAccess2 not; on every device of the cfg's kind the
profile enables it and device_reads_texels(false) is true while
device_reads_texels(true) stays false. README floor tables updated;
docs/REFUSALS.md regenerated, unchanged.
The consumer adds a scheduled handler to every command buffer. The submit thread handed each
command buffer's scheduled handlers to the completion thread (Done::scheduled), and where that
thread waited on the GPU the hand-over was a host vkSignalSemaphore of its wake timeline, on
every submission. On NVIDIA a host signal per submission measured 103-117 us of CPU a command
buffer on an RTX 3090 (the waits probe's rt arm, job 47928), against 2.9-3.5 us for every single
wait form, rt's own steady-state WAIT_ANY included.
Now the submit thread, which already marks a command buffer scheduled as it joins a submission,
runs its scheduled handlers itself once it has dropped its lock, in queue order, before that
submission goes to the driver and before any of those command buffers is handed on as ended.
So the status reads Scheduled and the kernel times are set in the handler, a command buffer that
ends before it joins a submission runs none, as before, and the scheduled handlers run before the
completed ones by construction. Done::scheduled, its list and the completion thread's branch for
it are deleted.
A handler on the submit thread may not call what waits for that thread to submit. The four
internal sites that do (Work::room, Work::capture, Work::stage and the readback's flush and
Done::wait) give the public entries that reach them; each is now Refusal::InScheduledHandler in a
scheduled handler, on every device and whatever the runtime holds: commit; wait_until_scheduled,
wait_until_completed and SharedEvent::wait_until_signaled_value; replace_region, upload_region,
get_bytes and zero_block_range; new_managed_buffer, and new_buffer zeroing a buffer in a Private
block. The one consumer's scheduled handler makes none of these calls, and a guest's
addScheduledHandler block runs in the guest. Quiesce in a scheduled handler answers false at once
(neither the submit thread nor the completion thread, which the submit thread stops as it ends,
is waited for), and a device whose last handle drops there tears down on the reaper, as from a
completed handler.
For a consumer: CommandBuffer::wait_until_scheduled and wait_until_completed now return
Result<(), Error>, and SharedEvent::wait_until_signaled_value returns Result<bool, Error>
(api_signatures.tsv blessed); docs/REFUSALS.md regenerated; the README's contract says where each
kind of handler runs, what a scheduled handler may do, and that it holds its queue's later
submissions while it runs.
Tests: every_device_tears_down_from_a_scheduled_handler,
every_device_answers_false_to_a_quiesce_in_a_scheduled_handler, and
every_device_refuses_each_call_that_waits_for_the_submit_thread_in_a_scheduled_handler (each
refused entry by name, the allowed calls, the status and kernel times in the handler, and the same
calls answering once it has returned). Verified by the next jobs.
The consumer adds a scheduled handler and a completed handler to every command buffer, so a
runtime's cost of carrying and running them, and of waking the thread that runs them, is part of
every command buffer it runs. The harness's workload rows committed bare command buffers, and
only frame, frame_5cb and long_4cb had a completed handler (the commit-to-complete timer), so the
burst rows timed a shape the consumer never runs. Now commit_run adds both to every command
buffer of a run, in both runtimes: rt's add_scheduled_handler and the old runtime's submission
handler, the point its consumer takes as a command buffer is scheduled. The handlers do nothing
but run.
To be verified by a table of the rows beside the parent's, both runtimes, on NVIDIA first.
The open record against the RTX 3090's extra leg is closed: the old runtime refuses a Shared
dma-buf import on a type with no coherence promise, and reims's forced-refusal pair is green at
the refusal's commit. So the matrix's exception for that record goes with its tests:
results.record_excused, the wrong-bytes parse behind it, the matrix's record_suites and the
`open_records` config key. Every failure on an extra leg is judged again.
a_shared_dma_buf_import_takes_host_coherent_types_or_none now runs over each lab driver's memory
types as vulkaninfo printed them (NVIDIA 620.70.06 on the RTX 2080, ANV on the Iris Xe, RADV on
the RX 550, RX 7900 XTX and 780M, lavapipe), with the udmabuf types the device test printed on
each, in place of the synthetic lists.
Verified: python3 -m unittest test_results test_matrix (53 OK); the per-device expectations
match the SHARED-DMA-BUF lines of the device test on each card (refused untried on both NVIDIA
cards, type 2 on the Iris Xe, type 5 on the three RADV cards, type 0 on lavapipe). The Rust test
is compiled and run by the next check.
The broad device suite on the RTX 2080 at the refusal (job 47947, dcc72aea65's archive) failed 27
dma-buf tests that make no-copy buffers (Shared) over host pages' dma-bufs and expect them
imported: on NVIDIA their order's first type, 0, is not host-coherent, so those imports are now
refused with no attempt and the buffers are copies (or the pages' pointer imports).
no_pointer_import::imports_shared_dma_bufs asks the device the way the runtime decides it: a
one-page udmabuf's types among a buffer's give a Shared import an order
(memory::dma_buf_candidates) or not. refuses_shared_dma_bufs, where they do not, checks what a
test then expects: a no-copy buffer over a RAM's pages with a source of their dma-bufs is made
with no dma-buf imported and over none, or refused as not importable; it prints so and the test
ends there. The tests that expect the import call it after their route check:
dma_buf_beside (2), dma_buf_shared_files::on_device (its tests and dma_buf_kept_files'),
dma_buf_in_import::over_dma_buf_pages, dma_buf_import_cycles' buffer cycles and several
imports, dma_buf_leak_probe::rounds, host_ram_dma_buf (2), in_place_check's dma-buf pages,
no_pointer_import (2) and shadow_write_lines' copy back. Devices that import such dma-bufs run
every test as before.
Not changed: the 2080's two queue_share_device latency tests failed in the same run; they make
no dma-buf and are not this change's.
The start-stage question closes on the RTX 2080. The bare burst probe (job 47967, NVIDIA
620.70.06, 2000 command buffers of one dispatch, medians of 40 runs) gave 21.29 us a command
buffer with no timestamp, 21.57 with the end alone, 23.88 with the start alone at TOP_OF_PIPE
and 23.68 with the start at BOTTOM_OF_PIPE: the start's cost does not fall to the end's at the
later stage, so the start stays where it is and the candidate (12c4dd857c) is not landed. The
XTX showed no difference between the stages either (job 47895). rt's harness on the 2080 in the
same job, T B B T: burst_2000 32487/32512 us at the top against 32553/32545 at the bottom,
burst_160 2803/2790 against 2792/2805.
Since every device test's instance runs under the validation layer, the lock
budget's three tests counted the layer's own locks: it takes an rwlock on
every command it checks, 74 locked instructions a draw, 170 a bound draw and
119 a dispatch on the RTX 2080 and the Radeon RX 7900 XTX (job 48024, perf
record of r1e25 on um790: pthread_rwlock_* and libVkLayer_khronos_validation
on the encoding thread). The reading is the runtime's and the driver's.
Locks::each_device opens the devices on a plain instance and fails where any
lists an active validation tool, so the layer cannot come back into the count
unseen; on_each_device is each_device's body on a given instance. The
validation helper's docs name the exception.
Verified by the next jobs: the check on msi, then the lock legs on um790 and
ms01.
Metrics::attachment_read_copies and attachment_read_copy_bytes (a render target read through a
counted copy where the device has no attachment feedback loop) count in bytes_copied too, so with
them and over_copies on the frame line, a frame's copied bytes split into staging, over copies and
attachment read copies.
Verified: cargo fmt; the replay lane's check job compiles it.
AddressMap::relocate looked each 8-byte word of a write up in the range tree, twice (the aligned
words and the count of those 4 past them), so a large upload cost two tree searches a word: on the
M3, relocate took 65% of the player's main-thread samples in one of u2's tail frames. A level's
ranges are disjoint, so the top level's first range starts the live ranges' span and its last
ends it; a word outside that span lies in no range, and now takes no lookup. Every word a lookup
would move still moves.
Test: words_outside_the_live_ranges_span_stay (words below the first range, between ranges and at
the last one's end stay; those inside move).