4b37878cdaa103cb8b0fe882474cd5961baafafe
45
Commits
| Author | SHA1 | Message | Date | |
|---|---|---|---|---|
|
|
67fb4a7902 |
SEMANTICS 2097 / RUNTIME 2239: an ICB's blit reset writes only the commands written since the last
An indirect command buffer's records live in Shared host memory by design (the host step reads
them on the CPU, and plain Metal lets the CPU write a Private ICB's commands), so a blit's reset
of a whole ICB was a vkCmdFillBuffer over every record across the link: on the consumer's Modern
Rendering sample (45k commands, 101 MB of records) 56.9 ms of GPU time a frame on an RTX 2080
over PCIe x4, against 0.26 ms for the same fill in device-local memory, while the sample writes
~1.3k commands a frame.
Each command now has a u32 written flag in an optional tail after the records (16 +
capacity*2248 + 4*i; CommandBuffer::initialize and decode unchanged). The lowered encode
operations and copy_command store 1 through the contained wide_at (no tail: the sink; a faulting
operation stores nothing); the CPU setters and edit mark it, and a CPU write of the reset record
(reset_with_range) clears it; a blit copy fills the destination's flags with 1. A blit reset is
one dispatch of the new owned kernel bind::icb_reset_module per run of commands, a workgroup a
command that zeroes a flagged record with 8-byte stores and clears its flag; the overflow clear
stays a fill. The carry copies the whole storage, flags included; a lost carry rewrites the header
and zeroes the flags.
Verified (radvcompile, at 273dbba28c on
|
||
|
|
ad402b548e |
Every VkPipeline the runtime makes is named for the validation layer's messages
Where the instance reports messages (VK_EXT_debug_utils), each pipeline now carries a debug name, which the layer prints after its handle. Until now only a raster-order pipeline was named, so a synchronization report could not tell a program's kernel from one of the runtime's own. - A program's pipelines are named by its Metal functions' names, in pipeline order, joined by " + ". Each variant's objects keep them (`VariantObjects::name_pipelines`), set where a compute variant is made (`pipeline/mod.rs`) and at each render variant's making (`RenderVariant::of`). A pipeline library is named the same, with its part in parentheses. An indirect-bindable replay pipeline takes its variant's names. - The runtime's own pipelines are named "metal2vulkan: " and the kernel or step: each owned kernel by its module (for example "metal2vulkan: PagesCopy(Gather)"), the split, merge, resolve, copy and plane steps by their kind, the in-place check's draw, and the priming's kernels beside its pipeline. - A raster-order pipeline keeps its name alone, since the validation crate's lanes match it whole (`raster_order_gap.rs`). - A name is worked out only where the instance reports messages (`DeviceShared::name_pipeline` takes a closure), and nothing reads it: it is a diagnostic, and no translation or runtime path depends on it. Why now: a sync-validation run on the XTX (SYNCVAL_SHADER_ACCESSES_HEURISTIC) reported 45 WRITE_AFTER_WRITE hazards. All were vkCmdDispatch after vkCmdDispatch, on one pipeline, at storage binding 1 of a pushed set 0. What the code points to, which the next run's names will confirm or not: - The runtime's pushed kernels are RowsCopy, PagesCopy and the shadow copies and merges. Of those, the ones whose binding 1 is a written storage buffer are PagesCopy(Gather), RowsCopy and ShadowCopyBack. - Only PagesCopy(Gather) records several dispatches in a row with one pipeline in one command: one per guest RAM chunk the runs touch (`host_ram/copy.rs`). Every one of them binds the same window of the destination buffer at binding 1. - That path is taken only when no destination byte is written twice (`twice()`; a gather whose runs share a buffer byte takes regions instead), so those dispatches write disjoint words. The tracker orders the copy as one command over its whole span. - The heuristic counts each dispatch as writing its whole bound range. So these would be reports of disjoint writes, not a missing barrier. - Guest kernels push set 0 too, so a program's kernel in a concurrent compute encoder is not ruled out. That is what the names settle. Docs: HOWTO section 8 says what the names are. |
||
|
|
54e08fc34c |
Owned sets of storage buffers are written from fixed arrays, each set's infos and writes on the stack
OwnedSets::write takes each set's (buffer, offset, range) as an array of the kernel's N storage buffers and writes each set from two stack arrays (its N buffer infos and N writes), one vkUpdateDescriptorSets a set: no list of infos or of writes. Its callers pass their arrays as they are, where each built a Vec a set (`vec![..]`, `.to_vec()`). A kernel whose storage buffers are not N is refused (internal), as before a set of another length was. On a tiled heap texture (heap_texture_256 on the Radeon 780M) this drops the two lists left per making; the before/after per-call counts are in the branch's report. |
||
|
|
25c95ef6a7 |
Owned sets of storage buffers are written with one list of infos and one of writes
OwnedSets::write copied each set's ranges into an OwnedSet, the kernel into a list of copies, and went through write_each, which built a list of image infos, one of storage image infos and one of buffer infos per set, nested, and a writes list that grew as it was pushed; and it took the kernel's set needs once per set. A tiled heap texture's two sets cost 18 allocations that way on the 780M PHOENIX (host_ab percall heap_texture_256, the allocation probe's call sites, job m3-max-16125). - write takes any list of ranges (a slice, an array or a Vec, so every caller stays as it is), checks them against the kernel, allocates the sets with the kernel's needs taken once, and writes one list of buffer infos and one of writes, each sized up front. - write_each and write share the opening checks and the pool's count (OwnedSets::opened). - A fitted arena counts the descriptors of the pool it would open from the set's needs (SetNeeds::pool_descriptors) instead of building that pool's Room to sum it. Not run yet: the build, clippy and the PHOENIX percall run come with the commits after. |
||
|
|
26440eaa22 |
Push set 0 on MoltenVK for a fragment stage that writes a set-0 storage buffer in its interlock
MoltenVK, binding through Metal argument buffers (the state device/argument_buffers.rs reads from the limits; a device without them is refused at open), makes a bound set 0 one Metal argument buffer, and marks each storage buffer a fragment stage reaches inside its interlock as a member in raster_order_group(0). Metal leaves such a member unordered where the function also reads another buffer member of the same argument buffer. A pushed set is discrete in either of MoltenVK's modes, and Metal orders a discrete [[buffer(n), raster_order_group(0)]]. RuntimeDriverDefect::InterlockedBoundBuffersUnordered names it, on every MoltenVK GPU (keyed on the driver, as the push holds however the device binds). There a render variant whose fragment stage writes a storage buffer of set 0 inside its interlock pushes set 0, read from its words (pipeline/interlocked_writes.rs: an interlock execution mode, a StorageBuffer variable of set 0 not decorated NonWritable). PushedBufferSizesUnset stays: such a variant pushes only where no stage reads a buffer's length (OpArrayLength, OpUntypedArrayLengthKHR) and no binding of set 0 lists a stage the pipeline adds; otherwise it binds set 0 as before and announces the new Degradation::InterlockedBufferOrder (`interlocked-buffer-order`, precision), as it does on a device without the push command or with a set 0 no push layout takes. Nothing is refused. Every other path is unchanged: the device now loads the push command on MoltenVK too (and primes it), but pushes_set_zero there admits only those variants; runtime kernels stay bound (OwnedKernel::pushed requires pushed sets that hold their sizes); every other driver decides as before. No new DriverFact or WorkCounts field: the lane reads draws_pushing_set_zero. Tests: - tests::interlocked_writes: the translator's own modules of ipo_primitive_order for the committed MoltenVK profile (only ipo_rog_buffer's fragment stage interlocks with a writable set-0 buffer; no stage reads a length), and synthetic words for each fact. - runtime_lane::interlocked_primitive_order: a RogBuffer draw must push set 0 where the device pushes it (draws_pushing_set_zero), and on a driver whose pushed sets lose their sizes no other draw may push; a_bound_set_of_interlocked_buffers_is_announced_once, the bound form with VK_KHR_push_descriptor withheld, the degrade site BOUND_INTERLOCKS. - tests::driver_defects lists the defect for the MoltenVK profile; api_signatures.tsv blessed (two rows); docs/REFUSALS.md regenerated: unchanged. docs/API.md: section 5's pushed set 0 and the catalogue entry. Evidence so far, Apple M3 Max, macOS 27.0.1, MoltenVK 1.4.2: Metal itself, our own MSL, 96 passes each: a raster order group buffer member beside a buffer member the function reads lost writes in 96 of 96, with the width read elsewhere 0 of 96, a texture member 0 of 96, the member alone 0 of 96; MoltenVK's own Metal for the lane's stage 48 of 48, the same with the buffer discrete 0 of 48. Through the runtime at 83d2d86519 (set 0 bound) the lane's RogBuffer lost writes in 96 of 96 passes (m3-max-14866); with every set 0 pushed (a probe arm) 0 of 96 (m3-max-14930). The fix's own lane run is reported with the tip. |
||
|
|
d83c658475 |
carry: clippy's drain and append forms, and a plain flag in OwnedKernels::destroy
Clippy rejected collecting a full drain into a Vec and extending from one. The lost parts now move out one by one as they are marked, and the event's pending notifications move with Vec::append. OwnedKernels::destroy sets its flag plainly, with no mem::replace. (cherry picked from commit d7cc6f4806e1f2948372fb274e619aedaadfe3d1) |
||
|
|
17a35ba5c0 |
Lost generation goes once nothing records on it: device handles, semaphores and work objects
Following the orchestrator's decision for 1a, the lost generation of a recovered device is let go of rather than kept alive by its carried objects. Before this, every recovery left one more live VkDevice behind while carried objects lived, and the 5080's driver refuses an 8th. - Carried buffers, their pages and events hold their generation through MadeOn, a device handle let go of once the object's parts there went. - A buffer names its generation by address for the RecordsOn compare, so nothing reads a handle that was let go of. - Lost parts go in two phases: marked under the registry's lock, then released after it. Command buffers made after the mark meet none of them. - Rest needs the line to serve past the generation. Once there, a lost generation refuses new command buffers (Recording::begin answers None and the queue refuses as on the lost device). - At rest, the generation destroys its device-level work objects: internal submissions, the staging pool, owned kernels, the mipmap scratch and the GPU pools. It also closes its recyclers and frees its kept and made-ahead blocks. OwnedKernels::destroy now runs once. - A carried event counts the host calls under way on its semaphore (counter reads, host-wait slices, reservations, the watcher). The last call, or the release when none is under way, destroys the semaphore. vkspec 7.4.4 bounds a wait on a lost device to finite time. The lost VkDevice is still destroyed only through DeviceShared's drop. This change adds no vkDestroyDevice site. Work in progress: not yet built. (cherry picked from commit f851e029dd4a4268d60e95bc936174c4ad2da715) |
||
|
|
c0f334eaff |
Every pipeline making reports what its driver found, so no found record is written again
What: the runtime's own pipelines were made through the shader cache with no
VK_EXT_pipeline_creation_feedback: its owned kernels, the depth, stencil and planes split
kernels, and the draws of its copies, resolves and planes steps. So each such making read the
driver's data back and compared its SHA-256 with what the cache was loaded with. Two functions of
DeviceShared now make every pipeline that goes through a record, each chaining the feedback:
make_compute_pipeline makes a program's compute pipelines and the runtime's kernels, and
make_graphics_pipeline makes the libraries of shaders a render pipeline is linked from and the
runtime's draws. A making the driver reports found in the cache its record loaded reads nothing
back and writes nothing (driver_data_found). Its report counts in driver_pipeline_hits and
misses. The unreported DeviceShared::make_pipelines, which nothing calls now, is gone. The
whole render pipeline's making keeps its own call, which already reported.
Why: RADV's data after a making from its record is now and then not the record's byte for byte
(Mesa 26.2.6 on a Radeon 780M: one byte of over a thousand, at the same length; the previous
commit fixed the libraries of shaders, the cause of the warm flake). The byte comparison took
that for new data and wrote the record again: needless SSD writes at a device's makings of its
helpers.
The negative: tests::driver_pipeline_compile::the_runtime_s_own_kernels_found_in_their_records_write_nothing.
A second device, over the directory where a first device made two of the runtime's kernels
(RowsCopy, VisibilityCombine), makes them again. It must count one report per kernel, with found
== hits, and where both are found it writes no record (driver_saves 0). Without the fix it reads
0 hits and 0 misses and fails.
That proves the missing reports, not drift writes on those two kernels: without the fix their
records were written 0 times in 50 runs on PHOENIX. The drift I measured was on the libraries.
With the fix, a kernel found in its record is neither read back nor written, whatever bytes the
driver returns.
Verified on um790's 780M (RADV PHOENIX via MESA_VK_DEVICE_SELECT=1002:15bf!, Mesa 26.2.6,
release, --cfg m2v_gpu), job 11523:
- The test alone (the negative) failed 50 of 50: 2 kernels made, 0 hits and 0 misses reported,
0 written, 2 loaded.
- With the fix:
- The own-kernel test passed x51: 2 hits, 2 found, 0 written.
- a_library_of_shaders_reports_what_its_driver_found passed x51.
- The warm own-directory test passed x100: 4 found, 0 written.
- tests::warm, shader_cache, driver_pipeline_compile, owned_kernel_builds and owned_pushes:
34 passed.
- The runtime suite (the GPU-hazard filter, the GPU-time tests left out) passed in 2 runs,
1965 tests each.
- runtime_lane::pipeline_records and runtime_lane::cache: 10 passed. The second device read
loads 2, saves 0, found 2, hits 2. The cache lane read 26 makings, each counted once by its
report.
- lavapipe (--cfg m2v_cpu_icd, llvmpipe from Mesa 26.2.6), job 11524: both report tests passed
(each 0 hits, 2 misses, 0 written) and the touched modules passed, 34 tests.
- cargo clippy -p metal2vulkan-runtime --all-targets --all-features -D warnings is clean, plain
and with --cfg m2v_gpu (job 11527).
Not yet run: NVIDIA (the 5080).
(cherry picked from commit f82a8a3b3f192fef6bb7dc74c030797f0a2773eb)
|
||
|
|
460a608d1b |
Depth uploads clamp into [0, 1] on devices that take no other: replace_region, blits from buffers, copies from colour textures
On a device without VK_EXT_depth_range_unrestricted whose driver is not measured to keep a depth outside [0, 1] (ImageFacts::depth_clamps, ANV on the Iris Xe), a copy into a D32_SFLOAT or D32_SFLOAT_S8_UINT depth plane took Metal's bytes as they are, which breaks VUID-vkCmdCopyBufferToImage-pRegions-07931 for any value outside [0, 1]. The heap's tiled copy-in already clamped (TiledLevelMove:: clamps_depth); every other upload now goes through the same clamp, on the bits: a NaN of either sign 1.0, -0.0 kept, other negatives 0, above 1.0 (+inf too) 1.0, the rest as they are, no denormal flushed. - Translator: bind::clamped_depth (the CPU rule) and bind::depth_clamp_module (DepthClampModule), an in-place clamp over a buffer's words in the extended-canonical kernel's shape (first, width, row and image pitches). The tiled kernel's clamp now shares the module's SPIR-V helper. - Runtime, depth_clamp.rs: clamps_depth (one test of format, aspect and device facts, which heap_tiled now uses too), the CPU clamp of packed bytes, and BlitCommandEncoder::clamp_depths / clamped_depth_copies: one dispatch a region (split into images or rows past the device's storage range or workgroup counts), each its own command so the tracker orders it between the copies. - replace_region clamps the packed bytes on the CPU before any route (a host copy, the staging queue, a submission), so no depth image holds a value outside [0, 1] that a later copy of its texels moves on. - A blit from a buffer into such a depth copies the regions' bytes into a scratch buffer, clamps them and copies from there; a plan that stages its rows clamps its staging buffer in place; a copy from a colour texture through the encoder's scratch clamps the scratch before the copy into the depth. - WorkCounts::depth_uploads_clamped counts each clamp. - restricted-depth-upload stays announced where it was; its doc, the replace_region message, docs/API.md, the blit and replace_region docs and the FAST-PATHS device-gap row say the upload clamps. - MoltenVK (DepthImageKeepsValuesOutsideUnitRange) and devices with the extension are untouched. Lanes, runtime_lane::depth_upload_clamps, under the validation layer's GPU-assisted buffer-copy check: replace_region, a blit from a buffer (as it is, through its plan's staging at an offset of 2, and into Depth32Float_Stencil8's depth) and a copy from an R32Float texture, each checking no VUID-07931, the clamp counted, and each texel read back clamped (or as written where the device keeps it). The heap lane now shares the lanes' device and message checks. Unit tests: the clamp rule, the kernel under the interpreter, the region splitting, the CPU clamp. api_signatures blessed (+16), api_surface table updated; REFUSALS.md unchanged on regeneration. Verified: not yet (Iris, lavapipe and Linux clippy are queued). (cherry picked from commit a63c3646dd5e3fad8b24e387c4adb0f94d635ac9) |
||
|
|
b30da69b50 |
Host RAM copies of runs of words take the pages copy's dispatches, not regions
The pages copy's table entries become three words: the run's first word in the scattered binding, its first word in the consecutive one (from the shape's first_word) and its words, at most a page's 1024. Each invocation copies its strided words below the run's count. Whole pages are entries of 1024 words, one a page as before, so their tables' entries, dispatches and windows are unchanged. In the runtime, a copy whose runs all end on a word (they already start on one, and the buffer's bytes too) takes the dispatches: plan() cuts each piece into runs of at most a page from its start and where a window of the buffer ends. Only runs that end off a word (rows of 1- or 2-byte texels), or a scatter whose runs write a byte twice (share_a_byte, so the later run's bytes stay as with regions), keep vkCmdCopyBuffer regions. The Iris measured regions at about 1.6 us of GPU and 1 us of CPU each (m3-max-8389: 8853 regions of a 31.5 MB surface, 14.0 ms GPU, against 0.99 ms for the page kernel over the same pages). Tests: the kernel's interpreter test of word runs (a word, 128, 129, a run across a page, a page less a word) with no word around them changed; the plan's cuts at a page and at a window's end; a device test of rows of 2044 bytes at a 2048 pitch from 16 bytes into a page, a run ending a word before a page's end, three pages and more from inside a page, one across the chunks' end and a word, with sentinels over every touched page, a dispatch per chunk and no region both ways, and a twice-named scatter of word runs by regions, the later run kept. The regions refusal case now ends off a word. The bench measures rows of 4-byte texels (dispatches), of 2-byte texels (regions) and 2046 bytes at a 2048 pitch. Docs: the kernel's module and entry docs, the copy module, both calls' API docs, HOWTO and the runtime README; signatures re-blessed (entry() takes the run's words and returns 12 bytes; ENTRY_WORDS). (cherry picked from commit 562fc5fc526cce2b31db280c4bbffb29314f8ac4) |
||
|
|
a0bebe78f1 |
runtime: copy runs of a guest RAM to and from a buffer on the GPU, from the chunk imports
`BlitCommandEncoder::copy_from_host_ram(ram, runs, destination, destination_offset)` gathers runs
of a `HostRam` the device uses into consecutive bytes of a buffer, and
`copy_to_host_ram(source, source_offset, ram, runs)` scatters them back (a runtime extension:
Metal has none). A surface that is a scatter of guest pages is copied straight from the RAM's
64 MiB chunk imports, with no view mapped per surface (one mmap per run) and no import made per
surface.
How: adjacent ascending runs merge, descending neighbours stay apart; runs are cut at chunk ends;
the 4 KiB pages become a table in the command buffer's upload arena, and each chunk the runs touch
takes one dispatch of the new `bind::pages_copy_module` (more only past the storage-buffer range
or the workgroup count). A chunk not imported yet is imported, or its pending import waited for,
as an object over it does.
Ordering: each chunk a copy uses gets a resource key placed over the chunk's host bytes in the
host-alias placements, the way no-copy buffers and heaps are placed, so the copy's chunk uses
(joined to at most 16 ranges per chunk) order against other copies and against every no-copy
object over the RAM's own addresses, in one encoder and across encoders; the buffer side is
tracked like any blit. A scatter's writes reach the RAM's dirty log as the GPU's in place, so a
copied backing over those pages takes them in at its next commit. Objects made over another
mapping of the pages (a view resolved through `with_runs`) are not ordered against the copies.
Refused with `Problem::HostRam`: an empty run, one off 4 KiB, one outside the RAM, a RAM the
device does not use, buffer bytes off a 4-byte word; no host import is `Unsupported`; bytes past
the buffer are `RangeOutOfBounds`. Replayed at rebinds (`BlitCall::HostRamCopy`). New counters
`host_ram_copies`, `host_ram_copy_bytes`, `host_ram_copy_dispatches`. README, HOWTO, the
API signature rows and docs/REFUSALS.md updated.
Verified:
- On this M3 Max (MoltenVK), --cfg m2v_gpu under nextest: the five new device tests
(`tests::host_ram_copy_device`: round trips byte for byte over ascending, descending, adjacent,
repeated and chunk-crossing runs into Shared and Private buffers; CPU writes before the commit
gathered and a scatter's bytes in the pages after completion; the two hazard cases in one
encoder and across encoders; a copied backing over the pages taking a scatter at the next
commit; the refusals) and the ten `tests::host_ram_device` tests: 15 passed.
- Negative controls, each a saved build: merging descending neighbours fails
`adjacent_ascending_runs_merge_and_descending_ones_stay_apart` and
`a_gather_and_a_scatter_move_every_runs_bytes_in_order` ("the gathered bytes"); not placing the
chunk keys over the host bytes fails
`copies_are_ordered_against_a_no_copy_buffer_over_the_same_pages` ("a later reader sees the
scatter"). The first control found the test pattern repeating every 1 KiB, so a page swap
went unseen; the pattern now differs per page.
- The `host_ram::copy` unit tests (merge, refusals, chunk cuts, the plan, the joined uses) and
`consumer_auto_traits`; clippy --workspace --all-targets --all-features -D warnings, plain and
--cfg m2v_gpu; rustdoc -D warnings; `signatures.py --check` after the bless; the refusal
surface `--check`.
- The ignored release bench `tests::host_ram_copy_bench` on the M3, a 3840x2054 BGRA8 surface
(31,549,440 bytes, 31,551,488 in whole pages) scattered over 1 GiB of shared RAM: 7703 4 KiB
runs (5490 descending neighbours, 7279 runs after the merge) take 16 dispatches, 0.35 ms of CPU in the call, 0.59 ms of GPU and 0.64 ms from commit to completion
for a gather (scatter 0.37 / 0.58 / 0.64). The view path at the host's 16 KiB page (1926 runs:
a view mapped run by run, a buffer `with_runs`, a buffer-to-buffer copy, the release) takes
1.58 ms to map, 2.36 ms to make the buffer, 0.99 ms commit to completion and 0.78 ms to
release; the gather of the same 1926 runs takes 0.14 ms CPU and 0.60 ms commit to completion.
Ported onto gate/stack27, where the device's thread imports a window of chunks ahead of the
objects (paced, with the memory lock released, short of maxMemoryAllocationCount and giving back
what no object took). The conflict was `RamOnDevice`'s fields alone: the copies' `ChunkKeys` sit
beside the window and its wake, and the old cursor is gone. The copy still takes each chunk
through `RamOnDevice::chunk(.., By::Object)`, the objects' own path, which now moves the window
past it, wakes the thread and clears the chunk's untaken mark; there is no second import path. The
copy module docs and HOWTO say so. The ignored release bench waited for every chunk imported
ahead, which the window never does; its warm-up copy now imports the chunks the runs touch.
The verification above was on the old base; this tree's is in the commit that follows.
(cherry picked from commit 923718777c198bef526dd07f701fc71a71e07b00)
(cherry picked from commit fa00224f7b29ab0359c8305a47da9c9273fc5d37)
|
||
|
|
d806c0a792 |
Write Boolean visibility results as the device's nonzero query result, without the resolve
Metal's Boolean visibility result is nonzero where any sample passed and 0 otherwise. The Apple M3 Max writes 1; Metal on the AMD Radeon Pro 5300M and the Intel UHD Graphics 630 (macOS 26.7.1, the reims-vgpu team's probes) writes the samples that passed. The runtime had a crate-owned dispatch (bind::visibility_resolve_module) after every pass with a Boolean offset whose only job was to rewrite that word to exactly 1. Under AGENTS.md rule 1 the device's native answer is the only form: a Boolean result is now the imprecise occlusion query's own result, which Vulkan states as "When any samples are passed, boolean queries will return a non-zero result value, otherwise a result value of zero is returned" (occlusionQueryPrecise). Across a split pass's render pass instances the combine still ORs the continuations, so zero stays zero exactly where no instance passed a sample. Counting queries stay precise. - Runtime: the resolve's plan, uploads, sets and dispatch are gone from visibility.rs, and OwnedModule::VisibilityResolve from owned_kernel.rs. A pass with no continuation now records only vkCmdCopyQueryPoolResults. The combine's in-place words are declared as shader reads and writes for every combined offset (they were declared only for Boolean ones). A new precision degradation, DeviceBooleanVisibility (device-boolean-visibility), is announced where a pass's Boolean results record; its catalogue entry is in docs/API.md section 9 and a device-gaps row in docs/FAST-PATHS.md, as for the other native-answer kinds. - Translator: bind/visibility_resolve.rs and its tests are deleted (VisibilityResolve, VisibilityResolveModule, visibility_resolve_module leave the public surface). Its shared helpers (windows, words_buffer, u32_value) move into visibility_combine.rs; the combine's plan tests take the two refusal cases only the resolve's tests held. No translation output changes. - Conformance: a new Loosening::Nonzero, and an allowance may name one element of a byte region as <site>/<byte offset>. The visibility family loosens each Boolean result's word, and only that word, by Nonzero, justified by device-boolean-visibility, which its Boolean cases also declare at the notices site. Every other word still compares exactly. No recording changes. README and docs/CONFORMANCE-COVERAGE.md (regenerated) say so. - Validation lane: every Boolean expectation reads the word by its contract (visibility::by_contract: nonzero and not the buffer's starting word reads as 1), in visibility, framebuffer_fetch, host_bytes, depth_never and amplified_draws; the notice is a new lane site (visibility::BOOLEANS) taken by boolean_results_announce_the_device_s_value and expected where other tests' notice sets are exact. boolean_results_are_copied_with_no_dispatch counts one query result copy and no vkCmdDispatch for a pass of two Boolean offsets. Verified: cargo clippy --workspace --all-targets --all-features -D warnings with --cfg m2v_gpu; the runtime's degradation catalogue and site tests, the translator's combine, owned-division, resolve-helper users', api_surface and api_signatures tests; the conformance suite's 1024 device-free tests. The device lane tests run on the M3 with the next step. (cherry picked from commit a4976cdc3734c21c1b9ed4cf603bbf6bab2523f0) (cherry picked from commit 34e44e3a12a46e6ff4b651cc4689002690d680fc) |
||
|
|
4b194d24af |
Write Metal's encoding through compressed BGRA10_XR blits under an exact-answers switch
What: a new DevicePolicy switch, `extended_range_blits` (ExtendedRangeBlitPolicy::Kept, the default, and ::Canonical, which `exact_answers()` selects). Under Canonical a blit or fill through a BGRA10_XR or BGRA10_XR_sRGB texture Metal keeps losslessly compressed writes Metal's canonical encoding: each 16-bit field's low six bits cleared and, for a blit, the alpha code clamped to [384, 894]. - bind::extended_canonical_module, a compute kernel that rewrites a texel range's words in place (bind/extended_canonical.rs, with extended_range_canonical as its reference and interpreter tests); the runtime owns it as OwnedModule::ExtendedCanonical. - The runtime (extended_canonical.rs): after a blit into such a texture, or out of one into another texture of the format, the written regions go out to a scratch buffer, one dispatch per region rewrites them, and they go back; after a blit out of one into a buffer, or into a texture over a buffer's bytes, one dispatch rewrites the words in place at the layout's rows. A fill's texel is encoded before it is written (fills clear the low bits alone: Metal's fill keeps alpha codes 4 and 1023 on the M3 Max under 27.0.1). A buffer the device cannot bind (offset or pitch off 4, past maxStorageBufferRange) or a texture over a buffer whose rows share bytes keeps the bytes and announces extended-range-bits-kept, as under Kept. Under Canonical the note is not announced for the blits it makes exact. - copy_from_buffer_to_texture's body moved into buffer_into_texture, which a fill's row copies call with Writer::Fill (so a fill announces its own wording and is never rewritten as a blit). Why: Metal's GPU blits through the compression rewrite these bits (measured on the M3 Max under macOS 27.0.1, plain Metal, xr_matrix: compression iff allowGPUOptimizedContents, shorter side >= 16, neither ShaderWrite nor PixelFormatView usage; every storage mode alike; CPU copies keep the bytes; fills clear the low six bits only). The device's copy keeps the bytes. It is the runtime's choice, not a native answer (no device arithmetic is involved: a copy's bytes), so per rule 1 the fast form stays the default and the exact form is the switch. Ledger: FAST-PATHS row (fast defaults), API.md section 1 bullet and the extended-range-bits-kept catalogue entry, the Degradation doc, the conformance Policy doc. Known gaps: the 28 rows of compressed-blits-bgra10xr and -srgb (7 sites x 2 formats x Apple M3 Max and llvmpipe) dropped: under the suite's exact policy those sites now hold Metal's bytes. RUNTIME_VERSION 1728 -> 1731 (a run under the exact policy writes other bytes). Also fixes forward a clippy needless borrow in engine_arith's pack test (7a99b93af2). Verified (M3 Max, macOS 27.0.1, MoltenVK 1.4.2; and lavapipe in scripts/linux-gate, arm64, LLVM 21.1.8 128 bits): - runtime_lane::compressed_blits on MoltenVK: both tests pass; the new extended_range_blits_write_metal_s_encoding_under_the_canonical_policy checks every direction, level 3 into padded rows, Shared CPU/blit mixes, texture to texture both ways, a fill of a compressed and a plain texture, and a copy into a texture over a buffer with padded rows, under both values (Canonical: Metal's bytes and no notice; Kept: the bytes and the notice once). - conformance replay of the four compressed-blits cases on MoltenVK: exit 0, the ledger as edited (bgra10xr and -srgb `announced` only for staged-texture-copy/shadowed-texture). - the full `conformance replay --cpu` on lavapipe at 68074019a3 and at this change: the only difference is the 14 llvmpipe sites of the two XR cases, which no longer diverge (divergent 244 -> 242, exact 458 -> 460); the 265 other ledger mismatches of that arm64 venue are the same at both (it is not CI's amd64 lavapipe). - 154 touched validation lanes on MoltenVK (blits, fills, extended-range, NaN, pack, padded, rotated, no-copy, two-plane heap): 143 passed, 10 failed, 1 ignored; the same 10 fail with the same messages and the same differing texels at 68074019a3 (pre-existing). (cherry picked from commit 612ff50b86bc29515b158d9b2596b14a45431467) |
||
|
|
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.
|
||
|
|
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.
|
||
|
|
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. |
||
|
|
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. |
||
|
|
5d09f454b4 |
Make the mipmap compute filter a plain bilinear filter in float
One work packet, landed as 4 commits (87ed7f903a..1af72fc0d8 on archive/development-linear-2026-10-28), in order: * Make the mipmap compute filter a plain bilinear filter in float The owner's decision for generate_mipmaps: the device's blit chain is the answer wherever the device blit-filters the format, and a compute filter runs only where it cannot (extended-range formats, formats without blits or linear filtering). That filter is a plain bilinear (trilinear in 3D) filter at texel centres in float, not a model of Apple's datapath. bind::mipmap_filter keeps its planning, scratch layout and first-level fetch, and drops the exact machinery: the measured answer tables, the reciprocal and tail models, the soft-float arithmetic and MipmapRule. The kernel decodes each field to float (Metal's 8-bit sRGB and extended-range sRGB tables, the packed floats and RGB9E5 exactly), sums the taps a linear sampler takes at the texel centres in tap order with no contraction, and encodes to nearest even. It needs no 64-bit integers. cpu.rs is the same filter on the CPU, the kernel's reference. The runtime still names the removed items; it follows in the next commit. Verified: cargo nextest run -p metal2vulkan --all-features --lib -E 'test(/mipmap_filter/) | test(/owned_divisions/)', 9 passed: every kernel validates on every committed profile, and the kernel run in the SPIR-V interpreter equals the CPU filter byte for byte over 38 formats and 9 shapes (arrays, cube, 3D, strips) and over 39 fetched first levels. * Make generate_mipmaps the device's filter: its blits, else the compute filter The owner's decision for generate_mipmaps: the device's blit chain (vkCmdBlitImage, VK_FILTER_LINEAR) is the answer for every format its blits filter, and the compute filter only where they cannot. No refusal for accuracy; refusals stay for what cannot run or what Metal refuses. mipmap_plan::plan_mipmaps now plans Blits, Picks or Filter. A filtered format takes the blit chain where the image's format has BLIT_SRC, BLIT_DST and SAMPLED_IMAGE_FILTER_LINEAR and the image takes transfers; it takes the compute filter where they lack (an extended-range format, an 8-bit sRGB texture held as its UNORM twin, a format without blits or linear filtering) and the filter computes the format in an image of its bytes. Otherwise the refusal names what the blits lack. The 1D refusal is gone (Metal makes 1D textures of one level, which are left as they are). Removed: the per-format first-use check against mipmap_answers.txt (mipmap.rs keeps only the blit recorder), mipmap_answers.txt, MipmapVerdict and Device::mipmap_generation, metal_release::MIPMAP_RULE, the texture facts' check cache, new_runtime_texture (only the check used it), and the degradation kinds mipmaps-within-spread and mipmap-tie-rounding. One kind replaces them: device-filtered-mipmaps (precision), announced once per device on both paths. WorkCounts::mipmaps_filtered counts compute-filter chains; image_blits_recorded counts the chain's blits. The filter kernel now decodes normalized, sRGB-step and extended-range codes by a product with a reciprocal rounded once to f32 instead of a division, so every operation is one Vulkan has a device round correctly and the CPU model is the device's answer on a device keeping f32 subnormals. The validation lane mipmaps_exact becomes mipmap_chains: the blit chain (work counts, each halving level within a code of the float filter, announced), every format the filter computes (the device's blits or the filter, the filter's levels byte for byte the CPU's), an extended-range texture announced as the filter, the picks, and the in-place fetch. texture_blits' every-format lane prints each format's way. Docs: API.md's catalogue, FAST-PATHS.md (a device-gaps row; the BGRA4Unorm gap's text), the runtime README, REFUSALS.md regenerated, api_signatures blessed, api_surface's table. RUNTIME_VERSION 1665 -> 1666 (mipmap behaviour changed) and the runtime-sources pin. Verified: cargo clippy --workspace --all-targets --all-features -D warnings, plain and with --cfg m2v_gpu; rustdoc -D warnings for metal2vulkan and the runtime; the runtime's whole suite plus the translator's surface, fast paths, refusal and mipmap tests (1180 passed); the runtime-sources guard. On lavapipe (scripts/linux-gate, arm64, --cfg m2v_cpu_icd), 13 passed: mipmap_chains (5), texture_blits' every-format lane, read_through_views' mipmaps, memoryless_uses (4), rgbx_textures' refusals and degrade_notices' site list. There the blits made 29 of the 38 formats the filter computes (87 chains), the compute filter made R8Unorm_sRGB, RG8Unorm_sRGB, RG11B10Float, RGB9E5Float, BGR10A2Unorm and the four XR formats (27 chains), each the CPU's byte for byte, and device-filtered-mipmaps was announced once. * Hold the device's filtered mipmaps among the conformance suite's native notes generate_mipmaps is now the device's filter (its blit chain, else the compute filter) and announces device-filtered-mipmaps: the device's own filtering, which rule 1 names, so it joins replay::NATIVE_NOTES beside device-sampling. Values still compare field by field. Verified on the merged tree (5a1a62bb0e + the mipmap commits): clippy --workspace --all-targets --all-features clean; nextest -p metal2vulkan-conformance -p metal2vulkan-runtime: 2140 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. |
||
|
|
b7a62be64b |
Drop the exact tile store: a loaded snorm or RGB9E5Float attachment keeps the device's load and store
One work packet, landed as 7 commits (c18e40911e..53fcb867b4 on archive/development-linear-2026-10-28), in order:
* Drop the exact tile store: a loaded snorm or RGB9E5Float attachment keeps the device's load and store
The owner's ruling (2026-10-27): the GPU's native answers are the contract,
with no exact emulation. TileStorePolicy and DevicePolicy::tile_store go,
with the load pass's rewrite of a signed normalized attachment's minimum
codes and an RGB9E5Float attachment's unnormalized words, and the
unused-bits module's two rules that served only it. The load pass keeps the
extended-range, padded and bfloat attachments, whose raw codes no device
holds as Metal's (capability). snorm-minimum-kept and shared-exponent-kept
still announce the native answer at each such draw; DriverFact::TileStoreIsMetals
still keeps them quiet on MoltenVK.
Docs: the ledger row and docs/API.md's policy bullet go; the catalogue
entries and the notices' docs drop the switch. The validation lane tests the
one form.
Verified: cargo clippy --workspace --all-targets --all-features -D warnings;
nextest of bind::unused_bits, tests::fast_paths, tests::owned_divisions,
api_surface and the runtime's degradation and catalogue tests (49 passed).
* Drop the exact color resolve: the device's average resolves every attachment it can
The owner's ruling (2026-10-27): the GPU's native answers are the contract.
ResolvePolicy and DevicePolicy::resolve go, with the crate-owned resolve
drawn after the pass for a format of Metal's rules on a device whose average
is not measured to be Metal's. The device's AVERAGE in the pass is the one
form there, announced device-rounded-resolve as before. The crate-owned
resolve keeps the resolves no device's average can write: an extended-range
attachment's raw codes, a resolve into the attachment's format's sRGB twin
(VUID-VkSubpassDescription-pResolveAttachments-00850), and a fetching pass's
sample planes, read in place of merging them back.
Docs: the ledger row and docs/API.md's policy bullet go; the shader-resolve,
device-rounded-resolve and unmeasured-resolve entries describe what remains
(unmeasured-resolve's cost text with them).
Validation: the lanes ran under exact_answers, so their expectations follow
the device's resolve: resolve_kind is device-rounded-resolve wherever the
average is not measured to be Metal's; the exact form's tests
(color_resolves_against_metals_rules, the caller's-image copy path, its cost
scout) go; the Maps-form and probe-6 resolves hold Metal's texels where the
fact holds and the announced bound elsewhere; shader-resolve's lane site
moves to the extended-range resolve lane.
Verified: cargo clippy --workspace --all-targets --all-features -D warnings,
plain and under --cfg m2v_gpu; nextest of fast_paths, the degradation and
catalogue tests, the runtime's resolve, sample-plane, framebuffer-fetch and
stand-in tests, and api_surface (129 passed). The device lanes were not run.
* Drop the depth twin: every Depth32Float texture is its D32_SFLOAT depth image
The owner's ruling: promise the GPU's native arithmetic, no exact emulation.
A Depth32Float texture the program only reads was held in an R32_SFLOAT
image with a D32_SFLOAT twin for comparisons, on a driver not measured to
keep every float in a depth image (plan_depth_twin), and a multisampled one
in R32_SFLOAT under MultisampleDepthTwinPolicy::Exact. Both forms exist only
to keep Metal's texel bits; the native form is the depth image, whose
possible clamp or denormal flush the existing notices already announce at
the write (restricted-depth-upload, depth-denormals).
Removed:
- MultisampleDepthTwinPolicy and DevicePolicy::multisample_depth_twin, its
FAST-PATHS row, its known-gap paragraph and its fast_paths choice.
- image_plan::plan_images, plan_depth_twin, holds_depth_in_colour,
holds_multisample_depth_in_colour, ImageFacts::depth_loss and
ImageFacts::multisample_depth_twin.
- The twin image of a texture (Image::twin), its copies in replace_region,
blits and host copies, Owner::HeapTwin and the heap plan's twin (heap_extent
now takes the image alone; check_heap_base the route alone; Mine is gone).
- The depth-twin degrade kind (Degradation::DepthTwin) and its docs/API.md
catalogue entry.
- The bind side: TextureFacts::depth_twin, TextureShape::Texture::depth_twin,
ImageViewDesc::twin and sampled_view's twin argument.
- A sparse Depth32Float texture is no longer refused for needing a twin.
- copy_unit refuses any depth format held in colour (none is now).
Tests: the twin tests are replaced by one that holds a Depth32Float texture
in its D32_SFLOAT image on every committed profile (single-sampled,
array, cube, render target, 2 and 4 samples); the heap and copy-plan unit
tests follow the one-image forms. The validation lanes that expected a twin
(texture_blits' upload lane, clear_reach, resolves' read-only depth pass,
texture_fills, heap_textures) now expect the depth image and its notices;
conformance's fill cases allow Depth32Float's digest unchecked where
restricted-depth-upload fires, as Depth32Float_Stencil8's already is.
RUNTIME_VERSION 1656: what a run of an unchanged pipeline does with such a
texture changes.
Verified: cargo clippy --workspace --all-targets --all-features -D warnings,
plain and with --cfg m2v_gpu; nextest of the translator and runtime
image_plan, heap, copy_plan, texture_facts, families, texture, degradation,
catalogue, fast_paths, profile, api_surface, bind and driver_facts tests
(973 passed). Device lanes not run.
* Drop the magnitude stand-in and the sign strip: a stored signed depth is tested natively
On the owner's ruling to promise the GPU's native arithmetic, a render target's
32-bit float depth that may hold a negative value or a NaN is no longer
switched on to render over a magnitude stand-in, and no pass strips the signs
of the words it did not write. The device's depth test compares the stored
value as it is and its pass keeps every bit; the runtime announces that
answer.
What goes:
- texture/signed_depth.rs, with the switch-on flags, the stand-in plans, the
write-backs and the sign strips in render.rs and render_pass.rs;
- Cause::Magnitude in attachment_stand_in.rs;
- the translator's DepthMagnitudeModule (bind/depth_magnitude.rs) and the
DepthStencilCopy::{DepthMagnitude, MagnitudeBits} draws;
- OwnedModule::DepthMagnitude;
- copy_plan's holds_unlike_its_stand_in;
- WorkCounts' signed_depth_switch_ons, magnitude_stand_in_passes,
magnitude_write_backs and sign_strips (and their counters).
What stays, describing the native answer:
- signed-depth-test is announced where a write (a host upload, a blit, a copy,
a written NaN clear, a new target's pattern loaded) may store such a value in
a render target's Depth32Float or Depth32Float_Stencil8 depth on a device
that keeps it and whose test is not Metal's (no
DriverFact::DepthTestComparesMagnitudes);
- where the device's test is Metal's own (MoltenVK), signed-depth-test is
announced only at a pass that loads and stores the depth and sets a state
with depth writes but draws under none, which keeps the signs.
The denormal notice no longer mentions the stand-in.
Docs:
- FAST-PATHS drops "A stored negative or NaN depth is tested by its magnitude"
and the matching known gap;
- FAST-PATHS also drops "A Depth16Unorm depth whose code the fragment stage
writes is tested after the stage" (the shader write is the translator's to
remove);
- API.md's depth-denormals and signed-depth-test entries now state the native
answer;
- doc comments the earlier steps left past 100 columns are reflowed, and the
remaining depth-twin mentions (bind docs, fast_paths' comment, three
conformance known-gap todos) are dropped.
Validation:
- depth_denormals' lanes check every read, sample and comparison against
Metal's, the depth tests only where the device's test is Metal's own, and
the notices where they now fall;
- the sign-strip lane is deleted;
- texture_blits expects signed-depth-test at the render-target upload.
Verified: clippy with all targets and all features, plain and with
--cfg m2v_gpu, across the workspace; rustdoc with -D warnings; the runtime's
nextest suite (1150 passed); the translator's touched tests (fast_paths,
catalogue, degradation, api_surface, depth_stencil_copy, owned_divisions,
profile, driver_facts, bind, policy: 671 passed); validation and conformance
non-device tests in the touched areas (230 passed). Device lanes were not run.
* Re-bless the API signatures and regenerate the refusal surface
The lane's removals leave the public surface without:
- MultisampleDepthTwinPolicy, TileStorePolicy and ResolvePolicy, with their
DevicePolicy fields;
- TextureFacts::depth_twin, TextureShape::Texture's depth_twin and
ImageViewDesc::twin;
- DepthMagnitudeModule and depth_magnitude_module;
- DepthStencilCopy::{DepthMagnitude, MagnitudeBits};
- Degradation::DepthTwin;
- WorkCounts' signed_depth_switch_ons, magnitude_stand_in_passes,
magnitude_write_backs and sign_strips.
The refusal surface loses four sites:
- the sparse depth-twin refusal (SparseHeaps, texture.rs plan_sparse_texture);
- the host heap's twin refusal (HeapTextureMemory, heap.rs host_heap_plan);
- the heap twin's DetachTextures site (heap.rs heap_texture_at);
- the sign strip's SeparateMultisampledDepthStencil site
(signed_depth.rs sample_strip).
Verified: python3 scripts/api-signatures/signatures.py --bless and
python3 scripts/refusal-surface/refusal_surface.py, then the api_signatures,
refusal, api_surface, published_crates, fast_paths and degradation_catalogue
tests (81 passed).
* Format the policy import lists after the half switches' removal
The rebase onto development (where the half-precision lane removed three policies) kept both lanes' removals; cargo fmt re-flows the shortened lists.
Verified: clippy (workspace, all targets, all features) clean; 709 touched tests (fast_paths, api_surface, api_signatures, catalogue, degradation, profile, bind, image_plan, published_crates, policy) pass.
* 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.
|
||
|
|
9bc1230b85 |
Resolve a YCbCr conversion's layout, range and matrix as its module is built
The steps this packet landed as, in order: - Bless the public signature table for the YCbCr conversion key - Re-pin the runtime sources at the landing tip Content: the tree of `development` at 9bf5d4dc24, unchanged. |
||
|
|
f29b4b4b4c |
Count the kernels the runtime builds inside a Metal call
Content: the tree of `development` at fcf0e41dc3, unchanged. |
||
|
|
35dd559a04 |
Bound a run of indexed indirect draws' index fetches in two dispatches
The steps this packet landed as, in order: - Announce a provoking mode past 1 at the draws Metal's third way draws otherwise Content: the tree of `development` at 107929f7b9, unchanged. |
||
|
|
a836b22821 |
Run loads, masks, blends and unstored passes into YCbCr attachments as Metal
The steps this packet landed as, in order: - Bump the semantics, artifact format and runtime versions for the eleventh stack Content: the tree of `development` at 02c396984e, unchanged. |
||
|
|
b0b61ac179 |
Time a fault that later failing encoders follow as Metal's GPU reaches them
The steps this packet landed as, in order: - Stop a running predicated loop at the GPU's recovery from a fault or a hang - Resolve multisampled extended-range targets by Metal's measured rules - Run the emulation's indirect mesh draws with an object function Content: the tree of `development` at 60cf488339, unchanged. |
||
|
|
642435208f |
Draw a run of direct indexed strips' lists in one dispatch
The steps this packet landed as, in order: - Draw far-start public draws under the last provoking vertex in the pulled list form Content: the tree of `development` at 77ada94845, unchanged. |
||
|
|
1d494932f7 |
Clear the object-grid lane's targets to zero before reading them as drawn nothing
The steps this packet landed as, in order: - Run any object grid Metal runs, in pieces within the task stage's limits - Upload a folded object draw's fold when it launches nothing too - Run an unfolded object stage's direct grid as Metal does when its threads wrap - Bump the semantics, artifact format and runtime versions for the seventh stack - Pin the runtime sources of the seventh stack - Bless the golden hash tables over the seventh stack Content: the tree of `development` at a6f6b269ad, unchanged. |
||
|
|
3bd3f8ace2 |
Skip mesh pipelines that read weights where the device has no barycentrics
The steps this packet landed as, in order: - Gather the lists of indirect draws in runs, planned on the GPU - Regenerate the refusal surface over the indirect gather Content: the tree of `development` at 9aa8e75be9, unchanged. |
||
|
|
54e399ca25 |
Draw indirect mesh grids as Metal does, through an arguments pass on mesh-shader devices
The steps this packet landed as, in order: - Regenerate the refusal surface after the indirect mesh draws - Read the task limits through the profile's public limits in the mesh draws lane - Name VK_EXT_post_depth_coverage in the candidate's enable list - Re-bless the opened chains, and let a late depth test behind an imageblock writer link - Withhold the mesh shader extension's features with it in the mesh lane Content: the tree of `development` at 3e1d7fbbe1, unchanged. |
||
|
|
c83dcdd384 |
Give the predication step ops that drop, hold and resume a range, and check a unit's end
The steps this packet landed as, in order: - Answer command predication as Metal does on an M3 Max under macOS 27.0.1 - Probe Metal's command predication from the validation crate's Metal platform - Wait for the predication probe's command buffers through the bounded wait - Name the record a predication block left open came from in its command buffer's failure - Refuse a run's first indirect dispatch of another dispatch type at Metal level 26.7 - Read an encodeEndDoWhile's word only where it closes a live DoWhile - Run command predication on devices without buffer device addresses - Nest predicated loops to any depth, their copies bounded by what they lay down - Read a predication word past its buffer as Metal reads it - Halt a predication unit where a loop runs past its copies - Name the lane's fixed loop case type, which clippy found too complex Content: the tree of `development` at ef8b74ec1b, unchanged. |
||
|
|
0d9e71903b |
Read VK_EXT_provoking_vertex: provokingVertexLast and provokingVertexModePerPipeline
The steps this packet landed as, in order: - Write the index rewrite pass's primitives in either provoking vertex order - Draw Apple's last provoking vertex: a last-vertex pipeline, else lists led by it - Test Apple's provoking vertex modes against Metal's on the device - Describe the provoking third way as pipeline-dependent; fix the table test - Check the last provoking vertex through a geometry stage; key its slice notice on stages - Test that executions keep the first vertex; scale the weights check by the values - Register rt6_provoking in the engine inventory and golden printouts - Add host_ab's provoking workload: flat-shaded draws at provoking vertex modes 0 and 1 - Add the index gather pass: one dispatch for a run of direct draws' lists - Gather direct indexed draws' lists in runs: one dispatch per run, not three per draw - Add the rotated-weights variant: Metal's barycentric weights from a rotated triangle - Count private lists' gathers under a last-vertex pipeline; take the open runs whole - Draw listed triangles' barycentric weights through the rotated-weights variant - Draw every provoking vertex mode past 1 the third way, its top bit set or not - Announce nothing for a provoking-mode draw that makes no primitive Content: the tree of `development` at 91b1df7b21, unchanged. |
||
|
|
b30642f159 |
Merge a GPU replay's draws of one list type or points into one draw in the translator
The steps this packet landed as, in order: - Draw a GPU-written render execution of one list type or points as one merged draw - Reset an indirect command buffer's records on the GPU with one fill - Regenerate the refusal surface after the merged draws, rebased onto development - Regenerate the refusal surface over the host-step cause Content: the tree of `development` at 99ae896ad5, unchanged. |
||
|
|
f05f8a5a94 |
Count a replayed draw's misses of the buffers its slot tables do not hold
The steps this packet landed as, in order: - Run GPU-written render commands on the GPU alone, and let a check state what it looks for - Say that a check of every kind runs on the GPU alone where the records rule out both kinds - Pass what the check looks for in the compute lane's checked execution - Add host_ab's icb_draws workload: a kernel writes the draws of Apple's GPU-encoded ICB sample Content: the tree of `development` at 665d587ae2, unchanged. |
||
|
|
3d9304798d |
Add host_ab's icb workload: a kernel writes compute commands that a second encoder executes
The steps this packet landed as, in order: - Run GPU-written compute executions on the GPU alone by indirect dispatches where the device has no generated commands - Run a concurrent encoder's GPU-alone execution with no barrier between its commands Content: the tree of `development` at 343b1abcb4, unchanged. |
||
|
|
62370dc95a |
Fetch a BGRA8 or RGBA8 shadow's texels through its own view in cut merges
Content: the tree of `development` at ed95238f3d, unchanged. |
||
|
|
b253a0ad98 |
Convert a two-plane YCbCr texture only where its planes changed since the last conversion
Content: the tree of `development` at b3c5e804ad, unchanged. |
||
|
|
0a7b64f41d |
Bind the last set 0 again, and settle a dispatch once, where nothing it reads changed
The steps this packet landed as, in order: - Ask a heap texture's image requirements once, and take owned kernels' sets from spare pools - Find a replayed draw's pipeline where its state's last draws found it Content: the tree of `development` at 6f29d4516f, unchanged. |
||
|
|
5783db2459 |
Keep a fetched merge's texels in an image copy of its shadow, the kept images held per queue
A fetched merge keeps its texels in an image copy of its shadow where the copy in takes no keep, and kept images are held per queue and taken by any later keep of the same shape once its encoder ended, so merges stop making a new image each time. Folds in: - Keep a fetched merge's texels in an image copy of its shadow where the copy in takes no keep - Keep merges' kept images per queue, taken by any later keep of the shape once its encoder ended Verified by each folded change's own checks; the tree this series ends on is the one verified at the tip on six GPUs, the CPU suites and lint (see the tables commit). |
||
|
|
b660f64e17 |
Copy equal rows between buffers as one dispatch on ANV and the RTX 5080 Laptop, and split long copy regions
A copy of rows between two buffers whose rows lie apart is one vkCmdCopyBuffer with a region per row, and ANV records each region as a blit operation of its own. In a guest frame's profile on the Iris Xe one such copy a frame took about 15.7 of the recorder thread's 19 ms. ANV's recording time for a single region also grows with the region's size at some sizes: one two-plane YCbCr texture's planes copied into its staging buffer cost about 15 ms of the recorder's time a frame. Row copies: - Every copy of rows between buffers goes through one place, row_copies.rs (RowCopies): a blit between a buffer and a texture over a buffer or between two textures over buffers (through its overlap scratch too), a buffer-texture copy's rows through its staging buffer, and every shadow's copy back out of its staging buffer, wherever it records: a render pass's steps between instances and before tile dispatches, a rotated texture's store, and a heap's two-plane and tiled textures' copies back. - RowCopies makes the copy one dispatch of the new translator kernel bind::rows_copy_module (RowsCopyModule) where the device is measured to run it faster (new DriverFact::RowCopiesDispatchFaster), the copy has 2 or more regions of the same size in whole 4-byte words, 4-byte aligned, evenly spaced with destination rows at least a row apart, and it fits the device's storage buffer range and workgroup counts. Invocation (x, y) stores word x of source row y at word x of destination row y and writes nothing else, so the bytes are the copy's. Every other copy stays regions. The kernel's set 0 is pushed through the device's checked push command where VK_KHR_push_descriptor exists, else allocated from a pool the command buffer keeps; the callers name the dispatch's accesses so the tracker orders it. - The fact holds on ANV (Mesa 26.2.4, keyed on the driver, so it covers the measured Iris Xe and UHD 770 identities) and on NVIDIA 615.71.09 on the RTX 5080 Laptop GPU. RADV is not listed: its GPU time rose 3 to 5% at 1080 rows. Long copy regions: every vkCmdCopyBuffer the runtime records goes through Vk::cmd_copy_buffer, which records each region over 16 KiB whose size is no multiple of 4 KiB as two regions of the same command, its bytes up to the last whole multiple of 4 KiB and the rest. The same bytes are copied by the same command, so the split is exact on every device and is not keyed to a driver; five helpers that recorded copies through a bare ash::Device now take the device's functions. Counters: WorkCounts::row_copies, row_copy_regions, row_copy_regions_most, row_copies_dispatched, copy_regions_split, and copy_sites, which names the places in the runtime that recorded buffer and image copies with their calls and regions (the device's checked functions record them through #[track_caller] methods). The runtime re-exports CopySite. Docs: docs/HOWTO.md's copies section, row_copies.rs, device/functions.rs, WorkCounts. Verified, as the commits state: - runtime_lane::row_copies::row_copies_cost (release, one blit a frame of 1920 BGRA8Unorm rows into rows 8192 bytes apart): 1080 rows on the Iris Xe CPU 3.1-3.3 -> 0.28-0.40 ms and GPU 5.3-7.8 -> 1.13 ms; on the UHD 770 CPU 0.77-0.83 -> 0.04-0.11 ms and GPU 3.3-5.3 -> 0.59-0.91 ms; on the RTX 5080 Laptop GPU 2.03-2.05 -> 0.42-0.43 ms. - rotated_textures::rotated_surface_frame_costs (1920x1080 BGRA8Unorm, release, UHD 770): rotation 1 clear+draw 4.41/4.43 ms against 7.24-8.24 ms, rotation 2 3.59-3.88 against 5.11-5.73 ms. - span_copy_cost on the UHD 770: one region of 8,294,411 bytes recorded in 0.018-0.020 ms against 28.4-35.1 ms, its GPU time 0.64-0.66 against 5.97-5.99 ms; the YCbCr frame 2.89-2.98 against 6.80 ms of GPU. On RADV and NVIDIA the split recorded in the same CPU time and ran within about 10 us of GPU time where one region was already quick, and faster where it was not (8,294,411 bytes on the RTX 3090: 1520 against 6051-6061 us). - Copy lanes with every byte checked under the validation layer (rows between buffers, a shadow's staged rows going back as one dispatch, blits of textures over buffers, textures over bytes past their VkBuffer) pass as dispatches on the UHD 770 and the RTX 5080 Laptop GPU and as regions on lavapipe; the rotated, tile-shadow, two-plane heap and heap-layout lanes pass on the UHD 770 with each rotated store's rows going back as a dispatched copy of rows. long_copies_of_any_size_copy_metals_bytes (prime sizes and offsets) passes on the UHD 770, the RX 7900 XTX, the 780M and the RTX 3090, and the YCbCr, blit, pitched-surface, no-copy, first-use, fill and frame-cost lanes pass on the UHD 770. - tests::exit_guard::only_the_listed_modules_keep_the_device_s_functions (the push goes through the checked functions), bind::rows_copy, the driver_facts tests, owned_divisions, api_surface, and the runtime unit tests named row_copies, work_counts, functions, copy, shadow, first_move and ycbcr; clippy in every configuration and Rustdoc. |
||
|
|
f514cb9a7d |
Cut shadowed textures' copies to what their commands touch, merge back every buffer another writer may write, and count copies by cause
A texture over a buffer's bytes or another image whose own image is a shadow now copies in, keeps, merges and copies back only the texels its commands reach, with fewer barriers, descriptor pools and scratch fills, and merges its writes back wherever another writer may write the bytes during the run. What changes: - Which shadows merge. A shadow merges back (kept before the first command that writes through it, only the words its commands changed reaching the bytes) over every buffer's bytes but a tracked Private or Memoryless buffer the runtime made: Shared buffers and host pages as before, and now Managed buffers (on unified memory the CPU writes the GPU's memory, and without it a later upload may run on another queue) and untracked buffers another queue may write. A tracked Private buffer's shadow, a command replacing every texel, an image's shadow, and turned and two-plane textures still copy back. A merge goes in place wherever the texture's first and last words lie in the buffer and the bytes lie in pages; only a first byte inside a word, a staging buffer or a last word past the buffer still merges through a copy, a new FAST-PATHS known gap since that round trip can undo another writer's write between its copies. - Correct merges. A command that replaces every texel followed by one that writes part of it is copied back before the keep, so the merge carries the later writes. A merge of a part leaves a twin stale there alone. A detached buffer's shadow binds no stand-in (the null handle while detached), so no merge binds a range past a 256-byte stand-in. - Cut copies. A read inside a rectangle keeps the rest of the changed rectangle for the next read; an image's one-level, one-slice shadow cuts its copies in as a buffer texture's do; a keep and merge are cut to the rectangle the encoder's commands write in, in bands within the device's limits; a loaded shadowed colour's copies are cut to its draws' scissors also in passes that clear another attachment or take a reach clear (Vulkan's scissor test leaves coverage outside at 0). - Cheaper copies. On ANV (DriverFact::ShadowCopyBackDispatchFaster, now every ANV device measured) a merge's keep and changed copy are the copy back's dispatch, and a cut merge reads the changed texels straight from the shadow's integer view (bind::shadow_merge_image_module), with no copy after the commands. On the UHD 770 (new DriverFact::ShadowCopyInDispatchFaster) a merged shadow's copy in and its keep are one dispatch (bind::shadow_copy_in_module), its 4-byte view R8G8B8A8_UINT because ANV drops a storage image's compression for an R32 view. The shadow kernels take a bind::ShadowTexelView. A cut merge's scratch is kept for the next merges and not zeroed. The shadow kernels and a linear attachment's merge push their descriptors where the device pushes set 0, so a shadowed pass makes no descriptor pool. A run of shadow copies in an unordered encoder shares one barrier before and one after, keeping a barrier only between copies that touch the same memory and one writes. - Counters (WorkCounts): every copy in by why it is made and by what holds the texture's truth, first copies apart (shadow_texels_first_copied_in_*, shadow_texels_recopied_*, shadow_texels_copied_in_images, shadow_texels_bounded_copied_in), shadow_texels_kept, shadow_merge_copies_dispatched, shadow_merges_fetched, shadow_copies_in_dispatched, shadow_merge_scratches_reused and _zeroed, owned_descriptor_pools, how passes take shadowed colours (shadow_attachment_loads_*, _clears, _clears_in_part), shadows_sharing_truth, and the tiles a loaded colour's scissors cover against their bounds. - Docs: shadow.rs and shadow_merge.rs module rules, API.md's shadow entries, FAST-PATHS' costs of matching Metal and known gaps; the snapshot rule's figure is now an upper bound. Why: Metal writes only the texels a command writes, and another writer may write bytes no command touches during a run. On an M3 Max under macOS 27.0.1, a fill of an untracked Private buffer from a second queue ran inside a first queue's kernel or render pass 5 times of 6 and both texels kept their writes, as did a CPU write to a Managed buffer; a tracked Private buffer's fill always ran after. And in the consumer's Finder drag on the Iris Xe, whole 1080p shadow copies were most of the composite command buffers' GPU time. Verified: - Iris Xe, four shadowed textures a frame over anonymous pages, commit to completion: merged passes that draw 11.7-11.8 ms -> 5.0-5.4 ms and scissored ones 11.3-11.4 -> 3.6-3.9 ms across the dispatched copies, cut keeps and fetched merges; a 1080p Load pass's GPU time 4572 -> 3484 us with the fetched merge. - UHD 770: a 1080p Load/Store pass 2390 -> 1683 us GPU with the fetched merge; a 1080p Load pass 1.64-1.67 -> 1.43 ms with the fused copy in; the kept scratch took a 1080p Load pass 4205-4755 -> 2626-3595 us commit to completion (RX 7900 XTX 4112-4392 -> 1628-1697 us). Shared barriers saved about 0.65 us of GPU time per barrier removed on the Iris Xe (680 -> 120 barriers a frame). - runtime_lane::pitched_surfaces 28 of 28 on the UHD 770, Iris Xe, Radeon 780M, RX 7900 XTX and lavapipe, with merges under changing scissors, split instances and two textures over one buffer matching a private texture's bytes; under synchronization validation with no message. The shadow lanes 123 to 132 of 123 to 132 on the M3 Max, lavapipe, Iris Xe and RADV; extended_range_blends, linear_attachments and padded_loads on the RTX 5080 with no validation message. - Unit tests: tests::shadow (24), clear_reach, owned_pushes, shadow kernels through all four views on the CPU interpreter, driver_facts. clippy -D warnings (plain, m2v_gpu, m2v_cpu_icd), rustdoc. |
||
|
|
697c55d514 |
Announce a loaded snorm or RGB9E5 attachment's kept codes, and store them as Metal's tile store does under TileStorePolicy::Exact
Metal's pass, once it draws, writes each 32x32 tile a draw reaches back through its texels'
values: a signed normalized channel's minimum code (-128, -32768) reads as -1.0 and is stored as
the code above it, and an RGB9E5Float word whose largest mantissa is below 256 under an exponent
above 0 is stored normalized. A Vulkan pass's load and store keep those bytes.
What changes:
- New degradation kind snorm-minimum-kept (Precision), announced at every draw and indirect
execution in a pass that loads a single-sampled R8, RG8, RGBA8, R16, RG16 or RGBA16 Snorm colour
attachment and keeps it, naming each such attachment. It joins shared-exponent-kept for RGB9E5.
- New DevicePolicy::tile_store, TileStorePolicy { Device (default), Exact }; exact_answers()
selects Exact. It is the runtime's choice alone and keys no profile. Under Exact the load pass
that already rewrites extended-range, padded and bfloat attachments also takes a single-sampled
snorm or RGB9E5Float attachment in the tiles the pass's draws reach, with two new
bind::unused_bits_module rules (SnormMinimum, SharedExponent; the module is keyed by
PixelFormat), and nothing is announced. An attachment the load pass cannot take keeps the
device's load and store, announced.
- New answer fact DriverFact::TileStoreIsMetals for MoltenVK 1.4.1 on Apple's GPUs: its render
pass is a Metal render pass, so its tile store is Metal's for both kinds. There neither value
adds a load pass or a notice.
- Docs: one FAST-PATHS row for the switch, its cost the load pass's measured GPU time; a known gap
for lavapipe, which states no blend for any snorm format, so a blending snorm pipeline is
refused there; API.md's policy bullet and catalogue entries; the unreached-tiles-rewritten text.
Why: a code no Metal write leaves, but uploaded or copied bytes may hold, reads back differently
after a drawing pass. The exact form costs a copy of the render area through a dispatch before
every such pass, so the device's store stays the default, announced, and Metal's store is a
switch away.
Verified:
- Metal's behaviour probed on an M3 Max under macOS 27.0.1 (70x40 targets of five snorm formats):
a pass that draws nothing moves no code; a tiny triangle moves every minimum code of its first
32x32 tile and none elsewhere; a blended full-target draw moves all of them; a blit there and
back moves none. The guest's sweep showed the same on R8Snorm and RG8Snorm.
- Unit tests: unused_bits (both rules against CPU models over every code, the M3's example
RGB9E5 word, the masked-tile rewrite), fast_paths (the row, no profile key), driver_facts,
api_surface, owned_divisions: 38 passed on gem10.
- runtime_lane::snorm_tile_store under Device and Exact for both kinds, asserting load-pass
counts, bytes and notices: on lavapipe with padded_loads, extended_range_blends and the notice
site check, 15 passed (Exact took the load pass, Device announced); on the M3 Max under
MoltenVK 1.4.1, 4 passed through the fact (no load pass, no notice) and 11 more beside them.
- The load pass's cost (FAST-PATHS): on the Radeon 780M, a 1080p pass per frame of BGRA10_XR
1958.8 us against RGBA16Float's 135.3 us; the snorm and RGB9E5 cases take the same pass, not
timed alone.
- clippy -D warnings (plain, m2v_gpu, m2v_cpu_icd) and rustdoc.
|
||
|
|
930d746df7 |
Read ASTC, ETC2/EAC, PVRTC and 4:2:2 textures the device lacks through twins of Metal's decode
On a device without a texture's compressed or chroma format, the runtime now makes the texture and
reads it as Metal does. Before, such a texture was refused at its making (ASTC, ETC2/EAC) or at its
first read (PVRTC, 4:2:2, held for copies alone). The consumer's guest on the RTX 5080 stopped at
ASTC_8x8_LDR, PVRTC_RGB_2BPP and EAC_R11Unorm. NVIDIA, RADV and lavapipe have none of these formats,
and Vulkan's 4:2:2 formats need a sampler Y'CbCr conversion whose chroma reconstruction is the
implementation's.
What changes:
- The store. The blocks lie in a carrier image of the same block bytes and shape (a compressed
format the device copies: BC1, BC4, BC7, BC3, BC2, BC5, ETC2, EAC or ASTC 4x4; R8G8 for 4:2:2).
replace_region, get_bytes, blits, fills and texture copies move Metal's blocks unchanged.
- The twin. Reads go to a decoded twin holding Metal's decode, kept in step on the GPU as a BC
texture's twin is: a decode pass after a blit, a texture copy or a submitted CPU copy, and a CPU
decode on the device's decode thread after a host write. No write costs a GPU-to-CPU round trip.
A write's decode covers whole levels for PVRTC and whole rows for 4:2:2, whose texels read their
neighbours. A new texture's twin starts at the decode of zero blocks (magenta for ASTC's error
block), not at zeros.
- The decoders, our own, written from the Khronos ASTC specification, the Khronos Data Format
Specification's ETC2 and EAC chapters, and Metal's measured answers for PVRTC1 and 4:2:2:
bind::AstcDecode, EtcDecode, PvrtcDecode and ChromaDecode, with their GPU kernels
astc_decode_module, etc_decode_module, pvrtc_decode_module and chroma_decode_module on the block
decode's bindings (new api_surface rows, with AstcTexels, EtcTexels and DecodedTexelsPolicy).
- Metal's decode, matched: an ASTC LDR channel is (C >> 4) / 4095 of the 16-bit interpolated C;
an 8-bit ETC2/EAC channel c / 255, an 11-bit one c / 2047 (signed c / 1023); PVRTC upscales
colours A and B from the four block centres around a texel and blends them by its index; a 4:2:2
texel takes its own green, and red and blue (3c + n + 2) >> 2 of its pair and the pair beside it.
- sRGB forms. The ASTC, PVRTC and ETC2/EAC sRGB formats read their twin's codes raw through an
R8G8B8A8_UNORM view and decode them through Metal's table, as the 8-bit and BC sRGB formats do:
reads, nearest samples and gathers exact, with no precision notice. Linear samples keep the
device's sRGB filter (the exact sum under SamplingPolicy::Exact). A device that has the ASTC
block keeps its own sRGB decode. The linear PVRTC and 8-bit linear ETC2/EAC formats take BC1 to
BC3's Argb8 texel class, so under TexelConversionPolicy::Exact their reads are Metal's c / 255.
- The switch: DevicePolicy::decoded_texels, DecodedTexelsPolicy { Compact (default), Exact };
exact_answers() selects Exact. Compact holds an ASTC LDR twin in 8-bit codes nearest Metal's
12-bit value (at most 1/510 off) and an EAC 11-bit twin in the nearest 16-bit codes, announced
decoded-texel-precision. Exact holds their floats. PVRTC, the 8-bit ETC2/EAC formats, the ASTC
sRGB formats and 4:2:2 are exact under both. Tested by fast_paths; a FAST-PATHS row.
- Views in the other colour space. An ASTC texture viewed in its other colour space reads a second
twin, made at the first such view: Metal reads that view exactly as a texture of the view's
format over the same blocks, and the two forms widen endpoints apart, so one twin cannot serve
both. Its decodes are queued on the device and recorded by the next batch with work. Counted by
WorkCounts::second_twins, second_twin_checks and second_twin_decodes. PVRTC and 8-bit ETC2/EAC
views of the other colour space share the one twin.
- Copies between a compressed texture and an uncompressed one whose texel is the block's bytes
(BC1 or ETC2 with RG32Uint, BC7 or ASTC with RGBA32Uint) run with Metal's rule: every coordinate
in the destination's texels, a block per texel. They were refused as formats of different units.
- Notices: carried-decoded-twin (Performance) on every twinned texture; decoded-texel-precision
(Precision) only for an ASTC LDR or EAC 11-bit twin under Compact.
- Typed refusals: RuntimeGap::DecodedHeapTexture (a heap's ASTC texture, a sparse heap's carried
texture; the heap size query refuses alike); views of the ASTC HDR form, of another footprint or
PVRTC block, and of an EAC 11-bit format as its other signedness (Unsupported(TextureView));
copies between PVRTC and an uncompressed format, between two compressed formats of one block size
and different extents, and level or slice copies between compressed and uncompressed formats
(NotImplemented(Format)). A device with the native format keeps the direct path.
- Docs: the API.md catalogue entries, the FAST-PATHS decoded_texels row and known gaps, and the
module docs of astc.rs, etc.rs, pvrtc.rs, chroma_pairs.rs and decoded_twin.rs.
Why: Metal makes, reads and samples these textures on Apple GPUs, and the consumer's guest uses
them; the desktop Vulkan drivers have no such formats.
Verified:
- Metal's answers, probed on an M3 Max under macOS 27.0.1: ASTC (seeded random blocks, all 14
footprints, linear and sRGB, read as float and half) bit for bit, digests pinned by
seeded_blocks_read_as_metal_read_them; ETC2/EAC (4096 random blocks of each of the ten formats)
digests equal; PVRTC (all eight formats) every digest equal; 4:2:2 every read, sample and gather
bit for bit what an RGBA8Unorm texture of the decoded codes answers; the copy rule on every listed
pair both ways.
- On the CPU SPIR-V interpreter each GPU kernel writes the CPU decode on every texel: ASTC on every
footprint, linear and sRGB, Float and Unorm8, with blocks covering all 16 endpoint modes, every
partition count, dual plane and void extent; ETC on every decode and both texel forms; PVRTC on
every format. The kernels are valid on every committed profile.
- Runtime unit filters 63 passed and translator unit filters 183 passed (ETC2/EAC); the runtime's
unit suite 952 of 953 (the one failure the recorder's module-list test, fixed with the recorder).
- On lavapipe: chroma_pairs, pvrtc_textures, the mipmap, fill, buffer-texture and degrade-notice
lanes, 45 passed; format_copies, the whole module. A lavapipe batch caught PVRTC codes read one
ulp high under exact answers, fixed by the Argb8 class.
- clippy -D warnings (plain, m2v_gpu, m2v_cpu_icd) and rustdoc on ms01 and gem10.
|
||
|
|
0175289314 |
Batch the development-fast round: tessellation without tessellationShader, primitive ids, mesh tooling, color groups, the vk12 floor, runtime timing and teardown fixes
One commit of the 247 on development-fast (720ef1ce9a..9f46fdf80d), squashed at the user's request. Translator: - Tessellation on a device without tessellationShader: Metal's tessellator emitted as SPIR-V, a one-workgroup scan placing each patch's triangles in Metal's order, and the post-tessellation function as a plain vertex stage (EmulatedTessellationDraws; SEMANTICS 1739, ARTIFACT_FORMAT 419). - [[primitive_id]] on a device without geometry or tessellation shaders, as a flat varying the vertex function writes; indexed lists, lines and points drawn de-indexed (RuntimeGap::PrimitiveIdIndices). - Fragment functions of more colors than the device draws at once, compiled in color groups (PrecisionNote::ColorAttachmentGroups). - Object functions' threadgroup memory from the render encoder; a kernel's mesh draws from an indirect command buffer; mesh payload sizing. - The Vulkan 1.2 floor profile (vk12-floor) and the gates it needs; Metal 27.0.1 answers as the M3 Max. - Overflow tests in the runtime-built modules by the product's high word (NVIDIA's compiler fails the division form), guarded crate-wide by tests::owned_divisions. Runtime: - Color-group passes replayed per group over twin depth/stencil; snapshot and copy-back cost cuts. - Command buffers finish on the queue waiter that saw them; the waiter holds no device handle, so a program's drop after its wait is the device's last. - Every object an encoder was handed held until its command buffer completes; deallocator order and announcements. - Driver defects recorded and announced: ANV counts a visibility sample once per color output (visibility-count-per-color); MoltenVK fails pending work when memory that held a device-address buffer is freed, so freed memory waits for the work in flight (host-deallocator-delayed). - RenderCommandEncoder::set_object_threadgroup_memory_length; Visibility::counting(). Validation: mesh tooling (object, mesh and ICB-mesh cases on both executors), the authoring census closed, the queue storm judged in Metal's unit, load-robust exits and indirect-census bounds, and the golden hashes, printouts, fixture inventory and authored compile census blessed. Docs: FAST-PATHS.md trimmed to a ledger of what is true now; API.md's catalogue and accepted differences, REFUSALS.md and METAL-COVERAGE.md current. Verified on development-fast before the squash: the full suites on the RTX 5080, RTX 3090, RX 7900 XTX, Radeon 780M, Iris Xe, lavapipe and the M3 (MoltenVK and the Metal oracle), lint in every configuration, rustdoc, doc tests, packaging and public case qualification; the timing and teardown lanes x5 on every venue; the authoring-capability census 16656/16656 with 0 unresolved, the vk12-floor translation census at 6139 translated with the slowest row 794 ms and peak 126 MiB. The tree is development-fast's at 9f46fdf80d. |
||
|
|
13b279df1b |
Squash 11203 commits of translator, runtime, and validation work
Rolls up everything since
|