cdc09276f37fd37ec5c1223d1fe301ffe2640949
164
Commits
| Author | SHA1 | Message | Date | |
|---|---|---|---|---|
|
|
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.
|
||
|
|
3b48637d3c |
Name a render stage's module without hashing its words again
The steps this packet landed as, in order: - Re-pin the runtime sources at the landing tip Content: the tree of `development` at ae7ed9fa17, unchanged. |
||
|
|
586bf2ad59 |
State what a translated module contains on its stage
Content: the tree of `development` at c21116f557, unchanged. |
||
|
|
d12ea9bbe7 |
Name the merge's planned dispatches and examined words in the API guide
Content: the tree of `development` at 27935d575e, unchanged. |
||
|
|
201803fc48 |
Compile a kernel once for the stage-input attributes it never reads
The steps this packet landed as, in order: - Bless the surface and the API guide for the kernel's narrowed inputs - Re-pin the runtime sources at the landing tip Content: the tree of `development` at 3eefc94c48, unchanged. |
||
|
|
18bf703b5d |
Predict a compute region only where the request states its threadgroup
The steps this packet landed as, in order: - Bless the surface for the shared-queue counter and correct three doc claims Content: the tree of `development` at 087149c5b8, unchanged. |
||
|
|
ee51060c1c |
Declare the shader-cache write kind last, so no ALL index moves
Content: the tree of `development` at 1649811132, unchanged. |
||
|
|
fc63e360fa |
Count the render and the dispatch pipeline predictions apart
The steps this packet landed as, in order: - Write a creation's shader cache entries on the device's cache thread Content: the tree of `development` at 1ff199a2eb, unchanged. |
||
|
|
1395addb47 |
Say what Metal leaves where a plane's GPU rows share bytes, and guard the copy that had no rule
The steps this packet landed as, in order: - Name BGRA4Unorm's packed-16 attachment and its color input in the API guide Content: the tree of `development` at ebd18b3408, unchanged. |
||
|
|
2dd3557a98 |
Hold an IOSurface plane whose GPU rows overlap as a shadow
Content: the tree of `development` at 16ad1f5af6, unchanged. |
||
|
|
cfcb83b069 |
Say when a heap texture takes the shadowed-texture notice
Content: the tree of `development` at 24bfeec43c, unchanged. |
||
|
|
242d017175 |
Name in each degrade-notice entry the driver facts and formats its kind carries
Content: the tree of `development` at 4a9adf3b33, unchanged. |
||
|
|
25653b5b1b |
Hold a heap texture to the heap's base only where an image of it binds there
Content: the tree of `development` at bb29a64948, unchanged. |
||
|
|
88d1a345f2 |
Reconcile the six degrade notices whose catalogue entry and declaration disagreed
The steps this packet landed as, in order: - Hold docs/API.md's degrade-notice catalogue to the notices' declarations - Bound how far a refused IOSurface plane's rows overlap Content: the tree of `development` at 3e9ba52013, unchanged. |
||
|
|
fe18def47a |
Hold the optimized-layout notice's cost to what every reaching texture answers
Content: the tree of `development` at 3614348837, unchanged. |
||
|
|
8c47bba02b |
Compute Metal's fast-math blend of a 32-bit float attachment
Content: the tree of `development` at 2c0f3c643c, unchanged. |
||
|
|
405c644b82 |
Make the shareable padded 10-bit textures Metal makes in Private storage
Content: the tree of `development` at cfd94efd5c, unchanged. |
||
|
|
16d8b76467 |
Say what Error::Invalid holds, and measure the five rules only the layer justified
The steps this packet landed as, in order: - Give a render command for a buffer of dispatches beside draws, as Metal does Content: the tree of `development` at aec2582c90, unchanged. |
||
|
|
6c05931d19 |
Run a ragged dispatchThreads: as Metal's one dispatch where the kernel allows
The steps this packet landed as, in order: - Regenerate the refusal surface at the tip Content: the tree of `development` at 68529de026, unchanged. |
||
|
|
15635f527e |
Ask the lane for the refusals the runtime now answers on llvmpipe
The steps this packet landed as, in order: - Hold a heap texture's offset to Metal's alignment where its image lies apart - Read each pipeline's own loop notice, and Metal's own pitch for a turned plane - Take Metal's depth denormal as a zero where the device announces the loss - Expect the memory notice and allow a late calibration one on a discrete chip - Recompute the runtime-sources pin for the heap, derivation and lane wave Content: the tree of `development` at 3d3c01150f, unchanged. |
||
|
|
cb0ced8bdc |
Make the memoryless texture buffer plain Metal makes
The steps this packet landed as, in order: - Say in the notice what the footprint now is Content: the tree of `development` at c8cee22aa9, unchanged. |
||
|
|
f7d857ec55 |
Answer a heap's and a heap texture's footprint Metal's numbers
The steps this packet landed as, in order: - Say in the ledger that the ASTC heap size query answers - Make the holding rule a named function and hold it to a table Content: the tree of `development` at 74da346075, unchanged. |
||
|
|
7b4c57316a |
Answer Metal's canonical NaN at a narrow float's widening to float
The steps this packet landed as, in order: - Hold the fresh-pages test to the runtime's per-class rule - Re-derive the generated documents for the ledger edits Content: the tree of `development` at 2be69bf102, unchanged. |
||
|
|
1ab5ae7380 |
Move a 16-bit multisampled depth's samples by draws, as its codes
The steps this packet landed as, in order: - Say in the refusal surface what a 16-bit depth copy really waits on - Copy a multisampled 16-bit depth, which plain Metal copies exactly Content: the tree of `development` at 688b62deab, unchanged. |