6e88d181dd3640a267c74c22cb4a3ce113a75813
458
Commits
| Author | SHA1 | Message | Date | |
|---|---|---|---|---|
|
|
6e88d181dd |
Record each pipeline state creation, and warm a device from an earlier process's records
DeviceOptions::pipeline_records (and RawDevice::pipeline_records) hands a
hook an opaque PipelineRecord once per pipeline state creation that made its
state. That covers compute, render, mesh and tile states, the
additional-binary-functions forms, and a render state's draw-time twins (the
one-sample and factor-scaling ones). A failed creation and a binary
archive's add make none. A record holds the descriptor field by field
("M2VPREC\0", RECORD_FORMAT 1, the library table by content hash, SHA-256),
read back and compared at its making. Its libraries are kept once in the
shader cache's content directory. to_bytes and from_bytes carry it between
processes.
Device::warm(records, byte_budget) stands in for Metal's own pipeline caches
across processes:
- One background thread per device (utility QoS on macOS, Urgency::Warm in
the making budget) runs each record's creation under the default options
and drops the state. Translations, creation records and driver
pipeline-cache data are then in place before the program asks.
- The guest sees nothing of it: no identifier, resource ID, sampler number,
neutral, room, stand-in copy, kept-variant traffic, live-variant sharing,
announcement or record.
- It stops at byte_budget of added driver data.
- An unread record is counted, and the device's first is announced as the
warning metal2vulkan-warm-record-unread; nothing fails.
- WarmStatistics and Device::warm_statistics report the pass.
Ports dev-perf 14df1fb5fe and 66fe0ada29 without per-entry stamps.
Development's build directory names the translator, and its creation records
name RUNTIME_VERSION, so no entry of another translator or runtime version
is ever found, and dev-perf's re-translate-and-compare check has nothing to
do. Adapted:
- the memo is asked but never hands a warm thread a live variant the
program holds;
- a warm thread's waits rank Urgency::Warm, not Program (making.rs), and the
pipewait creation bound still applies on warm threads;
- unread records are announced.
DeviceOptions' and RawDevice's Debug are hand-written. PipelineRecord is
among the consumer auto-trait checks. api_signatures re-blessed; runtime
README and HOWTO updated. RUNTIME_VERSION 1707.
Verified on the M3 Max (MoltenVK 1.4.2), on development 2e2e238346:
- 140 device tests and 500 plain tests pass.
- Five sabotages each fail their guard: an archive add making a record; a
pass answering Warmed without creating; no unread announcement; a warm
state taking an identifier; a warm thread taking a live variant.
- clippy plain and --cfg m2v_gpu, and rustdoc -D warnings, clean.
- Release, 5 runs of the cross-process test, three creations (render,
compute, indirect compute):
- after a warm pass: 3.11-3.42 ms, with 0 stages decoded, 0 translated, 0
directory lookups and 0 driver caches loaded;
- unwarmed over the same directory: 4.19-4.32 ms (6 lookups, 2 loads);
- cold: 4.98-5.10 ms.
Small shaders, and Metal's own cross-process compiler cache serves all
three legs.
Lane commits: ws/warmrec-lane (8d106f29ab hook, 30de4fc948 warm).
One work packet, landed as 2 commits on archive/development-linear-2026-10-29: 8c709f27a7, then e2f0f2a3d9 (the re-pin).
|
||
|
|
d4fa99a14c |
Make a state's predicted key in its general form, every texture class drawn at once
Ports dev-perf 7028c0d92a onto development. On a device that samples
through Metal's own texture unit (MoltenVK) a texture slot a function
converts to `half` declares `SpecKey::PlainHalfTexels` and
`SpecKey::UnmeasuredTexels`, each with an arm that serves every bound
class exactly (0: the class routine; 0: no instruction reads it). A
state's creation predicts no texture bound, so a draw binding an
unmeasured class (BC4 to BC7, the linear ASTC formats among them) keyed
apart from the one pipeline the creation made, compiled its own at the
draw, and its command buffer waited for it (past the commit bound the
draw is dropped).
The residual form becomes the general form (`render/residual.rs`):
RangeAtBindOffset, PlainHalfTexels and UnmeasuredTexels at 0. A state's
creation makes its predicted key's general form, waited as before, and
where the predicted key differs hands the predicted key itself to the
pool right after, at the rank nothing waits for, not waited for. A draw
whose own key is not made takes the general form at once while its own
is made, as the residual form did. graphics_pipeline_now and
made_or_make now say whether the pipeline is the key's own, so a made-now
draw that took the general form keeps nothing in its encoder's memo.
Adapted to development (development wins):
- Development's native half-texel rounding (
|
||
|
|
3fd1f6672b |
Cut copied host buffers' CPU sync: page-at-a-time compare, log-gated copy in, merge only what may be written
The consumer's 4K boot on the RTX 5080 at the stock vm.max_map_count was unusable past its import gate: about 680 MiB of live copies (2,934 made) were compared whole at every commit and every completion, costing about half a core on both sides. Until the GPU copy is wired, three exact cuts, plus the dirty-log reports change 1 needs (the consumer's audit, A to C). - Change 3, a page-at-a-time compare (copied.rs sync): each 4 KiB page is compared whole (slice equality, vectorized), and the byte-exact merge runs only inside a page that differs. Same bytes as before; unit-tested against the old routine on random data, both sides changed included. - A, the copies' merge-back is reported: each copy keeps its pages' DirtySource and a writer id. sync collects the runs it wrote, and merge_back reports them with wrote_as before the completion is visible. Bytes a read-only copy drops are not reported. - B, the runtime's own CPU writes into logged pages are reported: replaceRegion into a heap's shadow texture (texture/heap.rs), the argument encoder and copyParameterDataToBuffer, as buffer_texture.rs already did. - C, GPU writes into logged pages imported in place are reported: each command buffer's written uses over memory with a dirty source, as writer 0 (the consumer's own writes, which every copy counts). They are reported at commit, before signals in the completion turn, and at completion, minus the shadows' own copy-backs. Collection is on while copies or such imports are live. Past the use cap, each written import is reported whole. A texture's use is reported as its whole buffer or heap (correct, coarse). This also closes the texture-shadow gap for pages reached through two imports. - Change 1, the log gates the copy in: where a copy's pages have a log (HostRam::with_dirty_pages, or the object's HostMemory::with_dirty_pages), a commit compares only the pages the log reports written since the copy last agreed. It uses one stamp per log and commit for every copy, waited for as the shadows' gated copy-in waits (DirtyPages::wait). A false wait, a copy's first copy in, bytes no log covers, and a copy that merged back 1 MiB or more since its last copy in compare everything. The copy in now runs before the commit's second state-lock block, since it may wait up to the log's bound. - Change 2, merge-back skips copies no finished batch may have written. Its "may write" is the bindings' write answers plus unnamed reach: a command buffer with a function that reads addresses (a root table), or one that executes an indirect command buffer, counts every copy as written. WorkCounts (new): copied_copy_in_bytes_skipped, copied_merges_compared, copied_merges_skipped. RUNTIME_VERSION 1705. Docs: copied.rs (Cost, Coherence), dirty_pages.rs' trait doc (what the runtime reports), FAST-PATHS (copied-host-pages known gap; the shadow gap closed), HOWTO copied host buffers. Measured, release, 680 MiB of live copies (2,049), median of 7, copy in / merge back in ms: - RTX 5080 laptop host (Core Ultra 9 275HX): - nothing changed: 231.8 / 231.6 before; 0.16 / 0.00 with all three; - 1% of pages changed: 233.7 / 233.8 before; 3.43 / 33.0; - one copy redrawn: 254.6 / 261.6 before; 29.4 / 34.1. - M3 Max: - nothing changed: 314.5 / 314.0 before; 0.12 / 0.00; - 1% of pages changed: 321.4 / 321.4 before; 4.54 / 18.5; - one copy redrawn: 353.9 / 395.4 before; 39.4 / 54.9. The merge-back figures are with the batch naming what it writes. A real frame's skip rate was not measured; the new counters show it. Verified: - M3 Max, MoltenVK 1.4.2, --cfg m2v_gpu, under memcap and maclock: the runtime lib suite passes 1445, 2 skipped. - RTX 5080 Laptop, NVIDIA 615.71.09, one 42 s hold: copied|dirty_pages| host_ram|event 101 pass. - New tests: 6 plain gating and merge-skip tests; a contract test that a concurrent CPU write survives both ways, log on and off; 7 device tests of the B and C reports, the gated copy, a read-only batch skipped, and an unnamed write still merged back. - Negative controls, each shown failing then passing once restored: gate forced off; A's report removed; C's registration or completion reports removed; the shadows' copy-backs not subtracted; B's heap report removed; merge skip forced off; unnamed reach ignored. - clippy plain and --cfg m2v_gpu (Mac, and msi niced), rustdoc -D warnings, api_signatures, api_surface, fast_paths. Lane commits: ws/cpusync-lane (180fc103c1 .. 59d82299ad, 9 commits). One work packet, landed as 2 commits on archive/development-linear-2026-10-29: bb00ae47f6, then 2b8ad3ab58 (the re-pin). |
||
|
|
97116bb420 |
Keep pages the kernel cannot pin from NVIDIA's driver, and copy them as a failed import is copied
On NVIDIA's driver (615.71.09, RTX 5080 Laptop), a failed host-pointer
import of pages the kernel cannot pin breaks the process's later
host-visible allocations. The consumer's device-creation probe hit this, so
no guest RAM chunk imported afterwards. The runtime now asks the kernel
first on that driver, refuses such pages itself with the answer Vulkan
requires, and never hands them to the driver. The object then goes its
other ways: the dma-buf source, else a copy.
Cause, measured on msi's 5080 through runtime device tests that logged each
call's VkResult and errno, the fd table and the process's maps:
- The consumer's probe makes no dma-buf import on NVIDIA. Its 1025-page view
is past udmabuf's list_limit, so its source refuses. What fails is the
runtime's import of the view's pointer, a VM_PFNMAP mapping of a udmabuf:
vkGetMemoryHostPointerPropertiesEXT succeeds (types 2 and 3), then
vkAllocateMemory answers ERROR_OUT_OF_DEVICE_MEMORY on both.
- After that, vkAllocateMemory answers ERROR_OUT_OF_DEVICE_MEMORY to every
host-pointer import measured:
- memfd pages from 8 KiB to 8 MiB at any offset;
- anonymous pages;
- RAM 512 MiB away;
- 40 retries over 3 s;
- a second VkDevice.
It also fails a plain 64 KiB host-visible allocation. Device-local
allocations still work. The chunk import fails in vkAllocateMemory, not
in the properties query or the requirements check.
- Not the cause: a failed udmabuf import itself (the next 8 chunk imports
bind, and NVIDIA closes the handed clone: F_GETFD EBADF), the properties
query alone, mapping a udmabuf, address reuse, the fd table, VmPin/VmLck,
the kernel log.
Vulkan (vkspec 1.4.366, 11.2.6): such a restriction "must fail the memory
import operation with the error code VK_ERROR_INVALID_EXTERNAL_HANDLE_KHR";
and (Return Codes) "VK_ERROR_OUT_OF_*_MEMORY errors do not modify any
currently existing Vulkan objects."
Fix:
- RuntimeDriverDefect::UnpinnablePagesBreakHostMemory (NVIDIA_PROPRIETARY,
no GPU probed clean, per the defect table's rule).
- On such a device, Device::refuse_unpinnable runs before a no-copy
object's, heap's or rebind's own import and before a guest RAM chunk's
import. It walks the mappings over the pages (PROCMAP_QUERY, or the maps
lines before Linux 6.11) and reads one byte of each through
process_vm_readv. The kernel refuses a whole VM_IO/VM_PFNMAP mapping, so
one read per mapping answers for all its pages.
- Pages it cannot pin get its own Unsupported/HostMemory refusal naming the
defect. That refusal sends the object to the dma-buf source; with none,
or where the source's import fails, the object is a copy, announced as
copied-host-pages and counted as a failed import. This holds for buffers,
heaps and rebinds. A RAM chunk over such pages is not imported, and the
objects over it end in the copy. Pages not mapped readable keep their
refusal. The new refusal reaches a caller only where pages remapped after
their first import are imported again (docs/REFUSALS.md regenerated).
- Counted: WorkCounts::host_imports_unpinnable.
- Every other driver, and every OS but Linux, asks nothing and keeps its
path.
- Docs: driver_defects.rs (the measurement), FAST-PATHS known gaps, HOWTO
section 6 and its copy causes, the runtime README, copied.rs,
CopiedHostPages and its API.md entry.
- RUNTIME_VERSION 1704.
Verified:
- RTX 5080 Laptop, NVIDIA 615.71.09, --cfg m2v_gpu: the runtime filter
host_ram_device|copied_device|rebind|dma_buf|host_residency|
driver_defects|host_memory|host_import|copied passes 97/97 on the
committed tree.
- New: a_chunk_is_imported_after_a_refused_import_of_a_dma_buf_mapping
failed without the fix ((0, 0) where (1, 2) is expected) and passes
with it.
- New: pages_refused_before_the_driver_with_no_source_are_copied: a
buffer, a heap and a rebind over a udmabuf mapping with no gate and no
source give 3 refusals before the driver and 3 copies. The GPU reads
the right bytes, and a chunk then imports with 2 buffers bound.
- The consumer's repro, with its device probe in front
(os::linux::host_ram::tests::a_buffer_over_one_run_of_the_ram_is_bound_in_its_chunk,
built from a read-only copy of their 2cb3c8f91): passes. It fails against
development 2e2e238346.
- M3 Max, MoltenVK 1.4.2: the same filter 83/83; runtime unit tests 1161;
API, refusal-surface and fast-paths tests 34; rustdoc -D warnings clean.
Clippy -D warnings is clean on the Mac (plain and --cfg m2v_gpu) and on
msi (plain and --cfg m2v_gpu).
Left: RADV and ANV refuse such pages themselves, so an object there with no
source is still refused (not run there). A failed chunk import is not kept,
so the kernel is asked again for each object over that chunk (cost not
measured).
Lane commits: ws/chunkfix-lane (a2420020ea, a56fa43f2b).
One work packet, landed as 2 commits on archive/development-linear-2026-10-29: a0a1ea79d4, then 22fa5003db (the re-pin).
|
||
|
|
44eaa09898 |
Copies of read-only pages drop the GPU's writes; the gate is asked before write permission
The consumer's 4K boot on the RTX 5080 (NVIDIA 615.71.09) died at a buffer rebind onto 12 KiB of
read-only pages (`replaceBackingWithRanges:readOnly:`) with `OutOfMemory(Device)`, its gate having
refused the pages.
Cause: on Linux the runtime asked the pages' write permission before the caller's gate. Read-only
pages with a dma-buf source were sent to the source (by_pointer cleared), and the gate, asked only
for pages imported by pointer, was skipped. NVIDIA 615's import of the source's dma-bufs fails with
VK_ERROR_OUT_OF_DEVICE_MEMORY, and that failure was answered as the call's error, where a failed
pointer import takes the copy. The copy path itself never ran. Reproduced on the 5080: a buffer's
rebind, a heap's rebind and a no-copy buffer over read-only pages under a refusing gate each
answered OutOfMemory(Device). On macOS the gate was asked and the copy made, and the copy's
merge-back then wrote the read-only pages: SIGBUS in all three.
Fix:
- The gate is asked before the write permission, at a no-copy buffer's or heap's making and at a
rebind. Pages it refuses, and bytes moved in their page, are a copy, their permission unasked;
only pages imported have it asked.
- An admitted import of the caller's dma-bufs that fails (out of memory, another Vulkan error)
takes the copy too, as the pointer's import did: the gate's documented contract.
- A copy of pages the process cannot write drops the GPU's writes (copied.rs), as Metal drops them
for read-only memory (read_only_view.rs). The copy asks the system as it is made
(`mapped_writable`: PROCMAP_QUERY on Linux, mach_vm_region on macOS). At each completion, every
byte the GPU changed in the copy takes back the byte the pages and the copy last agreed on, and
nothing is written to the pages. Later commands of the same batch read the write back; a later
command buffer reads the pages' bytes. CPU writes through another mapping are copied in at each
commit as before.
- The copied-host-pages detail says so; read-only-pages-written is not announced over a copy.
Changes beyond the consumer's case: gate-refused pages and moved-bytes copies no longer ask the
kernel for write permission (no host_mappings_queried for them). Read-only pages with no source
under a refusing gate are a copy instead of Unsupported.
WorkCounts::copied_dropped_bytes (new). RUNTIME_VERSION 1703. api_signatures.tsv blessed;
REFUSALS.md regenerated, unchanged. Docs: HOWTO (copied host buffers), API.md (copied-host-pages,
read-only-pages-written), FAST-PATHS (the read-only-memory known gap now excepts copies),
ImportGate, HostMemory::new, new_buffer_with_bytes_no_copy, Buffer::rebind_bytes_no_copy, the two
Degradation declarations, copied.rs module docs.
Tests:
- Device, copied_device:
- a no-copy buffer, a buffer's rebind and a heap's rebind over read-only pages under a refusing
gate, the consumer's form: a read-only shared mapping, a dma-buf source on Linux;
- checked in each: the gate asked once with the pages, the source never called, a copy that
reads the bytes and a CPU write through the writable mapping;
- a blit fill completes with the pages unchanged, nothing merged back, copied_dropped_bytes the
fill's changed bytes, and a later command buffer reading the pages' bytes;
- Linux: the rebind under an admitting gate whose dma-buf import fails is a degraded copy that
drops the writes.
- Unit: restore, merge_back of an unwritable copy, mapped_writable (Linux and macOS).
- Negative controls:
- the three refusing-gate tests on the unfixed runtime: RTX 5080 3/3 fail with
OutOfMemory(Device) at the call; M3 Max 3/3 die with SIGBUS;
- the admitted test with only the source-failure copy arm removed: the 5080 fails with
OutOfMemory(Device).
Verified:
- RTX 5080 Laptop, NVIDIA 615.71.09 (msi; four holds, each under a minute): runtime
copied_device|rebind|host_ram_device|tests::copied::|can_be_written 52/52 at the final tree. The
admitted test's copy path ran (its line printed).
- M3 Max, MoltenVK 1.4.2, --cfg m2v_gpu under maclock and memcap: the same filter 49/49 (the
admitted test is Linux-only).
- Mac: degradation_catalogue, copied and host_memory unit tests with api_surface and
published_crates 37/37; api_signatures and fast_paths 16/16; clippy --workspace --all-targets
--all-features, plain and --cfg m2v_gpu, clean; rustdoc -D warnings for the runtime clean.
- msi: clippy -p metal2vulkan-runtime --all-targets --all-features --cfg m2v_gpu clean.
- Not run: the validation suites. The runtime-sources pin is left for landing.
One work packet, landed as 2 commits on archive/development-linear-2026-10-29: 5012056c31, then 6385d650b9 (the re-pin).
|
||
|
|
c0617d796e |
Rebinds take the copy where the gate refuses: heaps, images in place, moved bytes, one-run chunks
The NVIDIA RAM route's rebind part, with RunResolver's doc saying a rebind asks it. One work packet, landed as 4 commits on archive/development-linear-2026-10-29, in order: * Rebinds take the copy where the gate refuses: heaps, images in place, moved bytes, one-run chunks (c0e37e8984) The NVIDIA RAM route's rebind part (consumer spec, part 4). A buffer's rebind with an image in place over it, and a heap's rebind, now take the copy of the new pages (copied_pages) where the caller's gate refuses their import or the admitted import fails, instead of refusing NotImplemented(RebindTextures) or failing the call. Heap rebinds ask the gate like any import. A buffer's rebind to bytes at another offset in their page, under a texture planned at the old offset, takes a copy laid out at the old offset (the gate unasked: nothing is imported) instead of refusing. - The copy's memory, where images will bind in it, holds the window's whole pages from a multiple of the import's unit. The heap's textures bound to its bytes and the images in place over the buffer are made again over the copy: in memory the device allocates, as linear images that start PREINITIALIZED, whose first move keeps the copy's bytes (Vulkan: "the transition away from this layout will preserve that data"). - Where images in place ride on the copy, it lies in fresh pages the runtime maps and imports by pointer (Device::fresh_page_buffer), and each image is made as over the caller's pages for host allocations, under the device's in-place check for fresh pages (PagesClass::Fresh, else RebindTextures). On the RTX 5080 the driver's own linear image does not lie at Metal's 256-byte pitch, so the first form still refused there. - The run resolver at rebind (ram1's route_runs and bind_in_chunk): asked once with the new window, on the calling thread with no runtime lock held, before the gate. One run inside one chunk binds in the chunk's import (no import, no gate); any other answer takes the gate, then the import or the copy. The runs are kept with the new pages, copies included; bytes moved in their page are never chunk-bound. - Metal's rebind order is unchanged: the pending check runs before the gate, and committed-not-submitted command buffers are encoded again over the copy. - RebindTextures stays, for a device that makes no image over the copy at the texels' pitch, memory type or alignment, and for drops-writes buffers (option bit 24) whose bytes moved. WorkCounts (new): copied_rebind_pages_moved (a third cause within copied_host_buffers_made) and copied_rebind_images_made. No new Error variant. heap_raw_image takes (memory, at) and a memory-type check. RUNTIME_VERSION 1702. Docs: HOWTO copied host buffers and guest RAM, API.md copied-host-pages, FAST-PATHS (the heap and in-place rebind exception removed from the known gap), the runtime README, ImportGate, HostMemory::with_runs and with_import_gate, rebind.rs, copied.rs module docs, RebindTextures; REFUSALS.md and api_signatures.tsv regenerated. Verified: - RTX 5080 Laptop, NVIDIA 615.71.09 (msi, one hold): runtime copied_device|host_ram_device|rebind|in_place 48/48; the image over the copy is made (copied_rebind_images_made asserted 1) in the gate-refused, moved and ordering tests. Validation rebinds|dma_buf_imports 28/30: the two failures (ycbcr planes over chunks "off the grid", dma-buf in place "one run") also fail at development 2cfd8d6ef9 on the same GPU. - M3 Max, MoltenVK 1.4.2, --cfg m2v_gpu under maclock: runtime host-memory filter 157/157; validation rebinds|dma_buf|copied|no_copy|host_memory 75/75; at the final tip copied_device|host_ram_device|rebind 40/40. Here textures over buffers are shadows, so only the heap image over the copy runs (1 per heap test). - 7 new device tests: gate-refused buffer rebind with a texture over it, moved bytes, heap rebind gate-refused and import-failed, ordering with a held and an uncommitted command buffer, resolver at rebind (one run binds in the chunk; two runs go gate then copy). - Focused non-device tests 76/76; clippy plain and --cfg m2v_gpu clean; rustdoc -D warnings clean for the runtime. - Not covered by one venue: both images over a copy at once. Lane commits: ws/ram3-lane (d3945d0d9d, 7a114b599e, b93a6c1eac, 8b9fa5fb46). * Re-pin the runtime sources at the landing tip (7f76090454) * Say that a rebind asks the run resolver, as c0e37e8984 made it (8dcba47435) RunResolver's doc still said a rebind to new pages does not ask it. Since c0e37e8984 a buffer's or heap's rebind asks it once with the new window, before the gate, except where the bytes moved in their page under a texture, which take a copy without asking (with_runs' and Buffer::rebind_bytes_no_copy's docs already say so). Doc only. * Re-pin the runtime sources at the landing tip (17896b4366) |
||
|
|
7d1323ebcc |
Convert extended-range, padded and bfloat texels by the device's arithmetic
A read is float(c - 384) times the f32 nearest 1/510 (a padded code's float(c) times 1/1023), a write RoundEven(clamp(v)*510)+384 (padded *1023), an sRGB twin's colour the MSL transfer by the device's Pow on the magnitude, a half result the device's narrowing, a bfloat code its bit shift with NaNs as computed. Metal's correctly rounded quotients, exact-product rounding, ties-away half rounding and its extended/padded sRGB tables leave the shader path: extended_range/table.rs, R10X6_SRGB_DECODE_STEPS, round_exact_product(_lanes) and the plan's table fields are deleted. Each such module records DevicePackConversion; FAST-PATHS' air.pack row and API.md's catalogue state the bounds (one f32 ulp, one code, half a 2^-13 sRGB step, R10X6_SRGB 1.64 steps). The host-side clear_texel and the bicubic code still read extended_srgb.rs's tables, so on an sRGB twin a clear and a shader write can differ by one code. Verified: 331 touched lib tests; clippy plain and m2v_gpu; rustdoc; conformance ledger tests; M3 replay of 89 extended-range cases (exit 0, 276 ledger rows, +254/-57 against development); validation heap_extended on the M3 (6/6); the new tests fail with FDiv decode. Golden: 346 cells in 20 heap/argument-buffer subjects move (blessed on development). Translation words of an sRGB twin's read 4433 -> 588, write 5540 -> 632. One work packet, landed as 2 commits on archive/development-linear-2026-10-29: 8acec5a4a2, then 96d8394995 (the re-pin). |
||
|
|
76d89d87a8 |
See an event signal behind a copied host buffer at its completion turn
An event signal behind a copied host buffer is seen at the batch's completion turn, and the
copied host pages' cost is announced as the catalogue states it.
One work packet, landed as 4 commits on archive/development-linear-2026-10-29, in order:
* See an event signal behind a copied host buffer at its completion turn (8fc9c56dcb)
A batch's event signal is its GPU signal of the event's timeline semaphore,
and the host read the semaphore's counter directly (`EventShared::value`),
while a copied host buffer's GPU writes reach the caller's pages only at the
batch's completion turn (`completion.rs`, merge then `reached`). So a CPU
that saw the value could read the pages before the GPU's writes, and a plain
event's wait chained on the VkQueue let another queue's work start before
them: Metal's writes before a signal are in the pages once its value is
seen (the documented gap in FAST-PATHS, now closed).
A signal kept while the device holds a live copy is marked behind the merge
(`EventTimeline::keep`). No counter read observes it or any signal after it,
and no wait is handed its index (the scheduler's own host wait included); a
plain event's wait for it is held as a shared event's is. The completion
turn, which merges first, observes it and wakes every host wait and held
batch. The signal stays the batch's GPU signal: no submission is added. The
cost per such signal: its value reaches readers one completion turn later
than the counter shows it, and a GPU wait for it is a host hold plus a
vkQueueSubmit at that turn. Counted: WorkCounts::event_signals_behind_merge.
The same mechanism will hold for the GPU-kept copies.
RUNTIME_VERSION 1699 (renumbered at landing).
Verified on the M3 Max (MoltenVK), --cfg m2v_gpu, under memcap and maclock:
57 copied, event, scheduler and fast-path tests pass, among them the new
a_shared_event_s_value_is_seen_once_the_copy_s_bytes_are_in_the_pages
(six rounds, spin reads and host waits, a 64 MiB copy beside to lengthen
the merge) and the timeline unit test
a_signal_behind_a_merge_is_seen_at_its_completion_turn_alone. Negative
control: with the mark off, the device test fails on the byte check
("the write is in the pages once the value is seen"). clippy (plain and
--cfg m2v_gpu) on metal2vulkan and metal2vulkan-runtime, api_signatures
re-blessed (the new field), api_surface pass.
RUNTIME_VERSION 1700.
* Re-pin the runtime sources at the landing tip (2cef515da6)
* Announce the copied host pages' cost as the catalogue states it; list what pack.rs reaches (e9ba27478b) (its crates/metal2vulkan-runtime/src/degradation.rs part)
The final gate on 3e20b58763 failed two tests.
- degradation_catalogue: the signal-behind-merge fix (8fc9c56dcb) closed the
shared-event gap and rewrote the API.md entry for copied-host-pages, but the
runtime still announced "(behind a shared event's value among them)". The
announced cost now drops it, so the catalogue's entry starts with it word
for word again.
- the_runtime_sources_are_the_committed_ones: pack.rs became a runtime input
(the mipmap kernel's sRGB transfers), and it also reaches
metal2vulkan-air's intrinsics, lower/arith/math.rs and lower/arith/narrow.rs
through its pack and unpack intrinsics, which only the compile emits. They
are listed as not runtime with that reason. The stale comment about
srgb.rs's encode, tables and steps (deleted by the mipmap and n7 packets)
now says only what is true.
Verified: the two tests on the landed tip (see the landing).
* Re-pin the runtime sources at the landing tip (538f3f1161)
|
||
|
|
f4394b8712 |
Copy a no-copy buffer's pages the kernel cannot pin where the process maps them readable
Cause: a copied host buffer (the caller's gate refused the import, or the admitted import
failed) read its first bytes only through the kernel: `process_vm_readv` of our own pid on
Linux. That read pins each page, and no page of a VM_PFNMAP or VM_IO mapping can be pinned, so
on a dma-buf's mapping (udmabuf's on Linux 7.2) it fails although the pages are mapped
readable. `CopiedBuffers::add` then answered `NotCopied::Unreadable`, and the buffer, heap or
rebind was refused as not importable (`Unsupported { HostMemory, NotRepresentable }`): the copy
never worked for dma-buf mappings, which is where a consumer's gate refuses imports on NVIDIA
at the kernel's default vm.max_map_count.
Fix: where the kernel's read fails, the copy asks the process's mappings whether every page of
the range is mapped with read permission and, if so, reads it with plain loads, the access the
copy's comparisons already make at every commit and completion (`copied::read_caller`). The
mapping check generalizes the import's write check: `PROCMAP_QUERY` tests
`PROCMAP_QUERY_VMA_READABLE` as it tested `..._WRITABLE`, and before Linux 6.11 the
/proc/self/maps lines' `r` as their `w` (`host_memory::Access`, `queried_permitted`,
`permitted`, `mapped_readable`). Pages not mapped, or mapped without read permission, are still
refused. All three users of `add` (buffers, heaps' own buffers, rebinds) take it. Off Linux
nothing changes (no mapping is asked; macOS's mach_vm_read path as before). RUNTIME_VERSION
1696 -> 1697 (renumbered at landing). Docs: API.md's copied-host-pages entry, HOWTO's copied
host buffers, the runtime README, and FAST-PATHS' known gap with the measured cost.
Evidence (verified):
- msi (Linux 7.2.8, RTX 5080): tests::copied + tests::host_memory 21/21; the udmabuf test
printed "the kernel cannot read this udmabuf mapping: copied with plain loads".
Under the GPU lock on NVIDIA: tests::copied_device + tests::copied 15/15, among them the new
copied_buffer_is_made_over_a_dma_buf_mapping_the_gate_refuses (gate refusal -> copy made,
announced, CPU writes copied in and a fill merged back over the udmabuf pages).
- Negative control on msi: with the fallback disabled the two new copied tests and the new
device test FAIL (the device test at the buffer's refusal); restored, PASS.
- macOS (M3 Max, MoltenVK, under maclock): copied, copied_device, host_memory 25/25; plus
degradation, catalogue and fast_paths 45/45.
- clippy -D warnings clean: macOS plain and --cfg m2v_gpu; Linux (msi) plain and
--cfg m2v_gpu, runtime crate, all targets, all features. rustdoc -D warnings clean (runtime).
- Cost, release, msi: one add of a 64 MiB udmabuf range 15 ms (the failing kernel read 6 us,
the mapping query 22 us); each comparison of a 64 MiB copy 22-41 ms on the CPU; on NVIDIA a
live 64 MiB copy makes each empty command buffer's commit and wait 45-68 ms (0.2 ms without).
- Not run: the Mac's Linux container exposes no /dev/udmabuf.
RUNTIME_VERSION 1698 at landing.
One work packet, landed as 2 commits on archive/development-linear-2026-10-29: 1612481fb3, then 95852120a3 (the re-pin).
|
||
|
|
63859d8cc1 |
Sum emulated filters' taps in the device's arithmetic
Rule 1: where the device has a native form it is the only form. The emulated filters reproduced Metal's datapath bit for bit: a 2^-16 Catmull-Rom weight table, two-word integer sums truncated onto grids and rounded half up, exact quotients, ties-away half rounding, a 12-bit sRGB grid snap, 64ths of a level and 256ths of a blend, and the anisotropic filter's piecewise log2 and chord exp2. All of it is gone. Bicubic (lower/sampler/bicubic.rs, bicubic/routines.rs): - One routine, `Plane::sum`: Catmull-Rom weights computed in f32 from the fraction (vec4 Horner), the sixteen taps summed by the device's multiply and add, rows then columns; Metal's bilinear rule (32-bit float formats, a level under four texels) is the device's FMix of the four inner taps already fetched; UNORM/SNORM clamps. - 1D: `Line::sum`, the device's FMix of its two taps. - An 8-bit sRGB twin's taps are the device's transfer, not the 1/4095 grid. A half result is the device's narrowing (`narrow::round`), not ties-away. - Kept: Metal's footprint, addressing, mirror pin, filter selection, `Quad::exact` (in-place YCbCr's filter, owner form H, not touched). - Deleted: the weight table routine, the exact/half/accumulated plane and row routines, the block and float-quad routines, their words and specials; metal::bicubic's test-only table and its test. Extended range (lower/sampler/extended.rs): - Linear, 3D and the linear mip filter's level blend decode their taps through xrconv's functions as they are, then FMix in f32 at the f32 fractions; the level weight is the f32 fraction, not 64ths; a half result is the device's narrowing. Bicubic clamps into the format's decoded endpoints. The in-place decode keeps `Quad::exact`. - Deleted: the step tables' callers (steps_of, step, level_taps, half_of) and, in xrconv's extended_range.rs and texel_round.rs, the helpers only they used (STEPS_WORDS, has_steps, steps, step_grids, ratio_by_255_to_f32, normal_half_bits; minimal edits in another lane's files). Anisotropic (lower/sampler/anisotropic.rs): - The device's Log2 and Exp2 replace Metal's piecewise log2, chord exp2 and truncations; the level and spacing are not rounded to 256ths, 4096ths or a 6-bit mantissa. - Each tap is one explicit-level sample: under a linear mip filter the fractional level, which the device's own linear mip filter blends. The two-samples-a-tap form existed because an RTX 3090's blend of a fractional level is not Metal's (1.03 codes off without anisotropy); under rule 1 that blend is the device's. A nearest mip filter's level stays whole (the 3090's anisotropic sampler blends the next level at a fractional level whatever its mipmap mode). - Kept: Metal's length, tap count thresholds, floor(256/n) weights, kappa fit and direction. Notes: PrecisionNote::BicubicFilterArithmetic is reused, broadened to the extended-range linear, 3D and level blends (select.rs records it); AnisotropicFilter's doc names the device's logarithm and blend. No new variant, no ARTIFACT_FORMAT_VERSION bump. FAST-PATHS: the two "not built yet / none known" bicubic rows are now one device-gap row (the device's sum is the form); the known-gaps bullet loses the sRGB grid snap. API.md's catalogue entries rewritten. SEMANTICS_VERSION 1922 -> 1923. Tests: the plane routine's interpreter differential against an f32 Catmull-Rom reference in the routine's order (fails on the old table and integer sum), the line routine's FMix, the routines' word bounds; engine_bicubic against the polynomial within 2^-18 (+ half ulp); extended-range engine tests compare within the filter's bound (`filtered_close`); xr_bicubic's `near` adds Metal's table's deviation from the polynomial (WEIGHTS_BOUND 2.1e-3); anisotropic and bias-reach tests count one sample a tap and two Exp2 per emulation. Lanes and the conformance suite: - runtime_lane::extended_range_samples compares linear samples within `xr_bicubic::filtered_close` (moved to devtools from the engine test, which re-exports it); two_plane_samples holds the digest of nearest cases only (a linear one's values are compared by the conformance suite's xr-two-plane-samples cases). - runtime_lane::anisotropic_filter's bounds re-measured on the M3 Max with samplerAnisotropy withheld: linear 10.375 codes max (mean 0.21), nearest mean 0.82 and 6.7% of channels a code or more off, clamp to edge 6.531 max. Other devices not measured. - conformance: the XR two-plane-samples and extended-range/padded extended-swizzles cases declare bicubic-filter-arithmetic; 32 known-gaps rows (Apple M3 Max) for the linear sites the device's FMix moves. - runtime-sources.sha256 re-pinned: metal/bicubic.rs lost its test-only table and docs; no run's behaviour depends on it. Verified (this M3 Max, macOS 27.0.1): metal2vulkan + devtools suites, 3302/3303 passed (golden_hashes_match_the_table fails: 1001 cells moved, not blessed). Module words of a bicubic sample (ANV Iris Xe profile): xr_bicubic xrb_edge 12990 -> 2093, a2_bicubic_weights 15731 -> 3858, bcx_rules 30727 -> 11388; anisotropic emulation (vk12-floor) 2705 -> 1884. Also in this packet: the padded 10-bit formats' linear samples join the known gaps (d326b293c0), and the conformance coverage document is regenerated for the filter rows. Anisotropic emulation (devices without samplerAnisotropy only) now takes the device's Log2/Exp2 and level blend, and Metal's spacing roundings (r' to 256ths, g*S to 4096ths, S to a 6-bit mantissa) are gone with them: on the M3 with samplerAnisotropy withheld, linear reads up to 10.4 codes from Metal (mean <= 0.21), bounded in runtime_lane/anisotropic_filter.rs. One work packet, landed as 2 commits on archive/development-linear-2026-10-29: abc366a2fa, then 8f506cb2fd (the re-pin). |
||
|
|
20287666c0 |
Blend extended-range attachments in the device's arithmetic; drop the 32-bit float Metal blend
Rule 1 (owner, 10-29): where the device has a native form, it is the only form.
An extended-range attachment's raw codes are something no blend unit reads, so the
shader still blends it (capability), inside the pixel interlock or over lavapipe's
input attachment. Its arithmetic used to be Metal's compiler's: lerps, common
factors, fusing by factor rank, half rounding at every step, a separate float4
model and computed-output tables. Now it is a blend unit's arithmetic: S*Fs op D*Fd
in float, in the order of the blend equation, with the source, second source and
blend color clamped to the form's range first (`extended_range::blend::native`).
- computed.rs is deleted. blend_color.rs keeps only the two source ranges.
- input_blend.rs and fetch.rs call native().
- The blend color is pushed as raw f32 bits (HalfBlendColor), so
PushField::BlendColor is gone.
- Every blended extended-range output that stores a channel now records
ExtendedRangeBlendSource (half) or ExtendedRangeFloatBlendSource (float).
- The refusals ConstantColorDifference, SrgbForm and FloatOutput are gone, as is
the fast-math DualSource refusal for extended range. Every factor, operation
and mask is built; only outputs other than four half or float lanes are
still refused (Output).
The 32-bit float storage-form blend (`Blend::float32`, `fetch::float32_blended`)
computed Metal's fused forms in float. Every committed profile except
roadmap-2022 and vk12-floor sets COLOR_ATTACHMENT_BLEND on R32/RG32/RGBA32_SFLOAT,
so that form copied Metal's bits where the device blends natively. It is removed:
- a fetched 32-bit float attachment takes the generic float blend
(UnmeasuredFetchBlend);
- one that is not fetched gets the device's blend after the pass splits.
The float4-output paths of the half/unorm8 model (Atom::Sf, Arith::Kept,
round_inner, Blend::float/narrow/takes_float) were dead after this and are pruned.
Removed:
- the Metal blend-table validation lane (extended_range_blend_table.rs)
- devtools xr_blends
- the xr_blend_table*.txt fixtures
- lower/arith/tests/blend32.rs
- the extended_range tests that pinned Metal's forms
Added:
- every_blend_is_the_devices_arithmetic: every form, 19 factors, 5 operations,
rotating masks and adversarial sources, bit-exact against a float model of
S*Fs op D*Fd
- every_blend_is_built_but_a_placeholder
Docs:
- FAST-PATHS: the "Metal's rounding per shape" fast row is removed. The
extended-range blend is now a device-gaps row with the two notes. The
32-bit float row and the interlock section are fixed.
- artifact.rs note docs and the API.md catalogue are rewritten.
- REFUSALS is regenerated, reach.tsv updated and api_signatures blessed
(removed ExtendedRangeBlend::{ConstantColorDifference, FloatOutput, SrgbForm},
PushField::BlendColor).
- Conformance: the two notes join replay::NATIVE_NOTES, and 16 Apple M3 Max
known-gaps rows hold the xr-blend add/premul sites the device's arithmetic
moves: one code, two at the sRGB premultiplied sites.
- SEMANTICS_VERSION 1923, ARTIFACT_FORMAT_VERSION 479.
Size: a premultiplied half4 fill into RGB10A8_2P_XR10 on moltenvk-m3 goes from
3275 to 1937 SPIR-V words (the blend itself from 2133 to 795). The float4 fill
goes from 3435 to 1951 words, and BGRA10_XR_sRGB premultiplied from 7992 to 6654.
Verified:
- metal2vulkan lib, touched modules: 511/511.
- Sabotage: rounding the source to half in native() fails
every_blend_is_the_devices_arithmetic; restored, it passes.
- clippy, plain and with --cfg m2v_gpu; rustdoc -D warnings.
- M3 Max conformance replay of 25 cases: half-output-blends-*,
blend-interaction-format-float32 and xr-blend-*-one-zero are justified; the 16
xr-blend add/premul sites are held by the new rows.
The replay exits 0 with the ledger held exactly. The conformance crate
passes 1007/1007, CONFORMANCE-COVERAGE is regenerated, and runtime
degradation/catalogue and api_signatures/api_surface/refusal_surface pass.
- M3 device tests (memcap + maclock, --cfg m2v_gpu): 11/11 of
runtime_lane::extended_range_blends and framebuffer_fetch::generic_blend.
The renamed blends_of_half_outputs_into_extended_range_texels asserts
Metal's bytes for one-zero and prints the 16 add/premul outputs the device's
arithmetic moves.
One work packet, landed as 2 commits on archive/development-linear-2026-10-29: 808143ef80, then 18431ee908 (the re-pin).
|
||
|
|
442a9fd538 |
Bind no-copy objects over one run of guest RAM in the device's chunk import
The NVIDIA chunk route's API (HostRam, Device::use_host_ram, HostMemory::with_runs), the chunk
source and one-run route, and a chunk-bound buffer's out-of-bounds writes held to the device's
own containment (a device test and a known gap).
One work packet, landed as 7 commits on archive/development-linear-2026-10-29, in order:
* Add HostRam, Device::use_host_ram and HostMemory::with_runs (d3617f7e1d)
The API of the NVIDIA chunk route (guest RAM imported whole): the types the
chunk source, the GPU copy and the rebind lanes build on.
- HostRam (unsafe new(ranges, keep_alive)): the consumer's guest RAM ranges,
checked as non-empty, whole host pages, within the address space and apart;
a typed refusal otherwise (Invalid, Problem::HostRam). with_dirty_pages
takes one DirtyPages log for the whole RAM whose offsets are host addresses
(the log's pointer is 0), so one stamp per commit can serve every copy. The
keep-alive is dropped with the HostRam (forgotten while the process exits).
- Device::use_host_ram(&Arc<HostRam>) -> HostRamUse: a guard, since runtime
devices live for the process while a lease promises its RAM for one guest
device's life. Dropping the guard ends the use; a later RAM may be used
after. Several RAMs whose ranges are apart may be used at once; one whose
ranges meet a used RAM's (itself among them) is refused as misuse
(Invalid, Problem::HostRam). A device without VK_EXT_external_memory_host
is refused (Unsupported, naming it).
- HostMemory::with_runs(RunResolver): RunResolver is
Arc<dyn Fn(start, len) -> Option<Vec<Range<u64>>> + Send + Sync>, asked with
the import window, answering host addresses in the RAM's ranges. Stored
here; the routing that calls it comes in a later commit.
No Metal counterpart for any of it; the doc comments say so. The chunk import
itself (lazy 64 MiB chunks) and the routing in buffer_over_host_memory follow.
Verified: cargo clippy -p metal2vulkan-runtime --all-targets --all-features
-D warnings (Mac); host_ram unit tests 4/4 (range checks, refusals,
keep-alive drop); api_signatures and refusal_surface 7/7 after the re-bless
and regeneration; rustdoc -D warnings for the runtime crate.
* Re-pin the runtime sources at the landing tip (22c47609a9)
* Bind no-copy objects over one run of guest RAM in the device's chunk import (7f07d19b3d)
What: the chunk source and the one-run route (host_ram.rs).
- Chunk source: a device that uses a HostRam imports it by host pointer in
64 MiB chunks (CHUNK_BYTES), never across a range's end, lazily. Each chunk
is imported the first time an object over it is made, on that thread, once,
under a lock of its own (ChunkSlot). It goes through the existing
Memory::import_host: a coherent type, and the device-address flag where
bufferDeviceAddress is on. A whole-chunk VkBuffer is kept for the runtime's
own copies only, never named by a Metal buffer, root entry or binding.
- Chunk lifetime: chunks are never released while idle (they are no
HostImport, so host_residency never sees them). Once the HostRamUse is
dropped, a chunk is freed when nothing holds it: Placement gains ram_chunk,
so every buffer bound in a chunk holds it, and every command buffer that
used one does too. The RAM, and so its keep-alive, goes after the free
(release_then's after), dropped as the program's. Exiting leaves it all to
the process's end.
- Routing in buffer_over_host_memory: a buffer that lies in a live import of
the same bytes is unchanged. Otherwise, where the device uses a RAM and the
memory has a resolver, the resolver is asked once with the import window, on
the calling thread with no lock held, before the writability query and the
gate. Memory whose GPU writes bit 24 drops is never routed.
- One run inside one chunk: Device::bind_in_chunk makes the VkBuffer with
host_buffer against the object's own window, checks it with binds_in
against that window, and binds it at run offset + binds_in offset in the
chunk's memory. That offset must be a multiple of the buffer's alignment,
and the buffer must allow the chunk's memory type. Its placement
(Placement::ram_chunk) holds the chunk and maps the caller's pointer, so
contents stays the pointer. The buffer gets no import of its own, the gate
is not asked, and buffer_of keeps the import fixed (no Again).
- Several runs, a run crossing a chunk's end, a chunk that cannot be imported
or a buffer that cannot bind exactly: today's gate path (import, or copy
where the gate refuses).
- The RAM and runs are kept on HostPages (ram_runs) until rebind or release,
for the GPU copy lane.
- An answer that is not whole pages of one used RAM totalling the window is
refused: Invalid, Problem::HostRam.
- Heaps over host memory take the same routing (of_heap goes through
buffer_over_host_memory).
- rebind_host_pages only ignores the new HostParts.runs (`runs: _`). The
rebind lane asks the resolver there with Device::route_runs and
bind_in_chunk.
- New WorkCounts: host_ram_chunks_imported, host_ram_chunk_bytes,
host_ram_chunks_live (a gauge), chunk_bound_buffers_made.
- Docs: HOWTO "Guest RAM imported whole", the runtime README's extension list.
RUNTIME_VERSION 1697 -> 1698.
Why: the NVIDIA route (the consumer's spec). On a device that refuses
dma-buf views, each import of scattered guest pages takes a kernel mapping per
page, past vm.max_map_count at 4K. One-run objects bound in chunks take none.
How verified (this Mac, M3 Max, MoltenVK, under memcap + maclock):
- host_ram unit tests 8/8: chunk spans and lookup; one run in a chunk, a
chunk's last pages and a range's short last chunk; several runs and a run
crossing a chunk (gate path); broken answers refused.
- New device tests tests::host_ram_device 6/6. The path ran: the log prints
"chunks imported 1, chunk-bound buffers 2".
- One run binds in the chunk: 1 chunk import of 64 MiB, 0 pointer imports,
gate not asked, contents == pointer, the GPU reads the bytes, a fill
reaches them, a second buffer in the chunk imports nothing.
- Containment: a 1.5-page buffer's copy reach <= its 2-page window, and a
fill of all of it leaves the sentinel page before and the bytes after it
unchanged.
- A no-copy heap binds in the chunk.
- None, two runs and a crossing run ask the gate once and import; short and
outside answers are refused.
- A command buffer held behind an event keeps the chunk (live gauge, and
the keep-alive not dropped) after the buffer, the use and the RAM are let
go of; once it completes the chunk is freed and the keep-alive dropped.
- The same RAM twice and an overlapping RAM are refused, a RAM apart is
taken, and a new RAM over the same ranges is taken after the first use
and imports again.
- Regression on the same Mac: 249/249 for
host_|copied|dirty|rebind|heap|no_copy|dma_buf|in_place|detach|alias|
degradation|profile (copied_device, dirty_pages_device and the
host-import tests among them).
- clippy -D warnings plain and --cfg m2v_gpu (runtime, all targets, all
features); rustdoc -D warnings for the runtime; api_signatures 3/3 after
the re-bless.
Not run here: NVIDIA (msi 5080) and lavapipe; dma-buf devices' own tests
beyond the Mac's.
RUNTIME_VERSION 1699 at landing.
* Re-derive the generated documents at the landing tip (a9c042f142)
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.
* Re-pin the runtime sources at the landing tip (2cfd8d6ef9)
* Hold a chunk-bound buffer's out-of-bounds kernel writes to the device's own containment (1b09d84fad)
What: a device test (tests::host_ram_device) whose kernel, the owned fixture's
scale_and_offset, writes three pages of words through a one-page buffer bound
in a chunk of guest RAM. It asserts that the page before the buffer and the
pages after it keep a sentinel, and that the kernel wrote the buffer itself.
The page-after assertion applies wherever the device keeps the same write,
through a one-page buffer of its own, out of the buffer made after it: the
chunk binding is held to the device's own containment, measured in the same
test. A known gap in docs/FAST-PATHS.md records the device that does not
contain such writes.
Why: containment (c) of the route. A chunk-bound VkBuffer ends at the
object's last page, but the chunk's memory goes on past it, so containment
rests on the device's buffer robustness or in-shader checks, not on the
import's end as a per-object import does.
Found and how verified:
- RTX 5080 laptop (NVIDIA 615.71.09), msi, one hold 06:00-06:02, strict form
(no device check): host_ram_device 7/7. The chunk's pages after the buffer
were untouched.
- lavapipe (linux-gate, slot lava, arm64), strict form: 7/7.
- M3 Max (MoltenVK 1.4.2), this form: 15/15 host_ram tests. It prints that
out-of-bounds writes changed 32720 bytes of the device's own next buffer and
32720 bytes of the chunk's next pages. A control run (not committed) showed
that a no-copy pointer import of one page changed 0 bytes past its page. So
MoltenVK's gap is within an allocation; it predates the route, which
inherits it.
- clippy --cfg m2v_gpu -D warnings (runtime, all targets).
Also: the RunResolver doc no longer says rebinds ask it; they do not until rebinds are routed (af9f1e057d).
* Re-pin the runtime sources at the landing tip (60c300198f)
|
||
|
|
9bd91540f4 |
Take the device's answers for fast atan2, half fmod and precise pow's NaN; delete exact sRGB leftovers
- fast::atan2 without every fast-math flag divides by the device's own
reciprocal of x; past 2^126 the denormal it makes is the device's
(DeviceDenormals through MetalFloatDenormals; NativeDivision as before).
FastAtan2 { reciprocal_flushed } -> FastAtan2 { by_reciprocal }.
- A half fmod answers its float remainder rounded; the Metal zero-sign
select is gone and the call records NativeTranscendentals through
FloatFn::half_zero_of_float.
- Precise pow's NaN is classed BaseToExponentOne, so it records
NativeNanEncoding like fast pow and atan2 (the measured() exclusion
was left over from the removed pow(x,1) bit fix). Fast sin/cos keep
DeviceNanEncoding on purpose: Metal answers +0 there, no NaN to stand for.
- Delete the exact sRGB pack/unpack's dead code: ArithPlan::srgb,
Declared::srgb, SRGB_PACK/SRGB_UNPACK, srgb::TABLE_WORDS,
math::unpack's normalized and sRGB branches (UnpackRounding,
unpack_rounding, mul_exact, unpackable), word::srgb_code.
WordAttachment::output_word returns Option<u32> (None for Srgb8).
With the mipmap filter on the transfer (c9dd35e8a4), srgb's declare/
word/step and SRGB_ENCODE_FIRST lost their last users and go too, with
their texel_round test; SRGB_DECODE_STEPS stays for the ASTC and PVRTC
decoders.
- FAST-PATHS: row 58 names half fmod; known gaps lose the atan2 and
half-fmod lines. API.md: native-transcendentals, native-nan-encoding.
- SEMANTICS_VERSION + 1.
Verified: fmt, clippy (all features, m2v_gpu), rustdoc; metal2vulkan
arith/word/fast_paths 241/241, engine call notes + public fixture
expectations 20/20, api_signatures+api_surface 15/15, runtime 29/29,
validation c3 72/72; the atan2 tests FAIL on the old flushed reciprocal.
No conformance case reaches atan2, fmod or pow. Golden hashes: 21 rows x
19 profiles move (fast_atan2.f32 and fmod.f16 fixtures), re-blessed on
development.
One work packet, landed as 2 commits on archive/development-linear-2026-10-29: abb2b3db6e, then f76cdba457 (the re-pin).
|
||
|
|
67a1651f35 |
Filter mipmaps by the device's arithmetic, not Metal's tables
The mipmap compute filter takes the device's arithmetic (pack.rs's sRGB transfer and half conversions), and the validation guard lists the translator files it now reaches. One work packet, landed as 5 commits on archive/development-linear-2026-10-29, in order: * Filter mipmaps by the device's arithmetic, not Metal's tables (c9dd35e8a4) Rule 1: the mipmap compute filter (extended-range formats, 8-bit sRGB textures held as their UNORM twins, formats without blits or linear filtering) reproduced Metal's bits inside a capability path. Its arithmetic is now the device's: an 8-bit sRGB code decodes as c/255 through the MSL transfer by the device's division and Pow and encodes by the transfer then RoundEven(t*255) (pack's srgb_decode/srgb_encode, as the twin's shader reads do since c70ec588c4); an extended-range sRGB code takes the same transfer on its magnitude; a half takes UnpackHalf2x16/PackHalf2x16; a float's NaN is the device's; the products and sums lose NoContraction. The twelve-bit and 8192-step tables, the k/4095 step, srgb::search and the integer half rounding are gone (RG11B10Float's encode and RGB9E5's conversion stay: no device instruction gives them). cpu.rs is the bounded model: MipmapFilterChain::expected_levels is the chain in IEEE f32, and the new MipmapFilterChain::outside_bound lists a device level's texels outside 2^-17 of the terms' magnitudes (+2^-140) of the filter of the level above as the device wrote it: a code at a rounding boundary, an sRGB transfer within 2^-17 + 2^-20, one RGB9E5 mantissa step, any NaN. The interpreter models GLSL Pow as the f64 power rounded once. Announced as before by DeviceFilteredMipmaps; its docs, API.md's entry and FAST-PATHS say the filter is the device's arithmetic. No version moves: the owned kernel is built in-process and the driver cache keys on its words. Verified: 475 touched and contract tests; the bind::mipmap_filter interpreter tests FAIL with the old table decode restored and pass with the change; clippy plain and --cfg m2v_gpu; rustdoc. Apple M3 Max: mipmap_chains 4/5 (5 formats within the bound, 8 texels off the IEEE model; the 3D blit chain is the MoltenVK failure that predates this), runtime mipmap tests 13/13, conformance blit-generated-mipmaps announced and justified. lavapipe: mipmap_chains 5/5, 9 formats through the filter including both sRGB twins, RG11B10Float and RGB9E5Float. * Re-pin the runtime sources at the landing tip (187fa18b3d) * List air.pack's lowering among the runtime sources the validation guard hashes (4020aeecc9) The mipmap filter's owned kernel (bind/mipmap_filter/kernel.rs) takes its sRGB transfer and half conversions from lower/arith/pack.rs since c9dd35e8a4, so the runtime's inputs reach pack.rs, and the guard (candidate::engine::artifact::tests::the_runtime_sources_are_the_committed_ones) failed on development's gate at 4052e2209c: "the runtime inputs reach files that are neither inputs nor listed: lower/arith/pack.rs <- bind/mipmap_filter/kernel.rs". build.rs now lists pack.rs, and its comment says srgb.rs's steps feed the ASTC and PVRTC decoders (the mipmap filter no longer reads them). The hash moves with the new input; no runtime behaviour changes, so RUNTIME_VERSION stays (the landing re-pins). * Re-pin the runtime sources at the landing tip (821450aa43) * Announce the copied host pages' cost as the catalogue states it; list what pack.rs reaches (e9ba27478b) (its crates/metal2vulkan-validation/src/candidate/engine/artifact/tests.rs part) The final gate on 3e20b58763 failed two tests. - degradation_catalogue: the signal-behind-merge fix (8fc9c56dcb) closed the shared-event gap and rewrote the API.md entry for copied-host-pages, but the runtime still announced "(behind a shared event's value among them)". The announced cost now drops it, so the catalogue's entry starts with it word for word again. - the_runtime_sources_are_the_committed_ones: pack.rs became a runtime input (the mipmap kernel's sRGB transfers), and it also reaches metal2vulkan-air's intrinsics, lower/arith/math.rs and lower/arith/narrow.rs through its pack and unpack intrinsics, which only the compile emits. They are listed as not runtime with that reason. The stale comment about srgb.rs's encode, tables and steps (deleted by the mipmap and n7 packets) now says only what is true. Verified: the two tests on the landed tip (see the landing). |
||
|
|
9c1cd5500f |
Take NVIDIA's submit stall where the count puts it, under 2 ms too
The RTX 5080's device test tests::submit_stalls_idle failed since the stall packet ( |
||
|
|
df2bbfc3ab |
Merge a shadow over logged host pages back by its changes: words, or whole blocks where Metal rewrites them
Over host pages whose consumer logs every write, a pass replacing every texel takes the gated
merge, stored in whole 256-byte blocks; a loading, storing pass's attachment merges in whole
blocks of its area's rows; a kernel's and a blit's partial writes stay word by word, and
docs/FAST-PATHS.md says why.
One work packet, landed as 6 commits on archive/development-linear-2026-10-29, in order:
* Merge back a pass replacing every texel of a shadow over logged host pages (3b5b3b9b51)
A command that replaces every texel of a shadowed texture (ShadowUse::overwrites,
a cleared pass among them) took no copy in and no keep, and its copy back wrote
every texel it moved into the buffer's bytes: on a discrete GPU, 6 MB per
host_ab drag frame across PCIe for the 23 cleared 256x256 surfaces, whatever
changed. Over host pages whose consumer logs every write to them
(ShadowCopies::logged), such a command now takes the merge a command that
leaves texels in place takes: its gated copy in (only the rows the log reports
changed since the image's last copy, every row where the log cannot say), the
keep, the command, and the merge, which stores only the words the command
changed against the keep (shadow.rs, overwrites_unkept, and the module's
**Overwrites over logged pages**).
Metal's bytes: the gated copy in is decided once the log published the stamp
the command buffer asked at its commit, so the image and the keep hold the host
bytes as of the commit, every CPU write before it included, and a word the
merge leaves already holds the value the command wrote. A byte another writer
writes after the commit is one the command writes too, a race Metal leaves
unordered. Without a log the image may lag the CPU's writes, so there the copy
back stays a plain copy, as before. No switch: no byte differs from Metal's.
RUNTIME_VERSION development's 1692 + 1 = 1693 (renumbered at landing).
Verified on the M3 Max (MoltenVK), tests::dirty_pages_device:
- a_pass_replacing_a_logged_render_target_merges_back_the_words_it_changed:
frame 1, 0 texels copied back and 1 merge; frame 2, the gated copy in takes
the told row alone (256 bytes), the told CPU row the pass clears back to the
image's old black ends black (Metal's), and a CPU row the log left out, which
the pass clears to the black the keep held, keeps the CPU's 0x50 bytes: only
changed words are stored.
- a_pass_replacing_an_unlogged_render_target_copies_it_back: 4096 texels copied
back plainly and no merge, two frames.
Sabotage 1 (overwrites_unkept ignoring the log): the logged test fails (4096
texels copied back, 0 merges). Sabotage 2 (keep and merge without the copy in):
it fails on Metal's bytes (row 0 [16,16,0,16], want [255,0,0,255]). Restored:
dirty_pages_device, shadow, shadow_host_writes, shadow_merge_read,
shadow_carried_read, render::shadows and degradation tests 57/57 under
--cfg m2v_gpu; clippy plain and --cfg m2v_gpu (runtime) clean; rustdoc
-D warnings for the runtime clean.
* Store an overwriting pass's merge over logged pages in whole 256-byte blocks (d34f373d52)
Over host pages whose consumer logs every write to them, a command that
replaces every texel of a shadow (ShadowUse::overwrites, a cleared pass among
them) is merged back word by word since 3b5b3b9b51: only the words it changed
against the keep are stored. Where those changes are scattered, every warp's
store leaves gaps between words, which an RTX 5080 storing into host memory
over PCIe charges hundreds of times for (bind::shadow_merge's module docs:
590 ms against 0.85 ms per 8 MiB), where the plain copy back it replaced stored
every texel without gaps.
The merge kernels (bind::shadow_merge_module, shadow_merge_image_module and
its kept-image form) take a store form, bind::ShadowMergeStores { Words,
Blocks }. In the block form, the 64 words a workgroup takes in one step are one
256-byte block (ShadowMergeModule::BLOCK_BYTES), marked in workgroup memory
where a word of it changed (clear, barrier, atomic or, barrier); a marked block
is stored whole, a word it left as read, and no other block is read or written.
The form is chosen by structure, with no switch: blocks exactly for the merge
of a command that replaces every texel, cut to the texels' rows (so every word
it examines is texels' bytes, none between rows or past the last texel); every
other merge (partial writes, two ways, a linear attachment's) keeps the words.
That is Metal's answer: the command wrote every byte of every such block, as
the plain copy back stored them all, so a word it left is stored with the value
the merge reads, which differs from the command's only by another writer's
write since the commit, a race with the command's own write. A scratch made for
one kind of command is kept again only for the same kind; a command of the
other kind merges it and takes a new one. WorkCounts gains
shadow_merge_dispatches_in_blocks. RUNTIME_VERSION 1693 + 1 = 1694.
Public API: bind::ShadowMergeStores (new), shadow_merge_module /
shadow_merge_image_module / shadow_merge_kept_image_module take it,
ShadowMergeModule::BLOCK_BYTES, WorkCounts::shadow_merge_dispatches_in_blocks
(api_signatures re-blessed, api_surface lists the enum).
Verified on the M3 Max (MoltenVK):
- tests::dirty_pages_device::a_scattered_overwrite_of_logged_pages_merges_back_in_whole_blocks:
a 1024x1024 target over 4 MiB of logged pages, the CPU's texels (told to the
log) grey at every other texel; a pass clearing to black (one pixel drawn
red) merges 8 of 8 dispatches in whole blocks and leaves the pass's bytes, the
CPU's grey texels black; a pass loading and drawing black everywhere changes
the same words and merges in words (0 of 8 in blocks), same bytes. GPU time
median: blocks 1.318 ms (4 MiB stored), words 1.096 ms (2 MiB stored).
- Sabotage (never choose blocks): that test fails (0 of 8 in blocks).
- Device tests dirty_pages_device, owned_pushes, shadow, shadow_host_writes,
shadow_merge_read, shadow_carried_read, render::shadows: 42/42.
- Interpreter tests of both forms (ported from the measurement branch): equal
bytes in both forms and orders, two barriers per invocation in blocks, and a
current buffer holding only the first block, so any access to an unchanged
block traps; bind::shadow_merge*, owned_divisions, api_surface,
api_signatures 26/26.
- clippy workspace plain and runtime --cfg m2v_gpu, rustdoc -D warnings.
* Re-pin the runtime sources at the landing tip (44c96cfdf8)
* Merge a loading, storing pass's attachment back in whole blocks of its area's rows (2fcdb470fe)
A render pass that loads a shadowed color attachment and stores it, changing
it only inside its draws' scissors (ShadowUse::area), merged back to the
buffer's bytes word by word: only the words it changed against the keep. Where
those changes are scattered, a GPU storing into host memory over PCIe pays for
every separate run of words in a 64-byte host line (about 180 ns each on an RTX
5080, serialized: 88 to 102 ms for every other word over 4 MiB, against 0.4 ms
in whole blocks).
Metal itself rewrites such texels. Measured on this M3 Max's Metal (macOS
27.0.1, an ObjC harness, not MoltenVK): a 512x256 RGBA8Unorm texture over a
no-copy Shared buffer, 300 passes each loading and storing it and drawing one
pixel (a long fragment loop, about 2.9 ms of GPU time each), while a CPU thread
wrote a fresh value to every other texel over and over and checked that each
read back its last write. For points at (70,70), (200,130), (10,10) and
(100,33), the other 1023 texels of the 32x32 tile holding the point reverted to
an older value in 157 to 229 of the 300 passes each; no texel of any other
tile reverted, inside the render area (renderTargetWidth 384) or past it. A
kernel writing the same texel reverted none (0 of about 1.1e9 checks). So a CPU
write to a texel such a pass leaves inside its render area, made while it runs,
is not kept on Metal either.
ShadowUse gains tile_stores: a color the pass loads and stores inside its
bounded area (render/shadows.rs), joined like area (a draw's write through the
texture another way clears it, a read keeps it). shadow::stores_blocks takes it
with the overwrites rule, and MergeFor::overwrites becomes MergeFor::blocks
(KeptArea::for_overwrite -> in_blocks, ShadowMerge's flag alike): the merge of
such a pass, when its keep is the pass's area, is cut to that rectangle's rows
and stores whole 256-byte blocks (bind::ShadowMergeStores::Blocks), each
holding a changed word as one store, no other block, nothing outside the rows.
Over any merged-back bytes, logged or not: a block's unchanged words are stored
with the value the merge reads, so only a write between that read and the
store is undone, a shorter window than a tile's load to store. A block can
reach past the tiles the draws reach (64 RGBA8 texels of a row, two 32-texel
tiles), never past the rectangle. Docs: shadow.rs **Stored attachments**,
shadow_merge.rs, bind::shadow_merge, WorkCounts::shadow_merge_dispatches_in_blocks,
API.md (shadowed-texture entry), FAST-PATHS known gap (now the partial writes
of kernels and blits). RUNTIME_VERSION 1695 + 1 = 1696.
Verified on the M3 Max (MoltenVK):
- tests::shadow::a_pass_storing_its_loaded_area_merges_in_whole_blocks (new):
blocks for a bounded loaded-and-stored pass; words unbounded, without tile
stores, or joined with a draw's write; a read keeps them. Sabotage (never
tile stores): FAIL; restored: PASS.
- tests::dirty_pages_device::a_scattered_overwrite_of_logged_pages_merges_back_in_whole_blocks:
the Load pass drawing every texel now merges 8 of 8 in blocks (the old form
asserted 0), same bytes; GPU time median 1.078 ms (clear leg 1.860 ms).
- tests::dirty_pages_device::a_pass_storing_its_loaded_area_keeps_a_cpu_write_beside_it
(new): a Load pass drawing a 64x64 square over 4 MiB of logged pages while a
CPU thread writes three texels beside it (the next block of its rows, far
right, below) from before the commit to after the completion: 8 of 8 in
blocks, 12.4 million CPU writes, each texel ending with the CPU's last write,
every other byte Metal's.
- Device tests dirty_pages_device, shadow*, owned_pushes, render::shadows: 45/45.
RUNTIME_VERSION 1696 -> 1697 (renumbered at landing). Metal's own tile stores measured on the Apple M3 Max with an ObjC harness: 300 Load+Store passes drawing one point while a CPU thread rewrote every other texel; the 1023 other texels of the drawn 32x32 tile reverted in 157-229 of 300 passes, no texel in any other tile did, and a compute kernel writing the same texel reverted none in ~1.1e9 checks. A 256-byte block can reach the neighbouring tile within the scissor rectangle (64 RGBA8 texels), never beyond the rectangle: documented in shadow.rs's "Stored attachments".
* Re-pin the runtime sources at the landing tip (3da7eb9189)
* Say why a kernel's and a blit's partial writes merge back word by word, never in blocks (2e2e238346)
The owner decided (10-29) to keep whole-block merges out of kernels' and
blits' partial writes. Blocks rewrite the unchanged bytes inside each
256-byte block with the value the merge read, undoing a CPU write made
meanwhile. Metal keeps such a write beside a kernel's write: on the M3 Max
(macOS 27.0.1, an ObjC harness over a no-copy Shared buffer), a kernel
writing one texel lost none of a CPU thread's writes to the texels around
it in about 1.1e9 checks. A pass that loads and stores its attachment
rewrites the whole 32x32 tile it draws in (157 to 229 of 300 passes), which
is why only those passes, and commands that write every texel, take blocks.
Blits weren't measured; they keep the kernel's rule.
FAST-PATHS' known gap for the word-by-word merge now says so. Docs only: no
runtime source changes, so the runtime-sources pin doesn't move.
|
||
|
|
3ec4a69763 |
Record the native-answer work left open, and name lavapipe's pulled constant step
docs/FAST-PATHS.md's known gaps gain two entries. The first lists the places that still compute Metal's own answer where the device has one: fast::atan2's reciprocal flushed past 2^126, a bicubic sample of an 8-bit sRGB format through its UNORM twin snapping each decoded tap to Metal's twelve-bit step, and half fmod's zero sign on the exact remainder routine. The second is the shadow merge's per-word stores over PCIe, measured on an RTX 5080 over 4 MiB of host pages: 150 ms of GPU time with every other word changed, 0.40 ms with a 64x64 square, 0.86 ms with every word. Whole blocks take under 1 ms in each shape but would rewrite unchanged bytes a CPU may be writing, which Metal keeps. The five llvmpipe vertex-format-constant-step half/RG11B10 NaN rows said fixed-function vertex input; lavapipe reports no nonzero first instance, so the constant step is the vertex function's own fetch there, and device-nan-encoding is recorded on that pulled read (397e431a36). Their text now says so. docs/CONFORMANCE-COVERAGE.md regenerated. Verified: tests::fast_paths and the conformance ledger tests pass. One work packet, landed as 1 commit on archive/development-linear-2026-10-29: 189c16e23f. |
||
|
|
e84d5a4b60 |
Take the device's float denormals in ldexp
ldexp reads and makes float denormals by the device's multiply, records DeviceDenormals only where the profile's MetalFloatDenormals deviation does not already answer as Metal does, and the float-tininess notice names it. One work packet, landed as 4 commits on archive/development-linear-2026-10-29, in order: * Take the device's float denormals in ldexp, and fix stale exact comments (11eaace858) math::ldexp_bits read a float denormal operand as zero and flushed a denormal result on its bits, Metal's flush. A denormal operand is now scaled by 2^64 through the device's product (kept or flushed by the device's mode), and a result below 2^-126 is the device's product with 2^-126, rounded once or flushed. Every exponent is still answered (GLSL's Ldexp leaves exponents past +128 and overflowing products undefined: capability); infinities and NaNs keep their bits. ldexp leaves FloatFn::metal_denormals, so it records DeviceDenormals; its rustdoc and docs/API.md say so. Word bound 320. SEMANTICS_VERSION 1921. narrow::to_bits is the device's narrowing since 0d7093d826; the snapshot module docs, two leaf encode comments and ops::lane_bits' doc no longer call it exact. Verified: the "ldexp f32, every exponent" check expects the denormal-keeping product and fails on the old form (25 of 192 cases); lower::arith::tests 191/191; device_precision_float_functions, fast_paths, api_signatures, engine_metal_denormals 25/25; rustdoc clean; clippy clean apart from the dead code its base still held (deleted since by b7f6dec939). * Leave ldexp's float denormals to the MetalFloatDenormals deviation (3298b30510) Since 11eaace858, math::ldexp_bits reads a denormal operand and rounds a result below 2^-126 by the device's float multiply: a denormal times 2^64, and a normal times 2^-126. ldexp then recorded DeviceDenormals on every profile. On a profile that takes DriverDeviation::MetalFloatDenormals the device's multiply reads a denormal operand as the zero of its sign and flushes a denormal result, which is Metal's ldexp answer, so the note there named no difference from Metal. denormal::coverage now lists ldexp as Covered::Deviation, the same rule as + - *: the module requires MetalFloatDenormals where the profile takes it and notes DeviceDenormals elsewhere. half and bfloat are unchanged: leave_denormals touches only f32 lanes. The module is the same on both sides of the fact. Off MoltenVK, the device's multiply rounds before it flushes, so a result whose exact value is within half a unit below 2^-126 is 2^-126 where Metal answers zero. This is the same boundary as a float product, and float-tininess-after-rounding already announces it on those devices. The test float_denormals_are_the_devices_and_noted_off_the_device_fact still treated den_ldexp and den_ldexp_tiny as Metal-on-the-bits kernels. They now follow + - *: the requirement under the fact, the note without it, and the device's word from the interpreter, which keeps denormals. The ldexp_bits rustdoc, PrecisionNote::DeviceDenormals and docs/API.md's degrade-notice catalogue now list ldexp with the deviation's operations. SEMANTICS_VERSION 1922. Verified: nextest -E 'test(/^tests::engine_arith::|^tests::engine_metal_denormals::|^lower::arith::/)' --test-threads 8: 261/261 passed (the failing test included, on moltenvk-m3 and lavapipe with the fact on and off). cargo clippy -p metal2vulkan --all-targets --all-features -D warnings: clean. * Name ldexp in the float-tininess-after-rounding notice (53aefbfc60) Since 3298b30510, ldexp on float computes a result below 2^-126 as the device's product of a normal and 2^-126, so it takes the device's float multiply's tininess. Off MoltenVK the device rounds before it flushes, so an ldexp whose exact value lies within half a unit below 2^-126 answers 2^-126 where Metal answers the zero of its sign. The notice's cost text named only the float product and fused multiply-add. The notice, its rustdoc, the float_tininess module doc, docs/API.md's catalogue entry and its DeviceDenormals entry, and the FAST-PATHS.md row now name ldexp too. The notice's trigger is unchanged and already covers ldexp. The device announces it once at creation wherever its float functions are not Metal's own (rounds_before_flushing: not MetalFloatFunctions), whatever its pipelines hold. ldexp's product is the same OpFMul, so the same devices round it first. No new trigger is needed, and modules and recorded notes are unchanged (SEMANTICS_VERSION stays at 1922). The announced cost text is part of the run (the stderr line and DebugMessage::text), so RUNTIME_VERSION goes to 1694. The runtime-sources pin moves with degradation.rs and float_tininess.rs. The "ldexp f32, every exponent" check gains the operand 2 - 2^-23. Times 2^-127 it is 2^-126 - 2^-150, which ties to even at 2^-126 on the interpreter, a device that rounds first. A sanity assertion pins the expected word. Verified: a negative control that expected Metal's flush for that one case fails the check with "1 of 208 cases differ"; without it, lower::arith::tests::device_precision_float_functions_are_valid 8/8 passed. Runtime tests::degradation, tests::degradation_catalogue and tests::device::the_device_s_multiply_rounds_a_tiny_product_before_its_flush_off_moltenvk 17/17 passed. metal2vulkan tests::fast_paths and the api_signatures binary 24/24 passed. Validation candidate::engine::artifact::tests 3/3 passed, the_runtime_sources_are_the_committed_ones included. Workspace clippy (all targets, all features, -D warnings) is clean plain and with --cfg m2v_gpu. RUSTDOCFLAGS='-D warnings' cargo doc --workspace --all-features --no-deps is clean. * Re-pin the runtime sources at the landing tip (0d03676902) |
||
|
|
fa854417c0 |
Hold lavapipe's answers at the sites tonight's native commits moved
The native-answer commits were verified on the Apple M3 Max only. Replaying the whole conformance set on lavapipe (scripts/linux-gate --icd lavapipe, llvmpipe LLVM 21.1.8, Mesa 26.0.8) found ten llvmpipe sites the ledger did not hold: - vertex-format-constant-step, five rows added (UChar, UChar2, UChar3, UChar4, UChar4_BGRA normalized): 33a8839b7c expected none, but lavapipe reports supportsNonZeroFirstInstance = false (vulkaninfo in the gate image), so the constant step is the shader's own fetch there too; the sites read 0x3EFEFF00 where Metal reads 0x3EFEFEFF, the one-ulp product the stage-in rows hold (device-vertex-conversion). - Five rows updated to lavapipe's new answers after the sRGB transfer, maths and half-narrowing commits: math-frexp-ilogb-half's two mantissa sites (3 elements, largest 0x1FF: lavapipe's narrowing drops a NaN's payload, native-nan-encoding); pass-bytes-half-tanh-regimes half-tanh (63 words, largest 0x80008000, a NaN's sign first) and fast-float-tanh (2851 words, first one ulp); pass-bytes-srgb-decode-all-bytes words (1136 elements, largest 0x00F90001, the M3's same counts). Where a replay reads only the first and largest element, the row says so and leaves the element-by-element read open. docs/CONFORMANCE-COVERAGE.md regenerated: it also picks up the ledger changes of a049fcd0ee, d49cbcd398 and 0d7093d826, which left it stale. Verified on lavapipe, conformance replay --cpu over the whole case set at b7f6dec939 with these rows: exit 0 (487 exact, 407 announced, 177 divergent, 36 lacks-feature, 11 refused, 4 never-returned); without them exit 1 at exactly these ten sites. The five llvmpipe attribute-format-fetches rows (33a8839b7c) and the llvmpipe fetch-ordered-*-srgb rows hold unchanged. Mac: the conformance ledger tests and the conformance_coverage binary, 14/14. One work packet, landed as 1 commit on archive/development-linear-2026-10-29: e3a4094d6e. |
||
|
|
bc1a6ebf8b |
Encode a half's bits by the device's narrowing, not an integer sequence
A half value whose bits are not known from a load (a store, a reinterpretation, a texel's or snapshot's bits) is encoded by the device: with shaderFloat16 one OpFConvert to 16 bits (NoContraction under the float controls), each lane read as a word beside a 16-bit zero; without it GLSL.std.450 PackHalf2x16. The exact integer sequence (rebias, NaN quieting, the 2^24 denormal scaling, the 0x7C00 cap under native rounding) is deleted. narrow::encodes_bits finds the narrowing; compile.rs records the widening's notes for it: NativeNanEncoding everywhere, NativeHalfConversion where neither the float controls nor MetalHalfArithmetic cover it. Bits known from a load, folded constants, an integer's half and bfloat stay exact. bits_words 136 -> 48 per lane. Tests pinning the old NaN bits accept the device's where the note is recorded; 40 known-gaps rows the Apple M3 Max no longer diverges at are dropped (29 attribute-format-fetches half-NaN sites, 3 each of half-texel-nans-r16f/ -rg16f/-rgba16f, 2 of math-frexp-ilogb-half: Metal's own NaN bits now). SEMANTICS_VERSION 1919. Verified: 347 translator tests (lower::arith::tests, the touched engine modules, every public fixture on every committed profile), clippy plain and --cfg m2v_gpu, rustdoc; a sabotaged encode form fails the new a_half_encode_is_the_devices_narrowing_in_every_form; on the M3 Max: conformance replay of 28 half cases exit 0 (every divergence a held ledger row), validation runtime_lane half tests 7/7, runtime nan_signs/vertex conversion notices/degradation sites 4/4. golden_hashes.tsv cells move, re-blessed on development. Not run: lavapipe, the full validation and conformance sets. One work packet, landed as 1 commit on archive/development-linear-2026-10-29: 0d7093d826. |
||
|
|
ed114bcf43 |
Answer Metal's maths special values and fast functions by the device's instructions
The fast transcendental functions and the special values take the device's instructions, with the precision contract's and c3's near-equivalent checks held at the device's notes. One work packet, landed as 3 commits on archive/development-linear-2026-10-29, in order: * Answer Metal's maths special values and fast functions by the device's instructions (d49cbcd398) The fast sin, cos, tan, sinh, cosh, tanh and atanh are the device's Sin, Cos, Tan, Sinh, Cosh, Tanh and Atanh on every device: no flush past Metal's last evaluated quadrant, no kept denormal, no MSL Table 8.2 formula. The half zero and NaN-sign tables are gone: a half function is its float instruction rounded. pow, powr, fast::powr, atan2 and fast::atan2 keep only the C99/MSL special values GLSL.std.450 leaves undefined (a negative base, 0^y with y <= 0, atan2(0,0), infinities, pow's odd-integer sign), by the device's comparisons: no bit-level denormal-as-zero reading, no canonical NaN over a NaN operand (the device's sum instead), no pow(x, 1) = x, no flush of a denormal atan2 result. The fast functions take libm::Fun entries of their own, so MoltenVK records DeviceTranscendentals where its instruction is not Metal's fast function; elsewhere NativeTranscendentals and DeviceDenormals as before; the NaNs no longer claimed record NativeNanEncoding or DeviceNanEncoding. half fmod's zero stays on the exact remainder routine (capability; no note path there yet). Dead code goes: Lib's Metal mode and denormal::flush. FAST-PATHS rows, the libm module doc, and API.md's fneg/fabs paragraph (now the device's OpFNegate and FAbs) and native-transcendentals entry say so; known-gaps.tsv gains the M3's fast-float-tanh row. SEMANTICS_VERSION 1918. Verified: arith unit tests 192/192, engine tests of the path 42/42 (metal denormals, arith, metal math, float call notes), fast_paths/profile/ api_signatures 47/47, runtime degradation and catalogue 17/17; clippy plain and m2v_gpu, rustdoc; restoring pow(x,1) = x and a fast::sin flush fails the new tests; conformance replay of pass-bytes-half-tanh-regimes on the Apple M3 Max matches the ledger (exit 0; MoltenVK's Tanh is MSL's precise tanh, 2623 of 4096 words differ from Metal's fast::tanh, DeviceTranscendentals declared). golden_hashes.tsv moves 1224 cells (65 rows over 59 fixtures), re-blessed on development. Not run: lavapipe and other venues, the validation crate. * Hold the precision contract's fast tanh at the device's Tanh notes (685db3e29f) d49cbcd398 made a fast float tanh the device's Tanh instead of the MSL formula the crate computed with a division of its own, so on lavapipe it records NativeTranscendentals, not DeviceArithmetic, and on MoltenVK, whose Tanh is Metal's precise tanh rather than its fast one, DeviceTranscendentals instead of nothing. api_surface's the_precision_contract_names_each_float_operations_notes still held the formula's notes and failed in development's gate at b7f6dec939; it and its doc now hold the device's. Verified: the api_surface binary passes (with fast_paths, golden_hashes and the conformance ledger tests, 41/41) at 11eaace858. * Hold c3's near-equivalent checks at the device's tanh and NaN notes (43a9c268e4) d49cbcd398 made a fast float tanh the device's Tanh instead of the MSL formula the crate computed with a division of its own, and left the NaN of pow and of fast sin and cos to the device, so three c3 tests held the old notes and failed on development: - the_products_own_approximations_are_its_near_equivalents: tanh (fast or precise, float or half, lavapipe or MoltenVK) is now no near-equivalent; fast atan2 keeps DeviceArithmetic. Fast tanh(44) stays Apple's unstated word even where the row records DeviceArithmetic for another operation. - a_nan_encoding_the_product_answers_is_not_a_near_equivalent: on lavapipe F32 exactly precise pow and fast sin and cos record DeviceNanEncoding; the test asserts that set over msl::Prim::ALL. A differing NaN of fast sin(inf) and of precise pow(-1, 0.5) is now the note's (near_equivalent, open); precise sin(inf), mul and div keep the old answer. - an_unstated_word_the_product_approximates_keeps_its_reading_open: fast fmod keeps its open reading and refusal (now the named-lowering check); fast tanh(44) is the device's answer, unstated, and the sign-off stands with DeviceArithmetic recorded. Doc comments say what is true now. No product code changes. Verified: cargo nextest run -p metal2vulkan-validation --all-features -E 'test(/^c3::/)' 72/72 passed (3 failed before); clippy -p metal2vulkan-validation --all-targets --all-features -D warnings clean. The lavapipe/MoltenVK note sets were read from lowering_notes for every prim. |
||
|
|
ced4a0ecda |
Decode and encode 8-bit sRGB storage and twin texels by the device's transfer
Rule 1: a storage image of an 8-bit sRGB format (its UNORM alias, SrgbEncode/SrgbEncodeBgra) and a slot bound to such a format's UNORM twin decoded each code through Metal's twelve-bit step table and an exact k/4095 quotient, and encoded by searching the table. The format is capability (Vulkan has no sRGB storage; the device cannot sample the twin's format); the arithmetic is the device's. Reads (alias, twin read/sample/gather/fetch, bicubic taps) take the MSL transfer through the device's Pow (pack::srgb_decode_texel), a filtered twin sample decoding the device's filter of the codes; every access records SrgbTexelDecode. Writes take pack::pack's unorm4x8_srgb (DevicePackConversion). The module declares no sRGB table for these paths; SrgbReach, srgb_filtered_texel, the step/ratio helpers and Sampling::srgb_codes are gone. Words per access: read 520 -> 194, filtered sample 920 -> 194, write 1520 -> 314, bicubic tap 160 -> 106. Docs (artifact notes, API.md catalogue, FAST-PATHS rows, doc comments) say so; runtime_lane::srgb_storage now holds the device's bounds, with an alias-read test. SEMANTICS_VERSION 1917. Verified: clippy plain and --cfg m2v_gpu, rustdoc; nextest 65 core checks + 98 touched-module + 17 runtime degradation pass; sabotage of the decode FAILS 2, restored PASS; MoltenVK on the Apple M3 Max: runtime_lane::srgb_storage 4/4 (with the formatless storage features withheld, alias float reads within 1.83e-7 of the transfer, 762 of 1024 lanes differ from Metal's table; writes within one code; srgb-texel-decode and device-pack-conversion announced); conformance read-write-tier-round-trip-float and -held announced, justified. Golden hashes unchanged. Not run: the twin on a device that takes it (lavapipe, ANV, NVIDIA), release timing, the census. One work packet, landed as 1 commit on archive/development-linear-2026-10-29: c70ec588c4. |
||
|
|
038bad9386 |
Take the device's conversions in the storage-form fetch and blend, imageblock tiles and snapshots
The storage form, implicit imageblocks and snapshot reads take the device's conversions, and
the MetalFloatStorageNans driver fact, which nothing reads once the blend keeps the device's
NaN, is deleted.
One work packet, landed as 2 commits on archive/development-linear-2026-10-29, in order:
* Take the device's conversions in the storage-form fetch and blend, imageblock tiles and snapshots (a049fcd0ee)
Rule 1 (owner, 10-29): where the device has a native answer, it is the only
form. The interlocked storage form, implicit imageblocks and snapshot reads
are capability and stay; the arithmetic inside them still computed Metal's
own bits. Each now takes the device's form, its difference noted with an
existing note:
- lower/fragment/fetch.rs: an 8-bit sRGB attachment's read and write through
its uint view decode and encode by arith::pack's unorm4x8_srgb forms (the
8-bit instruction and the MSL transfer by the device's Pow) instead of
Metal's twelve-bit table (math::unpack/pack with the table); the module no
longer declares the table for it. DevicePackConversion.
- fetch.rs: an 8-bit unorm blend's result is stored as computed, the storage
image's store converting it (unorm8_write's exact product with 255, the
NaN select and the clamp are gone). DeviceColorConversion, recorded in the
storage write's plan.
- fetch.rs: a 16-bit float blend no longer makes every NaN 0x7FC00000; the
NaN is the device's arithmetic's, which the store converts.
stage_io/color_write.rs records DeviceNanEncoding for every such blend and
no longer relies on VkProperty::MetalFloatStorageNans (storage_nan
deleted; the deviation stays as a measured fact, now required by no
module).
- lower/stage_io/word_color.rs: an 8-bit sRGB word's encode is
arith::pack::pack (srgb_table and encode's table parameter deleted; its
two other callers updated). DevicePackConversion.
- lower/access/tile.rs: a normalized implicit imageblock access unpacks and
packs by arith::pack (instruction or its definition), a half access rounding
the unpacked float once more by narrow::round, instead of math::unpack/pack
with Metal's table and the exact c/D-to-half grid (half_channels,
Norm::grid deleted). DevicePackConversion, but for a float conversion of a
format GLSL.std.450 names on a device whose float functions are Metal's
(MoltenVK), as air.pack notes it.
- lower/fragment/snapshot.rs: a normalized form's read decodes c times the
f32 nearest 1/D (signed: at least -1) instead of exact integer division.
DevicePackConversion.
- lower/arith/color_write.rs: the unorm rule is gone from round and
channel_words (normalized deleted); a unorm channel is the device's
conversion's. FloatNearestEven stays (Metal's textureWriteRoundingMode, a
capability), as does unorm8_code for the private alpha test.
Dead in this tree and deleted: extended_range::blend::unorm8_write,
texel_round::grid_step, srgb::STEP_WORDS. Word estimates follow
arith::pack::words.
Tests: blend8's two blend checks now hold the blend's result, stored by
Vulkan's conversion, to Metal's code (unorm8_write's test deleted with it);
color_write checks that round takes no unorm rule (fails on the old form)
and its scalar/half test uses the small-float rules; snapshot_codes checks
the device's product c * fl(1/D) (asserted to differ from the quotient at
some code; the old exact test failed on the new form, seen); the
engine_fetch_blend8 tests require DeviceColorConversion (unorm8) and
DevicePackConversion (sRGB), which fail on the old form;
engine_fetch_blend16 requires DeviceNanEncoding on every profile and no NaN
property; engine_tile's normalized tests hold reads, stores and the
read-back within DevicePackConversion's bound (3 f32 ulp, one half step
more, codes within one) on the formats the interpreter models (no Pow: the
sRGB formats, and NaN stores, are the device lane's). Validation lanes: framebuffer_fetch::blend8 asserts the native note
alone on an interlock device and unorm8 channels within one code;
framebuffer_fetch::srgb accepts device-pack-conversion as a conversion;
tile_normalized checks reads and stores within DevicePackConversion's
bound; blend16::nans docs.
Conformance: known-gaps.tsv gains eight Apple M3 Max rows for
fetch-ordered-{bgra8unorm,rgba8unorm}-srgb (x1: a code apart, within the
note's bound; x2/x3/x3-depth: two, compounded across draws), the device's
sRGB conversion in the interlocked storage form.
Docs: API.md catalogue (DevicePackConversion, DeviceColorConversion,
DeviceNanEncoding, the sRGB word paragraph, the fetched sRGB and unorm8
blends), FAST-PATHS.md's air.pack row and the fetched-blend gap, the note
and deviation doc comments.
SEMANTICS_VERSION 1916 (emitted modules change). No public API change.
* Delete the MetalFloatStorageNans driver fact, which no module reads (e3f82758cb)
After the storage form's 16-bit float blend stopped making every NaN
0x7FC00000 (the device's NaN, noted DeviceNanEncoding), nothing reads
DriverDeviation::MetalFloatStorageNans or VkProperty::MetalFloatStorageNans:
no module requires the property and no lowering asks the profile for the
deviation. AGENTS.md's no-dead-code rule, and the owner's approval of deleting
unread facts (the 10-27 unread-fact sweep, 7b4509b9c4's precedent), remove
them.
Removed: both public variants and their docs; the five measured rows
(MoltenVK on Apple9, RADV on the 780M, NVIDIA on the RTX 3090 and the RTX
5080 Laptop GPU, lavapipe) and their measurement paragraph in
device/driver_facts.rs; the derive and profile mappings; the codec's
VkProperty entry; the driver_facts test rows (the deviation-to-property
table, the Apple, NVIDIA, lavapipe and 780M expectations); the
engine_fetch_blend16 split of interlock profiles by the deviation and its
"no such property required" assertions there and in engine_extended_range.
engine_fetch_blend16 still requires DeviceNanEncoding on every interlock
profile.
Corpus observations name the deviation only inside environment.profile, a
free-text Debug string of the profile (format!("{profile:?}"), a
serde_json::Value field nothing parses into an enum), so no reader changes
and no observation file is rewritten: the established handling, as the
MetalHalfQuantize name removed on 10-28 still stands in 152 observation
files. The profiles that took the deviation (moltenvk-m3, the two 780M RADV
profiles, the three lavapipe profiles, nvidia-rtx5080-laptop) change
fingerprint, so their golden cells and evidence re-key.
ARTIFACT_FORMAT_VERSION 478 (the encoded VkProperty list changed; the
orchestrator renumbers). api_signatures re-blessed (two variant rows gone);
REFUSALS.md regenerated, unchanged.
Verified: cargo fmt; clippy --workspace --all-targets --all-features -D
warnings, plain and with --cfg m2v_gpu; rustdoc -D warnings; nextest by
exact module: device::tests::{driver_facts,profile}, cache::tests,
cache::codec::tests, tests::fast_paths, tests::engine_fetch_blend16,
engine_extended_range::half_float_storage_slots_leave_their_writes_to_the_device,
api_signatures, api_surface, refusal_surface (130/130); validation index,
observation, observation_contract, c3, requirement,
candidate::platform::device (118/118).
|
||
|
|
5f2c69e087 |
Decode a pulled normalized vertex field by the device's reciprocal product
Pulled normalized fields (vertex, [[stage_in]], post-tessellation) take the device's product,
and a post-tessellation pulled read records its NaN note as the vertex and stage-in reads do.
One work packet, landed as 2 commits on archive/development-linear-2026-10-29, in order:
* Decode a pulled normalized vertex field by the device's reciprocal product (33a8839b7c)
The owner's ruling of 10-29: no exact emulation where the GPU has a native
answer. A normalized field the shader pulls (a vertex attribute fixed-function
input cannot fetch, a kernel's [[stage_in]] attribute, a post-tessellation
function's) was Metal's correctly rounded quotient via exact_division::div_exact.
It is now the device's product float(c)*float(1/m), rounded once, the signed one
max(., -1), as fixed-function fetch already converts it (
|
||
|
|
0a1851164d |
Copy a no-copy buffer, heap or rebind whose import the caller's gate refuses or that fails, announced
A new HostMemory::with_import_gate(ImportGate) asks the caller once,
holding no lock of the runtime's, just before a no-copy buffer, a
no-copy heap or a buffer rebind imports its pages, passing an
ImportRequest with the pages the import would map. If the gate answers
false, or an import the device and the gate admitted then fails
(OutOfMemory, another Vulkan error), the object is made over a copy of
the pages instead of failing. The default stays import-first. The copy
is host-visible memory owned by the runtime; `contents` stays the
caller's pointer. Each commit copies in the bytes the CPU changed since
the last sync, and each batch's completion merges back the bytes the GPU
changed (CPU wins where both wrote), byte by byte, before events,
waiters and handlers see it. Every copy is announced
(`copied-host-pages`) and counted. Pages the process cannot read are
never copied (the first copy reads through the kernel:
process_vm_readv / mach_vm_read_overwrite). A copied heap's buffers lie
in the copy and its textures are shadows. A rebind's copy is laid out as
its import would be. A rebind over an in-place image is refused
(NotImplemented(RebindTextures)) and a heap's rebind still imports
without asking. A caller's DirtyPages log stays attached to the copy as
to an import. The in-place check's pointer class skips copied buffers.
Ports dev-perf's fff961b7e5, 630d1b0174, 33d7aa5e98 and 9b4d4190f5 onto
a smaller coherence design: every live copy is compared in full at each
commit and completion, instead of dev-perf's log-driven,
encoder-collected copies (dev-perf's copied.rs, 79301a2515 and its
fixes, sat on a page log development has replaced). Also brings
789fa3d294's unreadable-page rule, 5190983470's lane site, and
1c7d49f788's copied-buffer skip. A driver that refuses the pointer
still fails the call (dev-perf copied there too; not taken). Known gaps
in FAST-PATHS: the compare costs O(size) per commit and completion, a
byte both sides wrote keeps the CPU's value, and a shared event's value
can be seen before the merge (c5db2d1b8a not ported). RUNTIME_VERSION
1690. Runtime-sources pin recomputed.
Public API: ImportGate, ImportRequest { start, length }
(#[non_exhaustive]), HostMemory::with_import_gate,
Degradation::CopiedHostPages, Device::fail_next_host_imports (test
hook), and the WorkCounts fields host_imports_refused_by_host,
copied_host_buffers_{made,refused,degraded}, copied_copy_in_bytes,
copied_merge_back_bytes, copied_rebind_pages_made, copied_heaps_made.
Verified on the M3 Max (MoltenVK, m2v_gpu): 11 new device tests
(tests::copied_device: buffer, rebind and heap, gate refusal and failed
admitted import, unreadable pages, a heap texture round trip) and 167
tests in the touched device filters pass; the counters move as
expected ([1,1,1,0,0] for a refusal, [0,1,0,1,0] for a failed import)
and the announcement is heard; on a 64 KiB copy 4079 bytes copied in and
4080 merged back for a 4 KiB CPU write and a 4 KiB fill, checked
exactly. Sabotage: ignoring the gate and removing the merge fails the 3
buffer tests; ignoring the rebind gate fails both rebind tests (no heap
sabotage). 249 host tests pass. Workspace clippy plain and
--cfg m2v_gpu, and rustdoc, clean; clippy re-run clean on the landing
merge. Not run on Linux.
|
||
|
|
8c09b7c2c0 |
Link a warm render creation from its recorded stages, and key the shader cache by its translator
A warm render state creation spent most of its own time in Device::render_variant_key, decoding and specializing every Function stage's AIR to learn its stages' compile keys, because the directory's variant record named only the pipeline's key and a sweep stores no pipeline artifact where the directory holds its stages. The record (v2: new tag and magic) now also names the stages' function compile keys (VariantStages); a creation that finds the record but not the pipeline finds the functions by those keys alone (Sources::found_function: memo, archives, disk, no translation) and links them (RenderVariant::link), decoding nothing. Every creation writes its record. The keys are valid exactly as long as the pipeline key beside them. (Ports dev-perf f4d864d160; development's lookup has no warm-pass Prior/Found and no fit_render_variant, and the bench it extended is gone.) The shader cache's build directory was named by the runtime's version, both artifact versions, the translator's SOURCE_DIGEST and the runtime's own source digest (its build.rs over every file under src/, tests included), so any runtime edit started the cache cold. Every translated entry is the translator's answer for the inputs its key and profile hash, so the runtime's digest goes (with build.rs, its sha2 build-dependency and the validation fingerprint's reference to it). The translator's SOURCE_DIGEST stays, as its doc promises: an unbumped translator change still starts afresh. The runtime's own creation records (linked-use answers, reflection, variant record) are runtime logic, so their names now hash RUNTIME_VERSION with their tag and key (creation.rs record_name): a runtime change that bumps it reads none of an earlier runtime's records. (Ports the idea of dev-perf db5f5baa73, narrowed: no per-entry stamp, no other_build_hits, no public API change.) Not ported from the same area: dev-perf's pipeline-record hook and Device::warm from an earlier process's records (14df1fb5fe, 66fe0ada29; ~3,200 lines on per-entry stamps this packet does not take). Verified on the M3 Max (MoltenVK): 84 device tests of the shader cache, creation, render-stage, sibling-work, archive and pipeline areas pass; the guard a_second_device_links_a_recorded_sweep_with_no_stage_decoded fails with the recorded-stage link disabled ((decoded, translated) = (2, 0)) and passes with it; a_creation_record_of_another_runtime_version _is_not_found passes. Release render-pipeline-split, integer-vertex-attributes, one run: warm processes decode 2 stages before and 0 after; cold counts identical; wall within run-to-run spread on this case's small shaders. Clippy (plain and --cfg m2v_gpu) and rustdoc -D warnings clean; 43 + 241 plain runtime/translator tests pass. No version bumps. Runtime-sources pin recomputed. |
||
|
|
d7d4870598 |
Wait a bound for a pipeline still being made, then drop its draws and dispatches
A cold MoltenVK compile inside one guest command buffer ran 11.59 s and tripped the guest's own 10 s FIFO watchdog, which tore the task down; development had no bound. New runtime choice DevicePolicy::pipeline_waits (PipelineWaitPolicy::Bounded, the default, or Exact, which exact_answers() selects), with bounds pipeline_creation_wait and pipeline_commit_wait (4.5 s each, so one FIFO step waits 9 s at most). Under Bounded: - A render or compute state's creation hands its predicted making to the pool and waits for it up to the creation bound (WorkCounts::creations_left_making). - A committed command buffer waits until its commit plus the commit bound for its draws', dispatches', tile dispatches' and execution replays' pipelines, then records each late one as nothing and runs on. CommandBuffer::dropped_draw names the first with VK_TIMEOUT. Counted in draws_dropped_still_making and dispatches_dropped_still_making, and announced as draw-dropped-still-making and dispatch-dropped-still-making. - An execution's settle hands its makings to the pool. A draw whose driver making failed now runs nothing and its command buffer runs on, where it used to fail it: counted in draws_dropped_unmade, named by dropped_draw(), and announced draw-dropped-unmade (Degradation::DrawDroppedUnmade: the draw, its state, a hash of the variant and specialization, and the driver's error; once per device, or each time where announce_each asks). A dispatch's failed making still fails its command buffer. Docs: FAST-PATHS.md row, API.md policy bullet and catalogue entries, runtime README Errors. RUNTIME_VERSION 1689. api_signatures.tsv re-blessed. Runtime-sources pin recomputed. Ports dev-perf 6f499ff764, 8c91a6e254, 33fc25b531, 5963fd6831 and 4ee316c55a, and the notice of aa7e78f23c in its minimal form (no per-key set, no driver-message relay). The general-form predicted key (7028c0d92a, ce02b68f23) is left out: on development it changed the pipeline makings three M3 device tests count (made_at_creation, pipeline_creation pooled making, its own general_form_drawn), cause not found. Verified on an M3 Max (MoltenVK 1.4.2), under maclock: the six bound and drop device tests under both policies (the unmade one also asserts the notice is heard once and names the driver's error), fast_paths, degradation, degradation_catalogue, pipeline_wait_order, inline_continues, dispatch_pending, api_signatures, api_surface and 169 profile tests: 218/218. Lanes on the M3: 42/44; the two failures are ycbcr_textures::a_ycbcr_sample_through_an_unmeasured_filter_is_announced (recorded failing on development before this change) and pipeline_creation::draws_made_on_the_pool_draw_as_made_ones (1 pooled making vs 2; fails the same under Exact; not yet run on development without this change). Clippy plain and --cfg m2v_gpu and rustdoc -D warnings clean. No sabotage run of the bound. |
||
|
|
b25f89d0af |
Zero new buffers by a fill on a discrete GPU, and cut a tiled heap texture's merge work
- A new buffer whose bytes the host cannot write (Private, a Managed buffer's device copy, the neutral buffers) is zeroed by one vkCmdFillBuffer in the submission's first work on a device without unified memory whose fills are not transfers, in place of copies of the device's host-visible zeros, which such a GPU reads over the bus. Range ends must be multiples of 4. Counted: WorkCounts::new_buffer_zero_fills. Same bytes; no FAST-PATHS row. - A heap's tiled texture's merge in place takes a kept scratch, unzeroed: its keep and changed copy write the texture's bytes whole, the bytes its kernel reads. - A one-sample colour tiled texture kept right after its copy in (ungated, with no copy of its shadow between) copies the staging buffer that copy filled, in place of a move out of the image, tight buffer and dispatch. Counted: WorkCounts::shadow_keeps_from_staging. development's dirty-page gate stays as it is; a gated copy in keeps the move out. Ports dev-perf b77843da73, c302c71029 and 01f17bde29 (archive/development-performance-2026-10-27); their measurements (RX 7900 XTX, RTX 5080) are dev-perf's, not re-measured here. RUNTIME_VERSION 1688. api_signatures.tsv: two additive WorkCounts fields. REFUSALS.md unchanged. Runtime-sources pin recomputed. Verified on the M3 (MoltenVK, under maclock): first_use, blits fills, heap_layouts, shadow/merge, dirty-pages and tiled device tests (58 + 34 passed); the tiled merge took no zeroed scratch and every keep came from the staging buffer (counters asserted); undoing each change fails its test (3 scratches zeroed vs 0; 6 and 2 bytes differing). The new-buffer fill path does not run on the M3 (unified memory); a forced local probe zeroed all 5 MiB through the fill, and failed with the fill word set to 0xdeadbeef. Its unforced run needs a discrete GPU (the round's RTX 5080 run). Clippy plain and --cfg m2v_gpu, rustdoc, touched non-device tests (338 passed). |
||
|
|
7a6818deda |
Take NVIDIA's stall in every 1024th signalling submit while idle
dev-perf measured on an RTX 5080 Laptop GPU (NVIDIA 615.71.09, Linux) that one vkQueueSubmit in every 1024 that signals a fence or semaphore on a VkQueue spends 2.2-3.7 ms in the driver, counted per queue, and the batch it lands on, with everything committed behind it, waits that long. Every batch signals, so the stall can only be moved. device/submit_stalls.rs keeps each queue's place in the driver's period under the queue's lock (Period): every signalling call the runtime times is counted (batches via submit_logged, the device's own submission via use_queue(Uses::OneSignalling), the plan's empty ones); a use it cannot count (the program's, sparse binds, wait-idle, relay marks) or a due stall that did not come forgets it. Once the scheduler's thread has had nothing to submit for 1 ms and a queue's next stall is due within its next burst plus 32 calls (at most 128), it submits the calls left as empty submissions signalling a timeline semaphore of the queue's own, outside its lock, stopping where a commit or waker came. WorkCounts gains idle_submits, submit_stalls_idle, submit_stalls_on_work, submits_behind_idle_stalls, wait_behind_idle_stall_longest_nanos; host_ab prints them. FAST-PATHS records the stall among device gaps. Ports dev-perf 76bf5a3189, 28c42746a5, b76d910450, 1ef8316ecf, 9d2f46431e. Adapted: keyed as development keys driver facts, a cost fact DriverFact::SignallingSubmitsStallEvery1024 on NVIDIA's driver on the RTX 5080 Laptop GPU (0x2c19, the GPU measured) at every release (dev-perf's release-keyed DriverTrait table, fd2ddc8faa, not ported); the scheduler's short idle sleep bounds WAIT_SLICE (development has no head bound). Public API: DriverFact::SignallingSubmitsStallEvery1024 (translator and runtime re-export), five WorkCounts fields. RUNTIME_VERSION 1687. Runtime-sources pin recomputed. Tests: tests::submit_stalls (planner vs a model driver), device::tests::driver_facts (the fact's GPU scope, the 5080 profile's facts), device test tests::submit_stalls_idle (new: on a driver with the fact, at least one stall taken idle over 5000 command buffers; elsewhere no empty submission). Verified on an M3 Max (MoltenVK 1.4.2): touched-module tests 268 passed; api_signatures/api_surface 15 passed; the planner tests fail with due_idle forced to 0 (4 of 9) and pass restored; device tests 45 passed, the idle-stall test printing idle_submits 0 on MoltenVK; with the gating forced on, a run made 106 empty submissions without driver errors and the test failed as it should. Clippy plain and --cfg m2v_gpu, rustdoc -D warnings clean. The stall path itself needs the RTX 5080: see the round's 5080 run. |
||
|
|
2f033d3002 |
Take the device's Y'CbCr conversion for 4:2:2 twins and for YCbCr planes read in place
4:2:2 twins hold the device's own conversion where it has Metal's reconstruction; planes read
in place are sampled through the device's Y'CbCr sampler where the driver lays them out as the
surface does; RADV's 10-bit conversion recorded as reading codes as words. With development's
golden re-bless after the native landings. SEMANTICS 1911, ARTIFACT 477, RUNTIME 1683.
One work packet, landed as 6 commit(s) (a1088b2c2e..67dc5650e1 on archive/development-linear-2026-10-28-evening), in order:
* Hold a 4:2:2 texture's twin as the device's own conversion where it converts the format
A GBGR422 or BGRG422 texture reads a decoded twin of 8-bit codes on every device: Vulkan views
G8B8G8R8_422_UNORM and B8G8R8G8_422_UNORM only through a sampler Y'CbCr conversion, which no
pipeline's layout bakes. Until now the twin always held Metal's decode, (3c + n + 2) >> 2, computed
by the runtime's own kernel or on the CPU, even where the device converts the format itself.
Now, where the device converts the pairs' format with Metal's reconstruction (its optimal tiling
reports SAMPLED_IMAGE, TRANSFER_DST, MIDPOINT_CHROMA_SAMPLES and a linear chroma filter, and the
width is even), the twin holds the device's conversion:
- each decode pass copies the written rows' pairs out of the carrier into the scratch, then into
a per-texture image of the 4:2:2 format, and samples it through the device's conversion (the
identity model at full range) into the band's texels, which go into the twin;
- the kernel is the new bind::chroma_sample_module (ChromaSampleModule), a sample at each luma
texel's centre at level 0, each channel stored as roundEven(clamp(c, 0, 1) * 255);
- such a carrier takes no host or staging copies, so every write's decode is a GPU pass and no
texel of the twin is the CPU's decode;
- counted in WorkCounts::chroma_device_twins and chroma_device_decodes, and announced
decoded-texel-precision (the catalogue's cost text says so).
Elsewhere the twin keeps Metal's decode, as capability. The FAST-PATHS device-gaps table has the
row.
Venues (from the formats' features): MoltenVK 1.4.2 converts both formats (its single-plane 4:2:2
reconstruction is Vulkan's); lavapipe filters their chroma nearest only; RADV (Mesa 26.2.4, 780M)
reports neither format.
Verified:
- clippy -D warnings, plain and --cfg m2v_gpu, for metal2vulkan and metal2vulkan-runtime;
- chroma_decode unit tests (the sample module is valid on every committed profile), fast_paths,
the degradation catalogue tests, api_surface and api_signatures (table blessed: the new module,
ChromaDecode::format and the two WorkCounts fields);
- M3 Max (MoltenVK 1.4.2): tests::ycbcr_device::a_four_two_two_twin_holds_the_devices_conversion...
took the device route for both formats (twins 1, passes >= 2, no CPU decode, announced once);
chroma within 0.5000 codes of Vulkan's (3c + n) / 4 on 40 x 24 random pairs (the test also
prints how many chroma codes differ from Metal's; that line is compiled and clippy-clean, not
yet run);
runtime_lane::chroma_pairs (5 tests) pass, the read lane checking green exactly and red and
blue within 1/255 of Metal's on the device route;
- lavapipe (arm64 linux-gate, m2v_cpu_icd): the same runtime test and the five chroma_pairs lane
tests pass; no 4:2:2 texture took the device route (twins hold Metal's decode, exactly);
- RADV 780M: not run (host away).
docs/REFUSALS.md regenerated: unchanged. runtime-sources.sha256 updated; the RUNTIME_VERSION
bump is in the versions commit.
* Record that RADV's 10-bit Y'CbCr conversion reads codes as words
RADV has the same defect lavapipe has (RuntimeDriverDefect::TenBitCodesReadAsWords): a sampler
Y'CbCr conversion of G10X6_B10X6R10X6_2PLANE_420_UNORM_3PACK16 reads each code's 16-bit word as a
16-bit UNORM value, its six unused low bits included, where Vulkan converts the 10-bit code as
c / 1023.
Evidence: a bare Vulkan probe on the Radeon 780M (RADV, Mesa 26.2.4) read luma code 1023 (low bits
0) through the identity model of a LINEAR image of the format as 0.999039, which is 65472 / 65535
and not 1.0. The optimal tiling's conversion of the format was not measured; the row is per
driver, as the defect table's rows are.
What changes: the AFFECTED table gains a MESA_RADV row, with no clean GPU. Nothing is refused.
- A 10-bit two-plane texture on RADV now converts through Metal's arithmetic. Before, RADV's
optimal-tiling device conversion (ycbcr_device.rs) took it, and that path was never measured on
RADV.
- The planes image of the next commit is not taken for 10-bit codes there.
The driver_defects test expectations (every committed RADV profile, Hawk Point's 780M) and the
docs that name the defect's drivers (ycbcr.rs, ycbcr_device.rs, docs/API.md) say RADV too.
Verified: clippy -D warnings (plain and --cfg m2v_gpu) for metal2vulkan, metal2vulkan-runtime and
metal2vulkan-validation; tests::driver_defects on the host. The RADV device itself was not run: the
host is away.
* Sample YCbCr planes read in place through the device's own Y'CbCr sampler where it has Metal's reconstruction
On an integrated GPU or a CPU device, a function that only samples a YCBCR8_420_2P or
YCBCR10_420_2P texture reads the planes in place through a uniform texel buffer. It converts and
filters them with Metal's fixed-point arithmetic in the shader. Where the device converts the
planes' 4:2:0 format as a linear image with Metal's reconstruction (midpoint chroma through a
linear chroma filter), rule 1 makes the device's own conversion the only form. So such a slot now
samples the planes through the device's sampler Y'CbCr conversion. Elsewhere the texel buffer
read stays, as capability.
Translator (metal2vulkan):
- bind::YCbCrPlanesSampler (new, non-exhaustive) holds the conversion: the codes' bits and the
surface's range and matrix. It also gives the image's format: G8_B8R8_2PLANE_420_UNORM, or
G10X6_B10X6R10X6_2PLANE_420_UNORM_3PACK16.
- YCbCrInPlace::with_planes_image, ::sampler and ::planes_sampler. TextureShape::Texture gains
ycbcr_planes_sampler.
- RuntimeFact::YCbCrInPlace gains `device`: the device's sampler takes every sample of the slot.
It does not where a constexpr sampler has a border address mode, or a texel offset is placed by a
parent's size.
- VariantKey and LoweringInputs gain ycbcr_planes_sampled. The binder fills it from slots with
`device`, bound to a texture that holds the image, whose runtime sampler words have no border
mode on s or t.
- Such a slot is declared as a combined image sampler: ResourceKind::YCbCrPlanes and
BindingSource::YCbCrPlanes, written from WriteSource::YCbCrPlanesImage. Its immutable sampler is
the new vk::SamplerDesc::ycbcr: linear, clamp to edge, lod 0, and a new `ycbcr` field.
- Each sample (lower/sampler/in_place.rs device_sample) is OpImageSampleExplicitLod at level 0:
- a linear sample takes Metal's coordinate, with its texel offset moved in texels;
- a nearest one takes the centre of the luma texel Metal reads, clamped to the edge;
- pixel coordinates and the filter are known when the module is made (constexpr) or read from
the runtime word;
- a half result is rounded to a half, as every sampled texel's is.
- The texel buffer stays the slot's resource otherwise. The planes read use is tracked as before.
Runtime (metal2vulkan-runtime):
- YCbCrFormats queries the two 4:2:0 formats' LINEAR tiling: SAMPLED_IMAGE,
MIDPOINT_CHROMA_SAMPLES, a linear chroma filter, and the limits and
combinedImageSamplerDescriptorCount.
- YCbCrSampler::planes gives the conversion. It is None under TwoPlaneChromaMisplaced, and for
10-bit codes under TenBitCodesReadAsWords. holds_planes checks for an even size within the
limits.
- texture/ycbcr_planes.rs (new) makes a PREINITIALIZED linear image of the format over the planes'
bytes, and only in memory the runtime allocated. It is made only where:
- the luma plane comes first;
- the driver's PLANE_0 and PLANE_1 subresource layouts are the surface's offsets and pitches;
- the alignment, the type and the room within the buffer fit.
Its view and every immutable sampler of it share one VkSamplerYcbcrConversion
(Device::made_ycbcr_conversion, kept in the owned kernels' map), so the two are identically
defined (VUID-VkWriteDescriptorSet-descriptorType-02738). Its first move rides the next
submission (Fresh, never rebindable), and it is announced ycbcr-filter-not-exact.
- Fresh pages, no-copy pages and the caller's VkBuffer keep the texel buffer. An image bound to
imported memory starts UNDEFINED, and the in-place check covers that first move for single-plane
images only.
- The texture's facts state the image (with_planes_image). binding.rs writes the view in GENERAL
under the layout's immutable sampler.
- sampler_set chains the conversion into each SamplerDesc::ycbcr sampler. A non-pushed set 0
reserves combinedImageSamplerDescriptorCount descriptors per such binding.
- WorkCounts gains ycbcr_planes_images, ycbcr_planes_images_kept_{conversion,memory,layout} and
ycbcr_planes_images_bound.
Venues (from the formats' linear features):
- Radeon 780M (RADV, Mesa 26.2.4): reports the 8-bit route for rows 256 bytes apart. Its 10-bit
codes carry TenBitCodesReadAsWords (previous commit).
- MoltenVK 1.4.2: TwoPlaneChromaMisplaced.
- lavapipe: its 4:2:0 conversion is cosited only.
Measured before building, through a bare Vulkan probe on the 780M with 8-bit codes:
- luma centres within 0.0003 codes of Vulkan's model, and points between texels within 0.66
codes;
- Metal's conversion-then-filter differs by up to 54/255 between texels of random planes;
- GPU time, 3840x2160 composited into 1680x1050: 248 us against the texel buffer's 340 (1 pass),
741 against 1027 (3 passes).
The runtime's path itself is not measured on a device that takes it: the 780M host is away.
Docs: a FAST-PATHS device-gaps row (the device's route, where the texel buffer stays, and why);
the in-place paragraph; docs/API.md (the pipeline interface paragraph, and the notice's catalogue
entry); module docs (ycbcr.rs, ycbcr_device.rs, ycbcr_image.rs); the api_surface table
(YCbCrPlanesSampler N); api_signatures blessed.
Tests:
- bind::ycbcr_in_place::the_planes_sampler_is_the_conversion_word.
- bind::plan::slots::the_planes_image_variant_takes_a_slot_the_device_s_sampler_reads.
- tests::engine_ycbcr_in_place::a_planes_image_slot_samples_through_the_device_s_conversion: the
lavapipe and M3 profiles; linear, nearest, pixel, offset and runtime samplers, each half and
float. Each case links and validates, with one OpImageSampleExplicitLod. Border and repeat-offset
slots state device false.
- Lane runtime_lane::ycbcr_in_place::a_ycbcr_texture_s_planes_image_samples_through_the_device_s_conversion
covers surfaces whose rows are 256 bytes apart. Each in-place texture is counted exactly once,
as an image or by why not. Through the image, nearest samples are Vulkan's conversion within the
device's bound, announced; without it, Metal's texels through the texel buffer, unannounced.
Verified:
- clippy -D warnings, plain and --cfg m2v_gpu, for metal2vulkan, metal2vulkan-runtime and
metal2vulkan-validation.
- Host, plain target, the touched selection (ycbcr, fast_paths, api_surface, api_signatures,
codec, slots, api_tests, the inputs encoding, sampler, ash_interop, driver_defects, degradation,
vk tests): 408 run, 407 passed. The engine test's half cases failed, because a half result was
an f16 where a sample holds it widened. They now take narrow::round_texel, and the in-place
engine tests pass, 4 of 4.
- M3 Max (MoltenVK 1.4.2), runtime and validation, ycbcr|chroma|driver_defects|runtime_sources:
66 run, 64 passed. The planes image test counted [0, 1, 0, 0] for both surfaces (kept for the
conversion: TwoPlaneChromaMisplaced), bound the texel buffer and read Metal's texels. The two
failures:
- the runtime-sources pin, re-pinned in the versions commit;
- runtime_lane::ycbcr_textures::a_ycbcr_sample_through_an_unmeasured_filter_is_announced
(anisotropic through a constexpr sampler), which fails the same way at the base, as
|
||
|
|
bd3c50d741 |
Take the device's own Depth16 bias and its store of an extended-range, padded or bfloat attachment's untouched texels
The device's depth bias unit on every format, and the device's store of untouched texels in
place of the unused-bits load pass (deleted with its capture machinery); the NaN depth
discard documented as capability. SEMANTICS 1910, RUNTIME 1682.
One work packet, landed as 7 commit(s) (88bcfeaea8..6aec9db4e9 on archive/development-linear-2026-10-28-evening), in order:
* Take the device's depth bias on a Depth16Unorm depth
Rule 1: the device's depth bias is its native form, so it is the only one. A
constant bias (or a slope alone) on a Depth16Unorm depth was recorded through
VK_EXT_depth_bias_control's depthBiasExact as Metal's own rule, c + 1 units of
1/65535 for c of 0 or more and c - 1 below (one unit for a slope alone), in
depth (floatRepresentation) or in 2^-16. Now `metal::state::depth_bias` hands
Metal's constant to vkCmdSetDepthBias in the device's own unit r on every depth
format; Vulkan leaves a fixed-point format's r to the implementation, at most
2 x 2^-16 ("Depth Bias", primsrast.adoc).
Deleted, nothing reading them any more: `depth16_units`, `DepthBiasUnit` and
`DepthBias::unit`, the `depth_format` parameter of `depth_bias` and of the
runtime's `vk_depth_bias`; the runtime's vkCmdSetDepthBias2EXT path
(`DepthBiasCommand`, `depth_bias_command`, the record's pinned representation,
the device's command, its priming and `DEPTH_BIAS_CALLS`, the exit guard's and
recorder's `CmdSetDepthBias2`, `Logged::SetDepthBias2` and its thunk, so
`CommandsReplayed::cmd_set_depth_bias2` goes). VK_EXT_depth_bias_control is
still described but no longer consumed, so the core recommends enabling neither
it nor its three features.
RADV on the 780M no longer takes DriverDeviation::MetalDepth16BiasedStores: it
was measured through the exact unit. MoltenVK keeps it (it hands Metal its
constant, by construction). Elsewhere `unorm-depth-bias` announces the device's
bias; its cost text, docs/API.md's entry, the deviation and property docs and a
new FAST-PATHS device-gap row state it.
Tests: `metal::state::a_unorm_depth_bias_is_metals_constant_in_the_devices_unit`
(the constant as given on lavapipe, NVIDIA and MoltenVK, which have
depthBiasExact or not); the recommendation test leaves the extension and its
features out; the driver-facts test drops RADV's row; the exit-guard tests lose
the priming group and render_state.rs as a keeper of the device's functions.
api_signatures blessed (DepthBiasUnit, DepthBias::unit, depth_bias's signature);
the refusal surface is unchanged. Not bumped here: RUNTIME_VERSION (the versions
commit) and the runtime-sources pin (landing).
Verified: cargo clippy -p metal2vulkan -p metal2vulkan-runtime
-p metal2vulkan-validation --all-targets --all-features -D warnings; nextest of
metal::state, device::tests::{enables,driver_facts,profile}, tests::fast_paths,
api_surface, api_signatures, exit_guard, render_state, degradation_catalogue,
draw_shape_notices and ash_interop: 159 passed.
* Cite the spec that leaves a NaN fragment depth undefined, which makes its discard capability
The native-arithmetic audit asked whether `clamp_depth`'s discard of a positive NaN
depth, on every profile, emulates Metal where the device has a native form. It does
not: Vulkan defines no answer for such a depth. "Depth Clamping and Range
Adjustment" (fragops.adoc, 35.10.1): "If zf is not in the range [zmin, zmax],
then zf is undefined following this step", with or without depthClampEnable, and a
NaN lies in no range; only depthClampZeroOne, which no profile enables, keeps a
float depth unchanged (and then the comparison of a NaN would still pass ALWAYS
and NOT_EQUAL, where Metal's fails every test). So the discard stays, as
capability, and the comment says why, so a later audit does not re-raise it.
Docs only (a doc comment); no behaviour changes.
Verified: cargo fmt --all.
* Drop the cube's unmeasured gradient route from the anisotropic tests' profile comment
The route was deleted with the native cube gradients; the comment still named it as a second
home of the anisotropic emulation. Only a profile without samplerAnisotropy emulates it now.
Verified: comment only; git grep finds no other mention of the unmeasured gradient route.
* Keep the device's store of an extended-range, padded or bfloat attachment's untouched texels
What: a render pass that loads and stores a color attachment of an extended-range, padded
10-bit or bfloat format now keeps the bytes its draws do not write, the device's own load and
store (VK_ATTACHMENT_STORE_OP_STORE of a loaded attachment), on every device. The runtime no
longer reproduces Metal's tile store: the load pass that rewrote the texels' unused bits before
the pass (render/unused_bits_load.rs, bind::unused_bits_module), the capture replay that found
the tiles a pass's draws reach for it (render/capture.rs, bind::capture_assembly_module,
capture_settle_module, tile_reach_module, the translator's capture form
LoweringInputs/VariantKey::captured_positions, CaptureForm, RuntimeFact::CapturedPositions,
PushField/PushHole::CaptureAddress, Feature::TileReach, StatusBits::CAPTURED_REACH_UNMEASURED,
StatusReport::captured_reach_unmeasured) and the pipeline states' capture forms are deleted, with
ExtendedRange::load_code, Degradation::UnreachedTilesRewritten and the WorkCounts fields
unused_bits_load_passes, unused_bits_load_texels and capture_reach_*. Every draw in such a pass
announces extended-range-bits-kept, naming the attachments (render/tile_store.rs, the renamed
module); its catalogue entry, the FAST-PATHS device-gap row and the format docs state what
differs: the unused bits, BGRA10_XR's alpha clamp, a padded sRGB twin's table and a bfloat code
through half, which Metal's pass rewrites in each tile a draw reaches. snorm-minimum-kept and
shared-exponent-kept are unchanged (TileStoreIsMetals still says where the device's store is
Metal's).
The de-indexed and private list forms keep the index read the capture form shared
(PushField::CaptureIndexAddress, CaptureLayout, CapturedIndex); the binder's de-indexed draw no
longer goes through the capture draw, and the vertex function's strip restart return, which only
the capture form's layout could take (a de-indexed strip is NotImplemented(PrimitiveId)), is
gone.
Why: the owner's rule 1. The device has a native load and store; reproducing Metal's tile store
emulated Metal's bits where the device has a native form. The difference is recorded and
announced (rule 2).
Verified: cargo clippy -D warnings, all targets and features, over metal2vulkan,
metal2vulkan-runtime, metal2vulkan-validation and metal2vulkan-conformance, plain and with
--cfg m2v_gpu: clean. api_signatures blessed, REFUSALS.md regenerated. The test runs (translator
and runtime suites, the touched validation lanes on lavapipe and on the M3 Max's MoltenVK) follow
this commit and are reported with the lane.
* Bump the semantics and runtime versions for the device's tile store and depth bias
What: SEMANTICS_VERSION 1907 -> 1908 and RUNTIME_VERSION 1681 -> 1682.
Why: SEMANTICS_VERSION, because the translator's output changes under unchanged keys: the
de-indexed and private list vertex forms no longer carry the strip restart return, and the
capture form, its runtime fact and its push field are gone. RUNTIME_VERSION, because runs of
unchanged artifacts now do something else: a Depth16Unorm depth takes the device's depth bias
(no depthBiasExact or unit rescale), and a pass that loads an extended-range, padded or bfloat
attachment keeps its untouched texels' bytes (no unused-bits load pass, no capture replay) and
announces extended-range-bits-kept. ARTIFACT_FORMAT_VERSION stays: the codec tags variants by
name, and the removed ones (CaptureForm, PushField::CaptureAddress,
RuntimeFact::CapturedPositions) leave their tags unused, so an old entry holding one is a miss.
Verified: the constants alone change; the golden tables and the runtime-sources pin are
re-blessed at landing.
* Hold the lanes and the fact census to the device's store of untouched texels
What: three runtime lanes still expected Metal's tile store after 5e710fb988 made the device's
store the only form, and the mechanism test still counted the deleted
RuntimeFact::CapturedPositions.
- extended_range_blends::a_pass_of_extended_range_and_padded_colors_names_each_loaded_color:
the padded colors, which the function does not write, keep their bytes (all ones), where
Metal's pass leaves each word 0xffc0.
- extended_range_blends::a_fetched_two_plane_attachment_written_unblended_stores_metals_write:
color 2, loaded and unwritten, keeps its bytes, where Metal's pass zeroes its color words' top
two bits.
- extended_range_blend_table::a_memoryless_color_2_blends_as_a_stored_color_does: the stored
color 0's bands are compared with the unused bits as Metal's pass leaves them
(as_metal_leaves), the codes exactly, as the table's other passes already are.
- device::tests::mechanism: the variant census is 0..89 (MergedDraws takes the freed index).
Why: the lanes held the deleted exact form; the device's store is now the contract and
extended-range-bits-kept announces the difference.
Verified: on the M3 Max (MoltenVK, --cfg m2v_gpu, under maclock and memcap) the three lanes and
the rest of extended_range_blends pass (11 of 11, with waiter_submits, which failed once under a
load of 40 and passed on its rerun); on plain, device::tests::mechanism and tests::fast_paths
pass (12 of 12); clippy -D warnings clean, plain and --cfg m2v_gpu, over the four crates.
* Re-pin the runtime sources at the landing tip
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.
|
||
|
|
487e23f3ee |
Declare a half color output 16-bit where the device enables storageInputOutput16
A fragment function's half color output is declared 16-bit where the device enables storageInputOutput16 and shaderFloat16, so the device blends the half Metal's attachment receives (the M3's 52 half-blend rows no longer diverge). SEMANTICS 1909, ARTIFACT 476. One work packet, landed as 6 commit(s) (9e8b40289e..f5e9c26fe3 on archive/development-linear-2026-10-28-evening), in order: * Declare a half color output 16-bit where the device enables storageInputOutput16 What: a fragment function's `half` color output through a variable of its own type (not an extended-range or word attachment's raw texel, not an attachment held with its channels rotated) is declared with 16-bit float lanes on a profile that enables `storageInputOutput16` and `shaderFloat16`, and stored by one OpFConvert of the f32 that holds the half (exact: the value is a half). The module then requires StorageInputOutput16 (derived from the Output pointer as before). `StageIo::half_outputs` lists the keys so link's contract check holds the module to the 16-bit declaration (`io_type_matches` takes the float width); the artifact codec carries the field. Every other interface variable stays 32-bit, and a device without the feature (lavapipe, NVIDIA's 615.71.09) keeps the half widened to float. Why: the widening hid the output's type from the device. With the half declared as a half, the device blends and converts the value Metal's attachment receives as its own half output: on MoltenVK that is Metal's compiler handling Metal's own output type. No Metal arithmetic is emulated and no note changes (HalfOutputPrecision and HalfOutputFastMathBlend fire as before; a computed fast-math output may still differ). Verified: - M3 Max, MoltenVK 1.4.2, macOS 27.0.1: `conformance replay` of the six `half-output-blends-*` cases: every value exact (verdict `announced`, the case's declared notice only); the 52 M3 rows of known-gaps.tsv (17, 17, 18 sites of r16f, rg16f, rgba16f) all read "no longer diverges", so they are removed. The 32-bit float formats stay exact. A replay of the 40 cases whose recorded fragment functions return half (half-output-blends-*, xr-*, rgb10a2-srgb-stores-h, render-then-sample-magnified-*, fragment-imageblock-reflection): 39 announced, 1 exact, no other ledger difference. - New unit test `a_half_color_output_is_declared_16_bit_where_the_device_enables_it` (moltenvk-m3 and amd-rdna3-radv 16-bit, lavapipe 32-bit; a float output and a rotated attachment 32-bit everywhere; L3 on each module). * Bump the cache versions for 16-bit half color outputs SEMANTICS_VERSION 1907 -> 1908: a fragment function's half color output is declared 16-bit on a profile that enables storageInputOutput16 and shaderFloat16, so its module's words and requirements change under an unchanged key (golden_hashes reports 657 cells changed; the table is re-blessed on the lane branch, not here). ARTIFACT_FORMAT_VERSION 475 -> 476: StageIo gains `half_outputs`, which the artifact codec encodes. Verified: cargo check; the version constants alone moved. * Regenerate the conformance coverage document for the 52 removed M3 rows What: docs/CONFORMANCE-COVERAGE.md, written by `python3 -I scripts/conformance-coverage/coverage.py`. Its ledger count goes from 1129 to 1077 rows and its ledger table loses the 52 Apple M3 Max rows of `half-output-blends-r16f`, `-rg16f` and `-rgba16f`, which the 16-bit half output commit removed from known-gaps.tsv (they read "no longer diverges" on the M3 replay). Why: the document is derived from the ledger, and `conformance_coverage::the_conformance_coverage_document_is_what_the_sources_derive` failed on the stale copy. Verified: the diff is those 52 lines and the count, nothing else. * Record the M3's safe-math half blends under the 16-bit half output What: PrecisionNote::HalfOutputPrecision's documentation said MoltenVK on the M3 Max stores Metal's bytes in every draw of the safe-math sweep. It now states what the lane measures with the output declared 16-bit, and that the NVIDIA, RADV, ANV and lavapipe bounds were measured with the output widened to float (RADV and ANV, which enable storageInputOutput16, now take the 16-bit form and are not re-measured: host away). Measured on the M3 Max, MoltenVK 1.4.2, macOS 27.0.1, with `runtime_lane::half_output_blends::half_output_blends_against_metals_rule` under --cfg m2v_gpu (the measurement prints HALF-BLEND-SUMMARY lines): - at this branch (16-bit output): R16Float, RG16Float, RGBA16Float 28 of 28 measured blend draws Metal's rule's value in every channel, largest distance 0; R32Float 28, RG32Float 28, RGBA32Float 26 of 28 (zero-1msa k0 and k4: one channel of 262,144 off by a zero's sign, distance 0); - at |
||
|
|
5f807517bd |
Make sampled textures over logged host pages device copies on a discrete GPU
On a discrete GPU a sampled, read-only, tracked texture over logged no-copy memory is a device
copy refreshed by the logged row bands, instead of an image read across the bus in place.
One work packet, landed as 3 commit(s) (7812de9edd..919557e82f on archive/development-linear-2026-10-28-evening), in order:
* Make sampled textures over logged host pages device copies on a discrete GPU
What: on a DeviceKind::Discrete device, a texture over host pages whose
policy and usage take the image in place (HostPageTexturePolicy::InPlace,
a usage that only samples or reads), tracked, over a no-copy buffer
whose memory carries a DirtyPages log (HostPages::dirty), one slice laid
out as one copy region straight from the buffer's VkBuffer (no staging,
no rows sharing bytes), is now a shadow instead of the image in place,
announced nowhere and counted as WorkCounts::device_copy_textures. Its
copies in are the shadow path's gated ones (dirty_pages.rs): each
command buffer's first copy in takes only the row bands the log reports
changed since the hold, nothing where none changed, every row where no
hold stands, the wait says false, or a GPU write of the bytes let go of
the hold. The in-place check's verdict is not asked: the copy binds no
image to the pages. Integrated GPUs, CPU devices and memory without a log
are placed as before.
This is ws/vramcopy's device copy (9c04997aa9..6f6d709ae9) resolved onto
ws/dirtypages' design: its own refresh (a per-batch entry preamble with
its own stamps, an encoder-entry hook and a carry write list), its
DirtyLog wrapper, its buffer-key log registry and GPU-write reports, its
replace_region report and its refresh counters are all dropped for the
shadow path's DirtyHook/DirtySource, per-shadow ShadowLog hold and
stamp, gated replay-time regions, note_dirty write tracking and
dirty_copies_in_* counters, which do the same job. What stays is the
placement, its fit check (Texels::device_copy) and its counter.
Tests: runtime_lane::device_copies (m2v_gpu), on the tally of the shadow
path: a 1920x1080 surface over logged pages follows six frames of CPU
writes, its gated copies in whole at the first frame and where the wait
could not say, skipped with no write, cut otherwise; a blit fill of the
buffer lets go of the hold and the next read finds the fill; without a
log no device copy; a cost report (DEVICE-COPY-COST) of in place against
the device copy for a 3840x2160 surface read whole each frame.
Docs: runtime README (textures over buffers) and docs/API.md (textures
over host pages). api_signatures.tsv: one field row
(signatures.py --check passes).
Verified (macOS): cargo fmt; cargo clippy -p metal2vulkan-runtime
--all-targets --all-features -D warnings; the same with -p
metal2vulkan-validation under --cfg m2v_gpu. Device runs follow.
* Run the device-copy lane under the product's in-place policy
What: runtime_lane::device_copies' devices take
HostPageTexturePolicy::InPlace (in_place_textures' in_place, now shared),
the product's default: the lane's devices otherwise take the exact
answers, under which no texture is a device copy, so on the RX 7900 XTX
the first test found none ("device copy false") and the cost test
compared two shadows rather than in place against the device copy.
Verified: cargo fmt; cargo clippy -p metal2vulkan-validation
--all-targets --all-features -D warnings under --cfg m2v_gpu; on the M3
Max (MoltenVK, integrated) the three device-copy tests pass, no device
copy made there. On gem10 at 134ac6eb18 (before this fix):
tests::dirty_pages_device 2/2 passed on the RX 7900 XTX; the lane's
content checks passed and its layer checks failed on a loader message
about gem10's NVIDIA ICD (libGLX_nvidia.so.0), not the runtime's.
READY 134ac6eb18 (product code; this commit changes tests alone)
* Re-pin the runtime sources at the landing tip
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.
|
||
|
|
7cce610704 |
Delete the shader-side dropped-store mask
One work packet, landed as 5 commits (a31d02e99a..46c3156d42 on archive/development-linear-2026-10-28), in order: * Delete the shader-side dropped-store mask What. The per-stage mask of buffer slots whose stores the shader drops goes, with everything that existed only for it: - translator: the store-dropping lowering (lower/access/sink.rs; the guarded stores in emit, psb, pulled, dynamic, atomic and blob; the write-only store-sink binding and the OpSelect of two storage-buffer pointers that chose it, with its VariablePointers requirement), the specialization key, the stage-table field and their codec tags; - runtime: argument_table's dropped_store_buffers and its refresh, Buffer::drops_writes (now unused), the two variable-pointer enables, and SetZeroChoice.store_sinks (now the layout's set-0 bindings); - tests: engine_dropped_stores, engine_dropped_store_sink, the sink cases of neutral_zeros_shared, and dynamic_multi_variable's two encoders_plain tests, whose only binding of several variables was the sink. The narrow-unit kernel now runs at its buffers' starts and at moving offsets: the moved run checks that a dynamic offset reaches every variable of its three-variable binding, and no dispatch at a moved offset reuses its predecessor's set in either form, since a slot read to its buffer's end has a range that moves with its offset; - the Apple M3 Max known-gaps row for host-page-writes-kernel-store-read-only at case/bytes-in-the-same-command-buffer-bytes, which this fixes. Removed public items: - metal2vulkan::bind::StageTable::dropped_store_buffers (field) - metal2vulkan::bind::StageShape::dropped_store_buffers (field) - metal2vulkan::pipeline::SpecKey::DroppedStoreSlots(Stage) - metal2vulkan::pipeline::SyntheticBinding::StoreSink - metal2vulkan::device::VkFeature::VariablePointers - metal2vulkan::device::VkFeature::VariablePointersStorageBuffer (the two features were asked for only by the sink's pointer select) Why. The mask was set only from Buffer::drops_writes, which is true only for host pages imported through a read-only view, and only macOS makes one (VIEWS_DROP_WRITES; ReadOnlyView::of is None elsewhere, and no_copy_options keeps the private bit off it). No other path set it: Linux writable imports, dma-buf imports (excluded where writes drop), heaps (the same import) and argument buffers (which name no slot). On that memory the view already takes the GPU's writes nowhere, so the shader-side drop was redundant there. It was also wrong: a later command of the same command buffer reads the stored words back from the GPU's caches on Metal (8 runs of 8 on the M3 Max), and the shader-side drop made it read the pages' own bytes. Versions, placeholders for the landing to renumber: SEMANTICS_VERSION 2000, ARTIFACT_FORMAT_VERSION 500 (the codec loses four tags), RUNTIME_VERSION 1840. api_signatures.tsv re-blessed, docs/REFUSALS.md and docs/CONFORMANCE-COVERAGE.md regenerated, the runtime sources re-pinned. FAST-PATHS: the read-only-memory known gap now says what is true (writes reach the pages off macOS), and the dynamic multi-variable row is scoped to bindings whose range stays as their offset moves. Verified: - metal2vulkan suite: 3329 of 3330 pass. golden_hashes moves 3391 cells (every module with a device store loses its guard); the table is re-blessed on development. - clippy -D warnings clean, plain and with --cfg m2v_gpu; rustdoc -D warnings clean for the four touched crates. - MoltenVK 1.4.2 on the M3 Max: conformance replay of the four host-page-writes cases exits 0, both kernel-store cases exact (the visibility pair "announced", the fast-math notice, as before). The host-page, read-only and private-bit lanes and argument_table, neutral_zeros_shared and dynamic_multi_variable pass. - lavapipe (arm64, linux-gate): full conformance replay exits 0, its 891 gap rows exactly the ones the ledger expects on the venue (none unlisted, none stale); the same lanes pass. * Lane: a kernel's stores into private-bit memory reach only its own command buffer What. runtime_lane::degrade_notices gains a_kernel_s_stores_into_private_bit_memory_reach_only_its_own_command_buffer. It dispatches a4_index_word into no-copy memory of an anonymous mapping, filled with 0xab and made with Metal's private option bit 24, bound 512 bytes in, then copies the first 1024 bytes in the same command buffer and in a later one, and reads them from the CPU. Why. It holds Metal's measured answer where the runtime gives it: the same command buffer's copy reads the stored words, everywhere; on macOS, where the pages come through a read-only view, the later command buffer and the CPU read the pages' own bytes and nothing is announced; elsewhere they read the stores, announced once as the private-option notice. Every byte the stores do not name keeps 0xab at every site. Verified: MoltenVK 1.4.2 on the M3 Max prints "drops writes true; same command buffer stored true, later command buffer stored false, CPU stored false" and passes; lavapipe (arm64) prints "drops writes false; ... true, true, true" and passes. * Number SEMANTICS_VERSION 1907, ARTIFACT_FORMAT_VERSION 475 and RUNTIME_VERSION 1681, past development's The dropped-store mask's deletion took the placeholders 2000, 500 and 1840; development is at 1906, 474 and 1680. * Re-bless the golden tables after the dropped-store mask's deletion Every module with a device store loses its read-only guard (a31d02e99a), so bless_golden_hashes moves 1330 rows of golden_hashes.tsv; bless_engine_inventory, bless_engine_goldens and tests::air_input wrote nothing new. Verified: the three bless runs and air_input exit 0 at 623f8d2170. * Re-bless the authored compile census after the dropped-store mask's deletion corpus-triage --audit authored-compile --bless over 2253 cases and 21 profiles: 0 differences, 0 regressions, 0 failed, 20159 artifacts moved by hash alone (the store guard's words). Slowest compile 586 ms, slowest case across all profiles 18.5 s, peak worker RSS 231 MB. Verified: the census run above at 623f8d2170. |
||
|
|
4c07cde4d2 |
Announce set-past-layout-support at every bind of a variant past its driver's support
One work packet, landed as 9 commits (332aebcc0c..c0ffb238b1 on archive/development-linear-2026-10-28), in order:
* Announce set-past-layout-support at every bind of a variant past its driver's support
What. A variant's kinds (`Kinds::of`), which a bind tests before it
announces anything at every occurrence, now hold `SetPastLayoutSupport`
where a set of the pipeline's layout is past the least
`maxPerSetDescriptors` (1024) on a driver that understates its layout
support (`RuntimeDriverDefect::SetLayoutSupportUnderstated`, MoltenVK):
`pipeline::objects::may_pass_support`, the same test `set_support` makes
before it asks the driver.
Why. The kinds held the stages' notes and the vertex-simdgroup property
alone, though `Device::degrade_pipeline` announces the layout notice too.
So a device announcing it at every occurrence (`announce_each`, which the
conformance suite's device sets) announced it only for a variant that
also recorded a precision note: the heap set of a kernel reaching a
texture through an argument buffer (65536 descriptors per array on the M3
Max, which MoltenVK's `getDescriptorSetLayoutSupport` refuses at a sum of
1212 or more) went unannounced until the native-arithmetic round gave 36
conformance cases' kernels a note (device-nan-encoding,
pixel-sampler-scaling), and then it surfaced in exactly those. The notice
is true of the driver: the layer reports VUID-09582 for each such layout.
Without announce_each nothing changes: the making announces it once.
RUNTIME_VERSION 1820 (placeholder, to be renumbered at landing): a bind
can announce what it did not.
Verified: tests::driver_defects::a_set_past_the_drivers_support_is_among_its_variants_kinds
(hsw_held compiled for the committed MoltenVK profile: sets of 4 and
65536 descriptors; the kind held where the driver understates, not where
it does not; the kinds' test agrees with set_support's Understated) passes,
and fails with the kind's addition disabled ("sets of [4, 65536]
descriptors, the driver understating its support: true"). A full MoltenVK
replay (M3 Max, 1.4.2) with the change reads the same 152 unlisted lines
as without it: the 36 cases that announce it already did.
* Declare set-past-layout-support where a case's kernel reads an argument buffer's texture
What. replay::set_past_layout_notice(), a declaration like
shared_memory_notice, and its use by the cases whose kernels reach a
texture or a sampler through an argument buffer: every pixel-samplers and
pixel-downscales case (the arg source), every norm-storage case (the held
route), the three half-storage-writes held rows, read-write-tier-held, and
the two argument-encoder cases that dispatch.
Why. Such a kernel takes the handle heap, set 1, of 65536 descriptors an
array on the M3 Max. MoltenVK 1.4.2 answers vkGetDescriptorSetLayoutSupport
by the sum of the counts against maxPerSetDescriptors (1212), so it refuses
the set though it makes and runs it; the runtime makes it and announces
set-past-layout-support, and the layer reports VUID-09582 for it. That is
a notice of what the driver lacks, which NATIVE_NOTES leaves to each case
to declare. The query is a true one, asked of the create info the layout
is made from, so the runtime keeps announcing it. The 36 cases' MoltenVK
replay read it as undeclared (42 sites, the argument-encoder cases' four
each, since their shared-memory declaration loosened the notices site with
nothing announced to justify it).
Verified: the MoltenVK replay of the 36 cases on the M3 Max (1.4.2) exits
0, 27 announced and the 9 divergent at their ledger rows, nothing
unlisted.
* Ledger the M3 Max's own NaN bits at 37 half-NaN sites
What. Apple M3 Max rows for the sites where this venue answers the
canonical quiet NaN 0x7E00 for a `half` NaN Metal keeps the bits of:
attribute-format-fetches' 29 attribute3 sites (a Half or Half2 attribute
fetched through stage_in into a half2 and reinterpreted), the three
half-write-nans 16-bit float stores, the three half-texel-nans `read`
sites, and math-frexp-ilogb-half's two frexp mantissa sites.
Why. Read off every element of each site (both sides' bytes dumped from
the replay): every differing element is a NaN on Metal's side -- 0x7E01
and 0xFE01 for the attributes, the stored halves' own codes, the texels'
own codes, frexp's 0x7E01, 0xFE55 and 0x7C01 -- and 0x7E00 on ours; no
other code differs. This M3 widens a half NaN to the canonical one, so
the bits are gone at the device's widening (the attribute's and texel's
reads, the store's widened conversion) or at the device's NaN result
(frexp). Each is announced and recorded: native-nan-encoding (a module
reading a half from its bits; an operand's bits where Metal answers
them) and device-nan-encoding (a half texel's write; a half texel's
read), both native notes whose bound is the device's sign and payload,
validation deriving no tolerance from them. The `read` rows carry the
words of the M3 rows at the family's two other sites, now that the read
also goes through the device's decode. So the 32769 the attribute rows
show is the negative NaN's sign and payload, not wrong data.
Verified: MoltenVK replay of the 8 cases on the M3 Max (1.4.2) exits 0
with nothing unlisted.
* Ledger the M3 Max's sRGB pack and unpack at the device-pack-conversion bound
What. Apple M3 Max rows for pass-bytes-srgb-decode-all-bytes and
pass-bytes-srgb-encode-sweep, at their one site each.
Why. The module decodes and encodes sRGB by the MSL transfer function
through the device's Pow (device-pack-conversion, a native note, recorded
on every device for the sRGB forms), where Metal goes through its
twelve-bit table. Read element by element off the replay's bytes against
the committed recordings: every decoded float is within 1.2205e-4 of
Metal's step (under half a twelve-bit step, 1/8190), every decoded half
within that and one half ulp (at most 0.97 of the sum), the alpha lanes
exact; every encoded colour channel that differs (1,821 of them) is one
code from Metal's, no alpha. That is the note's recorded bound. The
largest raw differences (0x00F90001, 0x00010101) are a small half 249
ulps off beside a one-ulp half, and one code in each colour byte.
Verified on the M3 Max (MoltenVK 1.4.2) by the replay of the two cases,
after the rows' rebuild (see the next commit's run).
* Ledger the M3 Max's own half-output blend at the fast-math-blend bound
What. The 18 Apple M3 Max half-output-blends rows go and 52 come: every
site the three 16-bit float formats now differ at, none for the 32-bit
float formats. The family's module docs say what each side does now.
Why. The exact shader blend of a half output is gone (the
native-arithmetic ruling), so the device blends. Read word by word off
the replay's bytes against the committed recordings and the case's own
source sweep and destination generator: this M3 blends the half widened
to float in float and converts into a 16-bit float format toward zero
(every word of the 43 divergent sites whose sum adds no blend-colour
product, 97 to 99.6 per cent of the other nine's), where Metal's compiler
folds the blend into the function (round(round(Sf*S) + Df*D) at the sites
the case's tests measure). Every differing word, 52 sites of 6 to 559
words, is within 2 half ulps of Metal's at the operands' magnitude (the
largest of the source, the destination, a factor and the two products'
magnitudes summed; the worst exactly 2), which is
half-output-fast-math-blend's recorded bound; the case declares that
note and it fired. Raw-code distances up to 1,582 are results near zero.
The 32-bit float formats now store Metal's codes at every word, so their
8 rows are stale, and the 10 old 16-bit rows' counts no longer hold.
Verified: MoltenVK replay of the six blend cases and the two sRGB cases
on the M3 Max (1.4.2) exits 0, nothing unlisted and nothing stale; the
32-bit float cases read announced.
* Ledger the M3 Max's same-command-buffer read of a dropped kernel store
What. One Apple M3 Max row for host-page-writes-kernel-store-read-only
at case/bytes-in-the-same-command-buffer-bytes, an open bug of ours.
Why. Metal drops a kernel's stores into read-only backing, and a later
command of the same command buffer reads them back from the GPU's caches
(every one of the 8 recorded runs); ours reads the pages' own bytes.
Measured cause: the shader drops its own stores through a slot bound to
such a buffer (StageTable::dropped_store_buffers, SpecKey::DroppedStoreSlots),
so the store never reaches the caches, though on macOS the read-only view
the pages are imported through already drops the write. With that word
forced to zero (a local probe, not committed) the case is exact on this
M3, 3 runs of 3, its later-command-buffer and CPU sites still the dropped
write. The gap predates the native-arithmetic round: the same divergence
replays at
|
||
|
|
524c2f7346 |
Record the device's own alpha to coverage as a native precision note
One work packet, landed as 4 commits (f6834405b7..7ec539ceb2 on archive/development-linear-2026-10-28), in order: * Record the device's own alpha to coverage as a native precision note What: a render pipeline that keeps alpha to coverage now records `PrecisionNote::DeviceAlphaCoverage` on its fragment stage, which the runtime announces as `device-alpha-coverage`, on every profile not measured to cover as Metal does. `link::graphics::coverage_notes` decides it from the graphics state alone and hands it through `Linked`'s new `fragment_notes` and `fragment_properties`, as the vertex stage's fixed-function notes already go. A profile that takes the new measured driver fact `DriverDeviation::MetalAlphaCoverage` (MoltenVK on Apple's GPUs of the M3 Max's macOS 27 identity, the APPLE9 row) records no note and requires `VkProperty::MetalAlphaCoverage` instead. Why: Vulkan specifies no algorithm for turning an alpha into a coverage mask, and Metal's is not the floor rule we assumed. Measured on the M3 Max (macOS 27.0.1) over 639 alphas a sample count with our own probe (probes/alpha_coverage_sweep.m): one sample covers above an alpha of 1/2; two and four samples cover ceil(alpha * n - t), t a 2x2 ordered dither. Under rule 1 the device's answer is the contract, so the note records it and nothing in the shader or the sample mask imitates Metal's. Bound, pixel by pixel against Metal's committed reading (runtime_lane::alpha_coverage, 10,224 pixels a count): lavapipe (Mesa on LLVM 21.1.8, arm64) dithers at one sample too, 2,560 pixels apart (a whole fragment stored or dropped), and at four samples 96 pixels one sample apart, all within an f32 ulp of a threshold; every pixel within floor..ceil of alpha * n. MoltenVK 1.4.2 on the M3 Max: 0 apart at 1, 2 and 4 samples (its reading is byte-identical to plain Metal's). NVIDIA is unmeasured beyond its known-gaps row. Stated in the note, the runtime kind, docs/API.md's catalogue and docs/FAST-PATHS.md's device gaps; `CoverageReadsRoundedAlpha`'s docs now say its bound is the rounding's alone. Validation derives no tolerance from it (`Allowance::Unbounded`). Versions: SEMANTICS_VERSION 1980, ARTIFACT_FORMAT_VERSION 490 (the codec gains a note and a property), RUNTIME_VERSION 1790. Verified: tests::engine_alpha_coverage (five profiles, 1 and 4 samples, coverage on and off) passes and fails with the note's recording removed; the lane passes on lavapipe (linux-gate arm64) and on MoltenVK (maclock), printing the counts above and asserting the announcement iff the note; nextest of metal2vulkan, -runtime, -conformance and -validation pass but for the golden table (stale at this base; against development's re-blessed table only the moltenvk-m3 profile fingerprint moves) and the runtime sources pin, both re-blessed on development; clippy (all features, and --cfg m2v_gpu) and rustdoc clean; api_signatures.tsv re-blessed. * Declare device-alpha-coverage native in the suite and fix Metal's coverage rule What: `replay::NATIVE_NOTES` gains `DeviceAlphaCoverage` (the coverage class), so no a2c case must declare the notice the device announces at its own coverage; values still compare field by field. The two `a2c-on-1-alpha-50` known-gaps rows (llvmpipe, RTX 5080 Laptop) keep their identity and now name the note and its bound: on llvmpipe the measured dither and counts; on NVIDIA the bound is open until the coverage lane's sweep runs there. `alpha_coverage_pairs`' model and docs, and `render.rs`'s field doc, said Metal covers floor(alpha * n) samples; they now state the measured rule (above 1/2 at one sample; ceil(alpha * n - t) under a 2x2 ordered dither at two and four), and the model's test holds the cases' recordings to it. docs/CONFORMANCE-COVERAGE.md regenerated. Why: the suite's standing declarations name every note that is the device's native answer, and the rows must say what differs and whose answer it is. Verified: the conformance suite passes (nextest); coverage.py and refusal_surface.py regenerated (REFUSALS.md unchanged). * Number SEMANTICS_VERSION 1906, ARTIFACT_FORMAT_VERSION 474 and RUNTIME_VERSION 1679, past development's The alpha-coverage note took the placeholders 1980, 490 and 1790; development is at 1905, 473 and 1678. * Re-pin the runtime sources at the landing tip 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. |
||
|
|
12e64034b3 |
Hold back the clear's conversion note where MoltenVK's load operation clears as Metal's
One work packet, landed as 5 commits (36c1f6d2ed..bad631efa8 on archive/development-linear-2026-10-28), in order: * Hold back the clear's conversion note where MoltenVK's load operation clears as Metal's A render pass's CLEAR load operation of a colour attachment its render area covers is, on MoltenVK, Metal's own Clear load action, so the texel it stores is Metal's. The new DriverFact::ColorClearIsMetals records that for MoltenVK on the Apple9 GPUs under macOS 27, and the pass layout withholds device-color-conversion for such a clear there. A clear that is not that load operation still announces the note on every device: a clear over a smaller render area (vkCmdClearAttachments, a quad draw on MoltenVK), a clear made before the pass of an attachment its first instance leaves out, and a memoryless attachment's backing. Measured with the renders lane's clear case set (clears_are_the_device_s_conversion_of_the_clear_value) under MoltenVK 1.4.2 on the M3 Max, macOS 27.0.1, before the change: 71 colour clears, 11 depth and 4 stencil, all 86 texels Metal's bytes, none a code apart. The lane now also asserts the note stays unannounced where the fact holds; the dont-care and colour-reformat lanes expect it only where their clears are not a covering load operation (tie_cleared's new flag). RUNTIME_VERSION 1760; api_signatures re-blessed for the new variant. Verified on MoltenVK (M3 Max, --cfg m2v_gpu): the renders clear lane (86 checked, 0 apart, no device-color-conversion), runtime_lane::dont_care_stores (4) and runtime_lane::color_reformat (6) pass; device::tests::driver_facts passes. * Resolve into an sRGB twin by the device's own sRGB decode and encode A multisampled 8-bit UNORM attachment resolving into its sRGB twin is the crate-owned resolve on every device, and it applied Metal's 12-bit sRGB tables. Under the native-arithmetic rule the device's conversions are the only form where the device has them, so where the device renders the sRGB format the resolve now reads the samples through a view in the sRGB format (the device decodes each sample), averages the decoded values (their f32 sum times 1/n) and writes the average through the resolve attachment's own sRGB view (the device encodes it); the alpha keeps the unorm rule. An attachment read from a copy gets a scratch image mutable to the sRGB view. A device without the sRGB format keeps the tables through the raw UNORM views. bind: ColorResolveFormat::device_srgb / decodes_on_device, the device_mean lowering, and the tables only for the table form. runtime: of_resolve picks the form (color_resolve::decodes), the plan reads through the sRGB view and skips the raw write, twin_read_view makes a stand-in mutable to the sRGB view, resolve::scratch_viewed. device-rounded-resolve is announced for such a resolve on every device; docs (degradation, API.md, FAST-PATHS sRGB row, the module docs) say so. Measured with the new lane resolve_rounding::a_twin_resolve_into_srgb_rounds_as_announced (every pair of codes at 2 samples, the lane's pattern at 4, RGBA8 and BGRA8): MoltenVK 1.4.2 on the M3 Max 696 of 262,144 channels one code below Metal's at 2 samples, 880 of 524,288 at 4; lavapipe (Mesa 26.0.8, 4 samples only) 57,865 of 524,288, above and below; none past one code. The model in the bind tests gives 1,758 of 65,536 pairs one code apart with correctly rounded conversions. The resolves lane's twin texels now hold each colour channel to the note's two codes (lavapipe writes 0xbb where Metal's is 0xbc). Verified: the twin lane, runtime_lane::resolves (19), runtime_lane::resolve_rounding (4) and the dont-care twin case pass on MoltenVK (--cfg m2v_gpu) and on lavapipe (--cfg m2v_cpu_icd); the bind color_resolve tests (20) and the runtime color_resolve, image_plan and stand-in unit tests pass; clippy clean plain and with --cfg m2v_gpu. api_signatures re-blessed for the two new methods. * Make a plain colour fill the device's clear where the device renders the format fillTexture:level:slice:region:color: (Apple SPI) packed the colour on the host by Metal's fill rules in every format. Under the native-arithmetic rule the device's own colour conversion is the only form where it has one, so a plain fill (no pixelFormat:) of a texture whose format's fill converts a float (normalized, sRGB, half, float, small float, shared exponent; fill_value::device_converts), whose image holds Metal's bytes of the format, and which the device renders and copies both ways, is now the device's clear: a scratch image of the region in the texture's image format, samples and dimension, cleared whole by vkCmdClearColorImage, copied into the region of each image the fill writes through the blit copy path, placed as the fill. Integer formats (no conversion), the extended-range and bfloat formats, texture buffers and every format the device does not render keep the host packing; the pixelFormat: variant keeps it everywhere (capability). The clear's note is recorded where it applies against Metal's fill packing, not its clear: device-color-conversion where fill_value::device_apart holds (a normalized value within 1/1024 of a tie, widened by the fill's float product and, for the packed 16-bit formats, a step through half; an sRGB value inside (0, 1); a value a half, small float or shared exponent does not hold), device-nan-encoding for a half or small-float NaN. The fill slot still takes the packed texel. The call is logged as itself (BlitCall::FillTextureColor) so a re-encode clears again. Lanes: color_fills::plain_color_fills_are_the_device_s_clear fills the probes' 762 colours into each of the 70 formats plain and packed, notices asked for at each fill, and holds every texel to Metal's or, where that fill announced, to a code (a NaN for a NaN); it asserts an RGBA8Unorm_sRGB fill announced device-color-conversion, which the host packing never does. color_fills::plain_color_fills_land_where_packed_ones_land checks the 31 placement cases byte for byte. The Metal-hash test now packs by pixelFormat:, texture_fills runs its plain colour cases packed (Metal's bytes), and the RGBX fill test accepts an announced code. Unit test for the predicates in tests::fill_value. Measured (plain against packed, 762 colours a format): lavapipe (Mesa 26.0.8) rounds a half toward zero (RGBA16Float 420 texels a code apart), an 8-bit tie down (RGBA8Unorm 20), and writes its own RG11B10 NaNs (275); MoltenVK 1.4.2 on the M3 Max keeps RGBA8Unorm exact, stands RG11B10Float 186 and RGB9E5Float 150 texels a code apart, and writes 0x7e00 for Metal's 0xfe00 half NaN; every one announced. Verified on MoltenVK (--cfg m2v_gpu) and lavapipe (--cfg m2v_cpu_icd): runtime_lane color_fills, texture_fills, rgbx_textures, sample_fills, surface_fills, texture_buffer_fills and two_plane_copies pass; runtime unit tests (fill, replay, blit) pass; clippy clean plain and with --cfg m2v_gpu; rustdoc clean. * List lavapipe's own clear at seven plain texture fills A plain colour fill of a format the device renders to is now the device's clear (6cdfe023d9), so the texture-fills conformance case's digest moves on the gate container's arm64 lavapipe at seven formats: ABGR4Unorm, RGBA8Unorm, RGBA8Unorm_sRGB, BGRA8Unorm, BGRA8Unorm_sRGB, RGBA16Unorm and RGBA16Float. The site is digest-only, so the same fills were run per texel through the color_fills lane's helper on that venue (a throwaway probe, not committed). Of the case's four plain colours only c5's (2, -1, 0.5, 0.3) differs, in its alpha alone, one code below Metal's: 0.3 is a tie in 4, 8 and 16 bits (4.5, 76.5, 19660.5 codes) that lavapipe rounds to even, and lavapipe truncates the half (0x34cc for Metal's nearest 0x34cd). device-color-conversion records it at every such fill and its one-code bound covers it, so each row is the device's native answer, scoped to the measured build, with nothing open. Verified: conformance replay --cpu on lavapipe (llvmpipe LLVM 21.1.8, 128 bits) exits 0, the 825 rows exactly the ledger's (no unlisted, no stale); the ledger's unit tests pass; replay --gpu of the 54 texture-fills cases on MoltenVK 1.4.2 / M3 Max: 37 announced, 17 exact, none divergent. * Re-pin the runtime sources at the landing tip 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. |
||
|
|
44910ecabd |
Hand pixel samplers' scaled coordinate to the device; test the unflushed subnormal coordinate
One work packet, landed as 2 commits (255f93b252..aba772e24d on archive/development-linear-2026-10-28), in order: * Hand pixel samplers' scaled coordinate to the device; test the unflushed subnormal coordinate Rule 1: the device's sampler is the contract. A pixel-coordinate sampler keeps its capability (the shader divides the coordinate by the level-0 size, since Vulkan's unnormalized samplers take no gather, offset, comparison, array, 3D image or level of detail) and drops the correction that reproduced Metal's position at texel edges. Deleted: `AxisSnap`, `SnapKind`, `Snap` and the snap plan (`snapped_axis`, `gathered_by_word`, `celled_by_word` and their word estimates), the texel centring of nearest pixel samples (`centred`, `centre_word`, `pixel_centre`, `PIXEL_CENTRE_WORDS`), the snapped census names, the shared switch's sampled-image arms (it is bicubic only now), `SamplerWord::PIXEL_GATED` and `PIXEL_NEAREST`, the binder's gated keying and `lower::select::pixel_gated`. A runtime slot now specializes on its word's coordinates bit alone. Kept: the division by the size, `SampleOp::PixelFetch` (a constexpr nearest clamp-to-edge sampler's exact fetch) and the argument buffer's flagged exact fetch, and Metal's position, wrap and offset rules the emulated filters still use. `PixelSamplerScaling` is now recorded on every device, MoltenVK included: always for a constexpr pixel sampler but its exact fetch, and for a runtime slot under the clause that the bound word states pixel coordinates. `ArgumentPixelSamplerScaling` is recorded for every heap access and announced at a dispatch while any pixel state lives (not only a filtering one). The notes, the API.md catalogue and a new FAST-PATHS device-gap row state the measured bound: the device's normalized sampler at a coordinate within one f32 ulp of x/N on MoltenVK and at x/N on lavapipe; a linear downscale by 8 within 1/255 of Metal's on MoltenVK, 2/255 on lavapipe. Lanes: pixel_samplers holds each pixel configuration to its normalized control within REACH ulps of the quotient and asserts both notes on every device; pixel_downscales holds every set within 2/255 of the snapped control; mirror_clamp counts a pixel lane that reads Metal's normalized answer within REACH ulps apart; resource_ids expects the argument note where a pixel state lives at the dispatch; the argument-note test waits for any pixel state. The pixel conformance cases declare `pixel-sampler-scaling`; known-gaps rows for their llvmpipe sites are replaced (38 stale, 40 new, at the end) and 22 Apple M3 Max rows appended, each naming the note. Subnormal coordinates (e7775e4c82 removed the flush): `a_subnormal_coordinate_reaches_the_device_unflushed` traces every sample and gather coordinate of constexpr border samplers (1D, 2D, 3D, gather; nearest and linear; zero and white borders) back to the loaded value through bit moves alone, on every committed profile, and holds a kernel whose AIR flushes the coordinate as not passing through. SEMANTICS_VERSION 1960; RUNTIME_VERSION 1676 (the argument note's announcement and the binder's sampler key changed). Verified: - cargo clippy --workspace --all-targets --all-features -D warnings, plain and --cfg m2v_gpu; RUSTDOCFLAGS=-D warnings cargo doc --workspace --all-features --no-deps. - Core suites (4953 tests): all pass but golden_hashes (3776 cells move, left for the re-bless); api_signatures fixed here. - Negative controls: on development's code, 7 of the new or changed sampler tests fail; with the removed flush put back in plane_coord, the subnormal test fails (border 1d zero). - Words (lavapipe; MoltenVK and NVIDIA alike in step): px_sample_argument 2869 -> 2641, xr_sample_runtime 1175 -> 967, px_const_linear_* 1078 -> 943, pix_gather_edge 1089 -> 920, runtime_gather 1165 -> 944; constexpr nearest-edge and the normalized control unchanged; spirv-val PASS on each. - Lanes on lavapipe (linux-gate arm64) and MoltenVK (M3 Max): pixel_samplers, pixel_downscales, resource_ids, mirror_clamp pass; on MoltenVK argument_linear_samples' half RGBA32Float heap groups, driver_deviations and one degrade_notices test fail, none through a pixel path. - conformance replay --cpu (whole set, lavapipe): exit 0, nothing unlisted, no stale row. The pixel cases on MoltenVK: every value site as listed; each case's set-past-layout-support notice is unlisted there, as in the untouched argument-encoder-texture-sampler. * Re-pin the runtime sources at the landing tip 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. |
||
|
|
8fb8b51f4e |
Hold the kept compressed-blit encodings to the ledger on the M3 Max
One work packet, landed as 2 commits (4a74bd7248..aa6286b711 on archive/development-linear-2026-10-28), in order: * Hold the kept compressed-blit encodings to the ledger on the M3 Max Since 62c7d7a9f5 a blit through a texture Metal keeps losslessly compressed is the device's copy, which keeps the bytes Metal's compression rewrites into its canonical encoding. dbd18ad126 held the lavapipe replay to that; the MoltenVK replay on this M3 Max read 24 value sites the ledger did not list. Each is now a known-gaps.tsv row (venue Apple M3 Max) naming the note that records it: - compressed-blits-bgra10xr and -srgb, all seven sites: the runtime holds the format in an R16G16B16A16_UINT image, whose blits under MoltenVK keep the bytes. extended-range-bits-kept. - compressed-blits-rg11b10f and -rgb9e5f, the five sites through the Shared texture (blit-in-cpu-out, cpu-in-blit-out, out-of-compressed, into-compressed, over-a-buffer): MoltenVK makes that texture's image of PixelFormatView usage, which Metal keeps uncompressed, so its copies keep the bytes. device-nan-encoding and shared-exponent-kept. The Private compressed sites (tall, level-3-padded) are MoltenVK's own blit through Metal's compression and match Metal there. This is the same value in another encoding, not wrong data. The bytes the case feeds, set against Metal's recorded words site by site, give exactly the replay's counts and largest differences at all 24 sites (for example tall 8191 words, largest 1610547199: Metal's alpha code clamped up to 384 from below). Every texel of those bytes decodes to Metal's value: the top ten bits of each field with alpha read clamped for BGRA10_XR, NaN for NaN for RG11B10Float, the exact value for RGB9E5Float. Nothing is open: rule 1 rules out a pass that writes Metal's encoding. docs/CONFORMANCE-COVERAGE.md regenerated (the ledger's row count). Verified on the Apple M3 Max, MoltenVK 1.4.2: - conformance replay of the four cases at 46bd06ec2f (the parent of 62c7d7a9f5): all four announced, every value exact. - the same replay at 19b0dafb5a: 24 unlisted divergent sites, exit 1; with these rows: exit 0, the 24 rows exactly the ledger's. - runtime_lane::compressed_blits under --cfg m2v_gpu: passed; every kept site held byte for byte, ExtendedRangeBitsKept, DeviceNanEncoding and SharedExponentKept each announced, MoltenVK's own copy of the Private compressed images rewrote 374 (RG11B10Float) and 507 (RGB9E5Float) words. - cargo nextest -p metal2vulkan-conformance known_gaps, compressed_blits and coverage tests (19 passed); clippy -D warnings; coverage.py --check. * Say in the notice catalogue that a compressed RG11B10Float blit announces device-nan-encoding The catalogue's device-nan-encoding entry named only float arithmetic's NaN results, while PrecisionNote::DeviceNanEncoding's doc and the runtime also announce it for a GPU blit through an RG11B10Float texture Metal keeps losslessly compressed, as the extended-range-bits-kept and shared-exponent-kept entries already say for their formats. Docs only. |
||
|
|
e656074087 |
Name no native note in any conformance case, at the notices site or at a value
One work packet, landed as 5 commits (647aeae138..19b0dafb5a on archive/development-linear-2026-10-28), in order:
* Name no native note in any conformance case, at the notices site or at a value
The suite declares every note of the device's native answers for every case
(replay::NATIVE_NOTES), so a case's own declaration of one stated the suite's rule a
second time, and a value tolerance justified by one was the suite deriving a tolerance
the note's own documentation says validation derives from none.
What changed:
- 237 notices-site declarations of native notes, over 180 cases from 28 case modules
(depth-denormals 76, device-color-conversion 33, float-sample-filter 31,
device-nan-encoding 27, srgb-texel-decode 25, signed-depth-test 17,
device-arithmetic 10, device-sampling 8, device-texel-conversion 8, one each of
device-transcendentals and unorm-depth-rounding), are gone. The shapes that existed only
to choose them go too: fresh_contents' per-row notices, half_write_nans' `packed`,
render_chains' and compute_render_chains' `divides_a_float`, alpha_coverage_pairs'
separate on/off and single-sample sets, and sampler_filtering's name-keyed branch.
- Four value tolerances justified by native notes are removed: border_swizzles'
one-word `Absolute` and compressed_decode's and etc_textures' one-ulp `Ulps`
(device-texel-conversion, whose note says validation derives no tolerance from it), and
pass_bytes' `Unchecked` tanh column (device-transcendentals, device-arithmetic). Those
sites compare exactly; where a venue's device answers otherwise the site is a
known-gaps.tsv row, which the ledger commits that follow carry. border_swizzles'
word-range test, which existed only to make its tolerance mean one ulp, goes with it.
- tests::no_case_names_a_native_note holds it: it failed listing 765 allowances before
this change and passes after.
- docs/CONFORMANCE-COVERAGE.md regenerated (tolerances 12 to 8, `Ulps` no longer used).
Verified: cargo nextest run -p metal2vulkan-conformance --all-features, 1007 passed;
clippy -p metal2vulkan-conformance --all-targets --all-features -D warnings clean.
* Count no native note in the cost and times halves' degraded-set rule
The rule is there because a notice can say the device lacked the exact form and the
runtime did something cheaper, so a count or a time taken with it is of a different amount
of work. A native note (replay::NATIVE_NOTES) never says that: the native form is the only
one the runtime builds, under either policy. Counting them made a cost record incomparable
with the same work whenever a run did or did not provoke one (the MoltenVK replay before
this change read 45 cases `unmeasured` for native notes alone: device-color-conversion,
device-filtered-mipmaps, device-nan-encoding, native-nan-encoding, native-half-conversion,
fast-math-rewrites), and withheld a times verdict from every case that computes, converts
or samples.
replay::degrading filters them out, sorted and once each. run.rs takes it for the replay's
cost row, the cost measurement and the times round; cost::judge and times::classify apply
it to the stored side as well, since records and figures taken before still hold native
codes (fast-math-rewrites in 56, device-nan-encoding in 33 of the committed ones), so no
re-bless is needed for the rule itself.
Tests: tests::the_degraded_set_rule_counts_no_native_note (a record holding a native note
judges `within` against a run that announced none, and the other way, while a non-native
difference stays `unmeasured`) and times::tests::a_leg_that_announced_only_native_notes_is_judged.
README's two statements of the rule say so.
Verified: cargo nextest run -p metal2vulkan-conformance --all-features, 1007 passed;
clippy -p metal2vulkan-conformance --all-targets --all-features -D warnings clean.
* State the measured bounds of the device's texel and colour conversions
device-texel-conversion's recorded bound named 8- and 16-bit codes and said a
4-bit channel's widening is exact, so two lavapipe ledger families had no
stated bound: a 10-bit BGR10A2Unorm code read one f32 ulp low, and ABGR4Unorm
codes read one ulp high (the device converts by the reciprocal product, where
it does not replicate bits). The bound now covers 8-, 10- and 16-bit codes and
a 4-, 5- or 6-bit channel converted by the reciprocal, within one f32 ulp.
device-color-conversion stated only that near a tie the device may store the
other code. On lavapipe it stores past one code in three shapes, which the
note now states: a blend into an 8-bit unorm attachment within 2 codes, a
fetched-and-rewritten 8-bit sRGB attachment within 2 codes once a later draw
reads an earlier one's code, and a blend into an 8-bit sRGB attachment within
4 codes. Another device is not bounded past one code; the NVIDIA RTX 5080
Laptop GPU ledger rows record up to 11 codes at an sRGB blend.
The same text goes into the translator's PrecisionNote docs, the runtime's
Degradation docs (DeviceColorConversion gains one) and docs/API.md's
catalogue. Docs only; no behaviour changes.
Verified: the lavapipe replay (scripts/linux-gate, arm64, LLVM 21.1.8) shows
every row of those families within the stated figures (the ledger's answers);
rustdoc -D warnings for metal2vulkan and the runtime; the runtime's
degradation and catalogue tests.
* Reword the ledger rows that proposed emulating Metal's bits, and list lavapipe's exact rows
Under the native-arithmetic contract, the device's blend, conversion and
sampler are the answer. Some known-gaps.tsv rows still proposed reproducing
Metal's bits: folding the blend into the fragment function, encoding through
Metal's table, or emulating an argument buffer's sampler. Those rows now name
the note that covers the difference and its stated bound, or the open work
where there is some. Only field 6 changes, and no row moves.
- Apple M3 Max half-output-blends (18 rows) and NVIDIA half-output-blends
(39): half-output-fast-math-blend and its stated bound, with no fold. The
sign-bit sentence is kept only where an NVIDIA bound is the sign bit.
- NVIDIA a2one (2) and argb8-targets (23): device-color-conversion. The
llvmpipe argb8 rows at 2 codes (9) now cite the bound the note states.
- blend-interaction-format-srgb8 (14, both venues): device-color-conversion.
lavapipe's sites are within its 4 codes. NVIDIA's 11- and 5-code sites are
past it and need an element-by-element read.
- fetch-ordered sRGB (8), ABGR4Unorm swizzles (26) and the BGR10A2Unorm
round trip (1) cite the bounds the notes now state.
- RADV sample-fills (3): depth-denormals is a native note the suite declares
for every case, not one the case declares.
- NVIDIA pixel-samplers nearest norm (6): device-sampling's nearest-boundary
bound. Open: an element-by-element read.
- a2c-on-1-alpha-50 (2): no note covers the device's coverage mapping. Open:
the owner's call between recording it and computing Metal's floor rule.
- format-footprints-plain-stragglers: the raw sRGB path and
`texel_format::srgb_raw` are gone. The row names the UNORM twin path that
is there today (`srgb_raw_twin`, `srgb_twin_on`, `RuntimeFact::SrgbTexture`)
and drops the todo-list wording.
Removing the old one-ulp and as-words tolerances showed lavapipe's own
conversion at exact sites. That adds 64 rows beside their families
(border-swizzles rgba8/bgra8 30 each, ETC2/EAC 8-bit 3, pass-bytes
fast-float-tanh 1) and updates 35 BC rows' answers, their counts now
including the one-ulp elements.
Verified: the lavapipe replay through scripts/linux-gate (arm64, 4 CPUs)
went from 99 unlisted and 35 stale before these rows to 0 unlisted and 0
stale ("the 882 row(s) above are exactly the open gaps known-gaps.tsv
expects"; 818 before the tolerance removal). The conformance host suite
passes (1007 tests), and docs/CONFORMANCE-COVERAGE.md is regenerated.
* Re-pin the runtime sources at the landing tip
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.
|
||
|
|
9afdb1e150 |
Take the device's instruction for pack, dot, mix, sqrt, exp, log, sign, fract, median3, fneg and fabs
One work packet, landed as 6 commits (3d6b2488ea..f1693ce8c4 on archive/development-linear-2026-10-28), in order: * Take the device's instruction for pack, dot, mix, sqrt, exp, log, sign, fract, median3, fneg and fabs Rule 1: where the device has a native form it is the only form. The translator still computed Metal's own bits for several functions the device has an instruction for. Each now takes the instruction, its difference from Metal recorded as a note: - air.pack/air.unpack: GLSL.std.450 Pack/Unpack Unorm4x8, Snorm4x8, Unorm2x16 and Snorm2x16; rgb10a2 and rgb565 by the device's NClamp, multiply, RoundEven, and multiply by the reciprocal; unorm4x8_srgb by the MSL transfer functions with the device's Pow around the 8-bit instruction (no table read, no NaN select). New note DevicePackConversion (device-pack-conversion), not recorded for a float conversion of the four named formats on MoltenVK. - dot, mix, fast::sqrt: OpDot, FMix and Sqrt on every device, MoltenVK included (the Mix/Dot/ChunkedChain strategies, Metal's fma chains and x * rsqrt(x) are deleted). NativeDot/NativeMix everywhere but a float one on MoltenVK; a chunked dot sums each chunk's OpDot. - precise exp/log and half exp/log/pow/powr/sinh/cosh/tanh: GLSL Exp, Log, Pow, Sinh, Cosh, Tanh (Metal's compositions, half_tanh and the half remaps deleted); half Fun kinds keep the notes honest on MoltenVK. - fract, sign, median3: Fract (bounded below one, the definition), FSign, NMin/NMax; their special-value fixes are deleted. median3 is NativeMinMax on every device (two NaNs, f32 denormals). - round keeps half-away-from-zero from Trunc without the +0 fix: C99's -0, NativeTranscendentals on every device. - float fneg/fabs: OpFNegate and FAbs, the NaN payload NativeNanEncoding and fneg's denormal DeviceDenormals. Kept: exp10/log10 compositions, fmod's routine, ldexp on bits, sinpi/cospi/tanpi, the fast_ formulas, pow/atan2 C99 specials, the saturating convert, round_integer. math::pack/unpack stay for the tile, attachment, fetch and texture callers. The interpreter models the normalized packs. SEMANTICS_VERSION 1920, ARTIFACT_FORMAT_VERSION 469 (a PrecisionNote variant). Verified so far: clippy -p metal2vulkan --all-targets --all-features -D warnings; rustdoc; nextest lower::arith (244 tests) and the engine_arith, engine_float_call_notes, engine_native_maths, engine_spirv_cross_forms, engine_native_half modules. * Delete the measured half quantize deviation; hold dot and median3 lanes to the device After the half follow-ups, no module requires VkProperty::MetalHalfQuantize: a module that rounds to half through OpQuantizeToF16 records NativeHalfQuantize on every profile, and nothing decides on DriverDeviation::MetalHalfQuantize. Delete it with its property, its derive and profile arms, its codec entry, its four measured rows (MoltenVK on Apple9, RADV on the 780M, ANV on the UHD 770 and the Iris Xe), the driver-facts test rows, and the lane assertions that it required nothing (engine_native_half, engine_arith, driver_deviations' half quantize and owned half edge lanes, native_maths' half rounding lane). Docs that named it (NativeHalfQuantize, narrow::quantizes, driver_facts) now say Vulkan leaves the quantize's rounding to the device. The lanes follow the previous commit's native forms: - driver_deviations' dot lane: dot is the device's OpDot on every device, so the half words (a dot of half lanes held as float) are no longer checked against Metal's fused 16-bit chain; the float words stay checked where the profile takes MetalFloatFunctions (MoltenVK, whose OpDot is MSL's own dot), and every kernel must record NativeDot. - driver_deviations' min/max lane: median3 is NMin/NMax on every device and records NativeMinMax, so its word (the seventh of each lane) is printed, not checked; every kernel must record NativeMinMax. - the denormal probe and native_maths docs name the device's OpDot and FMix. api_signatures re-blessed (DevicePackConversion added on both crates; the two MetalHalfQuantize variants removed). REFUSALS.md regenerated, unchanged. Verified: see the branch report. * Hold the sRGB pack bound and round's zero to what the devices answer The conformance replay on lavapipe and the MoltenVK lanes read the previous two commits' native forms against Metal: - sRGB unpack and pack: Metal decodes through its twelve-bit table (the step k / 4095 nearest the transfer) and encodes by that table's byte, where the module takes the MSL transfer by the device's Pow. DevicePackConversion's bound (artifact, runtime, API.md, FAST-PATHS.md) now says so: a decoded colour within half a twelve-bit step (1/8190) of Metal's step, beyond Pow's bound. Measured on the authored cases (lavapipe and MoltenVK): every float decode within 1.2205e-4 of Metal's, every half within that and one half ulp, every encoded channel within one code, no alpha differing; normalized packs a code apart at ties, a NaN channel the device's. - known-gaps.tsv: pass-bytes-srgb-decode-all-bytes's row takes the new answer (1153 elements, largest 0x00F90000) and names device-pack-conversion; a new row for pass-bytes-srgb-encode-sweep (772 elements, largest 0x00010101); pass-bytes-half-tanh-regimes's answer moves to 1257 elements (half tanh is the device's Tanh). CONFORMANCE-COVERAGE.md regenerated. - driver_deviations' denormal probe: round is C99's on every device (NativeTranscendentals), whose zero below zero is -0 where Metal answers +0, so its word (15) is printed, not checked. On MoltenVK it was the lane's only failing word (48 of 4096). Verified: conformance replay on lavapipe (arm64 gate container) exit 0, nothing unlisted or stale; driver_deviations' float_denormals, owned_dot and minimums lanes pass on lavapipe and on MoltenVK (M3 Max); conformance and degradation tests pass. * Hold the engine maths tests to the device's instructions engine_metal_math and engine_native_maths still asserted Metal's forms that the native change replaced; they skip without llvm-as, so the earlier focused runs missed them. - engine_metal_math: a half fast_tanh is Metal's half tanh (Metal's half functions are the same in both math modes, and MSL's fast-math formulas are its float ones), so it is the device's Tanh, no Exp2 and no division, as the code already lowers it; the float fast_tanh keeps the MSL formula and its assertions. sign is the device's FSign with and without fast math. Both record NativeTranscendentals wherever the device's functions are not Metal's own; on MoltenVK sign is MSL's own (no note) and a half tanh is MSL's float tanh rounded to half (DeviceTranscendentals). The sRGB fixtures now assert Pow beside UnpackUnorm4x8 / PackUnorm4x8, no table, and DevicePackConversion; the interpreter models no Pow, so the table reference values and the interpreter run go (their values are the device lanes'). The test is renamed metal_math_variants_select_their_forms. - engine_native_maths: dot, mix and fast::sqrt are OpDot, FMix and Sqrt with no Fma on lavapipe and on MoltenVK, a float dot and mix noting nothing on MoltenVK and a half mix NativeMix; the values hold their notes' bounds on both profiles' interpreter runs, where the test used to claim Metal's fused chains word for word on MoltenVK. - refine_float's doc: air.fast_sqrt is the device's Sqrt; engine_tiny_products' doc: the module's dot is the device's OpDot. Verified: with llvm-as set, every engine_ and lower::arith test passes (1610); clippy clean. * Number ARTIFACT_FORMAT_VERSION 473 and SEMANTICS_VERSION 1904, past development's The fast-math landing took ARTIFACT_FORMAT_VERSION 470 and the sampler-details landing 472 and SEMANTICS_VERSION 1903, so this series' encoding (the new DevicePackConversion note and the removed MetalHalfQuantize property in the codec) takes 473, and its translation changes 1904 (set in the series' first commit at the rebase onto 322dc6354d). * Re-pin the runtime sources at the landing tip 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. |
||
|
|
ae70850097 |
Take the device's native texel rounding, residency, level clamp and stores
One work packet, landed as 7 commits (d1161d6b38..322dc6354d on archive/development-linear-2026-10-28), in order: * Take the device's native texel rounding, residency, level clamp and stores Rule 1: where the device has a native form it is the only form, noted where it can differ. - Half texels on MoltenVK: a `half` read, sample or gather is the device's `float` texel (Metal's there) rounded to nearest even. The routine keeps only the YCbCr 8192 grid's ties away (the YCbCr work's), so the Metal-sampler families (32-bit float sample toward zero, the 16-bit normalized grids' exact half, the unmeasured class) go, with `HalfFamilies`, `HalfForm`, the grid constants and `texel_round::ones_ratio_*`. `HalfTexelConversion` is recorded under the bound format for a 32-bit float sample, a 16-bit normalized texel and an unmeasured format. - Subnormal coordinates: the clamp-to-zero flush is gone; the device reads the coordinate (`DeviceSampling`). - Residency: on a device with `shaderResourceResidency` a sample's or gather's word is the device's sparse residency (`SparseResidency`); Metal's footprint rule and the tile map stay only where the device has no residency of its own. `Probe`, the named footprint taps and the zeroing of them go. - Level clamps: a sampler's `lodMinClamp`/`lodMaxClamp` reach the device as given, not snapped to Metal's 1/64 grid; MoltenVK's Metal sampler snaps itself. Level queries are noted `DeviceSampling` off MoltenVK. - Stores: an integer texel written into a half-float or `RG11B10Float` storage texture of the float class is the store's to convert (noted `DeviceColorConversion`), and a `float` blend into a 16-bit float attachment through the pixel interlock is the store's to round (Metal's where the profile takes `MetalHalfStorageWrites`, else noted). Only `TextureWriteRoundingMode::NearestEven` keeps the shader's rounding (no store gives it). - color_writes.rs docs: drivers round small floats toward zero as measured. Docs: FAST-PATHS rows 60/61 and the subnormal gap removed; API.md catalogue entries; `PrecisionNote` and `DriverDeviation` docs. SEMANTICS_VERSION 1950, RUNTIME_VERSION 1750 (the runtime's sampler cache docs and test). Verified: cargo clippy --workspace --all-targets --all-features -D warnings clean; the metal2vulkan suite (3370 tests) with every failure fixed or updated to the native answer (half_texel, texture_interp's 16-bit grid, srgb_decode, the sparse binder tests, cross-class writes on the interpreter, fetch_blend16_narrow); golden_hashes moves and is left for development's re-bless; api-signatures and refusal-surface checks unchanged. * Take Vulkan's cube-gradient rule on a driver whose route is not measured A MoltenVK release or GPU whose cube-gradient route no measurement covers took Metal's anisotropic level and taps in the shader (`CubeGradientRoute::Unmeasured`), and elsewhere an isotropic sampler made for the use. Rule 1: the device has a native gradient sample, so it is the only form. Such a driver now takes `CubeGradientRoute::Vulkan` (the form Vulkan's derivative rule reads), the device's reading recorded as `CubeGradientFootprint`; the emulation stays only for a device without `samplerAnisotropy`. With the variant gone nothing sets the isotropic-sampler use, so it is deleted throughout: `SamplerUse::cube_gradient` and `with_cube_gradient`, `CombinedSampler::cube_gradient` and its index bit, `HandleClass::Sampler`'s `cube_gradient` (four heap sampler classes, not eight), the binding keys, the plan's `WriteSource::Sampler`/`ArgumentSampler` and `SamplerSource::Slot` fields, the codec, the runtime's and the validation executor's binders. The anisotropic emulation loses its isotropic one-tap form and the `answered` input. Consumer-visible: `SamplerUse`, `CombinedSampler`, `HandleClass::Sampler`, `WriteSource` and `SamplerSource` lose the field; `CubeGradientRoute::Unmeasured` is gone (api_signatures blessed). ARTIFACT_FORMAT_VERSION 470 (the encoded classes and symbols changed). Docs: profile.rs and error/mod.rs route docs, the AnisotropicFilter and CubeGradientFootprint notes, API.md's catalogue, FAST-PATHS's unmeasured-route gap removed. Verified: workspace clippy (all targets, all features) clean; nextest of the touched families (engine_sampler_unk, engine_heap_binder, engine_handles, anisotropic, driver_facts, cache, bind heap/plan, sym, metal::sampler, link, runtime sampler_cache, validation argument_buffer_members, api_signatures/api_surface/fast_paths): 429 run, all pass after updating the tests to the Vulkan route. * Ledger lavapipe's halfway nearest-mip level under a descriptor clamp With the level clamp handed to the device as given, lavapipe rounds a nearest mip filter's level at `lodMinClamp` 1.5 up to level 2 where Metal reads level 1; Vulkan allows either rounding at a half. The five `sampler-mip-*` sites are the device's native level selection: `DeviceSampling`'s docs (and API.md's entry) now state the shape, and known-gaps.tsv holds the five llvmpipe rows. Verified: `conformance replay --cpu` on lavapipe (linux-gate, arm64) listed exactly these five sites as unlisted and nothing stale; the conformance ledger tests pass. * Ledger the two filter-pair sites at their measured difference The two mixed-filter sites of sampler-mip-filter-pairs-nearest differ by 1000, as the other three do; the rows copied a truncated figure. Verified by conformance replay --cpu on lavapipe, whose rerun named these two rows both unlisted and stale. * Number ARTIFACT_FORMAT_VERSION 472 past the fast-math change's 470 Both the fast-math change and this series moved the artifact format to 470, so the rebase merged them silently; 471 is held for the maths-functions series. * Drop the YCbCr sample module's cube_gradient field, gone from CombinedSampler This series removed CombinedSampler::cube_gradient with the isotropic sampler use; the YCbCr sample module landed meanwhile still set it. Verified: clippy --workspace --all-targets --all-features -D warnings clean. * Re-pin the runtime sources at the landing tip 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. |
||
|
|
cdc09276f3 |
Emit fast-math arithmetic in the AIR's order and let the device group and fuse it
One work packet, landed as 4 commits (c81ea84c14..41bbe0f1c2 on archive/development-linear-2026-10-28), in order: * Emit fast-math arithmetic in the AIR's order and let the device group and fuse it What. The translator no longer reproduces Metal's compiler's grouping, pairing and fusion of fast-math arithmetic. Each float operation is emitted in the AIR's order, decorated by its own fast-math flags: an operation whose flags hold `contract` and `reassoc` is undecorated, so the device's compiler may group and fuse it; every other one is `NoContraction` (an undecorated SPIR-V operation would also allow reassociation, which a `contract`-only operation does not), and a precise module's operations keep their order. `llvm.fmuladd` keeps its fused route: one AIR operation, answered by the device's fused instruction. Deleted: lower/arith/regroup.rs (648 lines), reassoc.rs (1469), contract.rs (585) and contract/chain.rs (1204); the Folded and Fused strategies, ArithPlan's `contract` and `unrounded` fields and select.rs's CONTRACTED read bit; output_precision's `plan` (the `unrounded` marking of half output chains, Metal's choice of where not to round) and the plumbing that existed only for it: LoweringInputs::half_output_lanes, the public HalfOutputLane, StageIo::half_output_lanes, color_writes' half_output_lanes check, its cache-key hashing and codec entry; Fma::on (tests only). Tests engine_reassoc (318), engine_regroup (134), engine_settled_sums (572), three engine_arith tests, three half-output-lane engine_stage_io tests and the fused_sync lockstep case, whose premises were Metal's grouping. Fixtures regroup_chain, sum_regroup, sum_regroup_precise, fmx2_contract_fast, fmx2_contract_precise and unm_contract_chain (.metal, .ll, .air.ll, their TOOLCHAIN lines and air_input printouts). Validation lanes sum_regroup (308) and settled_sums (394), and the three authored cases whose expected values were Metal's fusions (multiply-add-contraction-shapes-under-fast-math, multiply-add-contraction-flags-without-fast-math, multiply-add-chains-under-fast-math) with their observations. Kept: the contraction rule itself (AIR semantics); output_precision's notes (half_output_note, note_half_output, note_extended_range_sources), which state where Metal may differ rather than reproduce it; the F16 strategy's per-operation rounding. The note. The existing FastMathRewrites covers it: it is now recorded where an operation's operand comes from an operation the two operations' flags let a compiler regroup (both `reassoc`) or fuse (a product into a sum, both `contract`), looking through negation, widening, shuffles and element moves. No new kind. It moves from the ledger's elsewhere class to a device gap (docs/FAST-PATHS.md row; tests::fast_paths), joins the conformance replay's NATIVE_NOTES, and the cases' own declarations of it are gone (depth_texel_reads, half_read_nans, host_page_writes, mesh_draws, sample_positions, snorm_tile_store, visibility, topology_classes). New tests. tests::engine_fast_math_order: a fast `((d+c)+b)+a`, its precise twin, fast and contract-only `a*a+c`, and a fast vector product, on every committed profile: spirv-val, no fused instruction, one instruction per AIR operation, NoContraction exactly where the flags forbid contraction, the interpreter's answer in the AIR's order, and the note on every form but the precise sum. runtime_lane::kept_apart (reworks settled_sums): strict and contract-only mul-adds store two roundings, a precise sum stores the AIR's order, a fast mul-add stores either rounding, and the layer reports nothing. Versions: SEMANTICS_VERSION 1900; ARTIFACT_FORMAT_VERSION 469 (StageIo lost a field). Docs: FAST-PATHS.md, API.md (catalogue entry and policy), ARCHITECTURE.md (module map), artifact.rs's FastMathRewrites doc. api_signatures.tsv re-blessed. Verified (this machine unless named): - Negative control: on the parent tree both new core tests fail (a fast sum regrouped to 0x34000000 where the AIR order stores 0, the mul-adds fused, the product paired, no note); with the change they pass. - cargo check, clippy --workspace --all-targets --all-features -D warnings, plain and with --cfg m2v_gpu; rustdoc -D warnings; refusal_surface --check; conformance and metal coverage current. - Core tests: engine_fast_math_order, engine_arith, arith::tests, engine_stage_io, engine_simd*, engine_native_*, engine_metal_math, engine_fetch_*blend, engine_bicubic, engine_rotated_weights, engine_extended_range, engine_float_call_notes, color_write, api_tests, compile tests, fast_paths: 469 + 83 passed. - The engine inventory bless (not committed) compiled every public fixture on all 19 profiles: 43593 ok cells, each through spirv-val; only the deleted fixtures' 28 rows went. - Conformance replay on lavapipe (linux-gate arm64): exit 0, the 723 rows are exactly known-gaps.tsv's, 0 unlisted. - Validation lanes on lavapipe (linux-gate arm64, --cfg m2v_cpu_icd): kept_apart and the lanes that assert notice sets (blits, degrade_notices, gpu_times, half_slice_nans, heap_metal_sizes, heap_textures, provoking, provoking_mesh, sparse_textures, ycbcr_passes): 93 passed. llvmpipe kept all 4096 fast mul-adds as written and all 4096 fast sums in the AIR's order. - kept_apart on MoltenVK (Apple M3 Max, --cfg m2v_gpu, under maclock): passed; the device's compiler fused 2370 of 4096 fast mul-adds and kept all 4096 fast sums in the AIR's order. - Release CLI before and after, back to back, on the deleted and most affected fixtures over moltenvk-m3, gate-lavapipe, nvidia-rtx5080-laptop and intel-irisxe-anv: wall within noise (about 8 ms of process start, +-3 ms on a loaded host). Words: hfb_filter_bank 148284 -> 162420 on moltenvk-m3 (half chains feeding a half output now round at each operation as the AIR says: +1408 OpFConvert, +1408 NoContraction; 289 OpFmaKHR became a multiply and an add), unm_contract_chain 33666 -> 35167, fmx2_contract_fast 18557 -> 18908, the rest within +-200. Not in this commit: the golden tables (6028 cells move in 347 subjects, 5707 of them under an unchanged key, 28 subjects go with the fixtures) and the engine inventory (28 rows go, none moves) are re-blessed on development; corpus/authored-compile.tsv keeps three lines for the deleted cases until its re-bless. * Read 16-bit operands directly and hold half chains at float without float16 What. Two forms of `half` arithmetic that were neither the device's native one nor the fast one: - Where a profile takes the device's 16-bit `+ - *` and `fma` (moltenvk-m3 on the measured fact, RADV and ANV under the 16-bit float controls), every `half` is held widened in an `f32`, so each 16-bit operation narrowed both operands and widened its result: three conversions an operation, the next operation narrowing what the last had just widened. `FunctionBuilder::convert` now answers a narrowing of a value it widened from a 16-bit float with that float (exact), and a narrowing of a plain constant whose lanes are zeros, infinities or normal halves with the 16-bit constant; the widenings nothing else reads leave with the dead code. A rounding's own pair (a narrowing widened back) is never taken apart, so `narrow::rounds_by_conversion`, which decides `NativeHalfConversion` and the controlled modes, still sees every rounding. A chain of 16-bit operations is now 16-bit instructions on 16-bit values, converted only where a value enters or leaves it. - Without `shaderFloat16` (vk12-floor, SwiftShader, Pascal) the module emulates `half` arithmetic in `float`, rounding each result by the device's quantize. New `DevicePolicy::half_chains`: `HalfChainPolicy::AtExits` (the default, the fast form) holds a `half` `+ - *` whose flags hold `contract` and `reassoc` and whose result only such operations read at `float` precision (`lower::arith::half_chain`), so a chain rounds where a value leaves it, one quantize per exit; `HalfChainPolicy::EachOperation`, which `exact_answers()` selects, rounds every operation. The profile carries it, so its fingerprint covers it. Recorded as `FastMathRewrites` (its doc and API.md's catalogue entry extended); a FAST-PATHS.md fast-default row; API.md's policy list. The forms by profile (unchanged, for the record): moltenvk-m3 takes the measured 16-bit arithmetic; RADV and ANV the controlled one; NVIDIA (the conversion pair folded, `HalfConversionPairFolded`) and lavapipe (no `DenormPreserve` for 16 bits) have `shaderFloat16` but compute `half` in `float` and round by the device's conversion pair, which this commit leaves as it is; the profiles without `shaderFloat16` quantize. Tests: tests::engine_fast_math_order::half_operations_read_their_16_bit_operands_directly (no narrowing of a widened half or a constant on any profile, the rounded chain stored, some profile takes 16-bit arithmetic) and ::half_chains_without_float16_round_at_their_exits_by_default (one quantize against two, the held and rounded answers, both policies on every profile, distinct fingerprints); runtime_lane::kept_apart::half_chains_without_float16_round_at_their_exits on the device. Updated, as the conversions they counted are gone (the half agent's files, minimal): lower::arith::tests::narrow::half_arithmetic_on_the_device_is_one_16_bit_instruction (at most two operand narrowings), tests::engine_arith::half_rounding_follows_the_operation (the chain's conversion count), tests::engine_arith::a_measured_half_sum_requires_the_arithmetic_fact_alone (a kernel whose halves only the 16-bit `fma` reads widens nothing, so needs no measured widening). Versions: SEMANTICS_VERSION 1901. ARTIFACT_FORMAT_VERSION unchanged (no encoded type changed). api_signatures.tsv re-blessed (the enum and the field). Words, release CLI, every module spirv-val'd (before = development 7b5cf8328d, then 622b388830, then this commit): - moltenvk-m3: hfb_filter_bank 148284, 162420, 140672; grd_half_many_samples 99039, 99330, 96710; nan_half_fast 10042, 10057, 9961. - nvidia-rtx5080-laptop: hfb 147962, 155474, 155474; grd 110944, 111163, 111163; nan 9888, 9882, 9882. - gate-lavapipe: hfb 148530, 155470, 155470; grd 111018, 111163, 111163; nan 9888, 9882, 9882. - vk12-floor: hfb 124826, 131766, 121270; grd 84482, 84627, 82019; nan 9838, 9832, 9808 (EachOperation reproduces 622b388830's: 131766, 84627, 9832). Verified: - Negative controls: with the narrowing fold off, the 16-bit test fails (amd-780m-hawkpoint-radv narrows a widened half); with the plan off, the chain test fails (two quantizes on lunarg-desktop-baseline-2023). Both pass with them on. - Core tests on this Mac: 1133 passed (arith, engine_arith, engine_native*, engine_stage_io, engine_fetch*, engine_simd*, spirv::*, device::*, cache::*, compile tests, api_tests, air_input, fast_paths, engine_fast_math_order, api_signatures, api_surface); conformance filtered tests 26 passed; clippy --workspace --all-targets --all-features -D warnings, plain and with --cfg m2v_gpu; rustdoc -D warnings; refusal_surface --check. - The engine inventory bless (not committed) over every public fixture on all 19 profiles: only the deleted fixtures' 28 rows go, every other cell as before (spirv-val on each `ok`). - runtime_lane::kept_apart on SwiftShader (linux-gate arm64, --icd swiftshader): the `fast` chain 4096 of 4096 held under AtExits and 4096 rounded under EachOperation, the strict chain rounded under both; on lavapipe (whose compiler drops the undecorated conversion pairs: the `fast` chain 4096 held under both, the strict one rounded) and on MoltenVK (Apple M3 Max, under maclock: every chain rounded at each sum, the 16-bit arithmetic) both tests pass. - Lavapipe (linux-gate arm64): the conformance replay exits 0, its 763 rows exactly known-gaps.tsv's, 0 unlisted, the verdicts as at 622b388830; runtime_lane kept_apart, native_maths, half_* and degrade_notices: 28 passed. MoltenVK: the half_* lanes and native_maths' half rounding pass; native_maths_answers_within_its_recorded_bounds fails on NativeDivision (`divide::precise` records it everywhere; code this commit does not touch). Not in this commit: the golden tables (with 622b388830, 7652 cells move in 672 subjects; 28 subjects go) and the engine inventory (28 rows go) are re-blessed on development. * Number ARTIFACT_FORMAT_VERSION 470, after development's 469 What. development's own commit took 469 for its encoding change while this branch's first commit took 469 for StageIo losing half_output_lanes; the rebase merged the two equal lines silently, so two layouts shared one value. 470 keeps an artifact of either from decoding as the other. Verified: cargo check -p metal2vulkan --all-features --all-targets on the rebased tree. * Re-pin the runtime sources at the landing tip 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. |
||
|
|
12cd1535a8 |
Keep the device's copy for blits through a texture Metal compresses
One work packet, landed as 9 commits (62c7d7a9f5..378d636d2f on archive/development-linear-2026-10-28), in order:
* Keep the device's copy for blits through a texture Metal compresses
Metal's GPU blit into or out of a texture it keeps losslessly compressed
writes three families' texels in its compressor's canonical encoding:
BGRA10_XR (and its sRGB twin) with each field's low six bits cleared and
the alpha code clamped, RG11B10Float with a NaN made the quiet NaN, and
RGB9E5Float with the shared exponent lowered. The runtime reproduced that
with a crate-owned compute rewrite of the copied rows (bind::CompressedBlit
and its module) after every such blit.
That is Metal's compressor's encoding, not the format's: Metal's own
uncompressed texture of the format keeps the bytes through the same blit,
and every rewritten texel reads the same value either way. The device's
copy, which keeps the bytes, is now the only form. A blit through such a
texture announces the note of the encoding it keeps, once per device:
extended-range-bits-kept (BGRA10_XR), device-nan-encoding (RG11B10Float)
and shared-exponent-kept (RGB9E5Float), each existing kinds; no new kind.
Where the device's own copy already writes Metal's encoding (MoltenVK,
RuntimeDriverDefect::CompressedImageCopiesRewriteTexels) nothing is
announced; the defect's PixelFormatView usage, which keeps CPU copies
byte-exact there, stays.
Removed public items: bind::CompressedBlit, bind::CompressedBlitModule,
bind::compressed_blit_module, WorkCounts::compressed_rows_rewritten.
RUNTIME_VERSION 1740. The conformance recordings' runtime cost records
that count compressed_rows_rewritten (compressed-blits-*, fresh-pattern-*,
xr-clear-routes-*, xr-draw-*) move at the next re-bless.
The compressed-blits lane now asserts the bytes are kept and each format's
note is announced; the conformance case declares the note where it is not
one of the suite's native notes.
Verified: cargo clippy --workspace --all-targets --all-features -D warnings;
RUSTFLAGS='--cfg m2v_gpu' cargo check of runtime and validation; nextest
of blit_plan, degradation, degradation_catalogue, conformance
compressed_blits, unused_bits, fast_paths, owned_divisions, api_surface,
api_signatures and refusal_surface (77 passed). Device lanes and replay
run after the whole series.
* Resolve a fetching pass's sample planes by the device's average
A color attachment whose sample planes held its samples as the pass ended
(framebuffer fetch in the pixel interlock on a device without multisampled
storage images: ANV, MoltenVK) was resolved from the planes by the
crate-owned resolve, which computes Metal's closed rules for every unorm,
snorm, sRGB, 32-bit float, half, packed 16-bit, RG11B10Float and
RGB9E5Float format. Every other color attachment resolves by the device's
AVERAGE. The average is the device's native answer, so it is now the only
form here too: the planes merge back and one more instance of no draws
resolves the attachment, announced device-rounded-resolve where the
driver's average is not measured to be Metal's (on MoltenVK it is,
DriverFact::ColorResolveAverageIsMetals, so nothing is announced there).
The crate-owned resolve keeps the two resolves no device's average writes:
into the attachment's format's sRGB twin (the 8-bit unorm and sRGB rules)
and of an extended-range attachment. Its rules for every other format, and
their tests, are deleted. ColorResolveFormat::of names the twin's eight
formats; sample planes are read only for an extended-range form, and a
module of a twin format from planes is refused.
Removed public items: ResolveRule::{HalfUnorm, Snorm, Float32, Float16,
SmallFloat, SharedExponent}, ResolveRule::bits, ResolveRule::resolves,
ColorResolveFormat::resolves; ResolveRule::Unorm loses its bits field.
Cost: such a pass now merges its planes back and resolves in one more
render pass instance, where it drew one resolve pass from the planes; a
memoryless attachment the pass only fetches and resolves needs a backing.
The ColorResolveAverageIsMetals docs, the shader-resolve and
device-rounded-resolve entries (degradation.rs, docs/API.md) now say what
resolves where. The fetch lanes expect no shader-resolve for a fetched
attachment.
Verified: cargo check --workspace --all-targets --all-features; the GPU
cfg check of runtime and validation; nextest of color_resolve,
sample_planes, degradation, driver_facts, fast_paths, api_surface,
api_signatures, refusal_surface (84 passed). Device lanes run after the
series.
* Clear a float attachment to the clear color as the device converts it
A render pass's Clear of a normalized, sRGB, packed 16-bit, half, float or
small-float color attachment computed Metal's texel on the CPU (its
rounding, its trip through half for the packed 16-bit formats, its
truncated small-float and shared-exponent mantissas) and handed the device
a value that converts back to it; a Depth16Unorm clear took a quarter step
above Metal's truncated code. The conversion is the device's native
answer, so the clear value is now the color (or depth) as a float, which
the device converts.
Where the device's conversion can stand a code from Metal's it is
announced, once per device: device-color-conversion where a normalized
channel's scaled value lies within 1/1024 of a midpoint between two codes
(a packed 16-bit channel's within Metal's half step too), an sRGB channel
lies inside (0, 1), or a half, small float or shared exponent does not
hold the value exactly; unorm-depth-rounding where a Depth16Unorm depth's
scaled value lies at or above a midpoint, which Metal truncates and a
device rounding to nearest takes up. Vulkan asks for rounding to nearest
and leaves ties, sRGB encodes and float rounding to the device. A NaN in a
normalized or RGB9E5Float channel still clears as 0 (Vulkan states no such
conversion); integer, extended-range, word and YCbCr attachments keep
Metal's conversion, which no device makes for them.
Metal's measured conversion moves into the tests as the model they compare
with. The renders lane accepts a device texel a code from Metal's where
the note is announced and prints it; the cleared sRGB resolve lane
compares the resolve with the device's own 1x clear.
UnormDepthRounding's docs and cost, PrecisionNote::DeviceColorConversion's
docs and both docs/API.md entries say so.
Verified: cargo clippy --workspace --all-targets --all-features -D
warnings; the GPU cfg check of validation; nextest of clear_value,
heap_tiled, fresh, nan_clear and degradation (55 passed). Device lanes and
replay run after the series.
* Expect the device's clear conversion in the lanes that clear at a tie
Since 5925c303f8 a clear converts the clear color (and a 16-bit depth)
the device's way, announcing device-color-conversion where a channel
lies at a rounding question (0.5 on an 8-bit unorm channel is 127.5
codes, a tie; any sRGB channel's encode) and unorm-depth-rounding where
a Depth16Unorm clear's fraction reaches the midpoint (Metal truncates).
Lanes that hold exact notice sets or Metal's truncated depth codes now
expect them:
- dont_care_stores: every pass clears through color_pass or earlier()
at 0.5; clear_tie() adds the note to each expected set (MoltenVK's
pipelines record no color-conversion note, so it showed there first).
- resolves: the depth stand-in clears Depth16Unorm to 0.5 (32767.5
codes): Metal's 0x7fff or the device's 0x8000, and the note announced
exactly for that format.
- buffer_depth_samples: the 16-bit clear to 0.25 (16383.75 codes)
announces unorm-depth-rounding.
- buffer_texture_blits: the planar depth clears (0.375, 0.625, 0.875)
hold Metal's truncated code or the one above it, the note's bound.
Verified: the four lanes' failing tests on lavapipe (linux-gate
halfnative) failed before these edits; on MoltenVK (Apple M3 Max,
maclock) dont_care_stores, resolves' depth stand-in,
buffer_depth_samples and the planar depth lane pass with them.
* Merge a fetched attachment's sample planes back before its twin resolve
A pass whose last draws fetch a multisampled attachment through sample
planes (the pixel interlock without multisampled storage images: ANV,
MoltenVK) left the planes unmerged after it under MultisampleResolve
wherever the crate-owned resolve drew the attachment's resolve, on the
reading that that resolve reads the planes. A resolve into the
attachment's sRGB twin is crate-owned but reads the attachment itself
(color_resolve.rs filters its planes out), so it resolved samples the
pass never wrote: on MoltenVK a 4x RGBA8Unorm attachment cleared to 0,
fetched once and resolved into RGBA8Unorm_sRGB read all zeros, where
the same pass stored too resolves (255, 225, 0, 0).
The planes steps now skip the merge only for a resolve that reads the
planes, an extended-range attachment's (the flag is renamed
planes_resolve to say so); a twin resolve merges first, as a stored
attachment does.
Test: runtime_lane::framebuffer_fetch::planes::
a_twin_resolve_of_a_fetched_attachment_reads_its_samples holds the
MultisampleResolve answer to the StoreAndMultisampleResolve one.
Verified on MoltenVK (Apple M3 Max, maclock): the test failed without
the fix (zeros) and passes with it, beside the planes, memoryless,
kept_resolves and twin-resolve lanes (18 passed); the runtime's
sample_planes unit tests pass.
* Expect the clear note in color_reformat's passes, through one helper
color_reformat's passes clear to (0.5, 0.25, 0.75, 1.0), whose red is a
tie in an 8-bit unorm channel, so the device's conversion of the clear
announces device-color-conversion at the device's first such pass.
Lavapipe's pipelines record the note already; MoltenVK's record none
(VkProperty::MetalColorWrites), so its exact notice sets failed there.
degrade_notices::tie_cleared() names that note for every lane whose
passes clear at a tie; dont_care_stores' local helper moves there.
Verified on MoltenVK (Apple M3 Max, maclock): color_reformat and
dont_care_stores pass (they failed in the full runtime_lane run before
this change).
* Hold the kept compressed-blit encodings to the ledger, and declare their notes
Since 01f733c6f0 a blit through a texture Metal keeps losslessly
compressed is the device's copy, which keeps the bytes Metal's
compression rewrites into the canonical encoding. The lavapipe replay
then read 46 rows the ledger did not expect:
- 28 value sites of compressed-blits-{bgra10xr,bgra10xr-srgb,rg11b10f,
rgb9e5f}: the device's bytes against Metal's canonical encoding. Each
is now a known-gaps.tsv row (venue llvmpipe) naming the note that
records it: extended-range-bits-kept, device-nan-encoding,
shared-exponent-kept, whose bound (the same value, another encoding)
covers it. Nothing is open: rule 1 rules out writing Metal's encoding.
- 18 notice sites of fresh-pattern-{552,553,93}, xr-draw-bgra10xr*
and xr-clear-routes-bgra10xr*: their read-backs blit out of such a
texture and announce the note, every value exact. They now declare
it through compressed_blits::kept_encoding_notice, the one table of
which format announces which note (device-nan-encoding is native and
declared for every case already). fresh_contents' row-notice test
counts the three pattern rows' second allowance.
docs/CONFORMANCE-COVERAGE.md regenerated (the ledger's row count).
Verified: conformance replay --cpu on lavapipe (linux-gate halfnative,
arm64): exit 0, 751 rows, exactly the ledger's (723 before the series
plus these 28), 0 unlisted and 0 stale; cargo nextest -p
metal2vulkan-conformance (1005 passed); clippy -D warnings.
* Format owned_divisions' bind import after the rebase
The rebase onto development dropped both CompressedBlit (this series)
and BlockDecode (development's BC twin removal) from the import, which
rustfmt now joins onto one line. No behaviour changes.
Verified: cargo fmt --all --check.
* Re-pin the runtime sources at the landing tip
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.
|
||
|
|
a1f1677174 |
Convert a two-plane YCbCr texture through the device's own Y′CbCr sampler where it has Metal's reconstruction
One work packet, landed as 3 commits (d38741a041..46bd06ec2f on archive/development-linear-2026-10-28), in order: * Convert a two-plane YCbCr texture through the device's own Y′CbCr sampler where it has Metal's reconstruction The owner's 10-28 decision: a YCbCr texture's texels are the GPU's own sampler Y′CbCr conversion where the GPU converts the format and the planes form one image; elsewhere Metal's fixed-point conversion stays as capability. Route. The texture's conversion pass (ycbcr.rs's refresh) copies the planes from its staging copy into an optimal image of the multi-planar format and samples it once per texel through a combined image sampler whose layout bakes an immutable sampler of the VkSamplerYcbcrConversion, writing the texture's image in the layout Metal's kernel writes (bind::ycbcr_sample_module). User pipelines are unchanged: no pipeline variant per conversion, no immutable sampler in a user layout, no combinedImageSamplerDescriptorCount in a user pool. The staging-to-image copy runs at every refresh (two regions); the sample dispatch takes the refresh's indirect arguments, so unchanged planes sample no workgroup. Which textures. Unpacked 8- or 10-bit codes of a 4:2:0, 4:2:2 or 4:4:4 layout over plane 0 whose planes form one image: no chroma codes 0, no rows past the buffer, each plane at a multiple of its texel's bytes with rows of whole texels that do not overlap (VUID-VkBufferImageCopy-bufferRowLength-09101, VUID-vkCmdCopyBufferToImage-dstImage-07976); on a device that enables samplerYcbcrConversion (enabled wherever present), whose optimal tiling has SAMPLED_IMAGE and TRANSFER_DST; a 4:4:4 format also needs Vulkan 1.3 or VK_EXT_ycbcr_2plane_444_formats (VUID-VkImageCreateInfo-None-12279), which the device now enables below 1.3 where listed. Metal's reconstruction required. Vulkan's implicit reconstruction of a subsampled format at MIDPOINT through a LINEAR chroma filter weighs the chroma 3 and 1 along a halved axis, as Metal does. Cosited it lies half a luma texel off (up to 1340/2048 of random planes on lavapipe), and nearest it takes one pair: that is what the codes mean, not a precision step, so a device without MIDPOINT_CHROMA_SAMPLES and a linear chroma filter for the format keeps Metal's arithmetic for it (a capability the device lacks). The brief allowed cosited; the measured distance is why I held it back, raised with the orchestrator. Left on ours, on purpose: - A 4:4:4 format read as codes (RGB8_444_2P, RGB10_444_2P): the identity model ignores the range and there is no chroma to reconstruct, so the device's answer is the codes ours reads, and the planes' image would only cost a copy. - A render pass's load: MTLLoadActionLoad keeps the attachment's contents and our store inverts Metal's read, not the device's; the device's load moved untouched codes by one on lavapipe (ycbcr_passes' loaded-pass lane), so the load stays Metal's arithmetic. Conversion. The surface's matrix (601/709/2020 model) and range (narrow/full); chroma filter linear where the format has YCBCR_CONVERSION_LINEAR_FILTER and (SEPARATE_RECONSTRUCTION or FILTER_LINEAR); the sampler's own filter nearest with SEPARATE_RECONSTRUCTION, else the chroma's (VUID-VkSamplerCreateInfo-minFilter-01645); each sample at a luma centre. No clamp of our own: "An implementation may clamp the R′G′B′ results of these conversions to the range [0,1]." Defects (measured, spec-forbidden; a RuntimeDriverDefect row keeps Metal's conversion): - TwoPlaneChromaMisplaced (MoltenVK 1.4.2): 4:2:0 and 4:2:2 chroma one luma texel up and left of the midpoint's and filtered twice. - TenBitCodesReadAsWords (lavapipe, Mesa 26.0.8): a 10-bit code's 16-bit word read as a 16-bit UNORM (1023 as 0.999039) where Vulkan converts c/(2^10-1). Paths measured: lavapipe converts its 8-bit 4:4:4 layout (its 4:2:0 and 4:2:2 ones are cosited only, its 10-bit ones carry the defect); MoltenVK converts none. Note and bound. ycbcr-filter-not-exact now also covers the device's conversion, announced where such a texture is made. Each channel within 0.04/2048 of Vulkan's conversion past the half the texture's image stores (0.038 measured at most), of Metal's read within 6/2048 inside [0, 1], unclamped outside it (lavapipe). FAST-PATHS gains its row; API.md matches. Plumbing: OwnedModule::YCbCrSample with a baked combined sampler; conversions and samplers held in OwnedKernels and released with it; priming makes and releases a conversion (the exit guard's 128th call, vkDestroySamplerYcbcrConversion); WorkCounts::ycbcr_device_conversions and ycbcr_device_samples count the path. RUNTIME_VERSION 1730. Lanes: the YCbCr lanes hold a texture the device converts (counted as it is made) to Vulkan's conversion within the bound instead of Metal's steps, and expect its notice (validation runtime_lane/ycbcr_device_reads.rs). Consumers: RuntimeDriverDefect gains TwoPlaneChromaMisplaced and TenBitCodesReadAsWords (an exhaustive match breaks); WorkCounts gains two public fields (a struct literal breaks); bind gains ycbcr_sample_module and YCbCrSampleModule. In place on an integrated or CPU device (not changed, not decided): a throwaway probe on the M3 Max under MoltenVK 1.4.2, 3840x2160 4:2:0 planes in host-visible memory composited into 1680x1050, best of 3x40: the device's Y′CbCr sampler over a LINEAR two-plane image of the planes in place 72.2 us (8-bit) and 81.2 us (10-bit), against 121.1 and 122.6 us for Metal's arithmetic over texel buffers (today's in-place form). MoltenVK's 4:2:0 conversion carries TwoPlaneChromaMisplaced and lavapipe's is cosited only, so neither venue could take it. Verified: build and clippy (plain and --cfg m2v_gpu); the touched host tests (catalogue, defect lists, exit guard, api_surface, api_signatures, fast_paths, the sample module on every committed profile). lavapipe (linux-gate arm64, --cfg m2v_cpu_icd): the runtime and validation YCbCr, chroma, two-plane, defect, exit-guard and degradation tests, 166 of 166, the device test counting 3 device-converted textures and the lanes 16; conformance replay --cpu exits 0, its 723 rows exactly known-gaps.tsv's (no YCbCr conformance case reaches the device path: they are 4:2:0). MoltenVK (M3 Max): the same selection 123 of 124, 0 textures device-converted; the one failure (a_ycbcr_sample_through_an_unmeasured_filter_is_announced, anisotropic through a constexpr sampler) fails identically at the base d736af8d66. Golden hashes: 2757 stale cells at the base and at this tip alike (key changes), none from this change. * Drop the YCbCr sample module's raw field, gone from CombinedSampler The sRGB change (9835965499) removed CombinedSampler::raw with the raw-view mechanism; the rebased YCbCr sample module still set it. Verified: clippy --workspace --all-targets --all-features -D warnings clean. * Re-pin the runtime sources at the landing tip 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. |
||
|
|
2ec1f9fdc8 |
Read an sRGB texel through the device's own decode wherever the device samples its format
One work packet, landed as 2 commits (9835965499..1a930f5dc1 on archive/development-linear-2026-10-28), in order: * Read an sRGB texel through the device's own decode wherever the device samples its format Rule 1 makes the device's texel conversion the answer wherever it has a native form. A texture bound in an 8-bit sRGB format (and the sRGB forms of BC1 to BC3, BC7, PVRTC, ETC2, EAC and ASTC) was read through a second UNORM "raw" view and decoded through Metal's twelve-bit table on every device; that emulated Metal's bits where the device decodes sRGB itself. What changed: - Every read, nearest and filtered sample, pixel fetch, gather and bicubic tap of a sampled sRGB texture now reads the device's decode through the slot's sRGB view (a decoded twin's R8G8B8A8_SRGB view where the device lacks the compressed format). An input-attachment read of an sRGB color attachment reads the device's decode too (the snap-to-byte and table decode in lower/fragment/color.rs is gone). - The note is the existing PrecisionNote::SrgbTexelDecode: specialized on the bound format's class (BicubicTexels::SRGB, SpecKey::BoundTexelFormat, announced at the draw or dispatch), outright for a heap element, and at link for a float input attachment over an sRGB attachment (StageIo::decoded_fetches). On MoltenVK the module requires VkProperty::MetalSampler instead. - The capability fallback stays: a format the device cannot sample, held as its UNORM twin (R8Unorm_sRGB and RG8Unorm_sRGB on lavapipe, RG8Unorm_sRGB on ANV and NVIDIA among the committed profiles), joins the SrgbTexture variant (srgb_twin_on) and decodes the twin's codes through Metal's table through the slot's own binding: exact for one texel's codes, the device's filter of the codes otherwise (noted). The storage alias, tile, word-attachment and pack/unpack table uses are untouched. - Deleted: the raw view and its plumbing (ResourceKind::RawTexture, BindingSource::RawTexture, CombinedSampler::raw/with_raw/sampler_binding_use, TextureDecls::raw, SlotPlan::raw, BindingKey::raw), texel_format::srgb_raw_view and srgb_raw_on, RuntimeFact::SrgbDeviceDecode, VariantKey/LoweringInputs::srgb_twins (merged into srgb_textures), LoweringInputs::srgb_fetches and the input attachment's snap, the runtime image plan's extra UNORM view of sampled sRGB images, and the ASTC-native bicubic refusal. srgb_raw is renamed srgb_coded. - Versions: SEMANTICS_VERSION 1891, RUNTIME_VERSION 1672 (the image plan lists no raw view; a notice text changed), ARTIFACT_FORMAT_VERSION 469 (CombinedSampler::raw removed, StageIo field renamed). The runtime-sources pin is left for the landing. - Docs: FAST-PATHS rows (sampling, texel conversion with the measured bound, ASTC twin), the stale "runtime sampler's nearest sRGB sample" known gap removed, SrgbTexelDecode moved to the device-gap class in tests::fast_paths; PrecisionNote docs, DriverDeviation::MetalSampler, docs/API.md's catalogue, decode module docs, runtime notice texts. - Lanes: a new runtime_lane::srgb_decode reads every code of RGBA8Unorm_sRGB; the ASTC, ETC, PVRTC, BC, cross-class and fetch lanes hold an sRGB color channel to the device's decode of its own code (srgb_decode_holds: bit for bit through Metal's own texture unit) and assert where the note is announced. The BC lane keeps development's no-twin structure: an sRGB color channel off a measured driver holds as the device's sRGB decode of a code within compressed-texel-decode's bound; the ASTC CPU-write lane's check takes the device's exactness. - known-gaps.tsv: 21 new llvmpipe rows (ETC2, EAC, ASTC sRGB reads, the read-write tier's sRGB round trip), the 12 BC1 to BC3 sRGB rows' answers and words (the device's BC decode, then its sRGB decode: both notes), the 8 sRGB fetch rows' answers updated; CONFORMANCE-COVERAGE.md regenerated. Measured: llvmpipe (LLVM 21.1.8, arm64) decodes every color code within 5.25 table steps (0.00128) of Metal's value; MoltenVK on the M3 Max equals Metal at all 1024 lanes, read and sampled, and in the cross-class gathers (0 of 240 words differ through each class). Words (lavapipe, one-access kernels, a slot bound in RGBA8Unorm_sRGB): read half 2941 -> 1131, read float 2513 -> 836, fetch half 3062 -> 1264, nearest float 2580 -> 915, gather alpha half 2934 -> 1191, gather red float 2571 -> 896; linear and runtime samples unchanged (1210, 1163); a bicubic sample grows, 10524 -> 13254 half and 10318 -> 13048 float (the emulated sum of the device's decoded taps). The twin variant loses its raw binding (read half 2941 -> 2929). Verified, on this tree (rebased onto 7b5cf8328d): cargo fmt; clippy --workspace --all-targets --all-features -D warnings, plain and under --cfg m2v_gpu; rustdoc -D warnings; scripts/api-docs; api_signatures re-blessed (the 9 removals listed above); REFUSALS.md unchanged; 700 of 701 focused metal2vulkan tests (lower::texture/sampler/fragment/select, pipeline, metal, spirv::requirements, the texture/sampler/fragment/srgb engine tests, fast_paths, surfaces) pass, the golden table failing as it does on 7b5cf8328d itself (1608 cells changed under unchanged keys): blessed on both trees, this change moves 0 cells; the conformance suite's 1007 tests pass. On lavapipe (scripts/linux-gate, arm64): 168 touched runtime-lane tests pass; the runtime crate passes 1368 of 1369, the one failure deferred_calls::a_commit_after_an_end_in_flight_returns_and_keeps_its_order (status Scheduled where Committed is expected, no texture involved) failing again in 1 of 5 reruns, a timing flake; `conformance replay --cpu` exits 0 with no unlisted or stale row. MoltenVK lanes were not rerun after the rebase. * Re-pin the runtime sources at the landing tip 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. |
||
|
|
3f3c972b8a |
Decode a pulled Int1010102Normalized 10-bit field as Metal's product
One work packet, landed as 2 commits (23c75d6d34..7b5cf8328d on archive/development-linear-2026-10-28), in order: * Decode a pulled Int1010102Normalized 10-bit field as Metal's product Metal's vertex fetch reads an Int1010102Normalized 10-bit field as its clamped magnitude times float(1/511) in float, one rounding, not the correctly rounded quotient c / 511: an ulp toward zero at 96 of the 1,024 codes (measured at every code on the Apple M3 Max, macOS 27.0.1, by runtime_lane::normalized_vertex_fetch). The shader's pulled decode (lower::stage_io::fetch::normalized) divided exactly, so Metal's constant step on MoltenVK, a device without buffer robustness, the indexed capture form and a kernel's stage input read those codes an ulp off, unannounced. It now multiplies (an OpConvertUToF and an OpFMul in place of the exact division's integer sequence); every other normalized field keeps the quotient. The FAST-PATHS known gap goes. The device-vertex-conversion entries in docs/API.md and the runtime's degradation.rs now state the 1/511 rule, the MoltenVK exemption and lavapipe's unclamped per-instance signed minimum, as the note's doc and the ledger row already do. SEMANTICS_VERSION 1890. Verified: nextest of lower::stage_io::fetch, fast_paths and the vertex tests, 116 passed; every_ten_and_two_bit_code_decodes_as_metals fails with the multiply disabled (negative control) and holds the 96-code count. * Re-pin the runtime sources at the landing tip 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. |
||
|
|
8acf6ae154 |
Sample a BC texture's own image through the device's decode, keeping no twin
One work packet, landed as 3 commits (d8bb73078f..862d4c13a1 on archive/development-linear-2026-10-28), in order: * Sample a BC texture's own image through the device's decode, keeping no twin Under the native-arithmetic rule a device that has a BC format decodes it itself: its decode is the answer, recorded where it can differ from Metal's. The BC1 to BC5 decoded twin emulated Metal's 6-bit-weight decode on drivers not measured to make it (lavapipe, NVIDIA, ANV, RADV's BC4/BC5), at the cost of a second image 4 to 8 times the blocks and a decode after every write. It goes, and with it every piece only it used: - the translator's `bind::BlockDecode` and `bind::block_decode_module` (Metal's fitted BC1 to BC5 decode, its kernel and its tests); `bind/block_decode.rs` keeps only what the carriers' decode modules share (`BlockDecodeModule`, the bindings, `table`, `decode_module`); - the runtime's `TwinDecode::Block`, `Device::twin_decode`, the twin's announcement `decoded-block-twin` (`Degradation::DecodedBlockTwin`, removed), the view-decode notice for a view of another decode (`degrade_view_decode`, `degrade_device_decode`), and the device-test-only `Scheduler::decodes_pending`, which only the BC twin's CPU decodes needed. A BC texture (BC1 to BC7, the sRGB forms too) is now its own BC image on every device, and on a device whose driver lacks the format's fact (`ColorBlockDecodeIsMetals`, `ChannelBlockDecodeIsMetals`, `Bc6hBlockDecodeIsMetals`, `Bc7BlockDecodeIsMetals`) announces `compressed-texel-decode`, now also for a sparse texture and a texture over the caller's `VkImage`, which announced nothing before. The facts still decide the note. The carriers' twins (ASTC, PVRTC, ETC2/EAC, 4:2:2) and their CPU decode thread are unchanged; a carrier whose twin's format the device cannot sample is now refused typed instead of read as its carrier (no conformant device lacks those formats). The sRGB forms' read through Metal's table is unchanged here (another change replaces it). Lanes and suite: - `runtime_lane::compressed_decode` reads the device's decode: exact where the driver has the fact (within `device-texel-conversion`'s ulp off Metal's sampler), else within the note's stated per-format bound, with the note announced; no write makes a decode pass or CPU decode. - `cpu-block-decode` keeps a lane site in `astc_textures` (`astc_cpu_writes_decode_on_the_cpu`, the CPU decode thread's ordering behind work in flight), and `chroma_pairs` holds its notice to the CPU decodes on every device. - conformance: `compressed-texel-decode` joins `replay::NATIVE_NOTES`; the BC cases declare no twin notices; 40 llvmpipe rows in known-gaps.tsv, one per BC1 to BC5 round, each within the note's lavapipe bound. The cross-check `every_recorded_texel_is_the_lanes_fitted_rule` still holds the M3 Max's recorded texels to the case's own model of Metal's decode. - new device test `tests::bc_own_image`: every BC format, `Shared` by `replaceRegion`, `Private` by a blit and a heap's, has no twin, keeps its blocks, makes no decode, and announces the note exactly where the fact is missing. Docs: API.md's `compressed-texel-decode` entry and cost (lavapipe's BC4/BC5 bound widened to 2.4/255, signed 0.022, as measured below), `decoded-block-twin` removed; a FAST-PATHS.md device-gap row; REFUSALS.md, api_signatures.tsv, api_surface and CONFORMANCE-COVERAGE.md regenerated. RUNTIME_VERSION 1669 -> 1710 (renumbered at landing). SEMANTICS_VERSION stays: no translation changes, so the golden hashes do not move. The runtime-sources pin is not re-pinned here. Verified: - clippy `--workspace --all-targets --all-features -D warnings`, plain and `--cfg m2v_gpu`; rustdoc with `-D warnings`; the refusal, signature, Metal and conformance coverage checks. - macOS, no device: metal2vulkan-runtime + metal2vulkan-conformance 2139 passed; metal2vulkan's fast_paths, owned_divisions, bind, api_surface, api_signatures, driver_facts and cache tests 568 passed; conformance again after the ledger rows, 1007 passed. - lavapipe (linux-gate arm64, `--cfg m2v_cpu_icd`): 145 tests of the touched families passed (bc_own_image, compressed_decode, astc_textures, chroma_pairs, pvrtc/etc textures, degrade_notices, texture_blits/fills, cpu_copy_layouts, image_plan, first_moves, the degradation tests). Largest differences from Metal: BC1/BC2 2/255, BC3 3/255, BC4 2.28/255 (signed 0.0172), BC5 2.31/255 (signed 0.0212); BC6H has its fact there, BC7 announces. `conformance replay --cpu`: the only unlisted gaps were these 40 BC rounds, no stale row. - MoltenVK on the M3 Max (maclock, memcap): 43 tests passed, every BC1 to BC5 channel exactly Metal's, no `compressed-texel-decode`; the replay of 105 touched cases left all 41 BC cases exact (one unrelated divergence, `read-write-tier-held`'s `set-past-layout-support` notice). * Count the ASTC CPU-write lane's behind-work decodes from before the making `astc_cpu_writes_decode_on_the_cpu` failed once on lavapipe after the rebase onto cb759a4c4a: "ASTC4x4LDR Event: 2 CPU decodes, not 1". The cause is the test's window, not a second decode. `WorkCounts::cpu_block_decodes` counts a write's decode when the device's decode thread finishes it (`Image::finish_twin_decode`). The case writes the old blocks, commits the reader, and only then took `before`. In the Busy case `scheduled(&reads)` waits for the reader's batch, which the scheduler holds until the old blocks' decode finished, so `before` already holds it. In the Event case nothing waits, so the old blocks' decode could land after `before` and be counted with the new ones'. Each write queues exactly one job, and the thread takes them in order, so 2 is the old write plus the new. Now the case counts from before the texture's making and expects exactly two CPU decodes (its two writes) where the copies go on the host or the staging queue, and none elsewhere. The count is read after the later reader completed. That reader's batch waits for the new write's decode, the thread finished every earlier job by then, and it counts each job before it releases the batches that wait for it. Every earlier case's decodes landed before its own later reader completed too. No sleep, and no looser bound. Verified: clippy of the validation crate under `--cfg m2v_gpu`; on lavapipe (linux-gate arm64, `--cfg m2v_cpu_icd`), the test 20 times and the families bc_own_image|cpu_copy_layouts|compressed_decode|degrade_notices|astc|etc_textures|chroma_pairs| event_round_trips|grouped_submissions|waiter_submits|scheduler. The 20 runs all passed: each of the 80 behind-work cases (two formats, Busy and Event) counted exactly 2 CPU decodes, 0 cases wrong; 13 Busy cases were void (the reader ran before the write) and 2 to 4 cases a run held. The families: 86 tests passed. * Re-pin the runtime sources at the landing tip 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. |
||
|
|
04f6fb57b8 |
Read a half by UnpackHalf2x16 and narrow one by the bare quantize without float16
One work packet, landed as 4 commits (91d9e38f75..80ca8d6abd on archive/development-linear-2026-10-28), in order:
* Read a half by UnpackHalf2x16 and narrow one by the bare quantize without float16
On a device with 16-bit storage but no shaderFloat16 (QuantizeForm::Device: Pascal, the
lunarg-2023 baseline, vk12-floor, SwiftShader), the GPU's native arithmetic is the contract
(AGENTS.md rule 1), so neither the read nor the narrowing of a `half` emulates Metal's bits any
more:
- A `half` read from its bits (a load, a reinterpretation, a texel's or snapshot's bits, a
vertex fetch) is GLSL.std.450 UnpackHalf2x16 of the bits as the low half of a 32-bit word
(component 0), or of both halves for a pair (`narrow::from_bits`, `from_word_halves`). The
exact integer decode (`half_bits_to_f32_bits`) is deleted: UnpackHalf2x16 is core and needs no
capability, so no device lacks a native form. The module records NativeNanEncoding (a NaN's
bits) and NativeHalfConversion (the widening is neither under DenormPreserve 16 nor measured,
so a denormal may flush), by the rules 860ad1489f set for the float16 widening;
`narrow::widens_bits` counts the unpack.
- Every narrowing to `half` through `narrow::round` (fptrunc, every `half` operation, function,
sum, multiply-add, mix step, division, square root, dot, simd and matrix reductions, stage I/O,
color and fetch narrowing, texel rounding through `round_texel`) is the bare OpQuantizeToF16,
recorded NativeHalfQuantize on every such device, measured or not. The denormal arm (quantize,
compare, RoundEven of x * 2^24, select) and `device_round`, `scaled` and
`flushes_below_normal` are deleted; `native_rounding(form)` now depends on the form alone, so
`native_half` holds on every Device-form module. `round_integer` stays exact: it is the
workaround for NVIDIA 615.71.09 keeping an integer conversion unrounded under the quantize.
- No module requires VkProperty::MetalHalfQuantize any more (compile.rs drops the requirement);
DriverDeviation::MetalHalfQuantize and the property are kept and documented as measuring only.
Devices with shaderFloat16 are unchanged.
Integer roundings to `half` that never took `narrow::round` are unchanged: the extended-range
blend's `half_of` (every form but the controlled one), the extended-range color encodes, the
sampler's level and the bicubic routines (Metal's directed roundings among them), and the texture
routine's grid families, which round an integer code's ratio.
Docs: PrecisionNote's NativeHalfConversion, NativeHalfQuantize and NativeNanEncoding, the
runtime's declarations of the three, docs/API.md section 9 and docs/HOWTO.md state the new reach;
`fetch.rs`'s `half()` no longer says "exactly". SEMANTICS_VERSION 1886 -> 1887. The runtime
sources change in doc comments only, so RUNTIME_VERSION stays; the runtime-sources pin moves.
Tests (the arith interpreter harness now builds in QuantizeForm::Controlled unless a body sets a
form, so routine references stay Metal's; a half NaN through the device's widening is accepted as
a NaN, the interpreter's widening being canonical):
- `narrow::device_half_rounding_is_the_quantize_alone`, `engine_native_half::
a_half_below_the_smallest_normal_takes_the_devices_quantize` and `engine_arith::
a_half_rounding_without_float16_is_the_quantize_alone`: no RoundEven or compare after the
quantize, NativeHalfQuantize on every Device profile, sums and narrowings below 2^-14 answer
the signed zero on the interpreter. Negative control (the denormal arm restored in `round`):
all three fail, and `half_rounding_follows_the_operation`.
- `narrow::a_half_decode_is_the_devices_widening_in_every_form` and `engine_native_half::
a_half_read_from_memory_is_the_devices_widening_on_every_profile` and the loop decode test: one
UnpackHalf2x16 per word, no 16-bit type, no integer decode, NaN and conversion notes. Negative
control (the integer decode restored in `from_bits` and `from_word_halves`): all three fail.
- The texel tests accept the quantize's signed zero for a half denormal in the Device form; the
16-bit grid comparison runs the Device form under native rounding only (its one production
setting); the wide tests validate on vk12-floor in its own form.
Verified on this Mac (no GPU): cargo nextest -p metal2vulkan -p metal2vulkan-runtime
-p metal2vulkan-air -p metal2vulkan-devtools --all-features: 5014 run, 5013 passed, the one
failure golden_hashes_match_the_table (hashes moved; not re-blessed here). cargo clippy
--workspace --all-targets --all-features -D warnings, plain and with --cfg m2v_gpu; cargo doc
-D warnings for metal2vulkan and metal2vulkan-runtime. Every fixture below translated with
spirv-val (vulkan1.2, vulkan1.4) passing.
Words (instructions), the CLI on the public engine fixtures, before -> after:
hfb_filter_bank (fragment) Pascal 198141 -> 147460 (38283 -> 28981)
lunarg-2023 176378 -> 124545 (34510 -> 24920), same on
swiftshader and vk12-floor
unm_contract_chain Pascal 46258 -> 34491 (9333 -> 6952)
lunarg-2023 48303 -> 36536 (9699 -> 7318)
swiftshader, vk12-floor 48364 -> 36597 (9928 -> 7547)
fmx2_contract_fast Pascal 24177 -> 18912; lunarg-2023 25107 -> 19842
a1_half_denormals Pascal 4230 -> 3071; lunarg-2023 4353 -> 3194
hwd_half_reads Pascal 2647 -> 2194; lunarg-2023 2688 -> 2235
dsm_half_live_built Pascal 6782 -> 5988; lunarg-2023 6799 -> 6005
sum_regroup unchanged (Pascal 1047, the others 879)
* Hold the native half lanes to each rounding's bound, and bound the quantize's flush by its input
On SwiftShader (no shaderFloat16, so every half narrowing is the bare OpQuantizeToF16) two
native_maths lanes broke the note they check:
- half_rounding_answers_within_its_recorded_bound held half(a) + half(b) to one ulp of Metal's
sum, but the note bounds each rounding: SwiftShader's quantize rounds toward zero, so two
roundings land two ulps off (thread 30: -45.0625 for Metal's -45.125; failing on development
too), and a flushed denormal operand moves the sum by itself. The sum is now held to the bound
of the sum of operands each rounded within it (half_within_sum).
- native_maths_answers_within_its_recorded_bounds held a half fma below 2^-14 to one ulp; where
the stage records NativeHalfQuantize or NativeHalfConversion, the zero of its sign is the
note's bound.
The quantize tests the value it rounds, not the rounded result: SwiftShader answers -0 for
-6.1005354e-5, which Metal rounds to -2^-14. PrecisionNote::NativeHalfQuantize, the runtime's
declaration, docs/API.md (its section 9 entry and the device-answers paragraph, which still said
the widening was the device's only with shaderFloat16) and docs/HOWTO.md now bound a value below
2^-14, not a result, and the lane tests the input.
Verified: scripts/linux-gate --icd swiftshader, runtime_lane::(driver_deviations|half_|
native_maths|sum_regroup|math_routines): 26 run, 22 passed. The four failures fail identically
on development 60fe70fb12 without this branch (sum_regroup 3863 of 4096 pixels, RG11B10 small
floats 2005 of 71505 fields, the slice NaN lane's 17 stored halves, 86 and 484 float NaN words),
so they are SwiftShader's, not this change's; development there fails six, among them
half_loads_the_device_widens_answer_as_metal, which passes here. The same lanes on lavapipe:
26 of 26. clippy -p metal2vulkan-validation --all-targets --all-features --cfg m2v_gpu
-D warnings; the runtime's degradation catalogue tests.
* Number SEMANTICS_VERSION 1889, after development's 1888
The half read and narrowing change (91d9e38f75) bumped SEMANTICS_VERSION, and each rebase onto
development took development's own bump for it (1887 for the MoltenVK vertex fetch, 1888 for the
blend sweep's one compile), so this change shared a number with another. 1889 keys its modules
apart: Device-form modules read a half by UnpackHalf2x16 and narrow one by the bare
OpQuantizeToF16, with their precision notes.
Verified on the rebased tree: the core suites, clippy plain and --cfg m2v_gpu (see the change).
* Re-pin the runtime sources at the landing tip
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.
|
||
|
|
bd1861cf3d |
Keep the samples a resolve after the pass reads on a framebuffer-fetch-by-input device
One work packet, landed as 5 commits (8ec20af606..60fe70fb12 on archive/development-linear-2026-10-28), in order: * Keep the samples a resolve after the pass reads on a framebuffer-fetch-by-input device A multisampled color attachment resolved by the crate-owned resolve after the pass (the sRGB twin, an extended-range format) under `MultisampleResolve` is meant to render through an image its texture keeps, so the texture keeps the samples it held before the pass, as Metal's does (`resolve::keep_samples`). The pass asked it whether a draw took a view of the attachment with the linear rule's `taken`, which on a device whose framebuffer fetch reads input attachments (`PassLayout::fetch_inputs`: rasterizationOrderColorAttachmentAccess, lavapipe's) counts every color of every pass. So on such a device no pass ever kept its samples: the attachment held the resolving pass's clear and draw (lavapipe: `80808080` where Metal keeps `bf4080ff`; BGRA10_XR `c09f...` where Metal keeps its earlier clear). keep_samples now takes `viewed`, the colors a draw actually read (input attachment, pixel interlock, sample planes, another format's view, the extended-range shadow), as `kept_bytes::settle` asks it of the attachment it renders apart. The subpass's input references name the framebuffer's attachments, which take the kept image's view, and a stand-in takes input attachment usage on such a device (`attachment_stand_in.rs`), so nothing a draw recorded refers to the attachment's own image. The linear rule keeps `taken`. RUNTIME_VERSION 1700 (to be renumbered at landing). Verified: runtime_lane::resolves::samples_a_twin_resolve_reads_are_kept_as_metal_keeps_them and ::samples_an_extended_range_resolve_reads_are_kept_as_metal_keeps_them failed on arm64 lavapipe at 742b94ac06 (diagnostic print: every pass's color counted taken, `fetch_inputs` true, including a pass with no draw) and pass with this change; both pass on MoltenVK (M3 Max), where `fetch_inputs` is false and nothing changes. * Wait on the GPU for the signal a checked head's shared-event wait is held for Since |