442a9fd5385c9178607ef8d8b2d59d654cb790a4
187
Commits
| Author | SHA1 | Message | Date | |
|---|---|---|---|---|
|
|
9bd91540f4 |
Take the device's answers for fast atan2, half fmod and precise pow's NaN; delete exact sRGB leftovers
- fast::atan2 without every fast-math flag divides by the device's own
reciprocal of x; past 2^126 the denormal it makes is the device's
(DeviceDenormals through MetalFloatDenormals; NativeDivision as before).
FastAtan2 { reciprocal_flushed } -> FastAtan2 { by_reciprocal }.
- A half fmod answers its float remainder rounded; the Metal zero-sign
select is gone and the call records NativeTranscendentals through
FloatFn::half_zero_of_float.
- Precise pow's NaN is classed BaseToExponentOne, so it records
NativeNanEncoding like fast pow and atan2 (the measured() exclusion
was left over from the removed pow(x,1) bit fix). Fast sin/cos keep
DeviceNanEncoding on purpose: Metal answers +0 there, no NaN to stand for.
- Delete the exact sRGB pack/unpack's dead code: ArithPlan::srgb,
Declared::srgb, SRGB_PACK/SRGB_UNPACK, srgb::TABLE_WORDS,
math::unpack's normalized and sRGB branches (UnpackRounding,
unpack_rounding, mul_exact, unpackable), word::srgb_code.
WordAttachment::output_word returns Option<u32> (None for Srgb8).
With the mipmap filter on the transfer (c9dd35e8a4), srgb's declare/
word/step and SRGB_ENCODE_FIRST lost their last users and go too, with
their texel_round test; SRGB_DECODE_STEPS stays for the ASTC and PVRTC
decoders.
- FAST-PATHS: row 58 names half fmod; known gaps lose the atan2 and
half-fmod lines. API.md: native-transcendentals, native-nan-encoding.
- SEMANTICS_VERSION + 1.
Verified: fmt, clippy (all features, m2v_gpu), rustdoc; metal2vulkan
arith/word/fast_paths 241/241, engine call notes + public fixture
expectations 20/20, api_signatures+api_surface 15/15, runtime 29/29,
validation c3 72/72; the atan2 tests FAIL on the old flushed reciprocal.
No conformance case reaches atan2, fmod or pow. Golden hashes: 21 rows x
19 profiles move (fast_atan2.f32 and fmod.f16 fixtures), re-blessed on
development.
One work packet, landed as 2 commits on archive/development-linear-2026-10-29: abb2b3db6e, then f76cdba457 (the re-pin).
|
||
|
|
67a1651f35 |
Filter mipmaps by the device's arithmetic, not Metal's tables
The mipmap compute filter takes the device's arithmetic (pack.rs's sRGB transfer and half conversions), and the validation guard lists the translator files it now reaches. One work packet, landed as 5 commits on archive/development-linear-2026-10-29, in order: * Filter mipmaps by the device's arithmetic, not Metal's tables (c9dd35e8a4) Rule 1: the mipmap compute filter (extended-range formats, 8-bit sRGB textures held as their UNORM twins, formats without blits or linear filtering) reproduced Metal's bits inside a capability path. Its arithmetic is now the device's: an 8-bit sRGB code decodes as c/255 through the MSL transfer by the device's division and Pow and encodes by the transfer then RoundEven(t*255) (pack's srgb_decode/srgb_encode, as the twin's shader reads do since c70ec588c4); an extended-range sRGB code takes the same transfer on its magnitude; a half takes UnpackHalf2x16/PackHalf2x16; a float's NaN is the device's; the products and sums lose NoContraction. The twelve-bit and 8192-step tables, the k/4095 step, srgb::search and the integer half rounding are gone (RG11B10Float's encode and RGB9E5's conversion stay: no device instruction gives them). cpu.rs is the bounded model: MipmapFilterChain::expected_levels is the chain in IEEE f32, and the new MipmapFilterChain::outside_bound lists a device level's texels outside 2^-17 of the terms' magnitudes (+2^-140) of the filter of the level above as the device wrote it: a code at a rounding boundary, an sRGB transfer within 2^-17 + 2^-20, one RGB9E5 mantissa step, any NaN. The interpreter models GLSL Pow as the f64 power rounded once. Announced as before by DeviceFilteredMipmaps; its docs, API.md's entry and FAST-PATHS say the filter is the device's arithmetic. No version moves: the owned kernel is built in-process and the driver cache keys on its words. Verified: 475 touched and contract tests; the bind::mipmap_filter interpreter tests FAIL with the old table decode restored and pass with the change; clippy plain and --cfg m2v_gpu; rustdoc. Apple M3 Max: mipmap_chains 4/5 (5 formats within the bound, 8 texels off the IEEE model; the 3D blit chain is the MoltenVK failure that predates this), runtime mipmap tests 13/13, conformance blit-generated-mipmaps announced and justified. lavapipe: mipmap_chains 5/5, 9 formats through the filter including both sRGB twins, RG11B10Float and RGB9E5Float. * Re-pin the runtime sources at the landing tip (187fa18b3d) * List air.pack's lowering among the runtime sources the validation guard hashes (4020aeecc9) The mipmap filter's owned kernel (bind/mipmap_filter/kernel.rs) takes its sRGB transfer and half conversions from lower/arith/pack.rs since c9dd35e8a4, so the runtime's inputs reach pack.rs, and the guard (candidate::engine::artifact::tests::the_runtime_sources_are_the_committed_ones) failed on development's gate at 4052e2209c: "the runtime inputs reach files that are neither inputs nor listed: lower/arith/pack.rs <- bind/mipmap_filter/kernel.rs". build.rs now lists pack.rs, and its comment says srgb.rs's steps feed the ASTC and PVRTC decoders (the mipmap filter no longer reads them). The hash moves with the new input; no runtime behaviour changes, so RUNTIME_VERSION stays (the landing re-pins). * Re-pin the runtime sources at the landing tip (821450aa43) * Announce the copied host pages' cost as the catalogue states it; list what pack.rs reaches (e9ba27478b) (its crates/metal2vulkan-validation/src/candidate/engine/artifact/tests.rs part) The final gate on 3e20b58763 failed two tests. - degradation_catalogue: the signal-behind-merge fix (8fc9c56dcb) closed the shared-event gap and rewrote the API.md entry for copied-host-pages, but the runtime still announced "(behind a shared event's value among them)". The announced cost now drops it, so the catalogue's entry starts with it word for word again. - the_runtime_sources_are_the_committed_ones: pack.rs became a runtime input (the mipmap kernel's sRGB transfers), and it also reaches metal2vulkan-air's intrinsics, lower/arith/math.rs and lower/arith/narrow.rs through its pack and unpack intrinsics, which only the compile emits. They are listed as not runtime with that reason. The stale comment about srgb.rs's encode, tables and steps (deleted by the mipmap and n7 packets) now says only what is true. Verified: the two tests on the landed tip (see the landing). |
||
|
|
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.
|
||
|
|
e84d5a4b60 |
Take the device's float denormals in ldexp
ldexp reads and makes float denormals by the device's multiply, records DeviceDenormals only where the profile's MetalFloatDenormals deviation does not already answer as Metal does, and the float-tininess notice names it. One work packet, landed as 4 commits on archive/development-linear-2026-10-29, in order: * Take the device's float denormals in ldexp, and fix stale exact comments (11eaace858) math::ldexp_bits read a float denormal operand as zero and flushed a denormal result on its bits, Metal's flush. A denormal operand is now scaled by 2^64 through the device's product (kept or flushed by the device's mode), and a result below 2^-126 is the device's product with 2^-126, rounded once or flushed. Every exponent is still answered (GLSL's Ldexp leaves exponents past +128 and overflowing products undefined: capability); infinities and NaNs keep their bits. ldexp leaves FloatFn::metal_denormals, so it records DeviceDenormals; its rustdoc and docs/API.md say so. Word bound 320. SEMANTICS_VERSION 1921. narrow::to_bits is the device's narrowing since 0d7093d826; the snapshot module docs, two leaf encode comments and ops::lane_bits' doc no longer call it exact. Verified: the "ldexp f32, every exponent" check expects the denormal-keeping product and fails on the old form (25 of 192 cases); lower::arith::tests 191/191; device_precision_float_functions, fast_paths, api_signatures, engine_metal_denormals 25/25; rustdoc clean; clippy clean apart from the dead code its base still held (deleted since by b7f6dec939). * Leave ldexp's float denormals to the MetalFloatDenormals deviation (3298b30510) Since 11eaace858, math::ldexp_bits reads a denormal operand and rounds a result below 2^-126 by the device's float multiply: a denormal times 2^64, and a normal times 2^-126. ldexp then recorded DeviceDenormals on every profile. On a profile that takes DriverDeviation::MetalFloatDenormals the device's multiply reads a denormal operand as the zero of its sign and flushes a denormal result, which is Metal's ldexp answer, so the note there named no difference from Metal. denormal::coverage now lists ldexp as Covered::Deviation, the same rule as + - *: the module requires MetalFloatDenormals where the profile takes it and notes DeviceDenormals elsewhere. half and bfloat are unchanged: leave_denormals touches only f32 lanes. The module is the same on both sides of the fact. Off MoltenVK, the device's multiply rounds before it flushes, so a result whose exact value is within half a unit below 2^-126 is 2^-126 where Metal answers zero. This is the same boundary as a float product, and float-tininess-after-rounding already announces it on those devices. The test float_denormals_are_the_devices_and_noted_off_the_device_fact still treated den_ldexp and den_ldexp_tiny as Metal-on-the-bits kernels. They now follow + - *: the requirement under the fact, the note without it, and the device's word from the interpreter, which keeps denormals. The ldexp_bits rustdoc, PrecisionNote::DeviceDenormals and docs/API.md's degrade-notice catalogue now list ldexp with the deviation's operations. SEMANTICS_VERSION 1922. Verified: nextest -E 'test(/^tests::engine_arith::|^tests::engine_metal_denormals::|^lower::arith::/)' --test-threads 8: 261/261 passed (the failing test included, on moltenvk-m3 and lavapipe with the fact on and off). cargo clippy -p metal2vulkan --all-targets --all-features -D warnings: clean. * Name ldexp in the float-tininess-after-rounding notice (53aefbfc60) Since 3298b30510, ldexp on float computes a result below 2^-126 as the device's product of a normal and 2^-126, so it takes the device's float multiply's tininess. Off MoltenVK the device rounds before it flushes, so an ldexp whose exact value lies within half a unit below 2^-126 answers 2^-126 where Metal answers the zero of its sign. The notice's cost text named only the float product and fused multiply-add. The notice, its rustdoc, the float_tininess module doc, docs/API.md's catalogue entry and its DeviceDenormals entry, and the FAST-PATHS.md row now name ldexp too. The notice's trigger is unchanged and already covers ldexp. The device announces it once at creation wherever its float functions are not Metal's own (rounds_before_flushing: not MetalFloatFunctions), whatever its pipelines hold. ldexp's product is the same OpFMul, so the same devices round it first. No new trigger is needed, and modules and recorded notes are unchanged (SEMANTICS_VERSION stays at 1922). The announced cost text is part of the run (the stderr line and DebugMessage::text), so RUNTIME_VERSION goes to 1694. The runtime-sources pin moves with degradation.rs and float_tininess.rs. The "ldexp f32, every exponent" check gains the operand 2 - 2^-23. Times 2^-127 it is 2^-126 - 2^-150, which ties to even at 2^-126 on the interpreter, a device that rounds first. A sanity assertion pins the expected word. Verified: a negative control that expected Metal's flush for that one case fails the check with "1 of 208 cases differ"; without it, lower::arith::tests::device_precision_float_functions_are_valid 8/8 passed. Runtime tests::degradation, tests::degradation_catalogue and tests::device::the_device_s_multiply_rounds_a_tiny_product_before_its_flush_off_moltenvk 17/17 passed. metal2vulkan tests::fast_paths and the api_signatures binary 24/24 passed. Validation candidate::engine::artifact::tests 3/3 passed, the_runtime_sources_are_the_committed_ones included. Workspace clippy (all targets, all features, -D warnings) is clean plain and with --cfg m2v_gpu. RUSTDOCFLAGS='-D warnings' cargo doc --workspace --all-features --no-deps is clean. * Re-pin the runtime sources at the landing tip (0d03676902) |
||
|
|
bc1a6ebf8b |
Encode a half's bits by the device's narrowing, not an integer sequence
A half value whose bits are not known from a load (a store, a reinterpretation, a texel's or snapshot's bits) is encoded by the device: with shaderFloat16 one OpFConvert to 16 bits (NoContraction under the float controls), each lane read as a word beside a 16-bit zero; without it GLSL.std.450 PackHalf2x16. The exact integer sequence (rebias, NaN quieting, the 2^24 denormal scaling, the 0x7C00 cap under native rounding) is deleted. narrow::encodes_bits finds the narrowing; compile.rs records the widening's notes for it: NativeNanEncoding everywhere, NativeHalfConversion where neither the float controls nor MetalHalfArithmetic cover it. Bits known from a load, folded constants, an integer's half and bfloat stay exact. bits_words 136 -> 48 per lane. Tests pinning the old NaN bits accept the device's where the note is recorded; 40 known-gaps rows the Apple M3 Max no longer diverges at are dropped (29 attribute-format-fetches half-NaN sites, 3 each of half-texel-nans-r16f/ -rg16f/-rgba16f, 2 of math-frexp-ilogb-half: Metal's own NaN bits now). SEMANTICS_VERSION 1919. Verified: 347 translator tests (lower::arith::tests, the touched engine modules, every public fixture on every committed profile), clippy plain and --cfg m2v_gpu, rustdoc; a sabotaged encode form fails the new a_half_encode_is_the_devices_narrowing_in_every_form; on the M3 Max: conformance replay of 28 half cases exit 0 (every divergence a held ledger row), validation runtime_lane half tests 7/7, runtime nan_signs/vertex conversion notices/degradation sites 4/4. golden_hashes.tsv cells move, re-blessed on development. Not run: lavapipe, the full validation and conformance sets. One work packet, landed as 1 commit on archive/development-linear-2026-10-29: 0d7093d826. |
||
|
|
ed114bcf43 |
Answer Metal's maths special values and fast functions by the device's instructions
The fast transcendental functions and the special values take the device's instructions, with the precision contract's and c3's near-equivalent checks held at the device's notes. One work packet, landed as 3 commits on archive/development-linear-2026-10-29, in order: * Answer Metal's maths special values and fast functions by the device's instructions (d49cbcd398) The fast sin, cos, tan, sinh, cosh, tanh and atanh are the device's Sin, Cos, Tan, Sinh, Cosh, Tanh and Atanh on every device: no flush past Metal's last evaluated quadrant, no kept denormal, no MSL Table 8.2 formula. The half zero and NaN-sign tables are gone: a half function is its float instruction rounded. pow, powr, fast::powr, atan2 and fast::atan2 keep only the C99/MSL special values GLSL.std.450 leaves undefined (a negative base, 0^y with y <= 0, atan2(0,0), infinities, pow's odd-integer sign), by the device's comparisons: no bit-level denormal-as-zero reading, no canonical NaN over a NaN operand (the device's sum instead), no pow(x, 1) = x, no flush of a denormal atan2 result. The fast functions take libm::Fun entries of their own, so MoltenVK records DeviceTranscendentals where its instruction is not Metal's fast function; elsewhere NativeTranscendentals and DeviceDenormals as before; the NaNs no longer claimed record NativeNanEncoding or DeviceNanEncoding. half fmod's zero stays on the exact remainder routine (capability; no note path there yet). Dead code goes: Lib's Metal mode and denormal::flush. FAST-PATHS rows, the libm module doc, and API.md's fneg/fabs paragraph (now the device's OpFNegate and FAbs) and native-transcendentals entry say so; known-gaps.tsv gains the M3's fast-float-tanh row. SEMANTICS_VERSION 1918. Verified: arith unit tests 192/192, engine tests of the path 42/42 (metal denormals, arith, metal math, float call notes), fast_paths/profile/ api_signatures 47/47, runtime degradation and catalogue 17/17; clippy plain and m2v_gpu, rustdoc; restoring pow(x,1) = x and a fast::sin flush fails the new tests; conformance replay of pass-bytes-half-tanh-regimes on the Apple M3 Max matches the ledger (exit 0; MoltenVK's Tanh is MSL's precise tanh, 2623 of 4096 words differ from Metal's fast::tanh, DeviceTranscendentals declared). golden_hashes.tsv moves 1224 cells (65 rows over 59 fixtures), re-blessed on development. Not run: lavapipe and other venues, the validation crate. * Hold the precision contract's fast tanh at the device's Tanh notes (685db3e29f) d49cbcd398 made a fast float tanh the device's Tanh instead of the MSL formula the crate computed with a division of its own, so on lavapipe it records NativeTranscendentals, not DeviceArithmetic, and on MoltenVK, whose Tanh is Metal's precise tanh rather than its fast one, DeviceTranscendentals instead of nothing. api_surface's the_precision_contract_names_each_float_operations_notes still held the formula's notes and failed in development's gate at b7f6dec939; it and its doc now hold the device's. Verified: the api_surface binary passes (with fast_paths, golden_hashes and the conformance ledger tests, 41/41) at 11eaace858. * Hold c3's near-equivalent checks at the device's tanh and NaN notes (43a9c268e4) d49cbcd398 made a fast float tanh the device's Tanh instead of the MSL formula the crate computed with a division of its own, and left the NaN of pow and of fast sin and cos to the device, so three c3 tests held the old notes and failed on development: - the_products_own_approximations_are_its_near_equivalents: tanh (fast or precise, float or half, lavapipe or MoltenVK) is now no near-equivalent; fast atan2 keeps DeviceArithmetic. Fast tanh(44) stays Apple's unstated word even where the row records DeviceArithmetic for another operation. - a_nan_encoding_the_product_answers_is_not_a_near_equivalent: on lavapipe F32 exactly precise pow and fast sin and cos record DeviceNanEncoding; the test asserts that set over msl::Prim::ALL. A differing NaN of fast sin(inf) and of precise pow(-1, 0.5) is now the note's (near_equivalent, open); precise sin(inf), mul and div keep the old answer. - an_unstated_word_the_product_approximates_keeps_its_reading_open: fast fmod keeps its open reading and refusal (now the named-lowering check); fast tanh(44) is the device's answer, unstated, and the sign-off stands with DeviceArithmetic recorded. Doc comments say what is true now. No product code changes. Verified: cargo nextest run -p metal2vulkan-validation --all-features -E 'test(/^c3::/)' 72/72 passed (3 failed before); clippy -p metal2vulkan-validation --all-targets --all-features -D warnings clean. The lavapipe/MoltenVK note sets were read from lowering_notes for every prim. |
||
|
|
ced4a0ecda |
Decode and encode 8-bit sRGB storage and twin texels by the device's transfer
Rule 1: a storage image of an 8-bit sRGB format (its UNORM alias, SrgbEncode/SrgbEncodeBgra) and a slot bound to such a format's UNORM twin decoded each code through Metal's twelve-bit step table and an exact k/4095 quotient, and encoded by searching the table. The format is capability (Vulkan has no sRGB storage; the device cannot sample the twin's format); the arithmetic is the device's. Reads (alias, twin read/sample/gather/fetch, bicubic taps) take the MSL transfer through the device's Pow (pack::srgb_decode_texel), a filtered twin sample decoding the device's filter of the codes; every access records SrgbTexelDecode. Writes take pack::pack's unorm4x8_srgb (DevicePackConversion). The module declares no sRGB table for these paths; SrgbReach, srgb_filtered_texel, the step/ratio helpers and Sampling::srgb_codes are gone. Words per access: read 520 -> 194, filtered sample 920 -> 194, write 1520 -> 314, bicubic tap 160 -> 106. Docs (artifact notes, API.md catalogue, FAST-PATHS rows, doc comments) say so; runtime_lane::srgb_storage now holds the device's bounds, with an alias-read test. SEMANTICS_VERSION 1917. Verified: clippy plain and --cfg m2v_gpu, rustdoc; nextest 65 core checks + 98 touched-module + 17 runtime degradation pass; sabotage of the decode FAILS 2, restored PASS; MoltenVK on the Apple M3 Max: runtime_lane::srgb_storage 4/4 (with the formatless storage features withheld, alias float reads within 1.83e-7 of the transfer, 762 of 1024 lanes differ from Metal's table; writes within one code; srgb-texel-decode and device-pack-conversion announced); conformance read-write-tier-round-trip-float and -held announced, justified. Golden hashes unchanged. Not run: the twin on a device that takes it (lavapipe, ANV, NVIDIA), release timing, the census. One work packet, landed as 1 commit on archive/development-linear-2026-10-29: c70ec588c4. |
||
|
|
038bad9386 |
Take the device's conversions in the storage-form fetch and blend, imageblock tiles and snapshots
The storage form, implicit imageblocks and snapshot reads take the device's conversions, and
the MetalFloatStorageNans driver fact, which nothing reads once the blend keeps the device's
NaN, is deleted.
One work packet, landed as 2 commits on archive/development-linear-2026-10-29, in order:
* Take the device's conversions in the storage-form fetch and blend, imageblock tiles and snapshots (a049fcd0ee)
Rule 1 (owner, 10-29): where the device has a native answer, it is the only
form. The interlocked storage form, implicit imageblocks and snapshot reads
are capability and stay; the arithmetic inside them still computed Metal's
own bits. Each now takes the device's form, its difference noted with an
existing note:
- lower/fragment/fetch.rs: an 8-bit sRGB attachment's read and write through
its uint view decode and encode by arith::pack's unorm4x8_srgb forms (the
8-bit instruction and the MSL transfer by the device's Pow) instead of
Metal's twelve-bit table (math::unpack/pack with the table); the module no
longer declares the table for it. DevicePackConversion.
- fetch.rs: an 8-bit unorm blend's result is stored as computed, the storage
image's store converting it (unorm8_write's exact product with 255, the
NaN select and the clamp are gone). DeviceColorConversion, recorded in the
storage write's plan.
- fetch.rs: a 16-bit float blend no longer makes every NaN 0x7FC00000; the
NaN is the device's arithmetic's, which the store converts.
stage_io/color_write.rs records DeviceNanEncoding for every such blend and
no longer relies on VkProperty::MetalFloatStorageNans (storage_nan
deleted; the deviation stays as a measured fact, now required by no
module).
- lower/stage_io/word_color.rs: an 8-bit sRGB word's encode is
arith::pack::pack (srgb_table and encode's table parameter deleted; its
two other callers updated). DevicePackConversion.
- lower/access/tile.rs: a normalized implicit imageblock access unpacks and
packs by arith::pack (instruction or its definition), a half access rounding
the unpacked float once more by narrow::round, instead of math::unpack/pack
with Metal's table and the exact c/D-to-half grid (half_channels,
Norm::grid deleted). DevicePackConversion, but for a float conversion of a
format GLSL.std.450 names on a device whose float functions are Metal's
(MoltenVK), as air.pack notes it.
- lower/fragment/snapshot.rs: a normalized form's read decodes c times the
f32 nearest 1/D (signed: at least -1) instead of exact integer division.
DevicePackConversion.
- lower/arith/color_write.rs: the unorm rule is gone from round and
channel_words (normalized deleted); a unorm channel is the device's
conversion's. FloatNearestEven stays (Metal's textureWriteRoundingMode, a
capability), as does unorm8_code for the private alpha test.
Dead in this tree and deleted: extended_range::blend::unorm8_write,
texel_round::grid_step, srgb::STEP_WORDS. Word estimates follow
arith::pack::words.
Tests: blend8's two blend checks now hold the blend's result, stored by
Vulkan's conversion, to Metal's code (unorm8_write's test deleted with it);
color_write checks that round takes no unorm rule (fails on the old form)
and its scalar/half test uses the small-float rules; snapshot_codes checks
the device's product c * fl(1/D) (asserted to differ from the quotient at
some code; the old exact test failed on the new form, seen); the
engine_fetch_blend8 tests require DeviceColorConversion (unorm8) and
DevicePackConversion (sRGB), which fail on the old form;
engine_fetch_blend16 requires DeviceNanEncoding on every profile and no NaN
property; engine_tile's normalized tests hold reads, stores and the
read-back within DevicePackConversion's bound (3 f32 ulp, one half step
more, codes within one) on the formats the interpreter models (no Pow: the
sRGB formats, and NaN stores, are the device lane's). Validation lanes: framebuffer_fetch::blend8 asserts the native note
alone on an interlock device and unorm8 channels within one code;
framebuffer_fetch::srgb accepts device-pack-conversion as a conversion;
tile_normalized checks reads and stores within DevicePackConversion's
bound; blend16::nans docs.
Conformance: known-gaps.tsv gains eight Apple M3 Max rows for
fetch-ordered-{bgra8unorm,rgba8unorm}-srgb (x1: a code apart, within the
note's bound; x2/x3/x3-depth: two, compounded across draws), the device's
sRGB conversion in the interlocked storage form.
Docs: API.md catalogue (DevicePackConversion, DeviceColorConversion,
DeviceNanEncoding, the sRGB word paragraph, the fetched sRGB and unorm8
blends), FAST-PATHS.md's air.pack row and the fetched-blend gap, the note
and deviation doc comments.
SEMANTICS_VERSION 1916 (emitted modules change). No public API change.
* Delete the MetalFloatStorageNans driver fact, which no module reads (e3f82758cb)
After the storage form's 16-bit float blend stopped making every NaN
0x7FC00000 (the device's NaN, noted DeviceNanEncoding), nothing reads
DriverDeviation::MetalFloatStorageNans or VkProperty::MetalFloatStorageNans:
no module requires the property and no lowering asks the profile for the
deviation. AGENTS.md's no-dead-code rule, and the owner's approval of deleting
unread facts (the 10-27 unread-fact sweep, 7b4509b9c4's precedent), remove
them.
Removed: both public variants and their docs; the five measured rows
(MoltenVK on Apple9, RADV on the 780M, NVIDIA on the RTX 3090 and the RTX
5080 Laptop GPU, lavapipe) and their measurement paragraph in
device/driver_facts.rs; the derive and profile mappings; the codec's
VkProperty entry; the driver_facts test rows (the deviation-to-property
table, the Apple, NVIDIA, lavapipe and 780M expectations); the
engine_fetch_blend16 split of interlock profiles by the deviation and its
"no such property required" assertions there and in engine_extended_range.
engine_fetch_blend16 still requires DeviceNanEncoding on every interlock
profile.
Corpus observations name the deviation only inside environment.profile, a
free-text Debug string of the profile (format!("{profile:?}"), a
serde_json::Value field nothing parses into an enum), so no reader changes
and no observation file is rewritten: the established handling, as the
MetalHalfQuantize name removed on 10-28 still stands in 152 observation
files. The profiles that took the deviation (moltenvk-m3, the two 780M RADV
profiles, the three lavapipe profiles, nvidia-rtx5080-laptop) change
fingerprint, so their golden cells and evidence re-key.
ARTIFACT_FORMAT_VERSION 478 (the encoded VkProperty list changed; the
orchestrator renumbers). api_signatures re-blessed (two variant rows gone);
REFUSALS.md regenerated, unchanged.
Verified: cargo fmt; clippy --workspace --all-targets --all-features -D
warnings, plain and with --cfg m2v_gpu; rustdoc -D warnings; nextest by
exact module: device::tests::{driver_facts,profile}, cache::tests,
cache::codec::tests, tests::fast_paths, tests::engine_fetch_blend16,
engine_extended_range::half_float_storage_slots_leave_their_writes_to_the_device,
api_signatures, api_surface, refusal_surface (130/130); validation index,
observation, observation_contract, c3, requirement,
candidate::platform::device (118/118).
|
||
|
|
5f2c69e087 |
Decode a pulled normalized vertex field by the device's reciprocal product
Pulled normalized fields (vertex, [[stage_in]], post-tessellation) take the device's product,
and a post-tessellation pulled read records its NaN note as the vertex and stage-in reads do.
One work packet, landed as 2 commits on archive/development-linear-2026-10-29, in order:
* Decode a pulled normalized vertex field by the device's reciprocal product (33a8839b7c)
The owner's ruling of 10-29: no exact emulation where the GPU has a native
answer. A normalized field the shader pulls (a vertex attribute fixed-function
input cannot fetch, a kernel's [[stage_in]] attribute, a post-tessellation
function's) was Metal's correctly rounded quotient via exact_division::div_exact.
It is now the device's product float(c)*float(1/m), rounded once, the signed one
max(., -1), as fixed-function fetch already converts it (
|
||
|
|
0a1851164d |
Copy a no-copy buffer, heap or rebind whose import the caller's gate refuses or that fails, announced
A new HostMemory::with_import_gate(ImportGate) asks the caller once,
holding no lock of the runtime's, just before a no-copy buffer, a
no-copy heap or a buffer rebind imports its pages, passing an
ImportRequest with the pages the import would map. If the gate answers
false, or an import the device and the gate admitted then fails
(OutOfMemory, another Vulkan error), the object is made over a copy of
the pages instead of failing. The default stays import-first. The copy
is host-visible memory owned by the runtime; `contents` stays the
caller's pointer. Each commit copies in the bytes the CPU changed since
the last sync, and each batch's completion merges back the bytes the GPU
changed (CPU wins where both wrote), byte by byte, before events,
waiters and handlers see it. Every copy is announced
(`copied-host-pages`) and counted. Pages the process cannot read are
never copied (the first copy reads through the kernel:
process_vm_readv / mach_vm_read_overwrite). A copied heap's buffers lie
in the copy and its textures are shadows. A rebind's copy is laid out as
its import would be. A rebind over an in-place image is refused
(NotImplemented(RebindTextures)) and a heap's rebind still imports
without asking. A caller's DirtyPages log stays attached to the copy as
to an import. The in-place check's pointer class skips copied buffers.
Ports dev-perf's fff961b7e5, 630d1b0174, 33d7aa5e98 and 9b4d4190f5 onto
a smaller coherence design: every live copy is compared in full at each
commit and completion, instead of dev-perf's log-driven,
encoder-collected copies (dev-perf's copied.rs, 79301a2515 and its
fixes, sat on a page log development has replaced). Also brings
789fa3d294's unreadable-page rule, 5190983470's lane site, and
1c7d49f788's copied-buffer skip. A driver that refuses the pointer
still fails the call (dev-perf copied there too; not taken). Known gaps
in FAST-PATHS: the compare costs O(size) per commit and completion, a
byte both sides wrote keeps the CPU's value, and a shared event's value
can be seen before the merge (c5db2d1b8a not ported). RUNTIME_VERSION
1690. Runtime-sources pin recomputed.
Public API: ImportGate, ImportRequest { start, length }
(#[non_exhaustive]), HostMemory::with_import_gate,
Degradation::CopiedHostPages, Device::fail_next_host_imports (test
hook), and the WorkCounts fields host_imports_refused_by_host,
copied_host_buffers_{made,refused,degraded}, copied_copy_in_bytes,
copied_merge_back_bytes, copied_rebind_pages_made, copied_heaps_made.
Verified on the M3 Max (MoltenVK, m2v_gpu): 11 new device tests
(tests::copied_device: buffer, rebind and heap, gate refusal and failed
admitted import, unreadable pages, a heap texture round trip) and 167
tests in the touched device filters pass; the counters move as
expected ([1,1,1,0,0] for a refusal, [0,1,0,1,0] for a failed import)
and the announcement is heard; on a 64 KiB copy 4079 bytes copied in and
4080 merged back for a 4 KiB CPU write and a 4 KiB fill, checked
exactly. Sabotage: ignoring the gate and removing the merge fails the 3
buffer tests; ignoring the rebind gate fails both rebind tests (no heap
sabotage). 249 host tests pass. Workspace clippy plain and
--cfg m2v_gpu, and rustdoc, clean; clippy re-run clean on the landing
merge. Not run on Linux.
|
||
|
|
d7d4870598 |
Wait a bound for a pipeline still being made, then drop its draws and dispatches
A cold MoltenVK compile inside one guest command buffer ran 11.59 s and tripped the guest's own 10 s FIFO watchdog, which tore the task down; development had no bound. New runtime choice DevicePolicy::pipeline_waits (PipelineWaitPolicy::Bounded, the default, or Exact, which exact_answers() selects), with bounds pipeline_creation_wait and pipeline_commit_wait (4.5 s each, so one FIFO step waits 9 s at most). Under Bounded: - A render or compute state's creation hands its predicted making to the pool and waits for it up to the creation bound (WorkCounts::creations_left_making). - A committed command buffer waits until its commit plus the commit bound for its draws', dispatches', tile dispatches' and execution replays' pipelines, then records each late one as nothing and runs on. CommandBuffer::dropped_draw names the first with VK_TIMEOUT. Counted in draws_dropped_still_making and dispatches_dropped_still_making, and announced as draw-dropped-still-making and dispatch-dropped-still-making. - An execution's settle hands its makings to the pool. A draw whose driver making failed now runs nothing and its command buffer runs on, where it used to fail it: counted in draws_dropped_unmade, named by dropped_draw(), and announced draw-dropped-unmade (Degradation::DrawDroppedUnmade: the draw, its state, a hash of the variant and specialization, and the driver's error; once per device, or each time where announce_each asks). A dispatch's failed making still fails its command buffer. Docs: FAST-PATHS.md row, API.md policy bullet and catalogue entries, runtime README Errors. RUNTIME_VERSION 1689. api_signatures.tsv re-blessed. Runtime-sources pin recomputed. Ports dev-perf 6f499ff764, 8c91a6e254, 33fc25b531, 5963fd6831 and 4ee316c55a, and the notice of aa7e78f23c in its minimal form (no per-key set, no driver-message relay). The general-form predicted key (7028c0d92a, ce02b68f23) is left out: on development it changed the pipeline makings three M3 device tests count (made_at_creation, pipeline_creation pooled making, its own general_form_drawn), cause not found. Verified on an M3 Max (MoltenVK 1.4.2), under maclock: the six bound and drop device tests under both policies (the unmade one also asserts the notice is heard once and names the driver's error), fast_paths, degradation, degradation_catalogue, pipeline_wait_order, inline_continues, dispatch_pending, api_signatures, api_surface and 169 profile tests: 218/218. Lanes on the M3: 42/44; the two failures are ycbcr_textures::a_ycbcr_sample_through_an_unmeasured_filter_is_announced (recorded failing on development before this change) and pipeline_creation::draws_made_on_the_pool_draw_as_made_ones (1 pooled making vs 2; fails the same under Exact; not yet run on development without this change). Clippy plain and --cfg m2v_gpu and rustdoc -D warnings clean. No sabotage run of the bound. |
||
|
|
b25f89d0af |
Zero new buffers by a fill on a discrete GPU, and cut a tiled heap texture's merge work
- A new buffer whose bytes the host cannot write (Private, a Managed buffer's device copy, the neutral buffers) is zeroed by one vkCmdFillBuffer in the submission's first work on a device without unified memory whose fills are not transfers, in place of copies of the device's host-visible zeros, which such a GPU reads over the bus. Range ends must be multiples of 4. Counted: WorkCounts::new_buffer_zero_fills. Same bytes; no FAST-PATHS row. - A heap's tiled texture's merge in place takes a kept scratch, unzeroed: its keep and changed copy write the texture's bytes whole, the bytes its kernel reads. - A one-sample colour tiled texture kept right after its copy in (ungated, with no copy of its shadow between) copies the staging buffer that copy filled, in place of a move out of the image, tight buffer and dispatch. Counted: WorkCounts::shadow_keeps_from_staging. development's dirty-page gate stays as it is; a gated copy in keeps the move out. Ports dev-perf b77843da73, c302c71029 and 01f17bde29 (archive/development-performance-2026-10-27); their measurements (RX 7900 XTX, RTX 5080) are dev-perf's, not re-measured here. RUNTIME_VERSION 1688. api_signatures.tsv: two additive WorkCounts fields. REFUSALS.md unchanged. Runtime-sources pin recomputed. Verified on the M3 (MoltenVK, under maclock): first_use, blits fills, heap_layouts, shadow/merge, dirty-pages and tiled device tests (58 + 34 passed); the tiled merge took no zeroed scratch and every keep came from the staging buffer (counters asserted); undoing each change fails its test (3 scratches zeroed vs 0; 6 and 2 bytes differing). The new-buffer fill path does not run on the M3 (unified memory); a forced local probe zeroed all 5 MiB through the fill, and failed with the fill word set to 0xdeadbeef. Its unforced run needs a discrete GPU (the round's RTX 5080 run). Clippy plain and --cfg m2v_gpu, rustdoc, touched non-device tests (338 passed). |
||
|
|
2f033d3002 |
Take the device's Y'CbCr conversion for 4:2:2 twins and for YCbCr planes read in place
4:2:2 twins hold the device's own conversion where it has Metal's reconstruction; planes read
in place are sampled through the device's Y'CbCr sampler where the driver lays them out as the
surface does; RADV's 10-bit conversion recorded as reading codes as words. With development's
golden re-bless after the native landings. SEMANTICS 1911, ARTIFACT 477, RUNTIME 1683.
One work packet, landed as 6 commit(s) (a1088b2c2e..67dc5650e1 on archive/development-linear-2026-10-28-evening), in order:
* Hold a 4:2:2 texture's twin as the device's own conversion where it converts the format
A GBGR422 or BGRG422 texture reads a decoded twin of 8-bit codes on every device: Vulkan views
G8B8G8R8_422_UNORM and B8G8R8G8_422_UNORM only through a sampler Y'CbCr conversion, which no
pipeline's layout bakes. Until now the twin always held Metal's decode, (3c + n + 2) >> 2, computed
by the runtime's own kernel or on the CPU, even where the device converts the format itself.
Now, where the device converts the pairs' format with Metal's reconstruction (its optimal tiling
reports SAMPLED_IMAGE, TRANSFER_DST, MIDPOINT_CHROMA_SAMPLES and a linear chroma filter, and the
width is even), the twin holds the device's conversion:
- each decode pass copies the written rows' pairs out of the carrier into the scratch, then into
a per-texture image of the 4:2:2 format, and samples it through the device's conversion (the
identity model at full range) into the band's texels, which go into the twin;
- the kernel is the new bind::chroma_sample_module (ChromaSampleModule), a sample at each luma
texel's centre at level 0, each channel stored as roundEven(clamp(c, 0, 1) * 255);
- such a carrier takes no host or staging copies, so every write's decode is a GPU pass and no
texel of the twin is the CPU's decode;
- counted in WorkCounts::chroma_device_twins and chroma_device_decodes, and announced
decoded-texel-precision (the catalogue's cost text says so).
Elsewhere the twin keeps Metal's decode, as capability. The FAST-PATHS device-gaps table has the
row.
Venues (from the formats' features): MoltenVK 1.4.2 converts both formats (its single-plane 4:2:2
reconstruction is Vulkan's); lavapipe filters their chroma nearest only; RADV (Mesa 26.2.4, 780M)
reports neither format.
Verified:
- clippy -D warnings, plain and --cfg m2v_gpu, for metal2vulkan and metal2vulkan-runtime;
- chroma_decode unit tests (the sample module is valid on every committed profile), fast_paths,
the degradation catalogue tests, api_surface and api_signatures (table blessed: the new module,
ChromaDecode::format and the two WorkCounts fields);
- M3 Max (MoltenVK 1.4.2): tests::ycbcr_device::a_four_two_two_twin_holds_the_devices_conversion...
took the device route for both formats (twins 1, passes >= 2, no CPU decode, announced once);
chroma within 0.5000 codes of Vulkan's (3c + n) / 4 on 40 x 24 random pairs (the test also
prints how many chroma codes differ from Metal's; that line is compiled and clippy-clean, not
yet run);
runtime_lane::chroma_pairs (5 tests) pass, the read lane checking green exactly and red and
blue within 1/255 of Metal's on the device route;
- lavapipe (arm64 linux-gate, m2v_cpu_icd): the same runtime test and the five chroma_pairs lane
tests pass; no 4:2:2 texture took the device route (twins hold Metal's decode, exactly);
- RADV 780M: not run (host away).
docs/REFUSALS.md regenerated: unchanged. runtime-sources.sha256 updated; the RUNTIME_VERSION
bump is in the versions commit.
* Record that RADV's 10-bit Y'CbCr conversion reads codes as words
RADV has the same defect lavapipe has (RuntimeDriverDefect::TenBitCodesReadAsWords): a sampler
Y'CbCr conversion of G10X6_B10X6R10X6_2PLANE_420_UNORM_3PACK16 reads each code's 16-bit word as a
16-bit UNORM value, its six unused low bits included, where Vulkan converts the 10-bit code as
c / 1023.
Evidence: a bare Vulkan probe on the Radeon 780M (RADV, Mesa 26.2.4) read luma code 1023 (low bits
0) through the identity model of a LINEAR image of the format as 0.999039, which is 65472 / 65535
and not 1.0. The optimal tiling's conversion of the format was not measured; the row is per
driver, as the defect table's rows are.
What changes: the AFFECTED table gains a MESA_RADV row, with no clean GPU. Nothing is refused.
- A 10-bit two-plane texture on RADV now converts through Metal's arithmetic. Before, RADV's
optimal-tiling device conversion (ycbcr_device.rs) took it, and that path was never measured on
RADV.
- The planes image of the next commit is not taken for 10-bit codes there.
The driver_defects test expectations (every committed RADV profile, Hawk Point's 780M) and the
docs that name the defect's drivers (ycbcr.rs, ycbcr_device.rs, docs/API.md) say RADV too.
Verified: clippy -D warnings (plain and --cfg m2v_gpu) for metal2vulkan, metal2vulkan-runtime and
metal2vulkan-validation; tests::driver_defects on the host. The RADV device itself was not run: the
host is away.
* Sample YCbCr planes read in place through the device's own Y'CbCr sampler where it has Metal's reconstruction
On an integrated GPU or a CPU device, a function that only samples a YCBCR8_420_2P or
YCBCR10_420_2P texture reads the planes in place through a uniform texel buffer. It converts and
filters them with Metal's fixed-point arithmetic in the shader. Where the device converts the
planes' 4:2:0 format as a linear image with Metal's reconstruction (midpoint chroma through a
linear chroma filter), rule 1 makes the device's own conversion the only form. So such a slot now
samples the planes through the device's sampler Y'CbCr conversion. Elsewhere the texel buffer
read stays, as capability.
Translator (metal2vulkan):
- bind::YCbCrPlanesSampler (new, non-exhaustive) holds the conversion: the codes' bits and the
surface's range and matrix. It also gives the image's format: G8_B8R8_2PLANE_420_UNORM, or
G10X6_B10X6R10X6_2PLANE_420_UNORM_3PACK16.
- YCbCrInPlace::with_planes_image, ::sampler and ::planes_sampler. TextureShape::Texture gains
ycbcr_planes_sampler.
- RuntimeFact::YCbCrInPlace gains `device`: the device's sampler takes every sample of the slot.
It does not where a constexpr sampler has a border address mode, or a texel offset is placed by a
parent's size.
- VariantKey and LoweringInputs gain ycbcr_planes_sampled. The binder fills it from slots with
`device`, bound to a texture that holds the image, whose runtime sampler words have no border
mode on s or t.
- Such a slot is declared as a combined image sampler: ResourceKind::YCbCrPlanes and
BindingSource::YCbCrPlanes, written from WriteSource::YCbCrPlanesImage. Its immutable sampler is
the new vk::SamplerDesc::ycbcr: linear, clamp to edge, lod 0, and a new `ycbcr` field.
- Each sample (lower/sampler/in_place.rs device_sample) is OpImageSampleExplicitLod at level 0:
- a linear sample takes Metal's coordinate, with its texel offset moved in texels;
- a nearest one takes the centre of the luma texel Metal reads, clamped to the edge;
- pixel coordinates and the filter are known when the module is made (constexpr) or read from
the runtime word;
- a half result is rounded to a half, as every sampled texel's is.
- The texel buffer stays the slot's resource otherwise. The planes read use is tracked as before.
Runtime (metal2vulkan-runtime):
- YCbCrFormats queries the two 4:2:0 formats' LINEAR tiling: SAMPLED_IMAGE,
MIDPOINT_CHROMA_SAMPLES, a linear chroma filter, and the limits and
combinedImageSamplerDescriptorCount.
- YCbCrSampler::planes gives the conversion. It is None under TwoPlaneChromaMisplaced, and for
10-bit codes under TenBitCodesReadAsWords. holds_planes checks for an even size within the
limits.
- texture/ycbcr_planes.rs (new) makes a PREINITIALIZED linear image of the format over the planes'
bytes, and only in memory the runtime allocated. It is made only where:
- the luma plane comes first;
- the driver's PLANE_0 and PLANE_1 subresource layouts are the surface's offsets and pitches;
- the alignment, the type and the room within the buffer fit.
Its view and every immutable sampler of it share one VkSamplerYcbcrConversion
(Device::made_ycbcr_conversion, kept in the owned kernels' map), so the two are identically
defined (VUID-VkWriteDescriptorSet-descriptorType-02738). Its first move rides the next
submission (Fresh, never rebindable), and it is announced ycbcr-filter-not-exact.
- Fresh pages, no-copy pages and the caller's VkBuffer keep the texel buffer. An image bound to
imported memory starts UNDEFINED, and the in-place check covers that first move for single-plane
images only.
- The texture's facts state the image (with_planes_image). binding.rs writes the view in GENERAL
under the layout's immutable sampler.
- sampler_set chains the conversion into each SamplerDesc::ycbcr sampler. A non-pushed set 0
reserves combinedImageSamplerDescriptorCount descriptors per such binding.
- WorkCounts gains ycbcr_planes_images, ycbcr_planes_images_kept_{conversion,memory,layout} and
ycbcr_planes_images_bound.
Venues (from the formats' linear features):
- Radeon 780M (RADV, Mesa 26.2.4): reports the 8-bit route for rows 256 bytes apart. Its 10-bit
codes carry TenBitCodesReadAsWords (previous commit).
- MoltenVK 1.4.2: TwoPlaneChromaMisplaced.
- lavapipe: its 4:2:0 conversion is cosited only.
Measured before building, through a bare Vulkan probe on the 780M with 8-bit codes:
- luma centres within 0.0003 codes of Vulkan's model, and points between texels within 0.66
codes;
- Metal's conversion-then-filter differs by up to 54/255 between texels of random planes;
- GPU time, 3840x2160 composited into 1680x1050: 248 us against the texel buffer's 340 (1 pass),
741 against 1027 (3 passes).
The runtime's path itself is not measured on a device that takes it: the 780M host is away.
Docs: a FAST-PATHS device-gaps row (the device's route, where the texel buffer stays, and why);
the in-place paragraph; docs/API.md (the pipeline interface paragraph, and the notice's catalogue
entry); module docs (ycbcr.rs, ycbcr_device.rs, ycbcr_image.rs); the api_surface table
(YCbCrPlanesSampler N); api_signatures blessed.
Tests:
- bind::ycbcr_in_place::the_planes_sampler_is_the_conversion_word.
- bind::plan::slots::the_planes_image_variant_takes_a_slot_the_device_s_sampler_reads.
- tests::engine_ycbcr_in_place::a_planes_image_slot_samples_through_the_device_s_conversion: the
lavapipe and M3 profiles; linear, nearest, pixel, offset and runtime samplers, each half and
float. Each case links and validates, with one OpImageSampleExplicitLod. Border and repeat-offset
slots state device false.
- Lane runtime_lane::ycbcr_in_place::a_ycbcr_texture_s_planes_image_samples_through_the_device_s_conversion
covers surfaces whose rows are 256 bytes apart. Each in-place texture is counted exactly once,
as an image or by why not. Through the image, nearest samples are Vulkan's conversion within the
device's bound, announced; without it, Metal's texels through the texel buffer, unannounced.
Verified:
- clippy -D warnings, plain and --cfg m2v_gpu, for metal2vulkan, metal2vulkan-runtime and
metal2vulkan-validation.
- Host, plain target, the touched selection (ycbcr, fast_paths, api_surface, api_signatures,
codec, slots, api_tests, the inputs encoding, sampler, ash_interop, driver_defects, degradation,
vk tests): 408 run, 407 passed. The engine test's half cases failed, because a half result was
an f16 where a sample holds it widened. They now take narrow::round_texel, and the in-place
engine tests pass, 4 of 4.
- M3 Max (MoltenVK 1.4.2), runtime and validation, ycbcr|chroma|driver_defects|runtime_sources:
66 run, 64 passed. The planes image test counted [0, 1, 0, 0] for both surfaces (kept for the
conversion: TwoPlaneChromaMisplaced), bound the texel buffer and read Metal's texels. The two
failures:
- the runtime-sources pin, re-pinned in the versions commit;
- runtime_lane::ycbcr_textures::a_ycbcr_sample_through_an_unmeasured_filter_is_announced
(anisotropic through a constexpr sampler), which fails the same way at the base, as
|
||
|
|
bd3c50d741 |
Take the device's own Depth16 bias and its store of an extended-range, padded or bfloat attachment's untouched texels
The device's depth bias unit on every format, and the device's store of untouched texels in
place of the unused-bits load pass (deleted with its capture machinery); the NaN depth
discard documented as capability. SEMANTICS 1910, RUNTIME 1682.
One work packet, landed as 7 commit(s) (88bcfeaea8..6aec9db4e9 on archive/development-linear-2026-10-28-evening), in order:
* Take the device's depth bias on a Depth16Unorm depth
Rule 1: the device's depth bias is its native form, so it is the only one. A
constant bias (or a slope alone) on a Depth16Unorm depth was recorded through
VK_EXT_depth_bias_control's depthBiasExact as Metal's own rule, c + 1 units of
1/65535 for c of 0 or more and c - 1 below (one unit for a slope alone), in
depth (floatRepresentation) or in 2^-16. Now `metal::state::depth_bias` hands
Metal's constant to vkCmdSetDepthBias in the device's own unit r on every depth
format; Vulkan leaves a fixed-point format's r to the implementation, at most
2 x 2^-16 ("Depth Bias", primsrast.adoc).
Deleted, nothing reading them any more: `depth16_units`, `DepthBiasUnit` and
`DepthBias::unit`, the `depth_format` parameter of `depth_bias` and of the
runtime's `vk_depth_bias`; the runtime's vkCmdSetDepthBias2EXT path
(`DepthBiasCommand`, `depth_bias_command`, the record's pinned representation,
the device's command, its priming and `DEPTH_BIAS_CALLS`, the exit guard's and
recorder's `CmdSetDepthBias2`, `Logged::SetDepthBias2` and its thunk, so
`CommandsReplayed::cmd_set_depth_bias2` goes). VK_EXT_depth_bias_control is
still described but no longer consumed, so the core recommends enabling neither
it nor its three features.
RADV on the 780M no longer takes DriverDeviation::MetalDepth16BiasedStores: it
was measured through the exact unit. MoltenVK keeps it (it hands Metal its
constant, by construction). Elsewhere `unorm-depth-bias` announces the device's
bias; its cost text, docs/API.md's entry, the deviation and property docs and a
new FAST-PATHS device-gap row state it.
Tests: `metal::state::a_unorm_depth_bias_is_metals_constant_in_the_devices_unit`
(the constant as given on lavapipe, NVIDIA and MoltenVK, which have
depthBiasExact or not); the recommendation test leaves the extension and its
features out; the driver-facts test drops RADV's row; the exit-guard tests lose
the priming group and render_state.rs as a keeper of the device's functions.
api_signatures blessed (DepthBiasUnit, DepthBias::unit, depth_bias's signature);
the refusal surface is unchanged. Not bumped here: RUNTIME_VERSION (the versions
commit) and the runtime-sources pin (landing).
Verified: cargo clippy -p metal2vulkan -p metal2vulkan-runtime
-p metal2vulkan-validation --all-targets --all-features -D warnings; nextest of
metal::state, device::tests::{enables,driver_facts,profile}, tests::fast_paths,
api_surface, api_signatures, exit_guard, render_state, degradation_catalogue,
draw_shape_notices and ash_interop: 159 passed.
* Cite the spec that leaves a NaN fragment depth undefined, which makes its discard capability
The native-arithmetic audit asked whether `clamp_depth`'s discard of a positive NaN
depth, on every profile, emulates Metal where the device has a native form. It does
not: Vulkan defines no answer for such a depth. "Depth Clamping and Range
Adjustment" (fragops.adoc, 35.10.1): "If zf is not in the range [zmin, zmax],
then zf is undefined following this step", with or without depthClampEnable, and a
NaN lies in no range; only depthClampZeroOne, which no profile enables, keeps a
float depth unchanged (and then the comparison of a NaN would still pass ALWAYS
and NOT_EQUAL, where Metal's fails every test). So the discard stays, as
capability, and the comment says why, so a later audit does not re-raise it.
Docs only (a doc comment); no behaviour changes.
Verified: cargo fmt --all.
* Drop the cube's unmeasured gradient route from the anisotropic tests' profile comment
The route was deleted with the native cube gradients; the comment still named it as a second
home of the anisotropic emulation. Only a profile without samplerAnisotropy emulates it now.
Verified: comment only; git grep finds no other mention of the unmeasured gradient route.
* Keep the device's store of an extended-range, padded or bfloat attachment's untouched texels
What: a render pass that loads and stores a color attachment of an extended-range, padded
10-bit or bfloat format now keeps the bytes its draws do not write, the device's own load and
store (VK_ATTACHMENT_STORE_OP_STORE of a loaded attachment), on every device. The runtime no
longer reproduces Metal's tile store: the load pass that rewrote the texels' unused bits before
the pass (render/unused_bits_load.rs, bind::unused_bits_module), the capture replay that found
the tiles a pass's draws reach for it (render/capture.rs, bind::capture_assembly_module,
capture_settle_module, tile_reach_module, the translator's capture form
LoweringInputs/VariantKey::captured_positions, CaptureForm, RuntimeFact::CapturedPositions,
PushField/PushHole::CaptureAddress, Feature::TileReach, StatusBits::CAPTURED_REACH_UNMEASURED,
StatusReport::captured_reach_unmeasured) and the pipeline states' capture forms are deleted, with
ExtendedRange::load_code, Degradation::UnreachedTilesRewritten and the WorkCounts fields
unused_bits_load_passes, unused_bits_load_texels and capture_reach_*. Every draw in such a pass
announces extended-range-bits-kept, naming the attachments (render/tile_store.rs, the renamed
module); its catalogue entry, the FAST-PATHS device-gap row and the format docs state what
differs: the unused bits, BGRA10_XR's alpha clamp, a padded sRGB twin's table and a bfloat code
through half, which Metal's pass rewrites in each tile a draw reaches. snorm-minimum-kept and
shared-exponent-kept are unchanged (TileStoreIsMetals still says where the device's store is
Metal's).
The de-indexed and private list forms keep the index read the capture form shared
(PushField::CaptureIndexAddress, CaptureLayout, CapturedIndex); the binder's de-indexed draw no
longer goes through the capture draw, and the vertex function's strip restart return, which only
the capture form's layout could take (a de-indexed strip is NotImplemented(PrimitiveId)), is
gone.
Why: the owner's rule 1. The device has a native load and store; reproducing Metal's tile store
emulated Metal's bits where the device has a native form. The difference is recorded and
announced (rule 2).
Verified: cargo clippy -D warnings, all targets and features, over metal2vulkan,
metal2vulkan-runtime, metal2vulkan-validation and metal2vulkan-conformance, plain and with
--cfg m2v_gpu: clean. api_signatures blessed, REFUSALS.md regenerated. The test runs (translator
and runtime suites, the touched validation lanes on lavapipe and on the M3 Max's MoltenVK) follow
this commit and are reported with the lane.
* Bump the semantics and runtime versions for the device's tile store and depth bias
What: SEMANTICS_VERSION 1907 -> 1908 and RUNTIME_VERSION 1681 -> 1682.
Why: SEMANTICS_VERSION, because the translator's output changes under unchanged keys: the
de-indexed and private list vertex forms no longer carry the strip restart return, and the
capture form, its runtime fact and its push field are gone. RUNTIME_VERSION, because runs of
unchanged artifacts now do something else: a Depth16Unorm depth takes the device's depth bias
(no depthBiasExact or unit rescale), and a pass that loads an extended-range, padded or bfloat
attachment keeps its untouched texels' bytes (no unused-bits load pass, no capture replay) and
announces extended-range-bits-kept. ARTIFACT_FORMAT_VERSION stays: the codec tags variants by
name, and the removed ones (CaptureForm, PushField::CaptureAddress,
RuntimeFact::CapturedPositions) leave their tags unused, so an old entry holding one is a miss.
Verified: the constants alone change; the golden tables and the runtime-sources pin are
re-blessed at landing.
* Hold the lanes and the fact census to the device's store of untouched texels
What: three runtime lanes still expected Metal's tile store after 5e710fb988 made the device's
store the only form, and the mechanism test still counted the deleted
RuntimeFact::CapturedPositions.
- extended_range_blends::a_pass_of_extended_range_and_padded_colors_names_each_loaded_color:
the padded colors, which the function does not write, keep their bytes (all ones), where
Metal's pass leaves each word 0xffc0.
- extended_range_blends::a_fetched_two_plane_attachment_written_unblended_stores_metals_write:
color 2, loaded and unwritten, keeps its bytes, where Metal's pass zeroes its color words' top
two bits.
- extended_range_blend_table::a_memoryless_color_2_blends_as_a_stored_color_does: the stored
color 0's bands are compared with the unused bits as Metal's pass leaves them
(as_metal_leaves), the codes exactly, as the table's other passes already are.
- device::tests::mechanism: the variant census is 0..89 (MergedDraws takes the freed index).
Why: the lanes held the deleted exact form; the device's store is now the contract and
extended-range-bits-kept announces the difference.
Verified: on the M3 Max (MoltenVK, --cfg m2v_gpu, under maclock and memcap) the three lanes and
the rest of extended_range_blends pass (11 of 11, with waiter_submits, which failed once under a
load of 40 and passed on its rerun); on plain, device::tests::mechanism and tests::fast_paths
pass (12 of 12); clippy -D warnings clean, plain and --cfg m2v_gpu, over the four crates.
* Re-pin the runtime sources at the landing tip
The landed packet changed a runtime-sources input, so the committed digest no
longer described the sources and `the_runtime_sources_are_the_committed_ones`
would fail. Recomputed over the same inputs and committed by land-pkt.sh.
|
||
|
|
487e23f3ee |
Declare a half color output 16-bit where the device enables storageInputOutput16
A fragment function's half color output is declared 16-bit where the device enables storageInputOutput16 and shaderFloat16, so the device blends the half Metal's attachment receives (the M3's 52 half-blend rows no longer diverge). SEMANTICS 1909, ARTIFACT 476. One work packet, landed as 6 commit(s) (9e8b40289e..f5e9c26fe3 on archive/development-linear-2026-10-28-evening), in order: * Declare a half color output 16-bit where the device enables storageInputOutput16 What: a fragment function's `half` color output through a variable of its own type (not an extended-range or word attachment's raw texel, not an attachment held with its channels rotated) is declared with 16-bit float lanes on a profile that enables `storageInputOutput16` and `shaderFloat16`, and stored by one OpFConvert of the f32 that holds the half (exact: the value is a half). The module then requires StorageInputOutput16 (derived from the Output pointer as before). `StageIo::half_outputs` lists the keys so link's contract check holds the module to the 16-bit declaration (`io_type_matches` takes the float width); the artifact codec carries the field. Every other interface variable stays 32-bit, and a device without the feature (lavapipe, NVIDIA's 615.71.09) keeps the half widened to float. Why: the widening hid the output's type from the device. With the half declared as a half, the device blends and converts the value Metal's attachment receives as its own half output: on MoltenVK that is Metal's compiler handling Metal's own output type. No Metal arithmetic is emulated and no note changes (HalfOutputPrecision and HalfOutputFastMathBlend fire as before; a computed fast-math output may still differ). Verified: - M3 Max, MoltenVK 1.4.2, macOS 27.0.1: `conformance replay` of the six `half-output-blends-*` cases: every value exact (verdict `announced`, the case's declared notice only); the 52 M3 rows of known-gaps.tsv (17, 17, 18 sites of r16f, rg16f, rgba16f) all read "no longer diverges", so they are removed. The 32-bit float formats stay exact. A replay of the 40 cases whose recorded fragment functions return half (half-output-blends-*, xr-*, rgb10a2-srgb-stores-h, render-then-sample-magnified-*, fragment-imageblock-reflection): 39 announced, 1 exact, no other ledger difference. - New unit test `a_half_color_output_is_declared_16_bit_where_the_device_enables_it` (moltenvk-m3 and amd-rdna3-radv 16-bit, lavapipe 32-bit; a float output and a rotated attachment 32-bit everywhere; L3 on each module). * Bump the cache versions for 16-bit half color outputs SEMANTICS_VERSION 1907 -> 1908: a fragment function's half color output is declared 16-bit on a profile that enables storageInputOutput16 and shaderFloat16, so its module's words and requirements change under an unchanged key (golden_hashes reports 657 cells changed; the table is re-blessed on the lane branch, not here). ARTIFACT_FORMAT_VERSION 475 -> 476: StageIo gains `half_outputs`, which the artifact codec encodes. Verified: cargo check; the version constants alone moved. * Regenerate the conformance coverage document for the 52 removed M3 rows What: docs/CONFORMANCE-COVERAGE.md, written by `python3 -I scripts/conformance-coverage/coverage.py`. Its ledger count goes from 1129 to 1077 rows and its ledger table loses the 52 Apple M3 Max rows of `half-output-blends-r16f`, `-rg16f` and `-rgba16f`, which the 16-bit half output commit removed from known-gaps.tsv (they read "no longer diverges" on the M3 replay). Why: the document is derived from the ledger, and `conformance_coverage::the_conformance_coverage_document_is_what_the_sources_derive` failed on the stale copy. Verified: the diff is those 52 lines and the count, nothing else. * Record the M3's safe-math half blends under the 16-bit half output What: PrecisionNote::HalfOutputPrecision's documentation said MoltenVK on the M3 Max stores Metal's bytes in every draw of the safe-math sweep. It now states what the lane measures with the output declared 16-bit, and that the NVIDIA, RADV, ANV and lavapipe bounds were measured with the output widened to float (RADV and ANV, which enable storageInputOutput16, now take the 16-bit form and are not re-measured: host away). Measured on the M3 Max, MoltenVK 1.4.2, macOS 27.0.1, with `runtime_lane::half_output_blends::half_output_blends_against_metals_rule` under --cfg m2v_gpu (the measurement prints HALF-BLEND-SUMMARY lines): - at this branch (16-bit output): R16Float, RG16Float, RGBA16Float 28 of 28 measured blend draws Metal's rule's value in every channel, largest distance 0; R32Float 28, RG32Float 28, RGBA32Float 26 of 28 (zero-1msa k0 and k4: one channel of 262,144 off by a zero's sign, distance 0); - at |
||
|
|
5f807517bd |
Make sampled textures over logged host pages device copies on a discrete GPU
On a discrete GPU a sampled, read-only, tracked texture over logged no-copy memory is a device
copy refreshed by the logged row bands, instead of an image read across the bus in place.
One work packet, landed as 3 commit(s) (7812de9edd..919557e82f on archive/development-linear-2026-10-28-evening), in order:
* Make sampled textures over logged host pages device copies on a discrete GPU
What: on a DeviceKind::Discrete device, a texture over host pages whose
policy and usage take the image in place (HostPageTexturePolicy::InPlace,
a usage that only samples or reads), tracked, over a no-copy buffer
whose memory carries a DirtyPages log (HostPages::dirty), one slice laid
out as one copy region straight from the buffer's VkBuffer (no staging,
no rows sharing bytes), is now a shadow instead of the image in place,
announced nowhere and counted as WorkCounts::device_copy_textures. Its
copies in are the shadow path's gated ones (dirty_pages.rs): each
command buffer's first copy in takes only the row bands the log reports
changed since the hold, nothing where none changed, every row where no
hold stands, the wait says false, or a GPU write of the bytes let go of
the hold. The in-place check's verdict is not asked: the copy binds no
image to the pages. Integrated GPUs, CPU devices and memory without a log
are placed as before.
This is ws/vramcopy's device copy (9c04997aa9..6f6d709ae9) resolved onto
ws/dirtypages' design: its own refresh (a per-batch entry preamble with
its own stamps, an encoder-entry hook and a carry write list), its
DirtyLog wrapper, its buffer-key log registry and GPU-write reports, its
replace_region report and its refresh counters are all dropped for the
shadow path's DirtyHook/DirtySource, per-shadow ShadowLog hold and
stamp, gated replay-time regions, note_dirty write tracking and
dirty_copies_in_* counters, which do the same job. What stays is the
placement, its fit check (Texels::device_copy) and its counter.
Tests: runtime_lane::device_copies (m2v_gpu), on the tally of the shadow
path: a 1920x1080 surface over logged pages follows six frames of CPU
writes, its gated copies in whole at the first frame and where the wait
could not say, skipped with no write, cut otherwise; a blit fill of the
buffer lets go of the hold and the next read finds the fill; without a
log no device copy; a cost report (DEVICE-COPY-COST) of in place against
the device copy for a 3840x2160 surface read whole each frame.
Docs: runtime README (textures over buffers) and docs/API.md (textures
over host pages). api_signatures.tsv: one field row
(signatures.py --check passes).
Verified (macOS): cargo fmt; cargo clippy -p metal2vulkan-runtime
--all-targets --all-features -D warnings; the same with -p
metal2vulkan-validation under --cfg m2v_gpu. Device runs follow.
* Run the device-copy lane under the product's in-place policy
What: runtime_lane::device_copies' devices take
HostPageTexturePolicy::InPlace (in_place_textures' in_place, now shared),
the product's default: the lane's devices otherwise take the exact
answers, under which no texture is a device copy, so on the RX 7900 XTX
the first test found none ("device copy false") and the cost test
compared two shadows rather than in place against the device copy.
Verified: cargo fmt; cargo clippy -p metal2vulkan-validation
--all-targets --all-features -D warnings under --cfg m2v_gpu; on the M3
Max (MoltenVK, integrated) the three device-copy tests pass, no device
copy made there. On gem10 at 134ac6eb18 (before this fix):
tests::dirty_pages_device 2/2 passed on the RX 7900 XTX; the lane's
content checks passed and its layer checks failed on a loader message
about gem10's NVIDIA ICD (libGLX_nvidia.so.0), not the runtime's.
READY 134ac6eb18 (product code; this commit changes tests alone)
* Re-pin the runtime sources at the landing tip
The landed packet changed a runtime-sources input, so the committed digest no
longer described the sources and `the_runtime_sources_are_the_committed_ones`
would fail. Recomputed over the same inputs and committed by land-pkt.sh.
|
||
|
|
524c2f7346 |
Record the device's own alpha to coverage as a native precision note
One work packet, landed as 4 commits (f6834405b7..7ec539ceb2 on archive/development-linear-2026-10-28), in order: * Record the device's own alpha to coverage as a native precision note What: a render pipeline that keeps alpha to coverage now records `PrecisionNote::DeviceAlphaCoverage` on its fragment stage, which the runtime announces as `device-alpha-coverage`, on every profile not measured to cover as Metal does. `link::graphics::coverage_notes` decides it from the graphics state alone and hands it through `Linked`'s new `fragment_notes` and `fragment_properties`, as the vertex stage's fixed-function notes already go. A profile that takes the new measured driver fact `DriverDeviation::MetalAlphaCoverage` (MoltenVK on Apple's GPUs of the M3 Max's macOS 27 identity, the APPLE9 row) records no note and requires `VkProperty::MetalAlphaCoverage` instead. Why: Vulkan specifies no algorithm for turning an alpha into a coverage mask, and Metal's is not the floor rule we assumed. Measured on the M3 Max (macOS 27.0.1) over 639 alphas a sample count with our own probe (probes/alpha_coverage_sweep.m): one sample covers above an alpha of 1/2; two and four samples cover ceil(alpha * n - t), t a 2x2 ordered dither. Under rule 1 the device's answer is the contract, so the note records it and nothing in the shader or the sample mask imitates Metal's. Bound, pixel by pixel against Metal's committed reading (runtime_lane::alpha_coverage, 10,224 pixels a count): lavapipe (Mesa on LLVM 21.1.8, arm64) dithers at one sample too, 2,560 pixels apart (a whole fragment stored or dropped), and at four samples 96 pixels one sample apart, all within an f32 ulp of a threshold; every pixel within floor..ceil of alpha * n. MoltenVK 1.4.2 on the M3 Max: 0 apart at 1, 2 and 4 samples (its reading is byte-identical to plain Metal's). NVIDIA is unmeasured beyond its known-gaps row. Stated in the note, the runtime kind, docs/API.md's catalogue and docs/FAST-PATHS.md's device gaps; `CoverageReadsRoundedAlpha`'s docs now say its bound is the rounding's alone. Validation derives no tolerance from it (`Allowance::Unbounded`). Versions: SEMANTICS_VERSION 1980, ARTIFACT_FORMAT_VERSION 490 (the codec gains a note and a property), RUNTIME_VERSION 1790. Verified: tests::engine_alpha_coverage (five profiles, 1 and 4 samples, coverage on and off) passes and fails with the note's recording removed; the lane passes on lavapipe (linux-gate arm64) and on MoltenVK (maclock), printing the counts above and asserting the announcement iff the note; nextest of metal2vulkan, -runtime, -conformance and -validation pass but for the golden table (stale at this base; against development's re-blessed table only the moltenvk-m3 profile fingerprint moves) and the runtime sources pin, both re-blessed on development; clippy (all features, and --cfg m2v_gpu) and rustdoc clean; api_signatures.tsv re-blessed. * Declare device-alpha-coverage native in the suite and fix Metal's coverage rule What: `replay::NATIVE_NOTES` gains `DeviceAlphaCoverage` (the coverage class), so no a2c case must declare the notice the device announces at its own coverage; values still compare field by field. The two `a2c-on-1-alpha-50` known-gaps rows (llvmpipe, RTX 5080 Laptop) keep their identity and now name the note and its bound: on llvmpipe the measured dither and counts; on NVIDIA the bound is open until the coverage lane's sweep runs there. `alpha_coverage_pairs`' model and docs, and `render.rs`'s field doc, said Metal covers floor(alpha * n) samples; they now state the measured rule (above 1/2 at one sample; ceil(alpha * n - t) under a 2x2 ordered dither at two and four), and the model's test holds the cases' recordings to it. docs/CONFORMANCE-COVERAGE.md regenerated. Why: the suite's standing declarations name every note that is the device's native answer, and the rows must say what differs and whose answer it is. Verified: the conformance suite passes (nextest); coverage.py and refusal_surface.py regenerated (REFUSALS.md unchanged). * Number SEMANTICS_VERSION 1906, ARTIFACT_FORMAT_VERSION 474 and RUNTIME_VERSION 1679, past development's The alpha-coverage note took the placeholders 1980, 490 and 1790; development is at 1905, 473 and 1678. * Re-pin the runtime sources at the landing tip The landed packet changed a runtime-sources input, so the committed digest no longer described the sources and `the_runtime_sources_are_the_committed_ones` would fail. Recomputed over the same inputs and committed by land-pkt.sh. |
||
|
|
12e64034b3 |
Hold back the clear's conversion note where MoltenVK's load operation clears as Metal's
One work packet, landed as 5 commits (36c1f6d2ed..bad631efa8 on archive/development-linear-2026-10-28), in order: * Hold back the clear's conversion note where MoltenVK's load operation clears as Metal's A render pass's CLEAR load operation of a colour attachment its render area covers is, on MoltenVK, Metal's own Clear load action, so the texel it stores is Metal's. The new DriverFact::ColorClearIsMetals records that for MoltenVK on the Apple9 GPUs under macOS 27, and the pass layout withholds device-color-conversion for such a clear there. A clear that is not that load operation still announces the note on every device: a clear over a smaller render area (vkCmdClearAttachments, a quad draw on MoltenVK), a clear made before the pass of an attachment its first instance leaves out, and a memoryless attachment's backing. Measured with the renders lane's clear case set (clears_are_the_device_s_conversion_of_the_clear_value) under MoltenVK 1.4.2 on the M3 Max, macOS 27.0.1, before the change: 71 colour clears, 11 depth and 4 stencil, all 86 texels Metal's bytes, none a code apart. The lane now also asserts the note stays unannounced where the fact holds; the dont-care and colour-reformat lanes expect it only where their clears are not a covering load operation (tie_cleared's new flag). RUNTIME_VERSION 1760; api_signatures re-blessed for the new variant. Verified on MoltenVK (M3 Max, --cfg m2v_gpu): the renders clear lane (86 checked, 0 apart, no device-color-conversion), runtime_lane::dont_care_stores (4) and runtime_lane::color_reformat (6) pass; device::tests::driver_facts passes. * Resolve into an sRGB twin by the device's own sRGB decode and encode A multisampled 8-bit UNORM attachment resolving into its sRGB twin is the crate-owned resolve on every device, and it applied Metal's 12-bit sRGB tables. Under the native-arithmetic rule the device's conversions are the only form where the device has them, so where the device renders the sRGB format the resolve now reads the samples through a view in the sRGB format (the device decodes each sample), averages the decoded values (their f32 sum times 1/n) and writes the average through the resolve attachment's own sRGB view (the device encodes it); the alpha keeps the unorm rule. An attachment read from a copy gets a scratch image mutable to the sRGB view. A device without the sRGB format keeps the tables through the raw UNORM views. bind: ColorResolveFormat::device_srgb / decodes_on_device, the device_mean lowering, and the tables only for the table form. runtime: of_resolve picks the form (color_resolve::decodes), the plan reads through the sRGB view and skips the raw write, twin_read_view makes a stand-in mutable to the sRGB view, resolve::scratch_viewed. device-rounded-resolve is announced for such a resolve on every device; docs (degradation, API.md, FAST-PATHS sRGB row, the module docs) say so. Measured with the new lane resolve_rounding::a_twin_resolve_into_srgb_rounds_as_announced (every pair of codes at 2 samples, the lane's pattern at 4, RGBA8 and BGRA8): MoltenVK 1.4.2 on the M3 Max 696 of 262,144 channels one code below Metal's at 2 samples, 880 of 524,288 at 4; lavapipe (Mesa 26.0.8, 4 samples only) 57,865 of 524,288, above and below; none past one code. The model in the bind tests gives 1,758 of 65,536 pairs one code apart with correctly rounded conversions. The resolves lane's twin texels now hold each colour channel to the note's two codes (lavapipe writes 0xbb where Metal's is 0xbc). Verified: the twin lane, runtime_lane::resolves (19), runtime_lane::resolve_rounding (4) and the dont-care twin case pass on MoltenVK (--cfg m2v_gpu) and on lavapipe (--cfg m2v_cpu_icd); the bind color_resolve tests (20) and the runtime color_resolve, image_plan and stand-in unit tests pass; clippy clean plain and with --cfg m2v_gpu. api_signatures re-blessed for the two new methods. * Make a plain colour fill the device's clear where the device renders the format fillTexture:level:slice:region:color: (Apple SPI) packed the colour on the host by Metal's fill rules in every format. Under the native-arithmetic rule the device's own colour conversion is the only form where it has one, so a plain fill (no pixelFormat:) of a texture whose format's fill converts a float (normalized, sRGB, half, float, small float, shared exponent; fill_value::device_converts), whose image holds Metal's bytes of the format, and which the device renders and copies both ways, is now the device's clear: a scratch image of the region in the texture's image format, samples and dimension, cleared whole by vkCmdClearColorImage, copied into the region of each image the fill writes through the blit copy path, placed as the fill. Integer formats (no conversion), the extended-range and bfloat formats, texture buffers and every format the device does not render keep the host packing; the pixelFormat: variant keeps it everywhere (capability). The clear's note is recorded where it applies against Metal's fill packing, not its clear: device-color-conversion where fill_value::device_apart holds (a normalized value within 1/1024 of a tie, widened by the fill's float product and, for the packed 16-bit formats, a step through half; an sRGB value inside (0, 1); a value a half, small float or shared exponent does not hold), device-nan-encoding for a half or small-float NaN. The fill slot still takes the packed texel. The call is logged as itself (BlitCall::FillTextureColor) so a re-encode clears again. Lanes: color_fills::plain_color_fills_are_the_device_s_clear fills the probes' 762 colours into each of the 70 formats plain and packed, notices asked for at each fill, and holds every texel to Metal's or, where that fill announced, to a code (a NaN for a NaN); it asserts an RGBA8Unorm_sRGB fill announced device-color-conversion, which the host packing never does. color_fills::plain_color_fills_land_where_packed_ones_land checks the 31 placement cases byte for byte. The Metal-hash test now packs by pixelFormat:, texture_fills runs its plain colour cases packed (Metal's bytes), and the RGBX fill test accepts an announced code. Unit test for the predicates in tests::fill_value. Measured (plain against packed, 762 colours a format): lavapipe (Mesa 26.0.8) rounds a half toward zero (RGBA16Float 420 texels a code apart), an 8-bit tie down (RGBA8Unorm 20), and writes its own RG11B10 NaNs (275); MoltenVK 1.4.2 on the M3 Max keeps RGBA8Unorm exact, stands RG11B10Float 186 and RGB9E5Float 150 texels a code apart, and writes 0x7e00 for Metal's 0xfe00 half NaN; every one announced. Verified on MoltenVK (--cfg m2v_gpu) and lavapipe (--cfg m2v_cpu_icd): runtime_lane color_fills, texture_fills, rgbx_textures, sample_fills, surface_fills, texture_buffer_fills and two_plane_copies pass; runtime unit tests (fill, replay, blit) pass; clippy clean plain and with --cfg m2v_gpu; rustdoc clean. * List lavapipe's own clear at seven plain texture fills A plain colour fill of a format the device renders to is now the device's clear (6cdfe023d9), so the texture-fills conformance case's digest moves on the gate container's arm64 lavapipe at seven formats: ABGR4Unorm, RGBA8Unorm, RGBA8Unorm_sRGB, BGRA8Unorm, BGRA8Unorm_sRGB, RGBA16Unorm and RGBA16Float. The site is digest-only, so the same fills were run per texel through the color_fills lane's helper on that venue (a throwaway probe, not committed). Of the case's four plain colours only c5's (2, -1, 0.5, 0.3) differs, in its alpha alone, one code below Metal's: 0.3 is a tie in 4, 8 and 16 bits (4.5, 76.5, 19660.5 codes) that lavapipe rounds to even, and lavapipe truncates the half (0x34cc for Metal's nearest 0x34cd). device-color-conversion records it at every such fill and its one-code bound covers it, so each row is the device's native answer, scoped to the measured build, with nothing open. Verified: conformance replay --cpu on lavapipe (llvmpipe LLVM 21.1.8, 128 bits) exits 0, the 825 rows exactly the ledger's (no unlisted, no stale); the ledger's unit tests pass; replay --gpu of the 54 texture-fills cases on MoltenVK 1.4.2 / M3 Max: 37 announced, 17 exact, none divergent. * Re-pin the runtime sources at the landing tip The landed packet changed a runtime-sources input, so the committed digest no longer described the sources and `the_runtime_sources_are_the_committed_ones` would fail. Recomputed over the same inputs and committed by land-pkt.sh. |
||
|
|
44910ecabd |
Hand pixel samplers' scaled coordinate to the device; test the unflushed subnormal coordinate
One work packet, landed as 2 commits (255f93b252..aba772e24d on archive/development-linear-2026-10-28), in order: * Hand pixel samplers' scaled coordinate to the device; test the unflushed subnormal coordinate Rule 1: the device's sampler is the contract. A pixel-coordinate sampler keeps its capability (the shader divides the coordinate by the level-0 size, since Vulkan's unnormalized samplers take no gather, offset, comparison, array, 3D image or level of detail) and drops the correction that reproduced Metal's position at texel edges. Deleted: `AxisSnap`, `SnapKind`, `Snap` and the snap plan (`snapped_axis`, `gathered_by_word`, `celled_by_word` and their word estimates), the texel centring of nearest pixel samples (`centred`, `centre_word`, `pixel_centre`, `PIXEL_CENTRE_WORDS`), the snapped census names, the shared switch's sampled-image arms (it is bicubic only now), `SamplerWord::PIXEL_GATED` and `PIXEL_NEAREST`, the binder's gated keying and `lower::select::pixel_gated`. A runtime slot now specializes on its word's coordinates bit alone. Kept: the division by the size, `SampleOp::PixelFetch` (a constexpr nearest clamp-to-edge sampler's exact fetch) and the argument buffer's flagged exact fetch, and Metal's position, wrap and offset rules the emulated filters still use. `PixelSamplerScaling` is now recorded on every device, MoltenVK included: always for a constexpr pixel sampler but its exact fetch, and for a runtime slot under the clause that the bound word states pixel coordinates. `ArgumentPixelSamplerScaling` is recorded for every heap access and announced at a dispatch while any pixel state lives (not only a filtering one). The notes, the API.md catalogue and a new FAST-PATHS device-gap row state the measured bound: the device's normalized sampler at a coordinate within one f32 ulp of x/N on MoltenVK and at x/N on lavapipe; a linear downscale by 8 within 1/255 of Metal's on MoltenVK, 2/255 on lavapipe. Lanes: pixel_samplers holds each pixel configuration to its normalized control within REACH ulps of the quotient and asserts both notes on every device; pixel_downscales holds every set within 2/255 of the snapped control; mirror_clamp counts a pixel lane that reads Metal's normalized answer within REACH ulps apart; resource_ids expects the argument note where a pixel state lives at the dispatch; the argument-note test waits for any pixel state. The pixel conformance cases declare `pixel-sampler-scaling`; known-gaps rows for their llvmpipe sites are replaced (38 stale, 40 new, at the end) and 22 Apple M3 Max rows appended, each naming the note. Subnormal coordinates (e7775e4c82 removed the flush): `a_subnormal_coordinate_reaches_the_device_unflushed` traces every sample and gather coordinate of constexpr border samplers (1D, 2D, 3D, gather; nearest and linear; zero and white borders) back to the loaded value through bit moves alone, on every committed profile, and holds a kernel whose AIR flushes the coordinate as not passing through. SEMANTICS_VERSION 1960; RUNTIME_VERSION 1676 (the argument note's announcement and the binder's sampler key changed). Verified: - cargo clippy --workspace --all-targets --all-features -D warnings, plain and --cfg m2v_gpu; RUSTDOCFLAGS=-D warnings cargo doc --workspace --all-features --no-deps. - Core suites (4953 tests): all pass but golden_hashes (3776 cells move, left for the re-bless); api_signatures fixed here. - Negative controls: on development's code, 7 of the new or changed sampler tests fail; with the removed flush put back in plane_coord, the subnormal test fails (border 1d zero). - Words (lavapipe; MoltenVK and NVIDIA alike in step): px_sample_argument 2869 -> 2641, xr_sample_runtime 1175 -> 967, px_const_linear_* 1078 -> 943, pix_gather_edge 1089 -> 920, runtime_gather 1165 -> 944; constexpr nearest-edge and the normalized control unchanged; spirv-val PASS on each. - Lanes on lavapipe (linux-gate arm64) and MoltenVK (M3 Max): pixel_samplers, pixel_downscales, resource_ids, mirror_clamp pass; on MoltenVK argument_linear_samples' half RGBA32Float heap groups, driver_deviations and one degrade_notices test fail, none through a pixel path. - conformance replay --cpu (whole set, lavapipe): exit 0, nothing unlisted, no stale row. The pixel cases on MoltenVK: every value site as listed; each case's set-past-layout-support notice is unlisted there, as in the untouched argument-encoder-texture-sampler. * Re-pin the runtime sources at the landing tip The landed packet changed a runtime-sources input, so the committed digest no longer described the sources and `the_runtime_sources_are_the_committed_ones` would fail. Recomputed over the same inputs and committed by land-pkt.sh. |
||
|
|
8fb8b51f4e |
Hold the kept compressed-blit encodings to the ledger on the M3 Max
One work packet, landed as 2 commits (4a74bd7248..aa6286b711 on archive/development-linear-2026-10-28), in order: * Hold the kept compressed-blit encodings to the ledger on the M3 Max Since 62c7d7a9f5 a blit through a texture Metal keeps losslessly compressed is the device's copy, which keeps the bytes Metal's compression rewrites into its canonical encoding. dbd18ad126 held the lavapipe replay to that; the MoltenVK replay on this M3 Max read 24 value sites the ledger did not list. Each is now a known-gaps.tsv row (venue Apple M3 Max) naming the note that records it: - compressed-blits-bgra10xr and -srgb, all seven sites: the runtime holds the format in an R16G16B16A16_UINT image, whose blits under MoltenVK keep the bytes. extended-range-bits-kept. - compressed-blits-rg11b10f and -rgb9e5f, the five sites through the Shared texture (blit-in-cpu-out, cpu-in-blit-out, out-of-compressed, into-compressed, over-a-buffer): MoltenVK makes that texture's image of PixelFormatView usage, which Metal keeps uncompressed, so its copies keep the bytes. device-nan-encoding and shared-exponent-kept. The Private compressed sites (tall, level-3-padded) are MoltenVK's own blit through Metal's compression and match Metal there. This is the same value in another encoding, not wrong data. The bytes the case feeds, set against Metal's recorded words site by site, give exactly the replay's counts and largest differences at all 24 sites (for example tall 8191 words, largest 1610547199: Metal's alpha code clamped up to 384 from below). Every texel of those bytes decodes to Metal's value: the top ten bits of each field with alpha read clamped for BGRA10_XR, NaN for NaN for RG11B10Float, the exact value for RGB9E5Float. Nothing is open: rule 1 rules out a pass that writes Metal's encoding. docs/CONFORMANCE-COVERAGE.md regenerated (the ledger's row count). Verified on the Apple M3 Max, MoltenVK 1.4.2: - conformance replay of the four cases at 46bd06ec2f (the parent of 62c7d7a9f5): all four announced, every value exact. - the same replay at 19b0dafb5a: 24 unlisted divergent sites, exit 1; with these rows: exit 0, the 24 rows exactly the ledger's. - runtime_lane::compressed_blits under --cfg m2v_gpu: passed; every kept site held byte for byte, ExtendedRangeBitsKept, DeviceNanEncoding and SharedExponentKept each announced, MoltenVK's own copy of the Private compressed images rewrote 374 (RG11B10Float) and 507 (RGB9E5Float) words. - cargo nextest -p metal2vulkan-conformance known_gaps, compressed_blits and coverage tests (19 passed); clippy -D warnings; coverage.py --check. * Say in the notice catalogue that a compressed RG11B10Float blit announces device-nan-encoding The catalogue's device-nan-encoding entry named only float arithmetic's NaN results, while PrecisionNote::DeviceNanEncoding's doc and the runtime also announce it for a GPU blit through an RG11B10Float texture Metal keeps losslessly compressed, as the extended-range-bits-kept and shared-exponent-kept entries already say for their formats. Docs only. |
||
|
|
e656074087 |
Name no native note in any conformance case, at the notices site or at a value
One work packet, landed as 5 commits (647aeae138..19b0dafb5a on archive/development-linear-2026-10-28), in order:
* Name no native note in any conformance case, at the notices site or at a value
The suite declares every note of the device's native answers for every case
(replay::NATIVE_NOTES), so a case's own declaration of one stated the suite's rule a
second time, and a value tolerance justified by one was the suite deriving a tolerance
the note's own documentation says validation derives from none.
What changed:
- 237 notices-site declarations of native notes, over 180 cases from 28 case modules
(depth-denormals 76, device-color-conversion 33, float-sample-filter 31,
device-nan-encoding 27, srgb-texel-decode 25, signed-depth-test 17,
device-arithmetic 10, device-sampling 8, device-texel-conversion 8, one each of
device-transcendentals and unorm-depth-rounding), are gone. The shapes that existed only
to choose them go too: fresh_contents' per-row notices, half_write_nans' `packed`,
render_chains' and compute_render_chains' `divides_a_float`, alpha_coverage_pairs'
separate on/off and single-sample sets, and sampler_filtering's name-keyed branch.
- Four value tolerances justified by native notes are removed: border_swizzles'
one-word `Absolute` and compressed_decode's and etc_textures' one-ulp `Ulps`
(device-texel-conversion, whose note says validation derives no tolerance from it), and
pass_bytes' `Unchecked` tanh column (device-transcendentals, device-arithmetic). Those
sites compare exactly; where a venue's device answers otherwise the site is a
known-gaps.tsv row, which the ledger commits that follow carry. border_swizzles'
word-range test, which existed only to make its tolerance mean one ulp, goes with it.
- tests::no_case_names_a_native_note holds it: it failed listing 765 allowances before
this change and passes after.
- docs/CONFORMANCE-COVERAGE.md regenerated (tolerances 12 to 8, `Ulps` no longer used).
Verified: cargo nextest run -p metal2vulkan-conformance --all-features, 1007 passed;
clippy -p metal2vulkan-conformance --all-targets --all-features -D warnings clean.
* Count no native note in the cost and times halves' degraded-set rule
The rule is there because a notice can say the device lacked the exact form and the
runtime did something cheaper, so a count or a time taken with it is of a different amount
of work. A native note (replay::NATIVE_NOTES) never says that: the native form is the only
one the runtime builds, under either policy. Counting them made a cost record incomparable
with the same work whenever a run did or did not provoke one (the MoltenVK replay before
this change read 45 cases `unmeasured` for native notes alone: device-color-conversion,
device-filtered-mipmaps, device-nan-encoding, native-nan-encoding, native-half-conversion,
fast-math-rewrites), and withheld a times verdict from every case that computes, converts
or samples.
replay::degrading filters them out, sorted and once each. run.rs takes it for the replay's
cost row, the cost measurement and the times round; cost::judge and times::classify apply
it to the stored side as well, since records and figures taken before still hold native
codes (fast-math-rewrites in 56, device-nan-encoding in 33 of the committed ones), so no
re-bless is needed for the rule itself.
Tests: tests::the_degraded_set_rule_counts_no_native_note (a record holding a native note
judges `within` against a run that announced none, and the other way, while a non-native
difference stays `unmeasured`) and times::tests::a_leg_that_announced_only_native_notes_is_judged.
README's two statements of the rule say so.
Verified: cargo nextest run -p metal2vulkan-conformance --all-features, 1007 passed;
clippy -p metal2vulkan-conformance --all-targets --all-features -D warnings clean.
* State the measured bounds of the device's texel and colour conversions
device-texel-conversion's recorded bound named 8- and 16-bit codes and said a
4-bit channel's widening is exact, so two lavapipe ledger families had no
stated bound: a 10-bit BGR10A2Unorm code read one f32 ulp low, and ABGR4Unorm
codes read one ulp high (the device converts by the reciprocal product, where
it does not replicate bits). The bound now covers 8-, 10- and 16-bit codes and
a 4-, 5- or 6-bit channel converted by the reciprocal, within one f32 ulp.
device-color-conversion stated only that near a tie the device may store the
other code. On lavapipe it stores past one code in three shapes, which the
note now states: a blend into an 8-bit unorm attachment within 2 codes, a
fetched-and-rewritten 8-bit sRGB attachment within 2 codes once a later draw
reads an earlier one's code, and a blend into an 8-bit sRGB attachment within
4 codes. Another device is not bounded past one code; the NVIDIA RTX 5080
Laptop GPU ledger rows record up to 11 codes at an sRGB blend.
The same text goes into the translator's PrecisionNote docs, the runtime's
Degradation docs (DeviceColorConversion gains one) and docs/API.md's
catalogue. Docs only; no behaviour changes.
Verified: the lavapipe replay (scripts/linux-gate, arm64, LLVM 21.1.8) shows
every row of those families within the stated figures (the ledger's answers);
rustdoc -D warnings for metal2vulkan and the runtime; the runtime's
degradation and catalogue tests.
* Reword the ledger rows that proposed emulating Metal's bits, and list lavapipe's exact rows
Under the native-arithmetic contract, the device's blend, conversion and
sampler are the answer. Some known-gaps.tsv rows still proposed reproducing
Metal's bits: folding the blend into the fragment function, encoding through
Metal's table, or emulating an argument buffer's sampler. Those rows now name
the note that covers the difference and its stated bound, or the open work
where there is some. Only field 6 changes, and no row moves.
- Apple M3 Max half-output-blends (18 rows) and NVIDIA half-output-blends
(39): half-output-fast-math-blend and its stated bound, with no fold. The
sign-bit sentence is kept only where an NVIDIA bound is the sign bit.
- NVIDIA a2one (2) and argb8-targets (23): device-color-conversion. The
llvmpipe argb8 rows at 2 codes (9) now cite the bound the note states.
- blend-interaction-format-srgb8 (14, both venues): device-color-conversion.
lavapipe's sites are within its 4 codes. NVIDIA's 11- and 5-code sites are
past it and need an element-by-element read.
- fetch-ordered sRGB (8), ABGR4Unorm swizzles (26) and the BGR10A2Unorm
round trip (1) cite the bounds the notes now state.
- RADV sample-fills (3): depth-denormals is a native note the suite declares
for every case, not one the case declares.
- NVIDIA pixel-samplers nearest norm (6): device-sampling's nearest-boundary
bound. Open: an element-by-element read.
- a2c-on-1-alpha-50 (2): no note covers the device's coverage mapping. Open:
the owner's call between recording it and computing Metal's floor rule.
- format-footprints-plain-stragglers: the raw sRGB path and
`texel_format::srgb_raw` are gone. The row names the UNORM twin path that
is there today (`srgb_raw_twin`, `srgb_twin_on`, `RuntimeFact::SrgbTexture`)
and drops the todo-list wording.
Removing the old one-ulp and as-words tolerances showed lavapipe's own
conversion at exact sites. That adds 64 rows beside their families
(border-swizzles rgba8/bgra8 30 each, ETC2/EAC 8-bit 3, pass-bytes
fast-float-tanh 1) and updates 35 BC rows' answers, their counts now
including the one-ulp elements.
Verified: the lavapipe replay through scripts/linux-gate (arm64, 4 CPUs)
went from 99 unlisted and 35 stale before these rows to 0 unlisted and 0
stale ("the 882 row(s) above are exactly the open gaps known-gaps.tsv
expects"; 818 before the tolerance removal). The conformance host suite
passes (1007 tests), and docs/CONFORMANCE-COVERAGE.md is regenerated.
* Re-pin the runtime sources at the landing tip
The landed packet changed a runtime-sources input, so the committed digest no
longer described the sources and `the_runtime_sources_are_the_committed_ones`
would fail. Recomputed over the same inputs and committed by land-pkt.sh.
|
||
|
|
9afdb1e150 |
Take the device's instruction for pack, dot, mix, sqrt, exp, log, sign, fract, median3, fneg and fabs
One work packet, landed as 6 commits (3d6b2488ea..f1693ce8c4 on archive/development-linear-2026-10-28), in order: * Take the device's instruction for pack, dot, mix, sqrt, exp, log, sign, fract, median3, fneg and fabs Rule 1: where the device has a native form it is the only form. The translator still computed Metal's own bits for several functions the device has an instruction for. Each now takes the instruction, its difference from Metal recorded as a note: - air.pack/air.unpack: GLSL.std.450 Pack/Unpack Unorm4x8, Snorm4x8, Unorm2x16 and Snorm2x16; rgb10a2 and rgb565 by the device's NClamp, multiply, RoundEven, and multiply by the reciprocal; unorm4x8_srgb by the MSL transfer functions with the device's Pow around the 8-bit instruction (no table read, no NaN select). New note DevicePackConversion (device-pack-conversion), not recorded for a float conversion of the four named formats on MoltenVK. - dot, mix, fast::sqrt: OpDot, FMix and Sqrt on every device, MoltenVK included (the Mix/Dot/ChunkedChain strategies, Metal's fma chains and x * rsqrt(x) are deleted). NativeDot/NativeMix everywhere but a float one on MoltenVK; a chunked dot sums each chunk's OpDot. - precise exp/log and half exp/log/pow/powr/sinh/cosh/tanh: GLSL Exp, Log, Pow, Sinh, Cosh, Tanh (Metal's compositions, half_tanh and the half remaps deleted); half Fun kinds keep the notes honest on MoltenVK. - fract, sign, median3: Fract (bounded below one, the definition), FSign, NMin/NMax; their special-value fixes are deleted. median3 is NativeMinMax on every device (two NaNs, f32 denormals). - round keeps half-away-from-zero from Trunc without the +0 fix: C99's -0, NativeTranscendentals on every device. - float fneg/fabs: OpFNegate and FAbs, the NaN payload NativeNanEncoding and fneg's denormal DeviceDenormals. Kept: exp10/log10 compositions, fmod's routine, ldexp on bits, sinpi/cospi/tanpi, the fast_ formulas, pow/atan2 C99 specials, the saturating convert, round_integer. math::pack/unpack stay for the tile, attachment, fetch and texture callers. The interpreter models the normalized packs. SEMANTICS_VERSION 1920, ARTIFACT_FORMAT_VERSION 469 (a PrecisionNote variant). Verified so far: clippy -p metal2vulkan --all-targets --all-features -D warnings; rustdoc; nextest lower::arith (244 tests) and the engine_arith, engine_float_call_notes, engine_native_maths, engine_spirv_cross_forms, engine_native_half modules. * Delete the measured half quantize deviation; hold dot and median3 lanes to the device After the half follow-ups, no module requires VkProperty::MetalHalfQuantize: a module that rounds to half through OpQuantizeToF16 records NativeHalfQuantize on every profile, and nothing decides on DriverDeviation::MetalHalfQuantize. Delete it with its property, its derive and profile arms, its codec entry, its four measured rows (MoltenVK on Apple9, RADV on the 780M, ANV on the UHD 770 and the Iris Xe), the driver-facts test rows, and the lane assertions that it required nothing (engine_native_half, engine_arith, driver_deviations' half quantize and owned half edge lanes, native_maths' half rounding lane). Docs that named it (NativeHalfQuantize, narrow::quantizes, driver_facts) now say Vulkan leaves the quantize's rounding to the device. The lanes follow the previous commit's native forms: - driver_deviations' dot lane: dot is the device's OpDot on every device, so the half words (a dot of half lanes held as float) are no longer checked against Metal's fused 16-bit chain; the float words stay checked where the profile takes MetalFloatFunctions (MoltenVK, whose OpDot is MSL's own dot), and every kernel must record NativeDot. - driver_deviations' min/max lane: median3 is NMin/NMax on every device and records NativeMinMax, so its word (the seventh of each lane) is printed, not checked; every kernel must record NativeMinMax. - the denormal probe and native_maths docs name the device's OpDot and FMix. api_signatures re-blessed (DevicePackConversion added on both crates; the two MetalHalfQuantize variants removed). REFUSALS.md regenerated, unchanged. Verified: see the branch report. * Hold the sRGB pack bound and round's zero to what the devices answer The conformance replay on lavapipe and the MoltenVK lanes read the previous two commits' native forms against Metal: - sRGB unpack and pack: Metal decodes through its twelve-bit table (the step k / 4095 nearest the transfer) and encodes by that table's byte, where the module takes the MSL transfer by the device's Pow. DevicePackConversion's bound (artifact, runtime, API.md, FAST-PATHS.md) now says so: a decoded colour within half a twelve-bit step (1/8190) of Metal's step, beyond Pow's bound. Measured on the authored cases (lavapipe and MoltenVK): every float decode within 1.2205e-4 of Metal's, every half within that and one half ulp, every encoded channel within one code, no alpha differing; normalized packs a code apart at ties, a NaN channel the device's. - known-gaps.tsv: pass-bytes-srgb-decode-all-bytes's row takes the new answer (1153 elements, largest 0x00F90000) and names device-pack-conversion; a new row for pass-bytes-srgb-encode-sweep (772 elements, largest 0x00010101); pass-bytes-half-tanh-regimes's answer moves to 1257 elements (half tanh is the device's Tanh). CONFORMANCE-COVERAGE.md regenerated. - driver_deviations' denormal probe: round is C99's on every device (NativeTranscendentals), whose zero below zero is -0 where Metal answers +0, so its word (15) is printed, not checked. On MoltenVK it was the lane's only failing word (48 of 4096). Verified: conformance replay on lavapipe (arm64 gate container) exit 0, nothing unlisted or stale; driver_deviations' float_denormals, owned_dot and minimums lanes pass on lavapipe and on MoltenVK (M3 Max); conformance and degradation tests pass. * Hold the engine maths tests to the device's instructions engine_metal_math and engine_native_maths still asserted Metal's forms that the native change replaced; they skip without llvm-as, so the earlier focused runs missed them. - engine_metal_math: a half fast_tanh is Metal's half tanh (Metal's half functions are the same in both math modes, and MSL's fast-math formulas are its float ones), so it is the device's Tanh, no Exp2 and no division, as the code already lowers it; the float fast_tanh keeps the MSL formula and its assertions. sign is the device's FSign with and without fast math. Both record NativeTranscendentals wherever the device's functions are not Metal's own; on MoltenVK sign is MSL's own (no note) and a half tanh is MSL's float tanh rounded to half (DeviceTranscendentals). The sRGB fixtures now assert Pow beside UnpackUnorm4x8 / PackUnorm4x8, no table, and DevicePackConversion; the interpreter models no Pow, so the table reference values and the interpreter run go (their values are the device lanes'). The test is renamed metal_math_variants_select_their_forms. - engine_native_maths: dot, mix and fast::sqrt are OpDot, FMix and Sqrt with no Fma on lavapipe and on MoltenVK, a float dot and mix noting nothing on MoltenVK and a half mix NativeMix; the values hold their notes' bounds on both profiles' interpreter runs, where the test used to claim Metal's fused chains word for word on MoltenVK. - refine_float's doc: air.fast_sqrt is the device's Sqrt; engine_tiny_products' doc: the module's dot is the device's OpDot. Verified: with llvm-as set, every engine_ and lower::arith test passes (1610); clippy clean. * Number ARTIFACT_FORMAT_VERSION 473 and SEMANTICS_VERSION 1904, past development's The fast-math landing took ARTIFACT_FORMAT_VERSION 470 and the sampler-details landing 472 and SEMANTICS_VERSION 1903, so this series' encoding (the new DevicePackConversion note and the removed MetalHalfQuantize property in the codec) takes 473, and its translation changes 1904 (set in the series' first commit at the rebase onto 322dc6354d). * Re-pin the runtime sources at the landing tip The landed packet changed a runtime-sources input, so the committed digest no longer described the sources and `the_runtime_sources_are_the_committed_ones` would fail. Recomputed over the same inputs and committed by land-pkt.sh. |
||
|
|
ae70850097 |
Take the device's native texel rounding, residency, level clamp and stores
One work packet, landed as 7 commits (d1161d6b38..322dc6354d on archive/development-linear-2026-10-28), in order: * Take the device's native texel rounding, residency, level clamp and stores Rule 1: where the device has a native form it is the only form, noted where it can differ. - Half texels on MoltenVK: a `half` read, sample or gather is the device's `float` texel (Metal's there) rounded to nearest even. The routine keeps only the YCbCr 8192 grid's ties away (the YCbCr work's), so the Metal-sampler families (32-bit float sample toward zero, the 16-bit normalized grids' exact half, the unmeasured class) go, with `HalfFamilies`, `HalfForm`, the grid constants and `texel_round::ones_ratio_*`. `HalfTexelConversion` is recorded under the bound format for a 32-bit float sample, a 16-bit normalized texel and an unmeasured format. - Subnormal coordinates: the clamp-to-zero flush is gone; the device reads the coordinate (`DeviceSampling`). - Residency: on a device with `shaderResourceResidency` a sample's or gather's word is the device's sparse residency (`SparseResidency`); Metal's footprint rule and the tile map stay only where the device has no residency of its own. `Probe`, the named footprint taps and the zeroing of them go. - Level clamps: a sampler's `lodMinClamp`/`lodMaxClamp` reach the device as given, not snapped to Metal's 1/64 grid; MoltenVK's Metal sampler snaps itself. Level queries are noted `DeviceSampling` off MoltenVK. - Stores: an integer texel written into a half-float or `RG11B10Float` storage texture of the float class is the store's to convert (noted `DeviceColorConversion`), and a `float` blend into a 16-bit float attachment through the pixel interlock is the store's to round (Metal's where the profile takes `MetalHalfStorageWrites`, else noted). Only `TextureWriteRoundingMode::NearestEven` keeps the shader's rounding (no store gives it). - color_writes.rs docs: drivers round small floats toward zero as measured. Docs: FAST-PATHS rows 60/61 and the subnormal gap removed; API.md catalogue entries; `PrecisionNote` and `DriverDeviation` docs. SEMANTICS_VERSION 1950, RUNTIME_VERSION 1750 (the runtime's sampler cache docs and test). Verified: cargo clippy --workspace --all-targets --all-features -D warnings clean; the metal2vulkan suite (3370 tests) with every failure fixed or updated to the native answer (half_texel, texture_interp's 16-bit grid, srgb_decode, the sparse binder tests, cross-class writes on the interpreter, fetch_blend16_narrow); golden_hashes moves and is left for development's re-bless; api-signatures and refusal-surface checks unchanged. * Take Vulkan's cube-gradient rule on a driver whose route is not measured A MoltenVK release or GPU whose cube-gradient route no measurement covers took Metal's anisotropic level and taps in the shader (`CubeGradientRoute::Unmeasured`), and elsewhere an isotropic sampler made for the use. Rule 1: the device has a native gradient sample, so it is the only form. Such a driver now takes `CubeGradientRoute::Vulkan` (the form Vulkan's derivative rule reads), the device's reading recorded as `CubeGradientFootprint`; the emulation stays only for a device without `samplerAnisotropy`. With the variant gone nothing sets the isotropic-sampler use, so it is deleted throughout: `SamplerUse::cube_gradient` and `with_cube_gradient`, `CombinedSampler::cube_gradient` and its index bit, `HandleClass::Sampler`'s `cube_gradient` (four heap sampler classes, not eight), the binding keys, the plan's `WriteSource::Sampler`/`ArgumentSampler` and `SamplerSource::Slot` fields, the codec, the runtime's and the validation executor's binders. The anisotropic emulation loses its isotropic one-tap form and the `answered` input. Consumer-visible: `SamplerUse`, `CombinedSampler`, `HandleClass::Sampler`, `WriteSource` and `SamplerSource` lose the field; `CubeGradientRoute::Unmeasured` is gone (api_signatures blessed). ARTIFACT_FORMAT_VERSION 470 (the encoded classes and symbols changed). Docs: profile.rs and error/mod.rs route docs, the AnisotropicFilter and CubeGradientFootprint notes, API.md's catalogue, FAST-PATHS's unmeasured-route gap removed. Verified: workspace clippy (all targets, all features) clean; nextest of the touched families (engine_sampler_unk, engine_heap_binder, engine_handles, anisotropic, driver_facts, cache, bind heap/plan, sym, metal::sampler, link, runtime sampler_cache, validation argument_buffer_members, api_signatures/api_surface/fast_paths): 429 run, all pass after updating the tests to the Vulkan route. * Ledger lavapipe's halfway nearest-mip level under a descriptor clamp With the level clamp handed to the device as given, lavapipe rounds a nearest mip filter's level at `lodMinClamp` 1.5 up to level 2 where Metal reads level 1; Vulkan allows either rounding at a half. The five `sampler-mip-*` sites are the device's native level selection: `DeviceSampling`'s docs (and API.md's entry) now state the shape, and known-gaps.tsv holds the five llvmpipe rows. Verified: `conformance replay --cpu` on lavapipe (linux-gate, arm64) listed exactly these five sites as unlisted and nothing stale; the conformance ledger tests pass. * Ledger the two filter-pair sites at their measured difference The two mixed-filter sites of sampler-mip-filter-pairs-nearest differ by 1000, as the other three do; the rows copied a truncated figure. Verified by conformance replay --cpu on lavapipe, whose rerun named these two rows both unlisted and stale. * Number ARTIFACT_FORMAT_VERSION 472 past the fast-math change's 470 Both the fast-math change and this series moved the artifact format to 470, so the rebase merged them silently; 471 is held for the maths-functions series. * Drop the YCbCr sample module's cube_gradient field, gone from CombinedSampler This series removed CombinedSampler::cube_gradient with the isotropic sampler use; the YCbCr sample module landed meanwhile still set it. Verified: clippy --workspace --all-targets --all-features -D warnings clean. * Re-pin the runtime sources at the landing tip The landed packet changed a runtime-sources input, so the committed digest no longer described the sources and `the_runtime_sources_are_the_committed_ones` would fail. Recomputed over the same inputs and committed by land-pkt.sh. |
||
|
|
cdc09276f3 |
Emit fast-math arithmetic in the AIR's order and let the device group and fuse it
One work packet, landed as 4 commits (c81ea84c14..41bbe0f1c2 on archive/development-linear-2026-10-28), in order: * Emit fast-math arithmetic in the AIR's order and let the device group and fuse it What. The translator no longer reproduces Metal's compiler's grouping, pairing and fusion of fast-math arithmetic. Each float operation is emitted in the AIR's order, decorated by its own fast-math flags: an operation whose flags hold `contract` and `reassoc` is undecorated, so the device's compiler may group and fuse it; every other one is `NoContraction` (an undecorated SPIR-V operation would also allow reassociation, which a `contract`-only operation does not), and a precise module's operations keep their order. `llvm.fmuladd` keeps its fused route: one AIR operation, answered by the device's fused instruction. Deleted: lower/arith/regroup.rs (648 lines), reassoc.rs (1469), contract.rs (585) and contract/chain.rs (1204); the Folded and Fused strategies, ArithPlan's `contract` and `unrounded` fields and select.rs's CONTRACTED read bit; output_precision's `plan` (the `unrounded` marking of half output chains, Metal's choice of where not to round) and the plumbing that existed only for it: LoweringInputs::half_output_lanes, the public HalfOutputLane, StageIo::half_output_lanes, color_writes' half_output_lanes check, its cache-key hashing and codec entry; Fma::on (tests only). Tests engine_reassoc (318), engine_regroup (134), engine_settled_sums (572), three engine_arith tests, three half-output-lane engine_stage_io tests and the fused_sync lockstep case, whose premises were Metal's grouping. Fixtures regroup_chain, sum_regroup, sum_regroup_precise, fmx2_contract_fast, fmx2_contract_precise and unm_contract_chain (.metal, .ll, .air.ll, their TOOLCHAIN lines and air_input printouts). Validation lanes sum_regroup (308) and settled_sums (394), and the three authored cases whose expected values were Metal's fusions (multiply-add-contraction-shapes-under-fast-math, multiply-add-contraction-flags-without-fast-math, multiply-add-chains-under-fast-math) with their observations. Kept: the contraction rule itself (AIR semantics); output_precision's notes (half_output_note, note_half_output, note_extended_range_sources), which state where Metal may differ rather than reproduce it; the F16 strategy's per-operation rounding. The note. The existing FastMathRewrites covers it: it is now recorded where an operation's operand comes from an operation the two operations' flags let a compiler regroup (both `reassoc`) or fuse (a product into a sum, both `contract`), looking through negation, widening, shuffles and element moves. No new kind. It moves from the ledger's elsewhere class to a device gap (docs/FAST-PATHS.md row; tests::fast_paths), joins the conformance replay's NATIVE_NOTES, and the cases' own declarations of it are gone (depth_texel_reads, half_read_nans, host_page_writes, mesh_draws, sample_positions, snorm_tile_store, visibility, topology_classes). New tests. tests::engine_fast_math_order: a fast `((d+c)+b)+a`, its precise twin, fast and contract-only `a*a+c`, and a fast vector product, on every committed profile: spirv-val, no fused instruction, one instruction per AIR operation, NoContraction exactly where the flags forbid contraction, the interpreter's answer in the AIR's order, and the note on every form but the precise sum. runtime_lane::kept_apart (reworks settled_sums): strict and contract-only mul-adds store two roundings, a precise sum stores the AIR's order, a fast mul-add stores either rounding, and the layer reports nothing. Versions: SEMANTICS_VERSION 1900; ARTIFACT_FORMAT_VERSION 469 (StageIo lost a field). Docs: FAST-PATHS.md, API.md (catalogue entry and policy), ARCHITECTURE.md (module map), artifact.rs's FastMathRewrites doc. api_signatures.tsv re-blessed. Verified (this machine unless named): - Negative control: on the parent tree both new core tests fail (a fast sum regrouped to 0x34000000 where the AIR order stores 0, the mul-adds fused, the product paired, no note); with the change they pass. - cargo check, clippy --workspace --all-targets --all-features -D warnings, plain and with --cfg m2v_gpu; rustdoc -D warnings; refusal_surface --check; conformance and metal coverage current. - Core tests: engine_fast_math_order, engine_arith, arith::tests, engine_stage_io, engine_simd*, engine_native_*, engine_metal_math, engine_fetch_*blend, engine_bicubic, engine_rotated_weights, engine_extended_range, engine_float_call_notes, color_write, api_tests, compile tests, fast_paths: 469 + 83 passed. - The engine inventory bless (not committed) compiled every public fixture on all 19 profiles: 43593 ok cells, each through spirv-val; only the deleted fixtures' 28 rows went. - Conformance replay on lavapipe (linux-gate arm64): exit 0, the 723 rows are exactly known-gaps.tsv's, 0 unlisted. - Validation lanes on lavapipe (linux-gate arm64, --cfg m2v_cpu_icd): kept_apart and the lanes that assert notice sets (blits, degrade_notices, gpu_times, half_slice_nans, heap_metal_sizes, heap_textures, provoking, provoking_mesh, sparse_textures, ycbcr_passes): 93 passed. llvmpipe kept all 4096 fast mul-adds as written and all 4096 fast sums in the AIR's order. - kept_apart on MoltenVK (Apple M3 Max, --cfg m2v_gpu, under maclock): passed; the device's compiler fused 2370 of 4096 fast mul-adds and kept all 4096 fast sums in the AIR's order. - Release CLI before and after, back to back, on the deleted and most affected fixtures over moltenvk-m3, gate-lavapipe, nvidia-rtx5080-laptop and intel-irisxe-anv: wall within noise (about 8 ms of process start, +-3 ms on a loaded host). Words: hfb_filter_bank 148284 -> 162420 on moltenvk-m3 (half chains feeding a half output now round at each operation as the AIR says: +1408 OpFConvert, +1408 NoContraction; 289 OpFmaKHR became a multiply and an add), unm_contract_chain 33666 -> 35167, fmx2_contract_fast 18557 -> 18908, the rest within +-200. Not in this commit: the golden tables (6028 cells move in 347 subjects, 5707 of them under an unchanged key, 28 subjects go with the fixtures) and the engine inventory (28 rows go, none moves) are re-blessed on development; corpus/authored-compile.tsv keeps three lines for the deleted cases until its re-bless. * Read 16-bit operands directly and hold half chains at float without float16 What. Two forms of `half` arithmetic that were neither the device's native one nor the fast one: - Where a profile takes the device's 16-bit `+ - *` and `fma` (moltenvk-m3 on the measured fact, RADV and ANV under the 16-bit float controls), every `half` is held widened in an `f32`, so each 16-bit operation narrowed both operands and widened its result: three conversions an operation, the next operation narrowing what the last had just widened. `FunctionBuilder::convert` now answers a narrowing of a value it widened from a 16-bit float with that float (exact), and a narrowing of a plain constant whose lanes are zeros, infinities or normal halves with the 16-bit constant; the widenings nothing else reads leave with the dead code. A rounding's own pair (a narrowing widened back) is never taken apart, so `narrow::rounds_by_conversion`, which decides `NativeHalfConversion` and the controlled modes, still sees every rounding. A chain of 16-bit operations is now 16-bit instructions on 16-bit values, converted only where a value enters or leaves it. - Without `shaderFloat16` (vk12-floor, SwiftShader, Pascal) the module emulates `half` arithmetic in `float`, rounding each result by the device's quantize. New `DevicePolicy::half_chains`: `HalfChainPolicy::AtExits` (the default, the fast form) holds a `half` `+ - *` whose flags hold `contract` and `reassoc` and whose result only such operations read at `float` precision (`lower::arith::half_chain`), so a chain rounds where a value leaves it, one quantize per exit; `HalfChainPolicy::EachOperation`, which `exact_answers()` selects, rounds every operation. The profile carries it, so its fingerprint covers it. Recorded as `FastMathRewrites` (its doc and API.md's catalogue entry extended); a FAST-PATHS.md fast-default row; API.md's policy list. The forms by profile (unchanged, for the record): moltenvk-m3 takes the measured 16-bit arithmetic; RADV and ANV the controlled one; NVIDIA (the conversion pair folded, `HalfConversionPairFolded`) and lavapipe (no `DenormPreserve` for 16 bits) have `shaderFloat16` but compute `half` in `float` and round by the device's conversion pair, which this commit leaves as it is; the profiles without `shaderFloat16` quantize. Tests: tests::engine_fast_math_order::half_operations_read_their_16_bit_operands_directly (no narrowing of a widened half or a constant on any profile, the rounded chain stored, some profile takes 16-bit arithmetic) and ::half_chains_without_float16_round_at_their_exits_by_default (one quantize against two, the held and rounded answers, both policies on every profile, distinct fingerprints); runtime_lane::kept_apart::half_chains_without_float16_round_at_their_exits on the device. Updated, as the conversions they counted are gone (the half agent's files, minimal): lower::arith::tests::narrow::half_arithmetic_on_the_device_is_one_16_bit_instruction (at most two operand narrowings), tests::engine_arith::half_rounding_follows_the_operation (the chain's conversion count), tests::engine_arith::a_measured_half_sum_requires_the_arithmetic_fact_alone (a kernel whose halves only the 16-bit `fma` reads widens nothing, so needs no measured widening). Versions: SEMANTICS_VERSION 1901. ARTIFACT_FORMAT_VERSION unchanged (no encoded type changed). api_signatures.tsv re-blessed (the enum and the field). Words, release CLI, every module spirv-val'd (before = development 7b5cf8328d, then 622b388830, then this commit): - moltenvk-m3: hfb_filter_bank 148284, 162420, 140672; grd_half_many_samples 99039, 99330, 96710; nan_half_fast 10042, 10057, 9961. - nvidia-rtx5080-laptop: hfb 147962, 155474, 155474; grd 110944, 111163, 111163; nan 9888, 9882, 9882. - gate-lavapipe: hfb 148530, 155470, 155470; grd 111018, 111163, 111163; nan 9888, 9882, 9882. - vk12-floor: hfb 124826, 131766, 121270; grd 84482, 84627, 82019; nan 9838, 9832, 9808 (EachOperation reproduces 622b388830's: 131766, 84627, 9832). Verified: - Negative controls: with the narrowing fold off, the 16-bit test fails (amd-780m-hawkpoint-radv narrows a widened half); with the plan off, the chain test fails (two quantizes on lunarg-desktop-baseline-2023). Both pass with them on. - Core tests on this Mac: 1133 passed (arith, engine_arith, engine_native*, engine_stage_io, engine_fetch*, engine_simd*, spirv::*, device::*, cache::*, compile tests, api_tests, air_input, fast_paths, engine_fast_math_order, api_signatures, api_surface); conformance filtered tests 26 passed; clippy --workspace --all-targets --all-features -D warnings, plain and with --cfg m2v_gpu; rustdoc -D warnings; refusal_surface --check. - The engine inventory bless (not committed) over every public fixture on all 19 profiles: only the deleted fixtures' 28 rows go, every other cell as before (spirv-val on each `ok`). - runtime_lane::kept_apart on SwiftShader (linux-gate arm64, --icd swiftshader): the `fast` chain 4096 of 4096 held under AtExits and 4096 rounded under EachOperation, the strict chain rounded under both; on lavapipe (whose compiler drops the undecorated conversion pairs: the `fast` chain 4096 held under both, the strict one rounded) and on MoltenVK (Apple M3 Max, under maclock: every chain rounded at each sum, the 16-bit arithmetic) both tests pass. - Lavapipe (linux-gate arm64): the conformance replay exits 0, its 763 rows exactly known-gaps.tsv's, 0 unlisted, the verdicts as at 622b388830; runtime_lane kept_apart, native_maths, half_* and degrade_notices: 28 passed. MoltenVK: the half_* lanes and native_maths' half rounding pass; native_maths_answers_within_its_recorded_bounds fails on NativeDivision (`divide::precise` records it everywhere; code this commit does not touch). Not in this commit: the golden tables (with 622b388830, 7652 cells move in 672 subjects; 28 subjects go) and the engine inventory (28 rows go) are re-blessed on development. * Number ARTIFACT_FORMAT_VERSION 470, after development's 469 What. development's own commit took 469 for its encoding change while this branch's first commit took 469 for StageIo losing half_output_lanes; the rebase merged the two equal lines silently, so two layouts shared one value. 470 keeps an artifact of either from decoding as the other. Verified: cargo check -p metal2vulkan --all-features --all-targets on the rebased tree. * Re-pin the runtime sources at the landing tip The landed packet changed a runtime-sources input, so the committed digest no longer described the sources and `the_runtime_sources_are_the_committed_ones` would fail. Recomputed over the same inputs and committed by land-pkt.sh. |
||
|
|
12cd1535a8 |
Keep the device's copy for blits through a texture Metal compresses
One work packet, landed as 9 commits (62c7d7a9f5..378d636d2f on archive/development-linear-2026-10-28), in order:
* Keep the device's copy for blits through a texture Metal compresses
Metal's GPU blit into or out of a texture it keeps losslessly compressed
writes three families' texels in its compressor's canonical encoding:
BGRA10_XR (and its sRGB twin) with each field's low six bits cleared and
the alpha code clamped, RG11B10Float with a NaN made the quiet NaN, and
RGB9E5Float with the shared exponent lowered. The runtime reproduced that
with a crate-owned compute rewrite of the copied rows (bind::CompressedBlit
and its module) after every such blit.
That is Metal's compressor's encoding, not the format's: Metal's own
uncompressed texture of the format keeps the bytes through the same blit,
and every rewritten texel reads the same value either way. The device's
copy, which keeps the bytes, is now the only form. A blit through such a
texture announces the note of the encoding it keeps, once per device:
extended-range-bits-kept (BGRA10_XR), device-nan-encoding (RG11B10Float)
and shared-exponent-kept (RGB9E5Float), each existing kinds; no new kind.
Where the device's own copy already writes Metal's encoding (MoltenVK,
RuntimeDriverDefect::CompressedImageCopiesRewriteTexels) nothing is
announced; the defect's PixelFormatView usage, which keeps CPU copies
byte-exact there, stays.
Removed public items: bind::CompressedBlit, bind::CompressedBlitModule,
bind::compressed_blit_module, WorkCounts::compressed_rows_rewritten.
RUNTIME_VERSION 1740. The conformance recordings' runtime cost records
that count compressed_rows_rewritten (compressed-blits-*, fresh-pattern-*,
xr-clear-routes-*, xr-draw-*) move at the next re-bless.
The compressed-blits lane now asserts the bytes are kept and each format's
note is announced; the conformance case declares the note where it is not
one of the suite's native notes.
Verified: cargo clippy --workspace --all-targets --all-features -D warnings;
RUSTFLAGS='--cfg m2v_gpu' cargo check of runtime and validation; nextest
of blit_plan, degradation, degradation_catalogue, conformance
compressed_blits, unused_bits, fast_paths, owned_divisions, api_surface,
api_signatures and refusal_surface (77 passed). Device lanes and replay
run after the whole series.
* Resolve a fetching pass's sample planes by the device's average
A color attachment whose sample planes held its samples as the pass ended
(framebuffer fetch in the pixel interlock on a device without multisampled
storage images: ANV, MoltenVK) was resolved from the planes by the
crate-owned resolve, which computes Metal's closed rules for every unorm,
snorm, sRGB, 32-bit float, half, packed 16-bit, RG11B10Float and
RGB9E5Float format. Every other color attachment resolves by the device's
AVERAGE. The average is the device's native answer, so it is now the only
form here too: the planes merge back and one more instance of no draws
resolves the attachment, announced device-rounded-resolve where the
driver's average is not measured to be Metal's (on MoltenVK it is,
DriverFact::ColorResolveAverageIsMetals, so nothing is announced there).
The crate-owned resolve keeps the two resolves no device's average writes:
into the attachment's format's sRGB twin (the 8-bit unorm and sRGB rules)
and of an extended-range attachment. Its rules for every other format, and
their tests, are deleted. ColorResolveFormat::of names the twin's eight
formats; sample planes are read only for an extended-range form, and a
module of a twin format from planes is refused.
Removed public items: ResolveRule::{HalfUnorm, Snorm, Float32, Float16,
SmallFloat, SharedExponent}, ResolveRule::bits, ResolveRule::resolves,
ColorResolveFormat::resolves; ResolveRule::Unorm loses its bits field.
Cost: such a pass now merges its planes back and resolves in one more
render pass instance, where it drew one resolve pass from the planes; a
memoryless attachment the pass only fetches and resolves needs a backing.
The ColorResolveAverageIsMetals docs, the shader-resolve and
device-rounded-resolve entries (degradation.rs, docs/API.md) now say what
resolves where. The fetch lanes expect no shader-resolve for a fetched
attachment.
Verified: cargo check --workspace --all-targets --all-features; the GPU
cfg check of runtime and validation; nextest of color_resolve,
sample_planes, degradation, driver_facts, fast_paths, api_surface,
api_signatures, refusal_surface (84 passed). Device lanes run after the
series.
* Clear a float attachment to the clear color as the device converts it
A render pass's Clear of a normalized, sRGB, packed 16-bit, half, float or
small-float color attachment computed Metal's texel on the CPU (its
rounding, its trip through half for the packed 16-bit formats, its
truncated small-float and shared-exponent mantissas) and handed the device
a value that converts back to it; a Depth16Unorm clear took a quarter step
above Metal's truncated code. The conversion is the device's native
answer, so the clear value is now the color (or depth) as a float, which
the device converts.
Where the device's conversion can stand a code from Metal's it is
announced, once per device: device-color-conversion where a normalized
channel's scaled value lies within 1/1024 of a midpoint between two codes
(a packed 16-bit channel's within Metal's half step too), an sRGB channel
lies inside (0, 1), or a half, small float or shared exponent does not
hold the value exactly; unorm-depth-rounding where a Depth16Unorm depth's
scaled value lies at or above a midpoint, which Metal truncates and a
device rounding to nearest takes up. Vulkan asks for rounding to nearest
and leaves ties, sRGB encodes and float rounding to the device. A NaN in a
normalized or RGB9E5Float channel still clears as 0 (Vulkan states no such
conversion); integer, extended-range, word and YCbCr attachments keep
Metal's conversion, which no device makes for them.
Metal's measured conversion moves into the tests as the model they compare
with. The renders lane accepts a device texel a code from Metal's where
the note is announced and prints it; the cleared sRGB resolve lane
compares the resolve with the device's own 1x clear.
UnormDepthRounding's docs and cost, PrecisionNote::DeviceColorConversion's
docs and both docs/API.md entries say so.
Verified: cargo clippy --workspace --all-targets --all-features -D
warnings; the GPU cfg check of validation; nextest of clear_value,
heap_tiled, fresh, nan_clear and degradation (55 passed). Device lanes and
replay run after the series.
* Expect the device's clear conversion in the lanes that clear at a tie
Since 5925c303f8 a clear converts the clear color (and a 16-bit depth)
the device's way, announcing device-color-conversion where a channel
lies at a rounding question (0.5 on an 8-bit unorm channel is 127.5
codes, a tie; any sRGB channel's encode) and unorm-depth-rounding where
a Depth16Unorm clear's fraction reaches the midpoint (Metal truncates).
Lanes that hold exact notice sets or Metal's truncated depth codes now
expect them:
- dont_care_stores: every pass clears through color_pass or earlier()
at 0.5; clear_tie() adds the note to each expected set (MoltenVK's
pipelines record no color-conversion note, so it showed there first).
- resolves: the depth stand-in clears Depth16Unorm to 0.5 (32767.5
codes): Metal's 0x7fff or the device's 0x8000, and the note announced
exactly for that format.
- buffer_depth_samples: the 16-bit clear to 0.25 (16383.75 codes)
announces unorm-depth-rounding.
- buffer_texture_blits: the planar depth clears (0.375, 0.625, 0.875)
hold Metal's truncated code or the one above it, the note's bound.
Verified: the four lanes' failing tests on lavapipe (linux-gate
halfnative) failed before these edits; on MoltenVK (Apple M3 Max,
maclock) dont_care_stores, resolves' depth stand-in,
buffer_depth_samples and the planar depth lane pass with them.
* Merge a fetched attachment's sample planes back before its twin resolve
A pass whose last draws fetch a multisampled attachment through sample
planes (the pixel interlock without multisampled storage images: ANV,
MoltenVK) left the planes unmerged after it under MultisampleResolve
wherever the crate-owned resolve drew the attachment's resolve, on the
reading that that resolve reads the planes. A resolve into the
attachment's sRGB twin is crate-owned but reads the attachment itself
(color_resolve.rs filters its planes out), so it resolved samples the
pass never wrote: on MoltenVK a 4x RGBA8Unorm attachment cleared to 0,
fetched once and resolved into RGBA8Unorm_sRGB read all zeros, where
the same pass stored too resolves (255, 225, 0, 0).
The planes steps now skip the merge only for a resolve that reads the
planes, an extended-range attachment's (the flag is renamed
planes_resolve to say so); a twin resolve merges first, as a stored
attachment does.
Test: runtime_lane::framebuffer_fetch::planes::
a_twin_resolve_of_a_fetched_attachment_reads_its_samples holds the
MultisampleResolve answer to the StoreAndMultisampleResolve one.
Verified on MoltenVK (Apple M3 Max, maclock): the test failed without
the fix (zeros) and passes with it, beside the planes, memoryless,
kept_resolves and twin-resolve lanes (18 passed); the runtime's
sample_planes unit tests pass.
* Expect the clear note in color_reformat's passes, through one helper
color_reformat's passes clear to (0.5, 0.25, 0.75, 1.0), whose red is a
tie in an 8-bit unorm channel, so the device's conversion of the clear
announces device-color-conversion at the device's first such pass.
Lavapipe's pipelines record the note already; MoltenVK's record none
(VkProperty::MetalColorWrites), so its exact notice sets failed there.
degrade_notices::tie_cleared() names that note for every lane whose
passes clear at a tie; dont_care_stores' local helper moves there.
Verified on MoltenVK (Apple M3 Max, maclock): color_reformat and
dont_care_stores pass (they failed in the full runtime_lane run before
this change).
* Hold the kept compressed-blit encodings to the ledger, and declare their notes
Since 01f733c6f0 a blit through a texture Metal keeps losslessly
compressed is the device's copy, which keeps the bytes Metal's
compression rewrites into the canonical encoding. The lavapipe replay
then read 46 rows the ledger did not expect:
- 28 value sites of compressed-blits-{bgra10xr,bgra10xr-srgb,rg11b10f,
rgb9e5f}: the device's bytes against Metal's canonical encoding. Each
is now a known-gaps.tsv row (venue llvmpipe) naming the note that
records it: extended-range-bits-kept, device-nan-encoding,
shared-exponent-kept, whose bound (the same value, another encoding)
covers it. Nothing is open: rule 1 rules out writing Metal's encoding.
- 18 notice sites of fresh-pattern-{552,553,93}, xr-draw-bgra10xr*
and xr-clear-routes-bgra10xr*: their read-backs blit out of such a
texture and announce the note, every value exact. They now declare
it through compressed_blits::kept_encoding_notice, the one table of
which format announces which note (device-nan-encoding is native and
declared for every case already). fresh_contents' row-notice test
counts the three pattern rows' second allowance.
docs/CONFORMANCE-COVERAGE.md regenerated (the ledger's row count).
Verified: conformance replay --cpu on lavapipe (linux-gate halfnative,
arm64): exit 0, 751 rows, exactly the ledger's (723 before the series
plus these 28), 0 unlisted and 0 stale; cargo nextest -p
metal2vulkan-conformance (1005 passed); clippy -D warnings.
* Format owned_divisions' bind import after the rebase
The rebase onto development dropped both CompressedBlit (this series)
and BlockDecode (development's BC twin removal) from the import, which
rustfmt now joins onto one line. No behaviour changes.
Verified: cargo fmt --all --check.
* Re-pin the runtime sources at the landing tip
The landed packet changed a runtime-sources input, so the committed digest no
longer described the sources and `the_runtime_sources_are_the_committed_ones`
would fail. Recomputed over the same inputs and committed by land-pkt.sh.
|
||
|
|
a1f1677174 |
Convert a two-plane YCbCr texture through the device's own Y′CbCr sampler where it has Metal's reconstruction
One work packet, landed as 3 commits (d38741a041..46bd06ec2f on archive/development-linear-2026-10-28), in order: * Convert a two-plane YCbCr texture through the device's own Y′CbCr sampler where it has Metal's reconstruction The owner's 10-28 decision: a YCbCr texture's texels are the GPU's own sampler Y′CbCr conversion where the GPU converts the format and the planes form one image; elsewhere Metal's fixed-point conversion stays as capability. Route. The texture's conversion pass (ycbcr.rs's refresh) copies the planes from its staging copy into an optimal image of the multi-planar format and samples it once per texel through a combined image sampler whose layout bakes an immutable sampler of the VkSamplerYcbcrConversion, writing the texture's image in the layout Metal's kernel writes (bind::ycbcr_sample_module). User pipelines are unchanged: no pipeline variant per conversion, no immutable sampler in a user layout, no combinedImageSamplerDescriptorCount in a user pool. The staging-to-image copy runs at every refresh (two regions); the sample dispatch takes the refresh's indirect arguments, so unchanged planes sample no workgroup. Which textures. Unpacked 8- or 10-bit codes of a 4:2:0, 4:2:2 or 4:4:4 layout over plane 0 whose planes form one image: no chroma codes 0, no rows past the buffer, each plane at a multiple of its texel's bytes with rows of whole texels that do not overlap (VUID-VkBufferImageCopy-bufferRowLength-09101, VUID-vkCmdCopyBufferToImage-dstImage-07976); on a device that enables samplerYcbcrConversion (enabled wherever present), whose optimal tiling has SAMPLED_IMAGE and TRANSFER_DST; a 4:4:4 format also needs Vulkan 1.3 or VK_EXT_ycbcr_2plane_444_formats (VUID-VkImageCreateInfo-None-12279), which the device now enables below 1.3 where listed. Metal's reconstruction required. Vulkan's implicit reconstruction of a subsampled format at MIDPOINT through a LINEAR chroma filter weighs the chroma 3 and 1 along a halved axis, as Metal does. Cosited it lies half a luma texel off (up to 1340/2048 of random planes on lavapipe), and nearest it takes one pair: that is what the codes mean, not a precision step, so a device without MIDPOINT_CHROMA_SAMPLES and a linear chroma filter for the format keeps Metal's arithmetic for it (a capability the device lacks). The brief allowed cosited; the measured distance is why I held it back, raised with the orchestrator. Left on ours, on purpose: - A 4:4:4 format read as codes (RGB8_444_2P, RGB10_444_2P): the identity model ignores the range and there is no chroma to reconstruct, so the device's answer is the codes ours reads, and the planes' image would only cost a copy. - A render pass's load: MTLLoadActionLoad keeps the attachment's contents and our store inverts Metal's read, not the device's; the device's load moved untouched codes by one on lavapipe (ycbcr_passes' loaded-pass lane), so the load stays Metal's arithmetic. Conversion. The surface's matrix (601/709/2020 model) and range (narrow/full); chroma filter linear where the format has YCBCR_CONVERSION_LINEAR_FILTER and (SEPARATE_RECONSTRUCTION or FILTER_LINEAR); the sampler's own filter nearest with SEPARATE_RECONSTRUCTION, else the chroma's (VUID-VkSamplerCreateInfo-minFilter-01645); each sample at a luma centre. No clamp of our own: "An implementation may clamp the R′G′B′ results of these conversions to the range [0,1]." Defects (measured, spec-forbidden; a RuntimeDriverDefect row keeps Metal's conversion): - TwoPlaneChromaMisplaced (MoltenVK 1.4.2): 4:2:0 and 4:2:2 chroma one luma texel up and left of the midpoint's and filtered twice. - TenBitCodesReadAsWords (lavapipe, Mesa 26.0.8): a 10-bit code's 16-bit word read as a 16-bit UNORM (1023 as 0.999039) where Vulkan converts c/(2^10-1). Paths measured: lavapipe converts its 8-bit 4:4:4 layout (its 4:2:0 and 4:2:2 ones are cosited only, its 10-bit ones carry the defect); MoltenVK converts none. Note and bound. ycbcr-filter-not-exact now also covers the device's conversion, announced where such a texture is made. Each channel within 0.04/2048 of Vulkan's conversion past the half the texture's image stores (0.038 measured at most), of Metal's read within 6/2048 inside [0, 1], unclamped outside it (lavapipe). FAST-PATHS gains its row; API.md matches. Plumbing: OwnedModule::YCbCrSample with a baked combined sampler; conversions and samplers held in OwnedKernels and released with it; priming makes and releases a conversion (the exit guard's 128th call, vkDestroySamplerYcbcrConversion); WorkCounts::ycbcr_device_conversions and ycbcr_device_samples count the path. RUNTIME_VERSION 1730. Lanes: the YCbCr lanes hold a texture the device converts (counted as it is made) to Vulkan's conversion within the bound instead of Metal's steps, and expect its notice (validation runtime_lane/ycbcr_device_reads.rs). Consumers: RuntimeDriverDefect gains TwoPlaneChromaMisplaced and TenBitCodesReadAsWords (an exhaustive match breaks); WorkCounts gains two public fields (a struct literal breaks); bind gains ycbcr_sample_module and YCbCrSampleModule. In place on an integrated or CPU device (not changed, not decided): a throwaway probe on the M3 Max under MoltenVK 1.4.2, 3840x2160 4:2:0 planes in host-visible memory composited into 1680x1050, best of 3x40: the device's Y′CbCr sampler over a LINEAR two-plane image of the planes in place 72.2 us (8-bit) and 81.2 us (10-bit), against 121.1 and 122.6 us for Metal's arithmetic over texel buffers (today's in-place form). MoltenVK's 4:2:0 conversion carries TwoPlaneChromaMisplaced and lavapipe's is cosited only, so neither venue could take it. Verified: build and clippy (plain and --cfg m2v_gpu); the touched host tests (catalogue, defect lists, exit guard, api_surface, api_signatures, fast_paths, the sample module on every committed profile). lavapipe (linux-gate arm64, --cfg m2v_cpu_icd): the runtime and validation YCbCr, chroma, two-plane, defect, exit-guard and degradation tests, 166 of 166, the device test counting 3 device-converted textures and the lanes 16; conformance replay --cpu exits 0, its 723 rows exactly known-gaps.tsv's (no YCbCr conformance case reaches the device path: they are 4:2:0). MoltenVK (M3 Max): the same selection 123 of 124, 0 textures device-converted; the one failure (a_ycbcr_sample_through_an_unmeasured_filter_is_announced, anisotropic through a constexpr sampler) fails identically at the base d736af8d66. Golden hashes: 2757 stale cells at the base and at this tip alike (key changes), none from this change. * Drop the YCbCr sample module's raw field, gone from CombinedSampler The sRGB change (9835965499) removed CombinedSampler::raw with the raw-view mechanism; the rebased YCbCr sample module still set it. Verified: clippy --workspace --all-targets --all-features -D warnings clean. * Re-pin the runtime sources at the landing tip The landed packet changed a runtime-sources input, so the committed digest no longer described the sources and `the_runtime_sources_are_the_committed_ones` would fail. Recomputed over the same inputs and committed by land-pkt.sh. |
||
|
|
2ec1f9fdc8 |
Read an sRGB texel through the device's own decode wherever the device samples its format
One work packet, landed as 2 commits (9835965499..1a930f5dc1 on archive/development-linear-2026-10-28), in order: * Read an sRGB texel through the device's own decode wherever the device samples its format Rule 1 makes the device's texel conversion the answer wherever it has a native form. A texture bound in an 8-bit sRGB format (and the sRGB forms of BC1 to BC3, BC7, PVRTC, ETC2, EAC and ASTC) was read through a second UNORM "raw" view and decoded through Metal's twelve-bit table on every device; that emulated Metal's bits where the device decodes sRGB itself. What changed: - Every read, nearest and filtered sample, pixel fetch, gather and bicubic tap of a sampled sRGB texture now reads the device's decode through the slot's sRGB view (a decoded twin's R8G8B8A8_SRGB view where the device lacks the compressed format). An input-attachment read of an sRGB color attachment reads the device's decode too (the snap-to-byte and table decode in lower/fragment/color.rs is gone). - The note is the existing PrecisionNote::SrgbTexelDecode: specialized on the bound format's class (BicubicTexels::SRGB, SpecKey::BoundTexelFormat, announced at the draw or dispatch), outright for a heap element, and at link for a float input attachment over an sRGB attachment (StageIo::decoded_fetches). On MoltenVK the module requires VkProperty::MetalSampler instead. - The capability fallback stays: a format the device cannot sample, held as its UNORM twin (R8Unorm_sRGB and RG8Unorm_sRGB on lavapipe, RG8Unorm_sRGB on ANV and NVIDIA among the committed profiles), joins the SrgbTexture variant (srgb_twin_on) and decodes the twin's codes through Metal's table through the slot's own binding: exact for one texel's codes, the device's filter of the codes otherwise (noted). The storage alias, tile, word-attachment and pack/unpack table uses are untouched. - Deleted: the raw view and its plumbing (ResourceKind::RawTexture, BindingSource::RawTexture, CombinedSampler::raw/with_raw/sampler_binding_use, TextureDecls::raw, SlotPlan::raw, BindingKey::raw), texel_format::srgb_raw_view and srgb_raw_on, RuntimeFact::SrgbDeviceDecode, VariantKey/LoweringInputs::srgb_twins (merged into srgb_textures), LoweringInputs::srgb_fetches and the input attachment's snap, the runtime image plan's extra UNORM view of sampled sRGB images, and the ASTC-native bicubic refusal. srgb_raw is renamed srgb_coded. - Versions: SEMANTICS_VERSION 1891, RUNTIME_VERSION 1672 (the image plan lists no raw view; a notice text changed), ARTIFACT_FORMAT_VERSION 469 (CombinedSampler::raw removed, StageIo field renamed). The runtime-sources pin is left for the landing. - Docs: FAST-PATHS rows (sampling, texel conversion with the measured bound, ASTC twin), the stale "runtime sampler's nearest sRGB sample" known gap removed, SrgbTexelDecode moved to the device-gap class in tests::fast_paths; PrecisionNote docs, DriverDeviation::MetalSampler, docs/API.md's catalogue, decode module docs, runtime notice texts. - Lanes: a new runtime_lane::srgb_decode reads every code of RGBA8Unorm_sRGB; the ASTC, ETC, PVRTC, BC, cross-class and fetch lanes hold an sRGB color channel to the device's decode of its own code (srgb_decode_holds: bit for bit through Metal's own texture unit) and assert where the note is announced. The BC lane keeps development's no-twin structure: an sRGB color channel off a measured driver holds as the device's sRGB decode of a code within compressed-texel-decode's bound; the ASTC CPU-write lane's check takes the device's exactness. - known-gaps.tsv: 21 new llvmpipe rows (ETC2, EAC, ASTC sRGB reads, the read-write tier's sRGB round trip), the 12 BC1 to BC3 sRGB rows' answers and words (the device's BC decode, then its sRGB decode: both notes), the 8 sRGB fetch rows' answers updated; CONFORMANCE-COVERAGE.md regenerated. Measured: llvmpipe (LLVM 21.1.8, arm64) decodes every color code within 5.25 table steps (0.00128) of Metal's value; MoltenVK on the M3 Max equals Metal at all 1024 lanes, read and sampled, and in the cross-class gathers (0 of 240 words differ through each class). Words (lavapipe, one-access kernels, a slot bound in RGBA8Unorm_sRGB): read half 2941 -> 1131, read float 2513 -> 836, fetch half 3062 -> 1264, nearest float 2580 -> 915, gather alpha half 2934 -> 1191, gather red float 2571 -> 896; linear and runtime samples unchanged (1210, 1163); a bicubic sample grows, 10524 -> 13254 half and 10318 -> 13048 float (the emulated sum of the device's decoded taps). The twin variant loses its raw binding (read half 2941 -> 2929). Verified, on this tree (rebased onto 7b5cf8328d): cargo fmt; clippy --workspace --all-targets --all-features -D warnings, plain and under --cfg m2v_gpu; rustdoc -D warnings; scripts/api-docs; api_signatures re-blessed (the 9 removals listed above); REFUSALS.md unchanged; 700 of 701 focused metal2vulkan tests (lower::texture/sampler/fragment/select, pipeline, metal, spirv::requirements, the texture/sampler/fragment/srgb engine tests, fast_paths, surfaces) pass, the golden table failing as it does on 7b5cf8328d itself (1608 cells changed under unchanged keys): blessed on both trees, this change moves 0 cells; the conformance suite's 1007 tests pass. On lavapipe (scripts/linux-gate, arm64): 168 touched runtime-lane tests pass; the runtime crate passes 1368 of 1369, the one failure deferred_calls::a_commit_after_an_end_in_flight_returns_and_keeps_its_order (status Scheduled where Committed is expected, no texture involved) failing again in 1 of 5 reruns, a timing flake; `conformance replay --cpu` exits 0 with no unlisted or stale row. MoltenVK lanes were not rerun after the rebase. * Re-pin the runtime sources at the landing tip The landed packet changed a runtime-sources input, so the committed digest no longer described the sources and `the_runtime_sources_are_the_committed_ones` would fail. Recomputed over the same inputs and committed by land-pkt.sh. |
||
|
|
3f3c972b8a |
Decode a pulled Int1010102Normalized 10-bit field as Metal's product
One work packet, landed as 2 commits (23c75d6d34..7b5cf8328d on archive/development-linear-2026-10-28), in order: * Decode a pulled Int1010102Normalized 10-bit field as Metal's product Metal's vertex fetch reads an Int1010102Normalized 10-bit field as its clamped magnitude times float(1/511) in float, one rounding, not the correctly rounded quotient c / 511: an ulp toward zero at 96 of the 1,024 codes (measured at every code on the Apple M3 Max, macOS 27.0.1, by runtime_lane::normalized_vertex_fetch). The shader's pulled decode (lower::stage_io::fetch::normalized) divided exactly, so Metal's constant step on MoltenVK, a device without buffer robustness, the indexed capture form and a kernel's stage input read those codes an ulp off, unannounced. It now multiplies (an OpConvertUToF and an OpFMul in place of the exact division's integer sequence); every other normalized field keeps the quotient. The FAST-PATHS known gap goes. The device-vertex-conversion entries in docs/API.md and the runtime's degradation.rs now state the 1/511 rule, the MoltenVK exemption and lavapipe's unclamped per-instance signed minimum, as the note's doc and the ledger row already do. SEMANTICS_VERSION 1890. Verified: nextest of lower::stage_io::fetch, fast_paths and the vertex tests, 116 passed; every_ten_and_two_bit_code_decodes_as_metals fails with the multiply disabled (negative control) and holds the 96-code count. * Re-pin the runtime sources at the landing tip The landed packet changed a runtime-sources input, so the committed digest no longer described the sources and `the_runtime_sources_are_the_committed_ones` would fail. Recomputed over the same inputs and committed by land-pkt.sh. |
||
|
|
8acf6ae154 |
Sample a BC texture's own image through the device's decode, keeping no twin
One work packet, landed as 3 commits (d8bb73078f..862d4c13a1 on archive/development-linear-2026-10-28), in order: * Sample a BC texture's own image through the device's decode, keeping no twin Under the native-arithmetic rule a device that has a BC format decodes it itself: its decode is the answer, recorded where it can differ from Metal's. The BC1 to BC5 decoded twin emulated Metal's 6-bit-weight decode on drivers not measured to make it (lavapipe, NVIDIA, ANV, RADV's BC4/BC5), at the cost of a second image 4 to 8 times the blocks and a decode after every write. It goes, and with it every piece only it used: - the translator's `bind::BlockDecode` and `bind::block_decode_module` (Metal's fitted BC1 to BC5 decode, its kernel and its tests); `bind/block_decode.rs` keeps only what the carriers' decode modules share (`BlockDecodeModule`, the bindings, `table`, `decode_module`); - the runtime's `TwinDecode::Block`, `Device::twin_decode`, the twin's announcement `decoded-block-twin` (`Degradation::DecodedBlockTwin`, removed), the view-decode notice for a view of another decode (`degrade_view_decode`, `degrade_device_decode`), and the device-test-only `Scheduler::decodes_pending`, which only the BC twin's CPU decodes needed. A BC texture (BC1 to BC7, the sRGB forms too) is now its own BC image on every device, and on a device whose driver lacks the format's fact (`ColorBlockDecodeIsMetals`, `ChannelBlockDecodeIsMetals`, `Bc6hBlockDecodeIsMetals`, `Bc7BlockDecodeIsMetals`) announces `compressed-texel-decode`, now also for a sparse texture and a texture over the caller's `VkImage`, which announced nothing before. The facts still decide the note. The carriers' twins (ASTC, PVRTC, ETC2/EAC, 4:2:2) and their CPU decode thread are unchanged; a carrier whose twin's format the device cannot sample is now refused typed instead of read as its carrier (no conformant device lacks those formats). The sRGB forms' read through Metal's table is unchanged here (another change replaces it). Lanes and suite: - `runtime_lane::compressed_decode` reads the device's decode: exact where the driver has the fact (within `device-texel-conversion`'s ulp off Metal's sampler), else within the note's stated per-format bound, with the note announced; no write makes a decode pass or CPU decode. - `cpu-block-decode` keeps a lane site in `astc_textures` (`astc_cpu_writes_decode_on_the_cpu`, the CPU decode thread's ordering behind work in flight), and `chroma_pairs` holds its notice to the CPU decodes on every device. - conformance: `compressed-texel-decode` joins `replay::NATIVE_NOTES`; the BC cases declare no twin notices; 40 llvmpipe rows in known-gaps.tsv, one per BC1 to BC5 round, each within the note's lavapipe bound. The cross-check `every_recorded_texel_is_the_lanes_fitted_rule` still holds the M3 Max's recorded texels to the case's own model of Metal's decode. - new device test `tests::bc_own_image`: every BC format, `Shared` by `replaceRegion`, `Private` by a blit and a heap's, has no twin, keeps its blocks, makes no decode, and announces the note exactly where the fact is missing. Docs: API.md's `compressed-texel-decode` entry and cost (lavapipe's BC4/BC5 bound widened to 2.4/255, signed 0.022, as measured below), `decoded-block-twin` removed; a FAST-PATHS.md device-gap row; REFUSALS.md, api_signatures.tsv, api_surface and CONFORMANCE-COVERAGE.md regenerated. RUNTIME_VERSION 1669 -> 1710 (renumbered at landing). SEMANTICS_VERSION stays: no translation changes, so the golden hashes do not move. The runtime-sources pin is not re-pinned here. Verified: - clippy `--workspace --all-targets --all-features -D warnings`, plain and `--cfg m2v_gpu`; rustdoc with `-D warnings`; the refusal, signature, Metal and conformance coverage checks. - macOS, no device: metal2vulkan-runtime + metal2vulkan-conformance 2139 passed; metal2vulkan's fast_paths, owned_divisions, bind, api_surface, api_signatures, driver_facts and cache tests 568 passed; conformance again after the ledger rows, 1007 passed. - lavapipe (linux-gate arm64, `--cfg m2v_cpu_icd`): 145 tests of the touched families passed (bc_own_image, compressed_decode, astc_textures, chroma_pairs, pvrtc/etc textures, degrade_notices, texture_blits/fills, cpu_copy_layouts, image_plan, first_moves, the degradation tests). Largest differences from Metal: BC1/BC2 2/255, BC3 3/255, BC4 2.28/255 (signed 0.0172), BC5 2.31/255 (signed 0.0212); BC6H has its fact there, BC7 announces. `conformance replay --cpu`: the only unlisted gaps were these 40 BC rounds, no stale row. - MoltenVK on the M3 Max (maclock, memcap): 43 tests passed, every BC1 to BC5 channel exactly Metal's, no `compressed-texel-decode`; the replay of 105 touched cases left all 41 BC cases exact (one unrelated divergence, `read-write-tier-held`'s `set-past-layout-support` notice). * Count the ASTC CPU-write lane's behind-work decodes from before the making `astc_cpu_writes_decode_on_the_cpu` failed once on lavapipe after the rebase onto cb759a4c4a: "ASTC4x4LDR Event: 2 CPU decodes, not 1". The cause is the test's window, not a second decode. `WorkCounts::cpu_block_decodes` counts a write's decode when the device's decode thread finishes it (`Image::finish_twin_decode`). The case writes the old blocks, commits the reader, and only then took `before`. In the Busy case `scheduled(&reads)` waits for the reader's batch, which the scheduler holds until the old blocks' decode finished, so `before` already holds it. In the Event case nothing waits, so the old blocks' decode could land after `before` and be counted with the new ones'. Each write queues exactly one job, and the thread takes them in order, so 2 is the old write plus the new. Now the case counts from before the texture's making and expects exactly two CPU decodes (its two writes) where the copies go on the host or the staging queue, and none elsewhere. The count is read after the later reader completed. That reader's batch waits for the new write's decode, the thread finished every earlier job by then, and it counts each job before it releases the batches that wait for it. Every earlier case's decodes landed before its own later reader completed too. No sleep, and no looser bound. Verified: clippy of the validation crate under `--cfg m2v_gpu`; on lavapipe (linux-gate arm64, `--cfg m2v_cpu_icd`), the test 20 times and the families bc_own_image|cpu_copy_layouts|compressed_decode|degrade_notices|astc|etc_textures|chroma_pairs| event_round_trips|grouped_submissions|waiter_submits|scheduler. The 20 runs all passed: each of the 80 behind-work cases (two formats, Busy and Event) counted exactly 2 CPU decodes, 0 cases wrong; 13 Busy cases were void (the reader ran before the write) and 2 to 4 cases a run held. The families: 86 tests passed. * Re-pin the runtime sources at the landing tip The landed packet changed a runtime-sources input, so the committed digest no longer described the sources and `the_runtime_sources_are_the_committed_ones` would fail. Recomputed over the same inputs and committed by land-pkt.sh. |
||
|
|
04f6fb57b8 |
Read a half by UnpackHalf2x16 and narrow one by the bare quantize without float16
One work packet, landed as 4 commits (91d9e38f75..80ca8d6abd on archive/development-linear-2026-10-28), in order:
* Read a half by UnpackHalf2x16 and narrow one by the bare quantize without float16
On a device with 16-bit storage but no shaderFloat16 (QuantizeForm::Device: Pascal, the
lunarg-2023 baseline, vk12-floor, SwiftShader), the GPU's native arithmetic is the contract
(AGENTS.md rule 1), so neither the read nor the narrowing of a `half` emulates Metal's bits any
more:
- A `half` read from its bits (a load, a reinterpretation, a texel's or snapshot's bits, a
vertex fetch) is GLSL.std.450 UnpackHalf2x16 of the bits as the low half of a 32-bit word
(component 0), or of both halves for a pair (`narrow::from_bits`, `from_word_halves`). The
exact integer decode (`half_bits_to_f32_bits`) is deleted: UnpackHalf2x16 is core and needs no
capability, so no device lacks a native form. The module records NativeNanEncoding (a NaN's
bits) and NativeHalfConversion (the widening is neither under DenormPreserve 16 nor measured,
so a denormal may flush), by the rules 860ad1489f set for the float16 widening;
`narrow::widens_bits` counts the unpack.
- Every narrowing to `half` through `narrow::round` (fptrunc, every `half` operation, function,
sum, multiply-add, mix step, division, square root, dot, simd and matrix reductions, stage I/O,
color and fetch narrowing, texel rounding through `round_texel`) is the bare OpQuantizeToF16,
recorded NativeHalfQuantize on every such device, measured or not. The denormal arm (quantize,
compare, RoundEven of x * 2^24, select) and `device_round`, `scaled` and
`flushes_below_normal` are deleted; `native_rounding(form)` now depends on the form alone, so
`native_half` holds on every Device-form module. `round_integer` stays exact: it is the
workaround for NVIDIA 615.71.09 keeping an integer conversion unrounded under the quantize.
- No module requires VkProperty::MetalHalfQuantize any more (compile.rs drops the requirement);
DriverDeviation::MetalHalfQuantize and the property are kept and documented as measuring only.
Devices with shaderFloat16 are unchanged.
Integer roundings to `half` that never took `narrow::round` are unchanged: the extended-range
blend's `half_of` (every form but the controlled one), the extended-range color encodes, the
sampler's level and the bicubic routines (Metal's directed roundings among them), and the texture
routine's grid families, which round an integer code's ratio.
Docs: PrecisionNote's NativeHalfConversion, NativeHalfQuantize and NativeNanEncoding, the
runtime's declarations of the three, docs/API.md section 9 and docs/HOWTO.md state the new reach;
`fetch.rs`'s `half()` no longer says "exactly". SEMANTICS_VERSION 1886 -> 1887. The runtime
sources change in doc comments only, so RUNTIME_VERSION stays; the runtime-sources pin moves.
Tests (the arith interpreter harness now builds in QuantizeForm::Controlled unless a body sets a
form, so routine references stay Metal's; a half NaN through the device's widening is accepted as
a NaN, the interpreter's widening being canonical):
- `narrow::device_half_rounding_is_the_quantize_alone`, `engine_native_half::
a_half_below_the_smallest_normal_takes_the_devices_quantize` and `engine_arith::
a_half_rounding_without_float16_is_the_quantize_alone`: no RoundEven or compare after the
quantize, NativeHalfQuantize on every Device profile, sums and narrowings below 2^-14 answer
the signed zero on the interpreter. Negative control (the denormal arm restored in `round`):
all three fail, and `half_rounding_follows_the_operation`.
- `narrow::a_half_decode_is_the_devices_widening_in_every_form` and `engine_native_half::
a_half_read_from_memory_is_the_devices_widening_on_every_profile` and the loop decode test: one
UnpackHalf2x16 per word, no 16-bit type, no integer decode, NaN and conversion notes. Negative
control (the integer decode restored in `from_bits` and `from_word_halves`): all three fail.
- The texel tests accept the quantize's signed zero for a half denormal in the Device form; the
16-bit grid comparison runs the Device form under native rounding only (its one production
setting); the wide tests validate on vk12-floor in its own form.
Verified on this Mac (no GPU): cargo nextest -p metal2vulkan -p metal2vulkan-runtime
-p metal2vulkan-air -p metal2vulkan-devtools --all-features: 5014 run, 5013 passed, the one
failure golden_hashes_match_the_table (hashes moved; not re-blessed here). cargo clippy
--workspace --all-targets --all-features -D warnings, plain and with --cfg m2v_gpu; cargo doc
-D warnings for metal2vulkan and metal2vulkan-runtime. Every fixture below translated with
spirv-val (vulkan1.2, vulkan1.4) passing.
Words (instructions), the CLI on the public engine fixtures, before -> after:
hfb_filter_bank (fragment) Pascal 198141 -> 147460 (38283 -> 28981)
lunarg-2023 176378 -> 124545 (34510 -> 24920), same on
swiftshader and vk12-floor
unm_contract_chain Pascal 46258 -> 34491 (9333 -> 6952)
lunarg-2023 48303 -> 36536 (9699 -> 7318)
swiftshader, vk12-floor 48364 -> 36597 (9928 -> 7547)
fmx2_contract_fast Pascal 24177 -> 18912; lunarg-2023 25107 -> 19842
a1_half_denormals Pascal 4230 -> 3071; lunarg-2023 4353 -> 3194
hwd_half_reads Pascal 2647 -> 2194; lunarg-2023 2688 -> 2235
dsm_half_live_built Pascal 6782 -> 5988; lunarg-2023 6799 -> 6005
sum_regroup unchanged (Pascal 1047, the others 879)
* Hold the native half lanes to each rounding's bound, and bound the quantize's flush by its input
On SwiftShader (no shaderFloat16, so every half narrowing is the bare OpQuantizeToF16) two
native_maths lanes broke the note they check:
- half_rounding_answers_within_its_recorded_bound held half(a) + half(b) to one ulp of Metal's
sum, but the note bounds each rounding: SwiftShader's quantize rounds toward zero, so two
roundings land two ulps off (thread 30: -45.0625 for Metal's -45.125; failing on development
too), and a flushed denormal operand moves the sum by itself. The sum is now held to the bound
of the sum of operands each rounded within it (half_within_sum).
- native_maths_answers_within_its_recorded_bounds held a half fma below 2^-14 to one ulp; where
the stage records NativeHalfQuantize or NativeHalfConversion, the zero of its sign is the
note's bound.
The quantize tests the value it rounds, not the rounded result: SwiftShader answers -0 for
-6.1005354e-5, which Metal rounds to -2^-14. PrecisionNote::NativeHalfQuantize, the runtime's
declaration, docs/API.md (its section 9 entry and the device-answers paragraph, which still said
the widening was the device's only with shaderFloat16) and docs/HOWTO.md now bound a value below
2^-14, not a result, and the lane tests the input.
Verified: scripts/linux-gate --icd swiftshader, runtime_lane::(driver_deviations|half_|
native_maths|sum_regroup|math_routines): 26 run, 22 passed. The four failures fail identically
on development 60fe70fb12 without this branch (sum_regroup 3863 of 4096 pixels, RG11B10 small
floats 2005 of 71505 fields, the slice NaN lane's 17 stored halves, 86 and 484 float NaN words),
so they are SwiftShader's, not this change's; development there fails six, among them
half_loads_the_device_widens_answer_as_metal, which passes here. The same lanes on lavapipe:
26 of 26. clippy -p metal2vulkan-validation --all-targets --all-features --cfg m2v_gpu
-D warnings; the runtime's degradation catalogue tests.
* Number SEMANTICS_VERSION 1889, after development's 1888
The half read and narrowing change (91d9e38f75) bumped SEMANTICS_VERSION, and each rebase onto
development took development's own bump for it (1887 for the MoltenVK vertex fetch, 1888 for the
blend sweep's one compile), so this change shared a number with another. 1889 keys its modules
apart: Device-form modules read a half by UnpackHalf2x16 and narrow one by the bare
OpQuantizeToF16, with their precision notes.
Verified on the rebased tree: the core suites, clippy plain and --cfg m2v_gpu (see the change).
* Re-pin the runtime sources at the landing tip
The landed packet changed a runtime-sources input, so the committed digest no
longer described the sources and `the_runtime_sources_are_the_committed_ones`
would fail. Recomputed over the same inputs and committed by land-pkt.sh.
|
||
|
|
3501e41448 |
Expect the served blit out of a plane whose GPU rows share bytes
One work packet, landed as 8 commits (8f359821ba..742b94ac06 on archive/development-linear-2026-10-28), in order: * Expect the served blit out of a plane whose GPU rows share bytes |
||
|
|
a3c550ca33 |
Read a half from memory by the device's widening, and sum one by its quantize
One work packet, landed as 3 commits (860ad1489f..46ec3ad81f on archive/development-linear-2026-10-28), in order: * Read a half from memory by the device's widening, and sum one by its quantize The owner's ruling on native half arithmetic, applied to the reads and sums that still emulated Metal's bits. A half read from memory or from its bits is the device's widening wherever the module holds 16-bit floats (every QuantizeForm but Device, i.e. every profile with shaderFloat16): the bits read as f16 (an OpBitcast of the word or words, a 16-bit storage unit read as a half itself) and one OpFConvert, with no use analysis. The module records NativeNanEncoding (the widening's NaN bits are the device's; a half stored unchanged keeps its bits through the noted bits). Its denormals are kept under the 16-bit float controls (ANV, RADV: DenormPreserve), read as Metal's by the measured MetalHalfArithmetic on MoltenVK (the module then requires the property), and elsewhere (NVIDIA, lavapipe) may flush, recorded as NativeHalfConversion. Without shaderFloat16 the integer decode stays: no 16-bit float type exists to read the bits as. The use analysis (lower/arith/widening.rs), ModuleBuilder::set_widens_halves, the loop-free offers it fed and the UnpackHalf2x16 decode are deleted. A half sum or difference (and the mix, muladd, fract and sqrt results that round the same way) takes the device's rounding alone (narrow::device_round): on a device without shaderFloat16 the bare OpQuantizeToF16, whose result below the smallest normal half may be a zero, noted NativeHalfQuantize whether or not the quantize is measured (narrow::flushes_below_normal). round_exact_below_normal is deleted. An integer's half stays exact (round_integer), documented as the workaround for NVIDIA 615.71.09 keeping an integer conversion unrounded under OpQuantizeToF16. SEMANTICS_VERSION 1883 -> 1884. The runtime-sources pin moves for doc comments only (device/driver_facts.rs, device/requirements.rs), so RUNTIME_VERSION stays. The golden hash table moves (2704 cells) and is re-blessed on development, not here. API signatures and REFUSALS.md are unchanged. Words (instructions) of the release command line's output, before -> after: hfb_filter_bank NVIDIA 5080 159876 -> 147962 (31488 -> 29438), lavapipe 160444 -> 148530, MoltenVK 153283 -> 148284, ANV 164906 -> 159903; unm_contract_chain NVIDIA 34516 -> 33048 (6985 -> 6769), MoltenVK 35366 -> 33666; fmx2_contract_fast NVIDIA 18983 -> 18272; sum_regroup pascal 3356 -> 3286, vk12-floor 2506 -> 2436. Every module passes spirv-val. Verified: the core suites (metal2vulkan, -air, -runtime, -devtools): 5056 of 5057 pass, golden_hashes_match_the_table the one failure (moved hashes, as above); a touched-test pass of 318 in metal2vulkan and the validation crate, the runtime pin included; clippy -D warnings with all features, plain and with --cfg m2v_gpu. New tests fail without the change (checked for the 16-bit unit read by disabling its note). Device lanes on lavapipe follow. * 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. * Re-bless the golden table after the half reads' native widening 860ad1489f reads a half by the device's widening on every shaderFloat16 profile and sums one by the bare quantize elsewhere, so 288 rows' cells moved. bless_engine_inventory, bless_golden_hashes and bless_engine_goldens at 9ac9892868; public_fixtures_engine, air_input and golden_hashes: 28 passed. |
||
|
|
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. |
||
|
|
96b6f3d12b |
Note the device's fixed-function vertex conversions where the pipeline links
One work packet, landed as 4 commits (0e348c4f85..2fc5327329 on archive/development-linear-2026-10-28), in order:
* Note the device's fixed-function vertex conversions where the pipeline links
A normalized vertex attribute has been the device's fixed-function UNORM or
SNORM conversion since the exact division went (9c0bdbe0d2), but nothing
recorded it: llvmpipe reads 127/255 one f32 ulp high (0x3EFEFF00 against
Metal's 0x3EFEFEFF) and the run announced nothing, against rule 2. And the
narrow-float NaN note rode in the vertex compile key
(VertexFetch::FixedFunction { narrow_float }), so one function used with a
half format and any other format translated twice for one module.
The design: the module of a fixed-function attribute names no part of its
format, so neither note belongs to the module. Link knows the vertex
descriptor and which attributes the stage reads as float, so
link::vertex::fixed_function_notes decides both there, from the stage's
fixed-function attributes and the descriptor's formats, and the compile API
adds them to the vertex StageModule's precision_notes (as color_writes'
pipeline notes are added). The runtime announces stage notes already, so
it needs only the new kind. A StageSource::Compiled stage gets the same
notes, since link recomputes them.
- PrecisionNote::DeviceVertexConversion (device-vertex-conversion): a
normalized format fixed-function input fetches, whatever width the
function reads it at. Recorded on every device; MoltenVK measured
Metal's, but no measured property says so yet.
- PrecisionNote::DeviceNanEncoding for a narrow float read as float now
comes from link too; lowering records nothing for a fixed-function
attribute.
- VertexFetch::FixedFunction is a unit variant; IoRole::Attribute loses
narrow_float; narrow_float_of_f32_reads goes; declared_attributes keeps
only the numeric class. Encoding::is_normalized names the formats.
- Runtime Degradation::DeviceVertexConversion, the codec tag, docs/API.md's
catalogue entry, a FAST-PATHS device-gap row (no switch), validation's
comparison class (unbounded, as DeviceTexelConversion).
- Versions: SEMANTICS_VERSION 1884 (notes and vertex keys move),
ARTIFACT_FORMAT_VERSION 467 (VertexFetch, IoRole, the new tag),
RUNTIME_VERSION 1666 (a new announced kind); runtime-sources.sha256
re-pinned for degradation.rs. api_signatures re-blessed.
Tests: engine_vertex_variants' new
a_pipeline_notes_what_the_device_converts_from_one_translation compiles
the float4 and half4 sweeps as render pipelines on moltenvk-m3, lavapipe
and amd-780m-radv: each normalized format's vertex stage notes the
conversion, each narrow float read as float the NaN, others neither, and
every fixed-function creation of an entry has one vertex compile key and
one module (two keys before). The float4 sweep is now 1 projection and 1
module (was 2 and 1); the constant-step counts follow.
Verified: cargo clippy --workspace --all-targets --all-features -D
warnings, plain and with --cfg m2v_gpu; RUSTDOCFLAGS='-D warnings' cargo
doc -p metal2vulkan -p metal2vulkan-runtime; nextest of the touched
metal2vulkan modules (343 passed), api_surface, api_signatures,
refusal_surface, golden_hashes and the public fixture tables (pass, no
hash moved); runtime degradation tests (17), validation
observation_contract, c3 and the runtime-sources guard. No device test.
* Hold a render state's vertex conversion notices and its one translation on a device
A device test (m2v_gpu, m2v_cpu_icd) of the runtime side of the link-time
vertex notes: four states of dsx_int_attributes' int_attribute_to_float4
whose vertex descriptors differ only in attribute 0's format
(UChar4Normalized, Half4, Float4, Short2Normalized). The three after the
first must translate nothing (WorkCounts::functions_translated, the
function shared once each), and each draw of one point over a record of
0x7f bytes must announce exactly its format's kinds: device-vertex-conversion
for the normalized formats, device-nan-encoding for Half4 (whose 0x7F7F is a
NaN read as float), neither for Float4. The stored words are printed, so a
run shows the device's own conversion of 127/255 and of the NaN.
Verified: clippy -p metal2vulkan-runtime --all-targets --all-features -D
warnings under --cfg m2v_gpu; the runtime-sources guard still passes (test
modules are not runtime inputs). Not run here: it needs a device.
* Say that a pipeline's stage adds its state's notes to its function's
CompiledFunction::precision_notes said its notes were the linked stage's,
which a fragment stage's attachment-write notes already broke and the
vertex stage's link-time conversion notes break too. The doc and
docs/API.md's compile-API paragraph now say the stage adds those of the
pipeline's own state. Docs only.
* Drop a known-gaps clause that points at a ledger row no longer there
The conformance-replay paragraph said its runs were at a tip before "the narrow-float widening
above" was canonicalized; that row is gone and the clause was history. Docs only.
|
||
|
|
adef203530 |
Describe each driver deviation's route as the code takes it now
One work packet, landed as 10 commits (262093ec48..8e4bfa28b4 on archive/development-linear-2026-10-28), in order: * Describe each driver deviation's route as the code takes it now The DriverDeviation, VkProperty and driver-table docs still named the exact emulations the native-arithmetic change sets deleted (Metal's libm, division, denormal flushing, NaN selection, min/max picks, the emulated sampler, the color, storage and Depth16 write roundings, the depth stand-in). Each variant's doc now says what a profile that takes it gets and what one without it gets: the device's own answer with the precision note recorded, or, where a capability hangs on the answer, its emulation or refusal. - error/mod.rs: DriverDeviation's header and the float-function, NaN, sampler, color-write, FMA, denormal, quantize, min/max, half arithmetic, storage-write, texel-write and Depth16 variants. - device/requirements.rs: the matching VkProperty docs; MetalColorWrites says no module requires it (compile.rs never adds it), and MetalHalfQuantize drops the clamp claim the code does not make. - device/driver_facts.rs: the table preambles and measurement paragraphs (docs and citations only, no row or variant changed); the deleted resolve_rounding::color_resolves_against_metals_rules citation now names the_device_resolve_rounds_as_announced, which holds the row. - runtime_lane/heap_textures.rs: heap_depth_textures_keep_their_bytes, renamed from ..._with_their_twins (no twin exists), with the two driver_facts.rs citations updated. - lower/texture/mod.rs and pipeline/compile.rs: the storage_properties doc and comment list the four properties select_write relies on, dropping the 0x7fc00000 store. Verified by reading each route in lower/ (narrow, fma, denormal, nan, arith, sampler, stage_io/color_write, texture) and pipeline/compile.rs, and by git grep for every cited test and item. * Describe the pixel samplers, routines and color-write inputs as they run now Translator docs that still described the deleted emulated sampler, the cube face fold routine, the compiler-word-bound fit and the shader's own color-write rounding: - pipeline/artifact.rs: PixelSamplerScaling no longer names a linear sample's emulation or a MetalSampler condition; a runtime word's linear pixel sample snaps onto its footprint cell on every device (position::plan plans SnapKind::WordCell with no device test), a word of mixed filters is the device's. ArgumentPixelSamplerScaling says it is recorded on every device for any access but a 2D gather and a sample without a comparison, as select.rs pixel_note does. - lower/sampler/select.rs (pixel_note) and lower/sampler/mod.rs (RuntimeSlot::cells, ::texels): the cell snap holds on every device; the slot's word filter fields are read for a half texel's conversion alone, on a MetalSampler device (half_converts requires !device_texels). - device/profile.rs: FunctionsInlinedAtEveryCall lists the routines that exist (wide-integer divisions, precise fmod, texel conversions, filter sums, sampling routines; no face fold); takes_driver_deviation names the route a deviation's docs give for a driver without it. - error/mod.rs: RuntimeInput::ColorWrites says what the color-write map decides (the conversion that records a note, and NearestEven's half rounding), not a rounding of every output. - bind/color_resolve.rs and its tests: drop the citation of resolve_rounding's cost test, which is deleted. - device/mechanism.rs: drop the trailing comment on the deleted ExactFormsOverCompilerLimit fact. Verified by reading position::plan, select.rs pixel_note and the half_converts branch, spirv/builder/module.rs's routine kinds and every mb.routine site, pipeline/color_writes.rs, and git grep for each cited item. * Describe texel conversion, YCbCr filtering and depth comparison as the device's Translator docs still named the deleted linear-filter emulation, the shader's own depth comparison and the depth twin: - lower/texture/half.rs: off MetalSampler devices the device's sampler filters and the half is its float texel rounded to nearest even (device_texels), not this routine's; the only fetch-computed filter that skips the routine is the in-place YCbCr one. - lower/texture/mod.rs (half_texels): drop the example of a runtime sampler's sRGB raw-code emulation for the `arm` clauses. - metal/format/mod.rs: a two-plane YCbCr texture's linear sample is the device's filter, noted, but where its planes are read in place. - pipeline/artifact.rs (RestrictedDepthRange) and lower/texture/slot.rs (depth_comparison): every comparison is the device's; no shader-made comparison is left to exclude. - lower/sampler/select.rs: a depth comparison reads the texture's own depth image (no twin). - lower/sampler/mod.rs (Sampling::words): list the terms plain_words sums; no linear emulation, level grid or shader comparison term exists. Verified by reading device_texels, half_texels and both its callers, linear.rs filter_note and metal_filtered_ycbcr, depth_comparison's one caller, in_place.rs, and plain_words. * Describe the runtime's YCbCr filter notice and variant kinds as they fire now - degradation.rs: YCbCrFilterNotExact fires on a device that samples through Metal's own sampler alone (linear.rs metal_filtered_ycbcr is None elsewhere), where the stage records HalfSampleFilter or FloatSampleFilter for any two-plane YCbCr format bound; a native sampler announces device-sampling. The module doc drops the exact forms dropped to fit a compiler word bound, whose kind and fit are deleted. - ycbcr.rs: linear filtering of the converted texels is the device sampler's (Metal's own on MoltenVK, announced ycbcr-filter-not-exact); only planes read in place are Metal's filter exactly. Verified by reading lower/sampler/linear.rs, in_place.rs and the runtime's Kinds::of and degrade_bound_formats. * Describe the lanes' and cases' native forms where they named deleted emulations Docs and comments only; no expectation changed. - validation runtime_lane/driver_deviations.rs: the half quantize, min/max, half arithmetic and half widening bullets say what the module does off the deviation (the device's own conversion or quantize, the same NMin/NMax/NClamp noted native-min-max, narrow::from_bits' decode), not the deleted integer rounding, operand picks and exact_answers decode. - validation observation_contract/comparison.rs: HalfSampleFilter and FloatSampleFilter are a YCbCr texture through Metal's own sampler. - validation runtime_lane/pixel_samplers.rs, conformance cases/pixel_samplers.rs: the pixel coordinates reach Metal's texels through the translator's snaps, filtered by the device's sampler. - conformance cases/snorm_tile_store.rs: no exact tile store and no FAST-PATHS row; only extended-range, padded and bfloat attachments take a load pass. Verified by reading the lanes' assertions, select.rs pixel_note, position::plan and narrow.rs. * State the native forms in the doc pages where they promised exact switches - README.md: the promise that every speed-for-accuracy choice has an opt-in exact switch was false for the device's maths, rounding, conversions and sampler, which have none; it now says those are the device's, recorded, and the runtime's choices keep their switches. - docs/API.md: exact_answers selects the runtime's five switches (as policy.rs's exact_answers sets them), not exact forms of the native arithmetic; an unmeasured driver takes each deviation's documented route, not a conservative one; half widening's NaN and denormal are the device's under its own conversion or the float controls; Depth32Float texels are the depth image's, announced where it clamps or flushes; the catalogue intro names the native forms. - docs/ARCHITECTURE.md: the native forms are the device's on every device with no policy choice; the policy's accuracy switches are the runtime's. - docs/FAST-PATHS.md (after the opening section): a YCbCr texture's image form holds Metal's texels exactly and its linear sample is the device's filter; only the in-place form is Metal's filter. Verified against device/policy.rs, lower/arith/narrow.rs, the depth twin's deletion (c11e653acd) and lower/sampler/linear.rs. * Drop the exact golden table from VALIDATION.md's emitter-stability contract 4bf2c22aad deleted golden_hashes_exact.tsv and its table in golden_hashes.rs; VALIDATION.md still described a second table of every sampling fixture under exact_answers. The contract now names the one table. Verified: crates/metal2vulkan/tests/ holds golden_hashes.tsv alone, and golden_hashes.rs names no exact table. * Re-pin the runtime sources after the doc audit The audit's commits edit doc comments and comments only in files the runtime guard hashes (degradation.rs, ycbcr.rs, and translator files the build lists); no run's behaviour changes, so RUNTIME_VERSION stays. Verified: the_runtime_sources_are_the_committed_ones failed with 81ebd500 committed against 8bc0e06b computed, and passes after this pin. * Drop the 0x7fc00000 hand-off from half_write_nans_converted's doc a6e97e7f93 deleted the NaN canonicalization before storage writes (StorageImageClass::SmallFloatQuietNan among it): a half write to a packed small float hands the device the half widened, as to a 16-bit float channel. The doc still said such a write hands it 0x7fc00000, and tied MetalHalfTexelWrites to both kinds, where it states the 16-bit float store alone (lower/texture/mod.rs half_write_nans). Verified by reading half_write_nans and the write emission (lower/texture/emit.rs), which canonicalizes no small-float NaN. * Re-pin the runtime sources after the half-write NaN doc fix metal/format/mod.rs is a runtime guard input; the preceding commit edits a doc comment there alone, so no run's behaviour changes and RUNTIME_VERSION stays. Verified: the_runtime_sources_are_the_committed_ones failed with 8bc0e06b committed against 279b25d4 computed, and passes after this pin. |
||
|
|
3c129f4d6f |
Delete the half gather's fetch and the compiler-word-bound fit, which have nothing left to drop
With the NaN lane landed beside this one, two exact-only paths lost their last use. The half gather's fetch (lower::sampler::fetched) read a half-float texel's NaN through TexelNanRoute, which the NaN lane removed: no selection reaches it. Deleted with the Sampling field, the RuntimeSlot word fields it set (filters, fetched, fetched_depth), the shared switch's fetched emulation and its lane constants, the heap fetch in emit, and the helpers only it used (LinearImage, HEAP_WORDS, footprint_from, texel_format_spec, texel_format_const, constant_lanes_by folded into constant_lanes). The compiler-word-bound fit (pipeline::compile::fit) retranslated a pipeline past ANV's 400,000-word bound with its exact forms dropped. No exact form is left to drop, so the fit, fit_render_variant / fit_mesh_variant / fit_compute_pipeline / fit_tile_pipeline, DeviceProfile::module_word_bound, RuntimeFact::ExactFormsOverCompilerLimit, the runtime's Degradation::ExactFormsOverCompilerLimit and its notice, the runtime and validation tests of it, its FAST-PATHS row and its API.md passages go. DriverWorkaround::RegisterAllocatorOverflowsLargeModules stays, recorded on the profile alone. fast_paths loses its FastDefault class, now empty. Verified: cargo clippy --workspace --all-targets --all-features -D warnings, plain and with --cfg m2v_gpu; RUSTDOCFLAGS='-D warnings' cargo doc --workspace --all-features --no-deps; refusal_surface.py leaves docs/REFUSALS.md unchanged. Originally 50fcff8a4e (archive/development-linear-2026-10-28). |
||
|
|
78ed264c90 |
Drop the normalized vertex attribute's exact division (vertex_normalized)
One work packet, landed as 9 commits (9c0bdbe0d2..41066d87d0 on archive/development-linear-2026-10-28), in order: * Drop the normalized vertex attribute's exact division (vertex_normalized) The owner's ruling of 2026-10-27: the GPU's native arithmetic is the contract, no exact emulation. A normalized vertex attribute is now always the device's fixed-function UNORM or SNORM conversion; the policy-forced pull that divided its codes in the shader goes with DevicePolicy::vertex_normalized, VertexNormalizedPolicy, its profile field, its ledger row and its tests. A format pulled for any other reason (a format the device cannot fetch, alignment, limits, containment, the capture form) still decodes in the shader as before. Verified: cargo clippy --workspace --all-targets --all-features -D warnings clean; nextest of engine_vertex_variants, device::tests::profile, fast_paths, catalogue, degradation and api_surface: 71 passed. api_signatures is re-blessed at the end of the lane. * Keep the compact decoded twin only (decoded_texels) The owner's ruling of 2026-10-27: no exact emulation. A carried ASTC LDR texture's decoded twin now always holds 8-bit codes, and an EAC 11-bit texture's 16-bit normalized codes (its values in floats only where the device does not take those codes' format, a capability fallback). DevicePolicy::decoded_texels and DecodedTexelsPolicy go, with their ledger row, their mentions in the degrade catalogue and the runtime's docs, the policy-keyed fingerprint test, and the validation lanes' exact twins. decoded-texel-precision is announced as before. bind::AstcTexels::Float stays: the conformance suite's cross-check decodes Metal's values with it. RUNTIME_VERSION 1654. Verified: clippy --workspace --all-targets --all-features -D warnings clean, plain and with --cfg m2v_gpu; nextest of fast_paths, device profile, degradation and catalogue, image_plan's decode bands, the conformance ASTC and ETC cases, api_surface: 112 passed. * Take the device's texel conversion only (texel_conversion) The owner's ruling of 2026-10-27: no exact emulation. A read, sample or gather with a float or half result off Apple's GPUs is now always the device's conversion of the texel's codes, recorded as DeviceTexelConversion or HalfTexelConversion. DevicePolicy::texel_conversion and TexelConversionPolicy go, with Metal's conversion by the bound format's class: lower::texture::float_texel (its routine, census entry and tests), the float_texel plan flags of reads and samples, the slots' float_format and the heap's float class, and the field of RuntimeFact::ExactFormsOverCompilerLimit that named it (encoded, so ARTIFACT_FORMAT_VERSION 456; SEMANTICS_VERSION 1873). The ledger row goes; DeviceTexelConversion is now documented in docs/API.md section 9 alone (fast_paths classes it Elsewhere), and the conformance cases cite the note's bound in place of the row. The half routine on Apple's GPUs is untouched. Verified: clippy --workspace --all-targets --all-features -D warnings clean, plain and with --cfg m2v_gpu; nextest of fast_paths, device profile, catalogue, degradation, the fit, mechanism, codec, the snapshot variant, engine_handles, the extended-range heap tests, the texel-conversion test (rewritten for the device's form alone), the conformance ETC, BC and border cases and the runtime's fitted-variant notice: passed (one exact-conversion test deleted). * Take the device's filter of a two-plane YCbCr texture only (ycbcr_filter) The owner's ruling: promise the GPU's native arithmetic, no exact emulation. YCbCrFilterPolicy and its Exact form go: no slot takes a YCbCr variant (RuntimeFact::YCbCrTexture, VariantKey and LoweringInputs::ycbcr_textures, ProfileFields::ycbcr_variant, Linear::exact_only and the binder's ycbcr_variant are gone). A natively sampling device filters such a texture's texels (device-sampling); on MoltenVK Metal's own sampler filters them, noted where the bound format is two-plane YCbCr (ycbcr-filter-not-exact). The planes read in place on a device whose memory is the host's are kept: that is a capability path, Metal's filter exactly. The FAST-PATHS row goes; HalfTexelConversion, which only that row named, is classed Elsewhere (API.md's catalogue states it). The YCbCr tests keep the default's selection and drop the variant's; the uniform-branch test runs at the default policy; the validation lane's Exact draw test goes. Verified: cargo clippy --workspace --all-targets --all-features -D warnings, plain and with --cfg m2v_gpu, clean. nextest over fast_paths, device::tests, bind::plan, compile::fit, compile::tests, engine_linear_half, catalogue, degradation, api_surface, codec, cache: 372 passed, 5 failed. The five are engine_linear_half tests of the emulated sampler on lavapipe and MoltenVK under EXACT_SAMPLING (the_emulation_reaches_what_metal_measured, the_linear_sums_run_one_by_a_branch_and_stay_calls, swizzled_packed_texels_are_the_unswizzled_swizzled, a_pipelines_texture_notes_follow_its_bound_format_and_sampler, a_depth_comparison_through_a_filter_is_a_filtered_float_sample); they go with the emulated sampler in the next step. api_signatures is re-blessed at the end of the lane. * Take the device's sampler only (sampling, unorm8_linear_filter) The owner's ruling of 2026-10-27: promise the GPU's native arithmetic, no exact emulation. Metal's sampler emulated by fetches (SamplingPolicy::Exact, a pipeline per bound sampler state) and the device's 8-bit unorm filter at Metal's footprint step (Unorm8LinearFilterPolicy) are gone with their switches: every sample, gather and comparison goes to the device's sampler, Metal's own on MoltenVK (VkProperty::MetalSampler) and the device's elsewhere (VkProperty::DeviceSampling, PrecisionNote::DeviceSampling). Deleted: lower/sampler/compared.rs, native.rs, linear/compare.rs, linear/cube.rs, the nearest and level snaps, the cube face position and fold (face::snapped, FaceWrap), the span and cube bicubic routines, the heap depth class (FLAG_DEPTH_*, HANDLE_DEPTH_*, Lookup::Flagged's depth), the normalized gather snap and the runtime sampler's anisotropic bias route. Notes nothing records any more are deleted with their catalogue and codec entries and the runtime's Degradation kinds: DeviceGatherFootprint, CubeFaceReciprocal, DeviceDepthComparison, DeviceTexelDenormals, DeviceUnorm8LinearFilter. The fit drops the sampling field of ExactFormsOverCompilerLimit and makes every module-growing form native in one reduction. Kept as capability: bicubic, extended range, heap raw reads, YCbCr planes read in place (its tests move to engine_ycbcr_in_place), constexpr pixel samplers' snaps and fetches, the runtime pixel word's gather and footprint cell, Metal's cube face at a tie, the anisotropic emulation without samplerAnisotropy and for an unmeasured cube-gradient route, the VkSampler level clamp on Metal's grid. Validation and conformance follow: the lanes judge the device's filter within two codes where it samples natively, the anisotropic lane runs with samplerAnisotropy withheld, and the conformance cases drop their device-texel-denormals declarations. docs/API.md, FAST-PATHS.md, ARCHITECTURE.md, CONTRIBUTING.md and VALIDATION.md updated. Verified so far: cargo check of the workspace, all targets and features, plain and --cfg m2v_gpu; 1000 of 3664 translator lib tests passed before the run was stopped for the rebase. * Join the device-sampler deletions with development's half and write removals The rebase onto development left two joins only a build shows: - `packed_scales` and `PackedField::small` lost their last readers (the float texel conversion this branch deleted and the normalized write development deleted): both go. - `engine_srgb_raw` takes `DevicePolicy::default()` where development's side named `EXACT_SAMPLING`, so it imports `DevicePolicy` again. Also formats the conflict resolutions (`cargo fmt --all`). Verified: `cargo check --workspace --all-targets --all-features` passes. * Drop the sampler word's snap and level-rule fields with their last readers With every sample the device's own, no function reads a runtime sampler's nearest snap (`SamplerWord::NEAREST_BASE`, `NEAREST_SNAP`, `NEAREST_LEVEL`, `LEVELED_SNAP`) or its level rule (`LEVEL_RULE`); only tests named them. The constants go, with the word test of the base-level mask; the `VkSampler` clamp on Metal's level grid (`clamps_on_grid`) stays, and its docs no longer say the shader reads the rule. The runtime-sampler tests of `engine_sampler` asked, off MoltenVK, for the emulation's linear state, leveled snap and level rule: they now state the device's sample on every committed profile (the pixel fields alone, gated; `MetalSampler` on MoltenVK, `DeviceSampling` elsewhere; no level field). Also matches `SnapKind::WordGather` as the unit variant it is (clippy). Verified: clippy (all targets, all features, -D warnings) passes. * Test the anisotropic, bias and position paths as the device's sampler runs them The tests of these paths compiled under the exact sampling policy, which is gone; under the default each now states what the translation does: - Metal's anisotropic filter is emulated only without `samplerAnisotropy` (and on MoltenVK's unmeasured cube-gradient route), so the emulation's shape tests compile on committed profiles with the feature withheld, and their MoltenVK arms on the profile as described. An isotropic cube keeps the device's gradient sample except on the unmeasured route. - A bias through a sampler without its own is the `Bias` operand on every profile (one test over MoltenVK, RADV, lavapipe and the floor); the compile-time and anisotropic axis-gradient tests take a constexpr sampler with its own bias, the only one that reaches them. The runtime slot's word-chosen axis gradients have no reader left: its test goes, with the helpers only it used. - The position kernel writes three words a lane: its record stride is 12 bytes, not 16, and the by-word gather test's lane floor matches its single pass. Verified: `cargo check -p metal2vulkan --tests --all-features` clean; the tests run after the rebase onto development. * Rewrite the sampling tests and notes for the device's sampler The sampling, texel-conversion and YCbCr-filter emulations are gone, so the tests that pinned them now pin the device's answer, and the note docs that described them describe what the module records today. Tests: the sampler-unk, anisotropic cube, depth-range, bicubic, dynamic-offset, heap half-texel, shared-switch, sRGB raw view, swizzled packed and texture-interpreter families. Deleted the tests of the emulated linear filter over raw sRGB codes (constexpr and runtime), the runtime sampler's one-texel raw sample and its switch, the shader's linear depth comparison, the bicubic small-level comparison against the linear emulation and the depth read's class conversion; the shared switch keeps the bicubic emulation alone. A NaN texel's half read only needs to read a NaN under the default policy. Docs: HalfSampleFilter, FloatSampleFilter, SrgbTexelDecode, AnisotropicFilter, DeviceAnisotropicFilter, ViewBaseTexelOffset and HalfTexelConversion in artifact.rs, RuntimeFact::TexelFormat, the heap class flag, texel_format_spec and a few comments that still named the emulated linear filter, snapped gathers or the shader's comparisons. Verified: plain clippy over the workspace with all targets and features; the touched families under nextest (see the next commits for the full runs). |
||
|
|
79166a74b1 |
Leave NaN bits and min/max picks to the device
One work packet, landed as 6 commits (a6e97e7f93..3919c8c94a on archive/development-linear-2026-10-28), in order: * Leave NaN bits and min/max picks to the device On the owner's ruling to promise the GPU's native arithmetic with no exact emulation, delete the NaN and minimum/maximum switch and every form that only it, or Metal's NaN bits, kept. What goes: - DevicePolicy::nan_and_min_max and NanMinMaxPolicy (exact_answers line, serde, ExactFormsOverCompilerLimit::nan_and_min_max, the fit leg). - The module's selects of Metal's NaN: NanEncoding::Device, ArithStrategy::Nan and lower/arith/nan.rs down to its answer classes. A NaN Metal answers that the device is not measured to answer records NativeNanEncoding. - Metal's operand pick in fmin, fmax, min3, max3, clamp and saturate (metal_min_max, metal_saturate, MinMaxRoute): NMin, NMax and NClamp on every profile, NativeMinMax where MetalMinMax is not taken. - Metal's texel NaN rule (TexelNanRoute, the 0x7e00 keeps, the half texel NaN keep, the NaN classes of reads, samples and gathers). - NaN canonicalization before colour and storage writes: StorageImageClass::HalfQuietNan and SmallFloatQuietNan, the half write NaN classes (HalfNans), the quieted heap small floats, the colour lanes that chose 0x7fc00000, the 16-bit colour outputs (StageIo and StageModule half_bit_colors, IoType::bits, Degradation:: ShaderHalfColorBits), PushField::TextureHalfChannels, RuntimeFact::StorageTextureHalfChannels and the slot word behind it. Such writes record DeviceNanEncoding where the stored NaN may not be Metal's (heap and formatless writes, 32-bit and packed float channels). - The narrow-float vertex fetch's canonical NaN: noted instead. - The runtime's colour NaN clears (nan_clear::NanClears and its texel computation, the inline-first NaN clear refusal, WorkCounts:: passes_not_inline_actions_nan_clear): the device's clear, announced as DeviceNanEncoding. The depth NaN clear and the bit-exact copies stay. - FAST-PATHS rows for the switch, the half texel keep and the half from bits under float controls; the known gap of RADV's sampler NaN; the API.md passages and catalogue entries. Kept: the notes that describe the native answer (NativeNanEncoding, NativeMinMax, DeviceNanEncoding), the measured deviations they read, the copy and depth paths, keeps_nan_sign, the heap half-bits twin, the half rounding and the blended snorm NaN of other lanes. Versions: SEMANTICS_VERSION 1871, ARTIFACT_FORMAT_VERSION 454, RUNTIME_VERSION 1652. docs/REFUSALS.md regenerated. Verified: cargo clippy --workspace --all-targets --all-features -D warnings, plain and with --cfg m2v_gpu; RUSTDOCFLAGS='-D warnings' cargo doc --workspace --all-features --no-deps; nextest of metal2vulkan filtered to the touched modules, fast_paths, catalogue, degradation, api_surface and profile (see the report for counts), and of the runtime, validation and conformance unit tests touched. No device test was run. * Re-bless the API signatures after the NaN and min/max deletion The table loses the public items the previous commit removed: NanMinMaxPolicy and its variants, DevicePolicy::nan_and_min_max, ExactFormsOverCompilerLimit::nan_and_min_max, PushField:: TextureHalfChannels, RuntimeFact::StorageTextureHalfChannels, StorageImageClass::HalfQuietNan and SmallFloatQuietNan, StageModule::half_bit_colors, Degradation::ShaderHalfColorBits and WorkCounts::passes_not_inline_actions_nan_clear. Verified: python3 scripts/api-signatures/signatures.py --bless; nextest of the api_signatures, api_surface, refusal_surface and feature_vocabulary binaries (21 passed); the previous commit's filtered metal2vulkan run, 1056 passed, plus runtime (53), validation (83 of 84; the failing c3 venue-identity test names the Apple M4 and touches no file of this change) and conformance (38) filtered runs. * Fix the tests the rebase onto development left broken The rebase of the NaN and min/max deletion onto development left two test compile errors: the extended-range samples still round through `half_toward_zero`, which the resolution had dropped with the storage-slot test that used it, and the RGBX storage cases named `HalfQuietNan`, which both sides' deletions removed (a half-float twin is `Identity` now). Verified: cargo clippy --workspace --all-targets --all-features -D warnings, plain and with --cfg m2v_gpu; RUSTDOCFLAGS='-D warnings' cargo doc. * Drop a dead dot form and let formatless half slots note conversion twice select_float_fn still computed dot's scalar result form, which only the removed NaN canonicalization read. The half-float storage test asserted that a formatless slot notes DeviceColorConversion exactly when the profile does not round Metal's way; a formatless slot may also reach a normalized image, whose conversion is the device's on every profile, so the note is only required one way there. Verified: cargo check --workspace --all-targets --all-features is clean. * Leave the fast division's NaN to the device in its test The float-maths lane's a_fast_division_answers_metals_nans_on_every_profile asserted Metal's canonical NaN after the device's OpFDiv where the profile does not take MetalCanonicalNans. Under the native-arithmetic ruling the module selects no NaN: the fast division is the device's OpFDiv on every profile, noted NativeNanEncoding where the device is not measured to answer Metal's. The test, now a_fast_division_leaves_its_nans_to_the_device, checks that the module is the same on both sides of the fact, the note where the fact is absent, the device's arithmetic, division and denormal notes on every committed profile, never DeviceNanEncoding, a NaN for each NaN case and 6 / 3 exactly. Verified: cargo nextest -E 'test(/engine_arith::a_fast_division/)' passes (2 tests); the previous form failed on amd-780m-hawkpoint-radv for fast_one_by_negative_nan (0xffc00000, the device's). * 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. |
||
|
|
4817f3bdfe |
Take the device's float maths, rounding order and denormals on every device
One work packet, landed as 3 commits (9fd799bdbb..43bdc4ac17 on archive/development-linear-2026-10-28), in order: * Take the device's float maths, rounding order and denormals on every device The owner's ruling: promise the GPU's native arithmetic, no exact emulation. The translation's own Metal-answer forms for float maths go, and the device's native form is the only form. What goes: - DevicePolicy::float_maths (FloatMathsPolicy) and DevicePolicy::rounding_order (RoundingOrderPolicy), their exact_answers() lines, serde, docs, and the profile state that carried them (FloatFunctions::Device, ProfileFields::rounding_order and RoundingOrderRoute); RuntimeFact::ExactFormsOverCompilerLimit loses its float_maths and rounding_order fields. - The maths routines of Metal's answers in lower/arith/libm (atan, exp, hyper, log, pair, pi, quarter, rcp, root, rsqrt, sincos, tan, trig) and their paths in math.rs: off MoltenVK every call takes the device's GLSL.std.450 instruction (or Metal's composition of the device's instructions), noted NativeTranscendentals; on MoltenVK the device's instruction, Metal's own in the module's mode, with its old notes. - Metal's precise division routine and its fast reciprocal: a precise and a fast division are the device's OpFDiv (NativeDivision), and an frem without every flag the device's OpFRem. - The checked OpFmaKHR, the double, integer and half fused multiply-add routines, and the tiny-product check (arith.float.tiny): a fused multiply-add is OpFmaKHR, the measured 16-bit Fma, OpFmaKHR under the 16-bit float controls, or the device's Fma (NativeFma). - Metal's fused chain for dot, mix and fast::sqrt off MoltenVK: OpDot, FMix and Sqrt (NativeDot, NativeMix, NativeTranscendentals). MoltenVK, whose float functions are Metal's, keeps Metal's chains. - The f32 denormal flush taken where the device is not measured to read denormals as Metal does (no DriverDeviation::MetalFloatDenormals), and the floor and ceil flush: those denormals are the device's, noted DeviceDenormals. - FloatTininessAfterRounding is announced on every device off MoltenVK. What stays: precise fmod's routine (OpFRem is not the exact remainder past a quotient of 2^24), ldexp on the bits (GLSL Ldexp is undefined past the exponent range), double support, and every precision note that describes the native answer. FloatFn::words charges each function a call takes as before (the device's instruction where a routine's call was counted). Tests of the deleted forms are deleted; the tests of the native forms now check the device's instruction, its note and the interpreter's IEEE answer (the division, remainder, fmod, fused multiply-add, dot, mix, denormal and tanh tests), and the roll fixture grows to 13,000 operations so two bodies stay above the roll size without the flushes. The c3 bound and sign-off tests expect a subnormal product or quotient on lavapipe to stay open (its multiply and divisions now record DeviceDenormals) and a product on MoltenVK, measured to flush as Metal does, to keep Apple's verdict. Docs: FAST-PATHS.md's two rows become device gaps (the maths library and divisions; dot, mix and fast::sqrt; the tininess; the denormals), API.md's policy bullet and catalogue entries, ARCHITECTURE.md's decisions bullet. Versions: SEMANTICS_VERSION 1878, ARTIFACT_FORMAT_VERSION 461, RUNTIME_VERSION 1660. REFUSALS.md regenerated unchanged; api_signatures.tsv is re-blessed in a later commit, after the rebase onto development. Verified on b1ae235a12, before the rebase onto development 4df472aea2 (whose conflicts the commits after this one check): cargo clippy --workspace --all-targets --all-features -D warnings with --cfg m2v_gpu; cargo nextest (--test-threads 4) on the touched modules' tests (lower::arith, lower::sampler face, position and linear, device::tests, compile::fit, cache, the engine_* suites touched, engine_roll, fast_paths, api_surface, api_signatures), the runtime's degradation, catalogue, device and fitted_variant_notice tests, and the whole metal2vulkan-validation suite but the runtime-sources pin (left to the landing) and c3::tests::each_moltenvk_device_compares_with_its_own_gpus_metal (a venue identity check outside the arithmetic). No device tests ran: the device lanes compile under --cfg m2v_gpu and were adapted, not run. * Re-bless the public signatures after the float maths switches' removal The commit before this one was rebased onto development 4df472aea2. This commit holds what the rebase left to do: - api_signatures.tsv re-blessed: against development it drops FloatMathsPolicy and RoundingOrderPolicy (their records, fields and variants) and ExactFormsOverCompilerLimit's float_maths and rounding_order fields. docs/REFUSALS.md regenerated, unchanged. - corpus-draw-ab's --policy error message: the conflict resolution lost the string's line continuation and left a run of spaces in it. - The DeviceDenormals docs (PrecisionNote and the API.md catalogue entry) no longer say the minimum and maximum functions and saturate answer Metal at a denormal on every device: under the default policy, and on every device once Metal's picks go, they are the device's NMin, NMax and NClamp, whose pick of a denormal NativeMinMax records. - Doc comments this lane wrote past 100 columns refilled. Verified on this tree: cargo clippy --workspace --all-targets --all-features -- -D warnings, plain and with --cfg m2v_gpu, clean; RUSTDOCFLAGS='-D warnings' cargo doc --workspace --all-features --no-deps, clean; cargo nextest (--test-threads 4) of metal2vulkan filtered to the touched modules (lower::arith, lower::sampler, device::tests, compile::fit, cache, the touched engine_* suites) and fast_paths, catalogue, degradation, profile, mechanism, api_surface and api_signatures: 818 run, 817 passed; of the runtime's degradation, catalogue, device and fitted_variant_notice tests and the whole metal2vulkan-validation suite: 1402 run, 1400 passed. The three failures fail identically on development 4df472aea2 (run there): engine_float_call_notes:: exported_float_notes_are_the_ones_a_compile_records (fabs_f16 on moltenvk-m3 records NativeHalfConversion, the half decode's note) and c3::tests::each_moltenvk_device_compares_with_its_own_gpus_metal (a venue identity check); and the runtime-sources pin, left to the landing. No device tests ran. * 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. |
||
|
|
70068f7cc0 |
Leave color writes to the device's own conversion
One work packet, landed as 6 commits (886b08c25a..4df472aea2 on archive/development-linear-2026-10-28), in order:
* Leave color writes to the device's own conversion
The owner ruled that the GPU's native arithmetic is the contract and
the exact emulation goes. The fragment stage no longer rounds a float
output to Metal's codes before a color write where the device is not
measured to convert as Metal does: every lane is written as computed
and the device converts it.
Removed: the shader's unorm, snorm, sRGB, packed 16-bit (through half)
and small-float roundings at Metal's default rounding mode, the
draw-selected rule (ChannelWrite::Selected, PushField::ColorWriteRule,
GraphicsState::color_write_rules, StageIo::selected_colors and the
rule words), and the sRGB color-write table
(SyntheticBinding::ColorWriteTable, WriteSource::ColorWriteTable,
bind::color_write_table) with its runtime and validation binders.
Kept: the rounding to nearest even under TextureWriteRoundingMode::
NearestEven (an explicit Metal API mode no device's conversion makes),
word attachments the function encodes, the storage-form blends of
framebuffer fetch, the 16-bit output route, and the notes. A channel
the device converts unmeasured records DeviceColorConversion; a float
NaN to a half-float channel records DeviceNanEncoding where the device
is not measured to store Metal's. A blend of one and zero is dropped
from an attachment whose channels convert by a rule, as before, so a
device without the blend still draws it.
Bumps SEMANTICS_VERSION to 1874, ARTIFACT_FORMAT_VERSION to 457 (codec
lists lose fields and variants) and RUNTIME_VERSION to 1655 (the
binder no longer binds the table).
Verified: cargo clippy --workspace --all-targets --all-features -D
warnings, plain and with --cfg m2v_gpu, clean; cargo nextest (color
writes, link, stage io, fragment, binder, blend8, api_surface, srgb,
extended range, word, fetch, fast_paths, catalogue, degradation,
profile, codec, compile, push): 694 of 694 passed. Device lanes not
run (no device tests in this lane).
* Leave storage-texture writes to the device's own conversion
On the owner's ruling that the GPU's native arithmetic is the contract,
a kernel's (or any stage's) float or half write to a storage texture
no longer rounds to Metal's codes in the shader where the device is
not measured to store them.
Removed: the normalized write's rounding by the bound format's class
(lower/texture/norm_write.rs, NormWrite, the slot's norm_write flag,
the heap's norm routine and its census entry), the 1-bit alpha's
rounding on a device that stores every other normalized channel as
Metal does (StorageImageClass::OneBitAlpha, the heap's one-bit class
test, texel_format::heap_one_bit_indices), ARGB8Unorm's code rounding
(RotateArgb now only rotates), and the half-float write's rounding
toward zero (StorageImageClass::HalfTowardZero): a half-float write
takes Identity where the device stores Metal's NaN, else HalfQuietNan.
Recorded instead: PrecisionNote::DeviceColorConversion for a write
that may reach a normalized format (ARGB8Unorm included) on a device
without MetalNormStorageWrites, or a 1-bit alpha on one with it, and
for a half-float write on a device without MetalHalfStorageWrites;
where measured, the module requires the property. Imageblock slice
writes record the same.
Kept: the HalfBits route (a half-float texture written through its
unsigned integer alias where the device does not keep a half's NaN
bits) as it is, its float texels still rounded toward zero, since the
alias has no conversion of the device's; the NaN quieting classes;
sRGB encodes; extended-range encodes; RGB9E5's word.
The device lanes for normalized and half storage writes, and the
extended-range planes lane's ARGB8 alpha, now hold a channel to
Metal's only where the device is measured to store it, and print the
rest.
Verified: cargo clippy --workspace --all-targets --all-features -D
warnings, plain and with --cfg m2v_gpu, clean; cargo nextest
(engine_handles, engine_extended_range, engine_link, engine_rgbx,
engine_texture, metal::format, texel_format, bind::heap, engine_access,
engine_heap, engine_texel_nans, storage, lower::texture,
lower::arith::tests, fast_paths, catalogue, degradation, profile,
api_surface): 1028 run, 1 failure fixed, then engine_link 26 of 26.
Device lanes not run.
* Leave Depth16Unorm depth stores to the device's own conversion
The owner's ruling ("Just promise the GPU's native arithmetics, no more
'exact' emulation") makes the device's own conversion of a fragment's
depth to a Depth16Unorm code, and its own depth bias, the contract.
The fragment stage no longer rounds its depth to Metal's 16-bit code,
nor adds Metal's bias in the shader, where MetalDepth16Stores or
MetalDepth16BiasedStores is absent: the depth is written as computed
and the attachment's fixed-function bias applies on every device.
Deleted with it: lower/stage_io/depth16.rs and its arith tests, the
engine_depth16_codes tests, the pipeline's depth16 stage form and its
variant key fields, the Depth16 runtime facts and their codec entries,
the DepthBias push field, the binder's depth16 selection and state, the
runtime's sided-bias push and its work count.
Removed public items: Degradation::ShaderUnormDepth and
Degradation::UnormDepthSlope (nothing can record them any more; their
API.md catalogue entries go too), WorkCounts::depth16_sided_draws,
metal::state::depth16_bias and depth16_bias_side, the four RuntimeFact
Depth16 variants, PushField::DepthBias, and the depth16 fields of
VariantKey, BindState and BindShape. UnormDepthBias and
UnormDepthRounding stay: they describe the native answer and are still
announced where the drivers are not measured to give Metal's codes.
The FAST-PATHS "Costs of matching Metal" bullet for Depth16 goes; the
API.md bias and rounding entries now describe the native answer. The
device lane unorm_depth_bias holds Metal's codes only where measured.
The cache versions were already taken for this lane (1874/457/1655).
Verified: cargo clippy --workspace --all-targets --all-features -D
warnings, plain and with --cfg m2v_gpu; rustdoc with -D warnings;
cargo nextest over mechanism, api_tests, bind_shape, pipeline::compile,
link tests, engine_stage_io, engine_fragment, metal::state,
bind::graphics, cache tests, engine_graphics_binder, depth, fast_paths,
catalogue, degradation, profile, api_surface, notice, work_counts,
draw_shape, render_state and codec across metal2vulkan,
metal2vulkan-runtime and metal2vulkan-conformance: 750 passed. Device
lanes not run; refusals regenerate unchanged.
* Drop two doc references to removed colour and depth16 machinery
The runtime's stage digest doc still listed a synthesized depth16
fragment stage among the link's stages, and the sRGB storage lane's
module doc still named bind::color_write_table, both removed on this
branch. The stage list now names only the stages the link still
synthesizes, and the lane's doc names bind::SRGB_RESOLVE_THRESHOLDS,
the table it reads.
Doc comments only; verified by cargo fmt and the rustdoc build below.
* Re-bless the public signatures after the write conversions' removal
The branch removed the Metal colour-write rule selection, the shader's
storage-texture rounding and the shader's Depth16Unorm codes; the
table now drops their 30 public records (ChannelWrite::Selected,
PushField::ColorWriteRule and DepthBias, the ColorWriteTable binding
and write source, bind::color_write_table, GraphicsState's
color_write_rules, the four RuntimeFact Depth16 variants,
StorageImageClass::HalfTowardZero and OneBitAlpha, the depth16 fields
of LoweringInputs, VariantKey, BindState and BindShape,
metal::state::depth16_bias and depth16_bias_side,
Degradation::ShaderUnormDepth and UnormDepthSlope, and
WorkCounts::depth16_sided_draws). Removals only; nothing added or
changed.
Verified: python3 scripts/api-signatures/signatures.py --bless, the
diff read line by line, and cargo nextest over api_signatures and
fast_paths: 17 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.
|
||
|
|
e87d6e558f |
Drop the exact read of a 16-bit float texel's own bits
One work packet, landed as 6 commits (b07aaeec71..ffa0751e77 on archive/development-linear-2026-10-28), in order:
* Drop the exact read of a 16-bit float texel's own bits
The owner's ruling of 2026-10-27 ("just promise the GPU's native
arithmetics, no more 'exact' emulation") makes the device's decode of a
16-bit float texel the only answer a `half` or `float` read gives. So
`DevicePolicy::half_texel_bits` and `HalfTexelBitsPolicy` go, with
everything only its `Exact` value reached:
- the slot's second binding of the texture's unsigned-integer alias
(`RuntimeFact::HalfBitsTexture`, `metal::format::half_bits_read_view`,
`DeviceProfile::reads_half_texel_bits`), its declaration, the read's
branch on the bound class and its integer widening;
- the snapshot copy's alias arm and the read's codes beside the value;
`snapshot_copies_alone` now expects the copy's one fetch a slot;
- the binder's alias view and its in-shader swizzle for it, and the
runtime's alias view format on a sampled image;
- the fit's `half_texel_bits` field of `ExactFormsOverCompilerLimit`
and the runtime's name for it.
The read keeps the device's decode and its `DeviceNanEncoding` note.
The `StorageImageClass::HalfBits` storage path is untouched. Tests of
the deleted form go (`engine_half_texel_bits`, the snapshot alias and
swizzle tests, the golden check of the copy's arm); the ledger row goes,
and the conformance gap rows' reasons no longer cite the switch.
SEMANTICS_VERSION 1872, ARTIFACT_FORMAT_VERSION 455 (a RuntimeFact
variant and a field gone), RUNTIME_VERSION 1653.
Verified: cargo clippy --workspace --all-targets --all-features
-D warnings clean; nextest over fast_paths, catalogue, degradation,
profile, mechanism, compile::fit, engine_snapshot_exact,
engine_srgb_raw, engine_swizzled_storage, snapshot_codes, codec and
image_plan (276 tests) passed. api_signatures is re-blessed at the
lane's end.
* Drop the shader's exact 16-bit float blend of a half output
The owner's ruling is to promise the GPU's native arithmetic, so the
`half_blend` switch (`HalfBlendPolicy`) goes. Under its exact value the
pipeline named a blended 16-bit float attachment of a `half` output, and a
32-bit float one of a four-lane output under fast math, for the interlocked
storage form alone (`FramebufferFetchInputs::half_blends`), so the shader
computed Metal's blend where the device would otherwise blend. That path
is gone: `compile::blended_in_shader`, the `half_blends` set and its
"optional" handling in the fetch lowering, `fetch::blends_half_in_shader`,
`half_output` and `half_blend_attachment`, the policy field, the profile
field and the fit's `half_blend` flag in
`RuntimeFact::ExactFormsOverCompilerLimit`.
Kept: a fetched attachment's blend (the function reads it, so no Vulkan
blend applies) and an attachment a draw moves into the storage form
(`VariantKey::interlocked_colors`), both capability. `HalfOutputPrecision`
still describes the device's blend and is recorded as before; with no
switch it is no fast-default row, so the ledger test classes it with the
notes docs/API.md section 9 states. The ledger's `half_blend` row goes,
and the device-gap rows no longer cite it.
Tests of the exact form go (`engine_fetch_float32_reach`, two
`engine_stage_io` tests); the validation lane `half_output_blends` runs
under the device's blend alone, and `corpus-draw-ab --policy` no longer
takes `half_blend`.
Verified: cargo clippy --workspace --all-targets --all-features -D
warnings clean; nextest of engine_stage_io, compile::fit, fast_paths,
device::tests, pipeline::api_tests, lower::fragment, catalogue,
degradation, fitted_variant_notice, api_surface and link render tests
(246 passed), and of every fetch, blend, interlock and half_output test
(199 passed). Golden tables not run (re-blessed on development).
* Round half by the device's own conversion or quantize
The owner's ruling is that the GPU's native arithmetic is promised, with
no exact emulation. This deletes the half_rounding switch
(HalfRoundingPolicy, ProfileFields::half_rounding, HalfRoundingRoute)
and everything that only its Metal value reached:
- QuantizeForm::Integer: Metal's rounding to half by integer arithmetic,
its texel routine arms (grid16_by_integers), round_texel_plain and
texel_round's f32_to_half_by.
- The NoContraction barrier on the conversion pair, and the
MetalHalfConversion requirement it carried.
A half now rounds by the device's form:
- Controlled: the float-controls route (ANV, RADV), unchanged.
- Converted: the device's conversion pair, wherever the profile has
shaderFloat16. It records NativeHalfConversion, MoltenVK included.
- Device: OpQuantizeToF16 with its denormal arm, which becomes the
QuantizeForm default. It records NativeHalfQuantize unless the driver
is measured as Metal's (MetalHalfQuantize).
A Converted module reads a half from its bits by the device's widening,
MoltenVK now included. The tests that held a NaN's bits there now accept
any NaN where the module records NativeHalfConversion: engine_access,
engine_half_moves, engine_typed_threadgroup and engine_texel_nans.
The integer conversion of an int to half, and the integer decode inside
loops and on profiles without shaderFloat16, stay: they have no native
form with a recorded bound.
Docs:
- FAST-PATHS.md: the three half_rounding rows are deleted.
- API.md: the degrade catalogue entries are rewritten without the
switch.
- HOWTO.md: the half paragraph is rewritten.
Tests: deleted the integer-form tests, and rewrote the engine_native_half
and engine_arith half-rounding tests to the device's forms.
SEMANTICS, ARTIFACT_FORMAT and RUNTIME versions were already bumped to
this lane's reserved numbers.
Verified:
- cargo clippy --workspace --all-targets --all-features -D warnings,
plain and with --cfg m2v_gpu: clean.
- cargo nextest over half, narrow, texel_round, lower::arith,
engine_arith, engine_sampler, engine_link, fast_paths, device::tests,
compile::fit, catalogue, degradation, fitted_variant_notice,
api_surface, engine_texture, lower::texture and engine_snapshot
(939 tests): the 11 failures were fixed, and the 161 tests they touch
re-run green.
* Take the device's float Fma for a half fused multiply-add
The owner's ruling is that the GPU's native arithmetic is promised, with
no exact emulation. Where neither MetalHalfFma (the device's 16-bit Fma
measured as Metal's) nor a 16-bit OpFmaKHR under the float controls is
offered, a half fused multiply-add used to call Route::HalfOdd. That is
the translation's round-to-odd routine of Metal's once-rounded answer;
off MoltenVK it was taken only under FloatMathsPolicy::Exact. It now
takes Route::Native under every policy: the device's float Fma, its
result rounded to half, noted NativeFma.
Removed: Route::HalfOdd, its census name (arith.fma.half), its define,
emit, words and routine arms, and half_form. Routine::words,
Routine::words_among and complete no longer take the quantize form, now
that no routine holds a half rounding. half_sum stays, since the
extended-range blend uses it.
Docs: the fma module docs, the narrow docs, NativeFma's and
DeviceSignedZeroInfNan's docs, their API.md catalogue entries, the
runtime NativeFma declaration, and the FAST-PATHS float-maths row's
mention of the half routine.
Tests:
- The HalfOdd rounding test becomes a test of the two 16-bit routes.
- The mix and dot half tests run through F16Khr.
- The route, words and lane-count tests drop HalfOdd.
- The engine_arith fma, zero-sign, chain and denormal-rounding tests
expect the inline device Fma, and NativeFma within one half ulp.
Verified:
- cargo clippy --workspace --all-targets --all-features -D warnings,
plain and with --cfg m2v_gpu: clean.
- RUSTDOCFLAGS='-D warnings' cargo doc --workspace --all-features
--no-deps: clean.
- cargo nextest over lower::arith, engine_arith, engine_simd, engine_agx,
lower::sampler::face, fast_paths, catalogue, degradation, api_surface,
engine_native_half, engine_extended_range, fused and fma (938 tests):
935 passed. The three engine_arith failures were fixed, and
engine_arith re-ran 43 of 43 green.
* Bless the public signatures after the half switches' removal
These are the public items lane C's commits removed:
- HalfRoundingPolicy, HalfBlendPolicy and HalfTexelBitsPolicy, and
their variants;
- FramebufferFetchInputs::half_blends;
- metal::format::half_bits_read_view;
- DeviceProfile::reads_half_texel_bits;
- RuntimeFact::HalfBitsTexture.
RuntimeFact::ExactFormsOverCompilerLimit also loses its half_rounding,
half_blend and half_texel_bits flags.
docs/REFUSALS.md re-derives unchanged: no refusal changed.
Verified:
- signatures.py --check: clean.
- cargo nextest of api_signatures, api_surface, fast_paths, catalogue,
degradation, device::tests, compile::fit, fitted_variant_notice and
published_crates: 171 of 171 passed.
- scripts/api-docs: 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.
|
||
|
|
d4412c9c95 |
Key the driver tables by driver and GPU, never by release
One work packet, landed as 3 commits (a1f70a4962..ae43dbc9b3 on archive/development-linear-2026-10-28), in order:
* Key the driver tables by driver and GPU, never by release
The owner's ruling: the driver-release table goes. A driver's measured deviations, defects and
runtime facts were keyed on `driverVersion` windows, and a device whose exact identity (driver,
vendor, deviceID and release) was not measured fell off every measured answer onto the exact
paths, with an informational `metal2vulkan-unmeasured-driver` message, and a release past the last
measured recorded `PrecisionNote::BeyondMeasuredDeviation` in every module.
Now every row of `device::driver_facts` (DEVIATIONS, DEFECTS, MEASURED) and of the runtime's
`driver_defects` names a driver and, where it was measured on some alone, a vendor and a GPU
(`deviceID`, read by `canonical_device_id`), and holds at every release of that driver.
Removed:
- `Measured::{first, last}`, `Standing`, `NAMED_RELEASES`, `MeasuredDevice`, `MEASURED_DEVICES`,
the `mesa`/`nvidia`/`moltenvk` release encoders;
- `DeviceDescription::{measured_identity, driver_facts_withheld, measured_gpu,
assumed_unmeasured}` and `DriverFact::assumed_where_unmeasured`;
- the runtime's `DeviceOptions::assume_unmeasured_identity`, `DeviceProperties::driver_facts_withheld`,
`unmeasured_driver_message` and the `metal2vulkan-unmeasured-driver` message;
- `PrecisionNote::BeyondMeasuredDeviation`, its degrade code `beyond-measured-deviation`,
`ProfileFields::deviations_beyond` and `DeviceProfile::driver_deviations`;
- the runtime defects' clean list is GPUs alone (the RTX 5080 Laptop GPU, the Radeon 780M).
Rows the release windows made redundant were merged (MoltenVK 1.4.1's and 1.4.2's: 112 deviation
rows to 86, 98 runtime fact rows to 80). Two MoltenVK defects measured on Apple's GPUs now name
MoltenVK on every GPU (`TimestampPoolsAreCounterSampleBuffers`,
`DepthStencilImagesStayGpuOptimized`), keeping the reach the unmeasured-identity rule gave them.
What changes on the committed profiles: RADV's RDNA2 and RDNA3 captures take RADV's
`RobustIndexFetchReadsZero` and `InterpolationNeedsTheWholeQuad`; ANV's Arrow Lake and Tiger Lake
captures take ANV's driver-wide rows (hidden aliased writes, host-transfer bytes, the first sparse
resource's wait, the dispatched copies) and `VertexGroupingNotApples`; NVIDIA's Pascal and RTX 50
desktop captures take `DepthImageKeepsDenormals`; lavapipe takes its 26.2.4 rows
(`SubmissionsWithoutSignalsMerge`, the 8-bit linear filter's bound); MoltenVK's capture takes the
rows measured at 1.4.2 on its deviceID (`MetalFullQuads`, `FragmentDepthKeepsDepth16Codes`,
`BlendlessColorAttachmentsWarn`, the heap colour layouts). A defect fixed in a later release (the
780M's implicit preprocessing, broken at 26.0.8 and clean at 26.2.4) is now the GPU's at every
release.
SEMANTICS_VERSION 1869, ARTIFACT_FORMAT_VERSION 452 (a `PrecisionNote` member removed),
RUNTIME_VERSION 1650.
Verified: clippy clean (workspace, all targets, all features; plain and `--cfg m2v_gpu`); the core
suites (metal2vulkan, -runtime, -air, -devtools) pass but the golden and fixture tables, whose M4
columns and changed outputs are re-blessed on development after this lands.
* 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.
* Re-bless the engine inventory and the golden tables
Blessed on development at b1ae235a12, after the Apple M4 profile left (its columns go) and the
driver tables stopped naming releases (the committed RADV, ANV, NVIDIA, lavapipe and MoltenVK
captures take the rows their drivers and GPUs were measured with, which changes their modules).
Verified: bless_engine_inventory, bless_golden_hashes and bless_engine_goldens each passed
(exit 0) in a tree at b1ae235a12.
|
||
|
|
6063e66a7c |
Drop the retired degrade codes
The owner asked for the retired notice codes to go. A kind that no longer fires is now removed with its code, as any removed public item is; nothing keeps the history of codes. - Degradation::RETIRED_CODES (18 codes) is gone, with its rows in api_signatures.tsv (re-blessed). - tests/degradation_codes.txt, the list of every code ever issued, and every_code_ever_issued_is_live_or_retired, which held it equal to the live and retired codes, are gone. - codes_are_distinct_and_decode no longer checks retired codes, and the_catalogue_lists_every_kind_and_only_them no longer reads retired lines. - docs/API.md's catalogue loses its 18 retired entries; the contract line and the runtime's module docs say a code is never renamed, and a kind that no longer fires goes with its code. CONTRIBUTING.md drops the ever-issued list's rule. - Validation's C3 test drops the retired code from the announced list it judges. Verified: metal2vulkan-runtime's degradation, catalogue and degradation-site tests (17 of 17) and validation's an_announced_deferred_near_equivalent_stays_open_with_its_reason pass; signatures.py --bless leaves two fewer records. Originally 3f7ced85af (archive/development-linear-2026-10-28). |
||
|
|
ec72c052dd |
Answer as one macOS release, 27.0.1, on every host
The owner's ruling: the runtime imitates the latest measured release
only, not the history of releases. Capabilities (GPU family, features,
limits) still follow the GPU; every answer that differs by release is
macOS 27.0.1's (build 26A434, measured on an Apple M3 Max), on every
host, whatever release it runs.
What changed:
- metal_level.rs becomes metal_release.rs: the public const
MACOS_RELEASE ("27.0.1") and the release's answers in one place
(heap block placement per family, the nil-texture stack alignment,
the mipmap rule, a depth/stencil state's resource ID below Apple10).
The pixel-format table and the private properties hold 27.0.1's
answers alone.
- Removed the MetalLevel enum and its 26.7 row, the host-release read
and the level choice, DeviceOptions::metal_level,
RawDevice::metal_level and DeviceProperties::metal_level.
- Removed what existed only for 26.7: the indirect-dispatch-of-another-
type refusal and its predication tracking, the depth/stencil resource
ID refusal, the M3 Max GPU row counting for heap blocks, PVRTC's
unmeasured heap placement, and the M4 mipmap stand-in emission.
- Problem::HostReleaseUnmeasured (the Unproven site),
Problem::IndirectDispatchOfAnotherType and
Problem::DepthStencilResourceId are gone. The Unproven type is
untouched.
- Degradations metal-level-below-host, metal-level-not-macos and
mipmaps-as-apple-m4 are retired (RETIRED_CODES, the retired section
of docs/API.md); mipmap-tie-rounding's trigger and cost drop the 26.7
clauses.
- Conformance: the recordings keep their "metal_level": "27.0.1" key as
a fact about the recording; record and replay compare it with
MACOS_RELEASE. Venue no longer carries a level.
- Validation's runtime_lane tests run on the default device, with the
26.7-only tests and level loops removed.
- A runtime unit test now holds the block-compressed kind on ASTC 4x2,
its one remaining trigger, in place of PVRTC at 26.7.
Docs: docs/API.md, docs/FAST-PATHS.md, docs/RUNTIME-PORTING.md and the
runtime README; docs/REFUSALS.md and docs/METAL-COVERAGE.md
regenerated (CONFORMANCE-COVERAGE.md regenerated, unchanged); the
signature table re-blessed with scripts/api-signatures/signatures.py.
Carried onto development from the parked development-performance branch
(a23f8181d9 there). The three conflicts were that branch's pipeline-record
hook (RawDevice and DeviceOptions fields and their Debug impls), which
development lacks: development's side is kept, without the release field.
Verified: cargo check --workspace --all-targets --all-features, plain and
with --cfg m2v_gpu; refusal_surface.py, signatures.py --check and the two
coverage generators leave the committed files unchanged.
Originally 79bb9749d3 (archive/development-linear-2026-10-28).
|
||
|
|
cfe3cadd65 |
Count a render target's shadow over host pages apart from a shader write's
One work packet, landed as 3 commits (fd42939b4c..6801186813 on archive/development-linear-2026-10-28), in order:
* Count a render target's shadow over host pages apart from a shader write's
What: WorkCounts::host_texture_shadows_written (a texture over host pages made a shadow because
its usage renders into it or writes it) is split into two counts:
- host_texture_shadows_render_target: the usage holds RenderTarget, whatever else it holds. A
texture of both RenderTarget and ShaderWrite counts here, and so does an Unknown usage (Metal
reports every usage for it).
- host_texture_shadows_shader_write: the usage writes it through a shader (ShaderWrite or
ShaderAtomic) and does not render into it.
ShadowCause::Written becomes ShadowCause::RenderTarget and ShadowCause::ShaderWrite in
in_place.rs. Render target wins because such a texture stays a shadow whatever a check of shader
writes could show.
Why: whether guest frames make shader-written textures over host pages at all decides whether
writing them in place is worth its check. The old count lumped them with render targets, so no
run could tell. Writing them in place is parked on park/shaderwrite-in-place.
The shadowed-texture notice's words are unchanged for both causes, and every texture takes the
path it took. No run's answer or announcement changes, so RUNTIME_VERSION is unchanged.
Tests:
- tests::in_place's decision test now expects each cause by usage. The usages include render
target with shader write, render target with atomic, shader write with atomic, and every usage.
It also checks that a shader write's notice reads as a render target's.
- New device lane in_place_textures::textures_that_render_or_write_count_their_shadows_apart:
64x64 R32Uint textures over no-copy pages, of seven usages, under InPlace and under Shadow. Each
moves exactly the count it should (render target, shader write, or the exact form's).
Verified:
- cargo clippy for metal2vulkan-runtime, metal2vulkan and metal2vulkan-validation, all targets
and features, plain and under --cfg m2v_gpu.
- The runtime's in_place and degradation unit tests.
- metal2vulkan's fast_paths, api_signatures and refusal_surface tests.
- api_signatures.tsv blessed.
- The runtime-sources pin is not updated.
Not run: the new device lane. It was landed without its device run on the user's word
("skip the tests, just land it"), so its first run is development's gate.
Removed: WorkCounts::host_texture_shadows_written (now host_texture_shadows_render_target and
host_texture_shadows_shader_write). Nothing in the tree read it but api_signatures.tsv.
* 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.
* Re-bless the golden tables for the new profile field
The YCbCr in-place packet (42abe9a315) added a field to the device profile, which moves every
profile's key. The tables record each profile's key beside its cells, so both went stale on
`development`.
Only the 20 `profile` key lines in each table change; no cell moved (every other line is
identical), so SEMANTICS_VERSION needs nothing here.
Verified: `cargo nextest run -p metal2vulkan --all-features --run-ignored ignored-only
-E 'test(bless_golden_hashes)'` passed at 00404a4ba4, and the diff holds profile lines only.
|
||
|
|
cdf59197cc |
Read a YCbCr texture's planes in place on integrated GPUs
One work packet, landed as 2 commits (42abe9a315..391480a6b2 on archive/development-linear-2026-10-28), in order:
* Read a YCbCr texture's planes in place on integrated GPUs
On an integrated GPU or a CPU device, a function that only samples a two-plane YCbCr texture now
reads the texture's planes directly. Such a texture is `YCBCR8_420_2P` or `YCBCR10_420_2P` over
plane 0 of a surface. "Only samples" means nearest or linear, no comparison, no anisotropy and no
`min_lod_clamp`; reading the texture's size is allowed too. The function fetches the codes from a
uniform texel buffer over the planes' bytes, then converts and filters them as Metal does, with
Metal's integer arithmetic. The draw or dispatch reads those bytes alone, so the texture's image is
not converted for it. Every other device, and every other use (a `read()`, a gather), keeps today's
form: the image is converted from the planes through the refresh, then sampled.
Both forms are exact, so there is no precision note and no switch. The device's kind picks the
cheaper one, by Vulkan's deviceType: INTEGRATED_GPU and CPU read in place; DISCRETE_GPU,
VIRTUAL_GPU and OTHER keep the image. This is the same rule as hasUnifiedMemory. Nothing is timed
at startup.
The measured basis is GPU time of a 3840x2160 texture whose planes lie in host memory, composited
into 1680x1050. Figures are microseconds, best of 3 x 40, over unchanged planes; "image" means
today's refresh compare plus the sample. Mesa 26.2.4 and MoltenVK 1.4.2.
device codes in place 1 pass image 1 pass in place 3 passes image 3 passes
Radeon 780M 8-bit 340 1178 1027 3013
Radeon 780M 10-bit 457 1509 1371 3344
RX 7900 XTX 8-bit 1819 1754 5460 1876
RX 7900 XTX 10-bit 3614 3479 10843 3613
M3 Max (MoltenVK) 8-bit 127 259 375 634
M3 Max (MoltenVK) 10-bit 125 364 378 737
A discrete GPU reads the host's planes across its bus at every pass, while its image lies in its
own memory. Where the planes changed, the image's form also converts every texel: 1055 to 1252 us
more on the 780M, 1790 to 3636 on the 7900 XTX, 350 on the M3 Max.
The texel buffer formats are R8G8_UINT for 8-bit codes and R16G16_UINT for 10-bit ones. Vulkan
requires UNIFORM_TEXEL_BUFFER support for both on every device ("Required Format Support": the
1-3 byte-sized components table and the 16-bit components table). Each element holds two luma
codes or one chroma pair.
The translator:
- bind::YCbCrInPlace (new, public) holds the slot's push words and the view's format and bytes:
the size, the planes' places and rows in elements, and the conversion word.
- On a profile that reads in place (ProfileFields::ycbcr_in_place), a 2D float texture slot whose
every access the form reads records RuntimeFact::YCbCrInPlace { slot, samplers }.
- The plan takes VariantKey::ycbcr_in_place for such a slot when the bound texture states
TextureFacts::ycbcr_in_place and every runtime sampler it is sampled through has one filter for
min and mag, no anisotropy, no cubic filter, no comparison and the weighted-average reduction.
The slot then binds WriteSource::YCbCrInPlace and PushField::YCbCrInPlace.
- The variant lowers each sample through lower::sampler::in_place. It builds Metal's texel from
the luma code and the 9/3/3/1 chroma, and feeds extended's exact filter routine
(Decode::InPlace). A runtime sampler's address word is mapped in the shader, as 4:2:0 maps
repeat and mirror to clamp-to-edge.
- Size and level-count queries answer from the push words.
- The YCbCr image variant excludes these slots, so the variant's plan states the same key.
The runtime:
- texture/ycbcr_image.rs states PlanesInPlace for a converted texture where the device reads in
place. Otherwise the texture keeps its image, counted by reason in
WorkCounts::ycbcr_images_kept_{device,layout,swizzle,alignment,elements,reach,view}:
- device: the device's kind;
- layout: another layout, or staged planes;
- swizzle: a swizzle;
- alignment: the planes' first byte misses minTexelBufferOffsetAlignment;
- elements: more than maxTexelBufferElements;
- reach: planes past the buffer, which Metal reads as zeros;
- view: no view usage.
- Binding a slot under the variant makes the texel buffer view, counted in ycbcr_planes_bound.
It records a read of the planes' bytes in the tracker, so writes to the planes through the
buffer, plane textures or blits are ordered before it. The texture's image is not used there.
- The image stays allocated; making it lazily is later work.
SEMANTICS_VERSION 1868, RUNTIME_VERSION 1645.
Also fixed: development's runtime_lane/dma_buf_imports.rs did not compile on Linux under the GPU
cfgs (layer_reported_nothing not imported). It now imports it.
Docs: the runtime's ycbcr.rs and ycbcr_image.rs module docs, docs/FAST-PATHS.md ("Costs of
matching Metal", and the YCbCr filter row), docs/API.md, the runtime README. The api_surface table
and api_signatures.tsv are blessed. REFUSALS, METAL-COVERAGE and CONFORMANCE-COVERAGE did not move.
Verified:
- New interpreter tests (tests::engine_linear_half::in_place) run every texel of a 7x5 texture
against Metal's model, on lavapipe and moltenvk-m3:
- 8-bit and 10-bit codes, with junk in the 10-bit words' low bits, under all six conversions;
- constexpr linear, nearest and offset (2, -1) samples;
- runtime linear, nearest and repeat-as-edge samples;
- half and float results.
They also check that the planner states the fact on lavapipe and moltenvk-m3 and not on
nvidia-rtx5080-laptop, and that a dynamic offset, min_lod_clamp or a 3D texture gets none. A
negative control, a deliberately broken in-place form, failed them.
- bind::plan::slots: the_in_place_variant_takes_a_slot_its_texture_and_samplers_read.
- The device lanes, filter test(/ycbcr/) over the validation and runtime crates, 49 tests:
- M3 Max, MoltenVK 1.4.2, INTEGRATED: 48 passed. The one failure, a constexpr linear mip
filter that is now read in place, is fixed in this commit's test.
- Radeon 780M, RADV, Mesa 26.2.4, INTEGRATED: 49 passed. The samples bind the planes:
ycbcr_planes_bound 3, refreshes 0, whole conversions 0 per three-dispatch round. The 4K
10-bit minify and padded lanes match Metal's hashes in place (planes bound 7, no refresh).
- RX 7900 XTX, RADV, DISCRETE: 49 passed. ycbcr_images_kept_device is counted, the planes are
bound 0 times and the refresh runs.
- lavapipe (linux-gate, LLVM 21.1.8, CPU): 47 passed. The 2 failures are test expectations,
fixed in this commit: the constexpr mip case above, and the baked-sampler test, where the
in-place variant bakes no sampler. The minify lanes read in place and match Metal's hashes.
- Chunked dma-buf buffer, runtime_lane::dma_buf_imports::
a_ycbcr_texture_over_a_buffer_of_chunks_reads_its_planes_in_place. The buffer is
list_limit + 76 single pages, assembled from 2 udmabuf chunks into 1 sparse buffer.
- 780M: read in place across the chunks, every texel Metal's (planes bound 1, no refresh).
- 7900 XTX: kept the image, every texel Metal's.
- Conformance replay on the M3 Max: ycbcr-minify-band-x and -y, ycbcr-texel-reads-420v and
ycbcr-two-plane-format-descriptors all compare exact against Metal's recordings. The bands now
count ycbcr_planes_bound 1 and no refresh, where the recordings hold ycbcr_refreshes 1, so their
cost records want a re-bless on development.
- clippy -D warnings over the workspace (all features), and over the validation, runtime and
translator crates under --cfg m2v_gpu. cargo fmt.
- The core suite is still running at commit time; its result goes in the report.
* 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.
|
||
|
|
54a8b32154 |
Bind a memoryless texture as plain Metal does, and fail what uses it
One work packet, landed as 2 commits (6c0070d57d..a759d0e88f on archive/development-linear-2026-10-28), in order: * Bind a memoryless texture as plain Metal does, and fail what uses it A memoryless texture bound at a texture slot was refused at the setter (`StorageMode`), as Metal's API validation layer refuses it. Plain Metal takes the binding, so a program that binds one died here at `setFragmentTextures:withRange:` where it runs on Metal. Seen on an RX 580 under RADV, where the device is told framebuffer reads are unsupported. Measured on an M3 Max under macOS 27.0.1, plain Metal (probes committed under crates/metal2vulkan-conformance/probes/memoryless_*.m): - Every setter returns. A command that uses the texture fails the command buffer with MTLCommandBufferErrorInvalidResource (9). That covers a draw, a dispatch or a tile dispatch whose function statically uses the slot, an empty one included, and one that reads the slot only behind a branch that is never taken. It also covers useResource of the texture, with or without a later command, and a blit into or out of it (a zero-size copy included), and generateMipmaps of more than one level. - Nothing fails for a slot no function uses, a slot rebound before the draw, a pass with no draw, a memory barrier, the optimize hints, synchronizeResource, a copy of no slices, or the mipmaps of one level. - Granularity: the submission that holds the command runs nothing, as Metal splits the command buffer (a render pass alone, a run of blit or compute encoders with no event command between them). Neither does anything after it, and its signals do not fire. The submissions before it run and their signals fire. The queue runs on. - The CPU calls of a memoryless 2D texture move nothing; a memoryless texture buffer's fault the process. Every view of one is nil. The runtime now: - binds it; - fails the command buffer with the new CommandBufferError::InvalidResource from the first encoder of the Metal submission (State::fail_submission_from, checks::submission_start); - records nothing for the failing command; - moves nothing in the CPU calls, still refusing the texture buffer's; - answers nil (`Nil`, `StorageMode`) for views. The check per command is one emptiness test of a per-table set of the slots that hold a memoryless texture. An execution's command whose function uses such a slot is the runtime's gap: Metal's answer there is not measured. That is IndirectRenderCommands for render, and CommandReplay for an inherited compute table. RUNTIME_VERSION 1646. The runtime-sources pin moves with it. docs/REFUSALS.md is regenerated, api_signatures is blessed for the new variant, and the degrade catalogue's memoryless-texture-buffer entry is updated. Verified on MoltenVK over this M3 Max under the validation layer: - runtime_lane::memoryless_uses: draw shapes (read, empty, branch never taken, earlier draw, use_resource, unused, rebound, rebound to nil, no draw); the probe's encoder sequences (CcC, BbB, CbC, BcB, BSbB, bSB, CSc); compute and blit uses; CPU access and views. - runtime_lane::memoryless, and the runtime's unit suite (plain cfg). - tests::command_buffer::a_memoryless_use_fails_from_its_submission_s_first_encoder. - Negative controls: - failing per encoder instead of per submission fails the sequence and blit/compute tests; - dropping the draw check fails the draw test (the draw is refused). - Clippy in both cfgs, rustdoc -D warnings for the runtime, and the pin guard. Not run: lavapipe, RADV, and the full validation and conformance suites. * 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. |
||
|
|
87994746ea |
Take IdPlacement::Outside for a texture over the caller's VkImage
One work packet, landed as 2 commits (6e5d7acfc7..6c8a857d8b on archive/development-linear-2026-10-28), in order:
* Take IdPlacement::Outside for a texture over the caller's VkImage
`Device::new_texture_with_vk_image` now accepts `IdPlacement::Outside`,
the runtime extension `Device::new_texture` already takes for a caller's
helper texture: the placement check is skipped for Outside, and
`Texture::made` (already handed `IdUse::Program(placement)`) takes no ID
and holds no slot. The wrapped path otherwise behaves as before; it still
takes no device sampler ID at any placement.
Why: the consumer wraps its swapchain images with this call. Refused at
Outside, it had to give them `Any`, so they took texture resource IDs and
a guest's textures' `gpuResourceID` and `uniqueIdentifier` started past
them while a window was open: the guest's answers depended on whether a
window existed. At Outside the program's textures are numbered as with
no window.
Docs: `IdPlacement::Outside`, the resource-ID module docs,
`check_texture_placement`, `Problem::OutsidePlacement`,
`TextureDescriptor::placement`, the call's own doc (which now says it is
a runtime extension and how it places the texture), docs/API.md and the
runtime README. docs/REFUSALS.md regenerated (the OutsidePlacement row's
wording). No public signature moved (`signatures.py --check` passes).
RUNTIME_VERSION 1647: a call that was refused now makes a texture, which
the version's rule ("a refusal or its class") counts as a behaviour
change. runtime-sources.sha256 follows the edited runtime files.
Test: `presenting::a_callers_image_placed_outside_takes_no_id` (device
lane). After a reservation of 20000, a plain texture takes 20001 on a
device with no caller's texture; a caller's texture placed Any takes
20001 itself and moves the plain texture to 20002; one placed Outside
answers 0 and the plain texture takes 20001. Placed Outside before the
reservation it starts no space (the plain texture still takes 20001),
and a clear of it is what a blit copy of it reads.
Verified, on this Mac (Apple M3 Max, MoltenVK, --cfg m2v_gpu, under
the shared GPU lock): the new test passes and prints "the plain texture
after a reservation of 20000 answers 20001 with no caller's texture;
(Some(20001), 20002) after one placed Any; (Some(0), 20001) after one
placed Outside". With the old unconditional placement check put back it
fails: new_texture_with_vk_image returns
Invalid(OutsidePlacement). Also passing in the same run: every
presenting test, resource_ids::an_outside_texture_takes_no_id, and the
runtime-sources guard. clippy -D warnings for metal2vulkan-runtime
(all targets, all features) plain, and for metal2vulkan-runtime and
metal2vulkan-validation under --cfg m2v_gpu; runtime rustdoc with
-D warnings; the refusal_surface, api_surface and api_signatures tests.
* 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.
|
||
|
|
675a3ee122 |
Take sampled textures over host pages in place where the device's check passes
One work packet, landed as 2 commits (86ec320bae..8485bc6865 on archive/development-linear-2026-10-28), in order:
* Take sampled textures over host pages in place where the device's check passes
A 2D texture (or array) over host pages is now a linear image aliasing those pages, with no shadow,
when all of these hold:
- its declared usage only samples or reads it (no RenderTarget, ShaderWrite or ShaderAtomic);
- the pages are a no-copy buffer's, imported by their pointer or as dma-bufs, or a buffer the
runtime placed in fresh pages;
- a startup check shows that, on this device, the image's first move keeps every byte while the
CPU writes beside it.
Vulkan makes such an image start UNDEFINED (VUID-VkImageCreateInfo-pNext-01443) and lets the move
read and write every byte bound to it. Relying on the driver here, once checked, is the owner's
ruling ("In place, trusting the driver"): a deliberate, scoped exception, recorded in FAST-PATHS.
The switch is DevicePolicy::host_page_textures:
- HostPageTexturePolicy::InPlace is the default.
- HostPageTexturePolicy::Shadow is the exact form, which exact_answers() selects. Under it every
such texture stays a shadow and no check runs.
The check (in_place_check.rs):
- It runs on a thread of its own, started by the first texture that asks, per class of pages:
pointer imports, fresh pages and dma-buf imports. On a Unix target the dma-buf class uses an
exported allocation of the device's own.
- Each class tries 11 shapes, 3 rounds each, through the product's own Buffer::new_texture:
- packed rows of 1, 2, 4, 8 and 16-byte texels;
- rows with bytes between them, for the same texel sizes;
- one 3840x2160 surface.
A shape the device makes no image of is skipped, as the product makes none either.
- A writer thread writes the pattern's complement through texels, the bytes between rows and the
bytes after the image while the move runs. Every byte is then compared.
- The pattern is a 4099-byte prime period, so it lines up with no row, page or texel. The window
is filled by copies and compared written bytes first, then a period at a time. That makes the
33 MB surface cost about 11 ms a round in release.
The verdicts are kept as one record in the shader cache's content store:
- The record is named by vendor, device, driver ID, version, name and info, the UUID, the check's
kind and version, and RUNTIME_VERSION.
- It is checksummed. A bad, partial or other-version record counts as none: the check reruns and
overwrites it.
- With no cache directory, the check runs once per process.
- A forced failure (DeviceOptions::fail_in_place_check, a hidden test hook) keeps nothing.
Every texture that still takes a shadow announces why (shadowed-texture) and is counted by cause:
- the policy;
- usage that renders or writes;
- check pending, failed or unchecked;
- refused: rows, detached, image, pitch, placement, the dma-buf source, other dma-buf reasons.
WorkCounts also counts the in-place textures by class and pitched images, and the check's runs and
verdicts.
How an image in place is made, used and visible:
- Pointer and fresh pages take a linear image made for host allocations at Metal's pitch, or a
DRM_FORMAT_MOD_LINEAR image at an explicit pitch over the host allocation where the driver makes
one. Dma-buf pages take the modifier image over a dma-buf of the texture's own pages.
- A rebind remakes these images like the others.
- A write or pass beyond the declared usage goes through the existing usage shadow and attachment
stand-in.
- A CPU write reaches the image's commands as it reaches the buffer's (Host Write Ordering
Guarantees).
RUNTIME_VERSION 1643 -> 1644. The runtime-sources pin is left for the landing.
Check duration, Apple M3 Max on MoltenVK 1.4.2:
- 75-78 ms in release: Pointer and Fresh passed; DmaBuf unchecked, as there are no dma-bufs on
macOS.
- 1.76 s in a debug build.
- The first version took 4.1-4.2 s in debug, almost all of it the 3840x2160 shape's per-byte
hashed fill (240 ms) and compare (461 ms) per round, times 3 rounds and 2 classes; the GPU move
itself took 0.15-3 ms.
- Nothing was dropped from the check. The 64x64/256 shape became 64x16/256, and packed shapes of
each texel size were added, because MoltenVK takes no padded pitch: the first version made only
4-byte images there.
Verified on the M3 Max (debug lanes, --cfg m2v_gpu):
- in_place_textures, all five tests:
- the path follows the check, and an event-held CPU write after the commit is read;
- a kernel write and a pass beyond the usage go through their shadows and keep the image;
- a forced failure keeps the shadow and no record; the next device runs the check, and the one
after recalls three verdicts and checks nothing;
- the costs.
- first_use_writes under both settings: 1920x1080/7680 in place, 0 of 542 writes undone.
- no_copy_textures read/write under both settings: ShaderRead-only textures in place at packed
rows, the rest shadows.
- pitched_surfaces, including the new _in_place variants of the only-reads and read-only-pages
tests.
- The runtime and translator suites passed (4971 tests), with clippy plain and under --cfg m2v_gpu.
Cost on the M3 Max, release, median GPU time per command buffer, in place against shadow:
- 3840x2160, one pass reading a 32-row strip: 492 against 553 us.
- 1920x1080 strip: 457 against 452 us.
- 1920x1080 whole: 393 against 466 us.
- 1920x1080, three whole passes: 566 against 545 us.
Untested here: RADV, lavapipe and the dma-buf class, which follow; ANV and NVIDIA have no venue
now.
* 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.
|