9c1cd5500ffbe04c3b0a762bd2f06b64337cedb8
34
Commits
| Author | SHA1 | Message | Date | |
|---|---|---|---|---|
|
|
bc1a6ebf8b |
Encode a half's bits by the device's narrowing, not an integer sequence
A half value whose bits are not known from a load (a store, a reinterpretation, a texel's or snapshot's bits) is encoded by the device: with shaderFloat16 one OpFConvert to 16 bits (NoContraction under the float controls), each lane read as a word beside a 16-bit zero; without it GLSL.std.450 PackHalf2x16. The exact integer sequence (rebias, NaN quieting, the 2^24 denormal scaling, the 0x7C00 cap under native rounding) is deleted. narrow::encodes_bits finds the narrowing; compile.rs records the widening's notes for it: NativeNanEncoding everywhere, NativeHalfConversion where neither the float controls nor MetalHalfArithmetic cover it. Bits known from a load, folded constants, an integer's half and bfloat stay exact. bits_words 136 -> 48 per lane. Tests pinning the old NaN bits accept the device's where the note is recorded; 40 known-gaps rows the Apple M3 Max no longer diverges at are dropped (29 attribute-format-fetches half-NaN sites, 3 each of half-texel-nans-r16f/ -rg16f/-rgba16f, 2 of math-frexp-ilogb-half: Metal's own NaN bits now). SEMANTICS_VERSION 1919. Verified: 347 translator tests (lower::arith::tests, the touched engine modules, every public fixture on every committed profile), clippy plain and --cfg m2v_gpu, rustdoc; a sabotaged encode form fails the new a_half_encode_is_the_devices_narrowing_in_every_form; on the M3 Max: conformance replay of 28 half cases exit 0 (every divergence a held ledger row), validation runtime_lane half tests 7/7, runtime nan_signs/vertex conversion notices/degradation sites 4/4. golden_hashes.tsv cells move, re-blessed on development. Not run: lavapipe, the full validation and conformance sets. One work packet, landed as 1 commit on archive/development-linear-2026-10-29: 0d7093d826. |
||
|
|
0a1851164d |
Copy a no-copy buffer, heap or rebind whose import the caller's gate refuses or that fails, announced
A new HostMemory::with_import_gate(ImportGate) asks the caller once,
holding no lock of the runtime's, just before a no-copy buffer, a
no-copy heap or a buffer rebind imports its pages, passing an
ImportRequest with the pages the import would map. If the gate answers
false, or an import the device and the gate admitted then fails
(OutOfMemory, another Vulkan error), the object is made over a copy of
the pages instead of failing. The default stays import-first. The copy
is host-visible memory owned by the runtime; `contents` stays the
caller's pointer. Each commit copies in the bytes the CPU changed since
the last sync, and each batch's completion merges back the bytes the GPU
changed (CPU wins where both wrote), byte by byte, before events,
waiters and handlers see it. Every copy is announced
(`copied-host-pages`) and counted. Pages the process cannot read are
never copied (the first copy reads through the kernel:
process_vm_readv / mach_vm_read_overwrite). A copied heap's buffers lie
in the copy and its textures are shadows. A rebind's copy is laid out as
its import would be. A rebind over an in-place image is refused
(NotImplemented(RebindTextures)) and a heap's rebind still imports
without asking. A caller's DirtyPages log stays attached to the copy as
to an import. The in-place check's pointer class skips copied buffers.
Ports dev-perf's fff961b7e5, 630d1b0174, 33d7aa5e98 and 9b4d4190f5 onto
a smaller coherence design: every live copy is compared in full at each
commit and completion, instead of dev-perf's log-driven,
encoder-collected copies (dev-perf's copied.rs, 79301a2515 and its
fixes, sat on a page log development has replaced). Also brings
789fa3d294's unreadable-page rule, 5190983470's lane site, and
1c7d49f788's copied-buffer skip. A driver that refuses the pointer
still fails the call (dev-perf copied there too; not taken). Known gaps
in FAST-PATHS: the compare costs O(size) per commit and completion, a
byte both sides wrote keeps the CPU's value, and a shared event's value
can be seen before the merge (c5db2d1b8a not ported). RUNTIME_VERSION
1690. Runtime-sources pin recomputed.
Public API: ImportGate, ImportRequest { start, length }
(#[non_exhaustive]), HostMemory::with_import_gate,
Degradation::CopiedHostPages, Device::fail_next_host_imports (test
hook), and the WorkCounts fields host_imports_refused_by_host,
copied_host_buffers_{made,refused,degraded}, copied_copy_in_bytes,
copied_merge_back_bytes, copied_rebind_pages_made, copied_heaps_made.
Verified on the M3 Max (MoltenVK, m2v_gpu): 11 new device tests
(tests::copied_device: buffer, rebind and heap, gate refusal and failed
admitted import, unreadable pages, a heap texture round trip) and 167
tests in the touched device filters pass; the counters move as
expected ([1,1,1,0,0] for a refusal, [0,1,0,1,0] for a failed import)
and the announcement is heard; on a 64 KiB copy 4079 bytes copied in and
4080 merged back for a 4 KiB CPU write and a 4 KiB fill, checked
exactly. Sabotage: ignoring the gate and removing the merge fails the 3
buffer tests; ignoring the rebind gate fails both rebind tests (no heap
sabotage). 249 host tests pass. Workspace clippy plain and
--cfg m2v_gpu, and rustdoc, clean; clippy re-run clean on the landing
merge. Not run on Linux.
|
||
|
|
8c09b7c2c0 |
Link a warm render creation from its recorded stages, and key the shader cache by its translator
A warm render state creation spent most of its own time in Device::render_variant_key, decoding and specializing every Function stage's AIR to learn its stages' compile keys, because the directory's variant record named only the pipeline's key and a sweep stores no pipeline artifact where the directory holds its stages. The record (v2: new tag and magic) now also names the stages' function compile keys (VariantStages); a creation that finds the record but not the pipeline finds the functions by those keys alone (Sources::found_function: memo, archives, disk, no translation) and links them (RenderVariant::link), decoding nothing. Every creation writes its record. The keys are valid exactly as long as the pipeline key beside them. (Ports dev-perf f4d864d160; development's lookup has no warm-pass Prior/Found and no fit_render_variant, and the bench it extended is gone.) The shader cache's build directory was named by the runtime's version, both artifact versions, the translator's SOURCE_DIGEST and the runtime's own source digest (its build.rs over every file under src/, tests included), so any runtime edit started the cache cold. Every translated entry is the translator's answer for the inputs its key and profile hash, so the runtime's digest goes (with build.rs, its sha2 build-dependency and the validation fingerprint's reference to it). The translator's SOURCE_DIGEST stays, as its doc promises: an unbumped translator change still starts afresh. The runtime's own creation records (linked-use answers, reflection, variant record) are runtime logic, so their names now hash RUNTIME_VERSION with their tag and key (creation.rs record_name): a runtime change that bumps it reads none of an earlier runtime's records. (Ports the idea of dev-perf db5f5baa73, narrowed: no per-entry stamp, no other_build_hits, no public API change.) Not ported from the same area: dev-perf's pipeline-record hook and Device::warm from an earlier process's records (14df1fb5fe, 66fe0ada29; ~3,200 lines on per-entry stamps this packet does not take). Verified on the M3 Max (MoltenVK): 84 device tests of the shader cache, creation, render-stage, sibling-work, archive and pipeline areas pass; the guard a_second_device_links_a_recorded_sweep_with_no_stage_decoded fails with the recorded-stage link disabled ((decoded, translated) = (2, 0)) and passes with it; a_creation_record_of_another_runtime_version _is_not_found passes. Release render-pipeline-split, integer-vertex-attributes, one run: warm processes decode 2 stages before and 0 after; cold counts identical; wall within run-to-run spread on this case's small shaders. Clippy (plain and --cfg m2v_gpu) and rustdoc -D warnings clean; 43 + 241 plain runtime/translator tests pass. No version bumps. Runtime-sources pin recomputed. |
||
|
|
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.
|
||
|
|
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. |
||
|
|
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.
|
||
|
|
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.
|
||
|
|
a73af4db0b |
Keep one driver pipeline cache per record, named by what converts a stage
The steps this packet landed as, in order: - Read the records lane's files only once the device that wrote them is gone Content: the tree of `development` at fdf4232b79, 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. |
||
|
|
787d92fdc2 |
Answer a heap texture's allocatedSize from the place that holds it
The steps this packet landed as, in order: - Answer a kept heap texture requirement before asking the device's limits - Answer whether a command buffer or submission uses given objects, cloning nothing - List devices' registry IDs without making devices, and open one by its ID - Give a made pipeline state's reflection from its compile, after its creation - Enable optional device extensions where each device can, and say which it enabled - Let a caller vouch for its host pages' write permission, skipping the kernel's answer - Import read-only host pages from the caller's dma-buf source, and say whether a device takes shared pointers - Hold a texture of Apple's private usage 0x8 alone to what Metal does with it - Measure RADV 26.2.4 on the RX 7900 XTX: its pointer imports follow their address - Free a no-copy buffer's dma-buf imports before its keep-alive goes - Measure a file's pages mapped under a live RADV pointer import, a known gap - Let what waits for a dma-buf import's free go as its fields drop Content: the tree of `development` at 0a38130573, unchanged. |
||
|
|
b253a0ad98 |
Convert a two-plane YCbCr texture only where its planes changed since the last conversion
Content: the tree of `development` at b3c5e804ad, unchanged. |
||
|
|
e841dd6b4a |
Read the Radeon 780M of Hawk Point as the measured Phoenix 780M, with its own device profile
The Radeon 780M of Hawk Point (PCI device 0x1900) takes the driver facts measured on the Phoenix 780M (0x15bf), the same GPU, and gets its own committed device profile. Folds in: - Read the Radeon 780M of Hawk Point (0x1900) as the measured Phoenix 780M (0x15bf) Verified by each folded change's own checks; the tree this series ends on is the one verified at the tip on six GPUs, the CPU suites and lint (see the tables commit). |
||
|
|
b660f64e17 |
Copy equal rows between buffers as one dispatch on ANV and the RTX 5080 Laptop, and split long copy regions
A copy of rows between two buffers whose rows lie apart is one vkCmdCopyBuffer with a region per row, and ANV records each region as a blit operation of its own. In a guest frame's profile on the Iris Xe one such copy a frame took about 15.7 of the recorder thread's 19 ms. ANV's recording time for a single region also grows with the region's size at some sizes: one two-plane YCbCr texture's planes copied into its staging buffer cost about 15 ms of the recorder's time a frame. Row copies: - Every copy of rows between buffers goes through one place, row_copies.rs (RowCopies): a blit between a buffer and a texture over a buffer or between two textures over buffers (through its overlap scratch too), a buffer-texture copy's rows through its staging buffer, and every shadow's copy back out of its staging buffer, wherever it records: a render pass's steps between instances and before tile dispatches, a rotated texture's store, and a heap's two-plane and tiled textures' copies back. - RowCopies makes the copy one dispatch of the new translator kernel bind::rows_copy_module (RowsCopyModule) where the device is measured to run it faster (new DriverFact::RowCopiesDispatchFaster), the copy has 2 or more regions of the same size in whole 4-byte words, 4-byte aligned, evenly spaced with destination rows at least a row apart, and it fits the device's storage buffer range and workgroup counts. Invocation (x, y) stores word x of source row y at word x of destination row y and writes nothing else, so the bytes are the copy's. Every other copy stays regions. The kernel's set 0 is pushed through the device's checked push command where VK_KHR_push_descriptor exists, else allocated from a pool the command buffer keeps; the callers name the dispatch's accesses so the tracker orders it. - The fact holds on ANV (Mesa 26.2.4, keyed on the driver, so it covers the measured Iris Xe and UHD 770 identities) and on NVIDIA 615.71.09 on the RTX 5080 Laptop GPU. RADV is not listed: its GPU time rose 3 to 5% at 1080 rows. Long copy regions: every vkCmdCopyBuffer the runtime records goes through Vk::cmd_copy_buffer, which records each region over 16 KiB whose size is no multiple of 4 KiB as two regions of the same command, its bytes up to the last whole multiple of 4 KiB and the rest. The same bytes are copied by the same command, so the split is exact on every device and is not keyed to a driver; five helpers that recorded copies through a bare ash::Device now take the device's functions. Counters: WorkCounts::row_copies, row_copy_regions, row_copy_regions_most, row_copies_dispatched, copy_regions_split, and copy_sites, which names the places in the runtime that recorded buffer and image copies with their calls and regions (the device's checked functions record them through #[track_caller] methods). The runtime re-exports CopySite. Docs: docs/HOWTO.md's copies section, row_copies.rs, device/functions.rs, WorkCounts. Verified, as the commits state: - runtime_lane::row_copies::row_copies_cost (release, one blit a frame of 1920 BGRA8Unorm rows into rows 8192 bytes apart): 1080 rows on the Iris Xe CPU 3.1-3.3 -> 0.28-0.40 ms and GPU 5.3-7.8 -> 1.13 ms; on the UHD 770 CPU 0.77-0.83 -> 0.04-0.11 ms and GPU 3.3-5.3 -> 0.59-0.91 ms; on the RTX 5080 Laptop GPU 2.03-2.05 -> 0.42-0.43 ms. - rotated_textures::rotated_surface_frame_costs (1920x1080 BGRA8Unorm, release, UHD 770): rotation 1 clear+draw 4.41/4.43 ms against 7.24-8.24 ms, rotation 2 3.59-3.88 against 5.11-5.73 ms. - span_copy_cost on the UHD 770: one region of 8,294,411 bytes recorded in 0.018-0.020 ms against 28.4-35.1 ms, its GPU time 0.64-0.66 against 5.97-5.99 ms; the YCbCr frame 2.89-2.98 against 6.80 ms of GPU. On RADV and NVIDIA the split recorded in the same CPU time and ran within about 10 us of GPU time where one region was already quick, and faster where it was not (8,294,411 bytes on the RTX 3090: 1520 against 6051-6061 us). - Copy lanes with every byte checked under the validation layer (rows between buffers, a shadow's staged rows going back as one dispatch, blits of textures over buffers, textures over bytes past their VkBuffer) pass as dispatches on the UHD 770 and the RTX 5080 Laptop GPU and as regions on lavapipe; the rotated, tile-shadow, two-plane heap and heap-layout lanes pass on the UHD 770 with each rotated store's rows going back as a dispatched copy of rows. long_copies_of_any_size_copy_metals_bytes (prime sizes and offsets) passes on the UHD 770, the RX 7900 XTX, the 780M and the RTX 3090, and the YCbCr, blit, pitched-surface, no-copy, first-use, fill and frame-cost lanes pass on the UHD 770. - tests::exit_guard::only_the_listed_modules_keep_the_device_s_functions (the push goes through the checked functions), bind::rows_copy, the driver_facts tests, owned_divisions, api_surface, and the runtime unit tests named row_copies, work_counts, functions, copy, shadow, first_move and ycbcr; clippy in every configuration and Rustdoc. |
||
|
|
e35bf78bd5 |
Shadow every padded texture over a buffer and every texture over host pages, keeping CPU writes
A texture over a buffer could be an image bound to the buffer's bytes: a padded texture that only read (PaddedReadsPolicy::Alias, the default), and any 2D texture over a no-copy buffer's host pages (a linear image, a DRM_FORMAT_MOD_LINEAR image at Metal's row pitch, or on MoltenVK a Metal texture over the import's MTLBuffer). An image bound to imported memory starts UNDEFINED, and a layout transition "may perform read and write accesses on all memory bound to the image subresource range", so such an image kept Metal's bytes across its first move only through a host keep (read the bytes, submit the move alone, wait, write back what changed), which undid a CPU write made inside that window. Metal keeps every CPU write to bytes a command buffer does not write: on the M3 Max, a kernel reading half a padded no-copy texture while the CPU rewrote the bytes between its rows and its other rows kept every CPU byte in 10 of 10 rounds. Changing bytes in memory is not a precision note, so under the owner's rules it may be neither a default nor a switch; exact is the default, and cost chooses only among exact forms. Now a padded texture over a buffer, and every 2D texture (or array) over a no-copy buffer's host pages, imported by pointer or as dma-bufs, is a shadow on every device, whatever its usage: an optimal image of the runtime's memory, copied in from the bytes before a use and merged back after a write. Texture::vk_image answers None for such a texture. Removed: - DevicePolicy::padded_reads and the enum PaddedReadsPolicy (Alias, Shadow); its FAST-PATHS row, its tests::fast_paths choice and its api_surface row. - The images over host pages: the linear image for host allocations, the DRM_FORMAT_MOD_LINEAR image over host allocations with its refusal memo, the modifier image over a buffer texture's own dma-buf, the Metal texture over the import's MTLBuffer on MoltenVK (VK_EXT_metal_objects is no longer enabled for it), and the one image shared by textures of one plan over one import. - The first move's host keep, and its notice unrestored-first-move-bytes (Degradation UnrestoredFirstMoveBytes), retired. - WorkCounts fields first_move_keeps, first_move_kept_bytes, first_move_restored_bytes, pitched_host_images, pitched_host_image_refusals, pitched_host_image_refusals_recalled, shared_alias_images and shared_alias_moves_waited. Kept: the buffer's dma-buf import as the last resort where the pointer is refused, on any device; the images of heap textures over host pages, including over dma-bufs (a heap resource's contents are undefined until written, in Metal too); a linear image over a buffer of the runtime's own memory (PREINITIALIZED), whose first move FAST-PATHS records as a one-line known gap. ShadowedTexture (shadowed-texture) now also covers read-only padded textures. Also: a staged shadow's copy back merges rows that lie one after another into one region (a packed 1080p surface takes one region, not 1080), and two new counters size what a shadow kept across a command buffer's passes could save: WorkCounts::shadow_attachment_passes and shadow_attachment_textures. Docs: docs/FAST-PATHS.md (the shadow bullet with its costs, the known gaps), docs/API.md (section 1's texture paragraph, the shadowed-texture and dont-care-stand-in entries, the retired code), docs/HOWTO.md section 6, the runtime README, linear_attachment.rs's module doc. Cost, as measured: on the Iris Xe a frame sampling four BGRA8Unorm tiles over no-copy pages took 3.2-5.3 ms as shadows against 3.0-6.1 ms as images (textures made once) and 3.4-7.1 against 4.6-8.6 ms (made each frame). On the UHD 770 (ANV, release, alternated), one Load/Store pass into the guest's 1080p surface took 1.89-1.97 ms as a shadow against 2.56-3.09 ms as the linear alias, whose draws ran slowly in host memory; 12 passes 20.9-21.1 ms against 27.4-27.8 ms, at about 40 us more CPU a pass. Verified, as the commits state: - runtime_lane::first_use_writes (new: another thread writes bytes of a texture over host pages that its first use does not read, from 2 ms before to 2 ms after the commit; every write stays) passes on the RTX 3090, the Radeon 780M and the UHD 770. - runtime_lane::pitched_surfaces asserts a shadow for every surface (counted, vk_image None), including the CPU write beside a padded texture during its first use and the new counters; no_copy_textures asserts a shadow and no modifier queries; the keep, pitch-refusal and shared-image tests go with what they tested. - The lanes restated for the shadows pass whole: dma_buf_imports 13, resource_ids 38, rotated_textures 7 and linear_attachments 20 on the RX 7900 XTX and the 780M (RADV), the UHD 770 (ANV, with row_copies 2) and the RTX 3090. - linear_attachments renders over a Shared buffer of the runtime's memory, so the linear attachment paths stay covered, each test asserting the way its passes took; 21 pass on the RTX 3090, the 780M, the RX 7900 XTX and the UHD 770. - Runtime and validation nextest without a device, 2306 passed; the translator's fast_paths, api_surface, published_crates, refusal and driver_facts tests, 34 passed; clippy in every configuration and Rustdoc -D warnings. |
||
|
|
7db879f242 |
Release idle pointer imports on RADV 26.2.4, and say which RADV host stack loses GPU writes
On the Radeon 780M with RADV (Mesa 26.2.4), idle pointer imports are released where they follow their address, as on the other measured drivers; docs/HOWTO.md says which RADV host stack loses GPU writes under memory churn. Folds in: - Release idle pointer imports on RADV 26.2.4 on the Radeon 780M, where they follow their address - Say which RADV host stack loses GPU writes under memory churn Verified by each folded change's own checks; the tree this series ends on is the one verified at the tip on six GPUs, the CPU suites and lint (see the tables commit). |
||
|
|
3bb4722d9f |
Release idle pointer imports where they follow their address, keep deallocator timing Metal's across rebinds and detaches, and cut host-import work
No-copy buffers and host imports now cost the kernel and the encoding thread less, and their deallocators run in the call Metal runs them in, including when a detach races a commit. What changes: - Idle pointer imports. A no-copy buffer's own pointer import is releasable, as its dma-buf import was: while only blits read it and no pending command buffer holds it, the residency thread releases it after its idle window (2 s, doubling at each import again up to 64 s), and the next blit imports it again at the same pointer. Only where the new measured fact DriverFact::PointerImportsFollowTheirAddress holds (ANV 26.2.4 on the Iris Xe; lavapipe 26.0.8 to 26.2.4): there a pointer import reads the pages mapped at its address at each submission, so an import again reads what the kept one would. A refused re-import fails the blit's call, typed. - Deallocator timing. A released import hands its keep-alive and deallocators to the objects a command buffer still holds, so they run as that memory is freed (or parked and announced, as a kept import's). A committed but unsubmitted command buffer holds a blit's import objects weakly, so a rebind or detach before its first submission runs the deallocator in its call, as Metal does. A detach racing a commit on another thread runs the deallocator in one of the two calls: a let-go mark on the pages and the commit's hold count, both sequentially consistent, make each side see the other, and a commit that sees the mark replays its own command buffer at once. The live list re-reads a buffer's pages where a detach moved them meanwhile. HostDeallocatorDelayed is no longer announced for these races. - Fewer kernel queries. A no-copy buffer asks the kernel about its mappings (PROCMAP_QUERY) only where it makes its own import; a rebind onto a live buffer's bytes lies in that buffer's import and asks nothing; /proc/self/maps stays open for the queries (reopened in a forked process). Three blit paths that read the caller's buffer as a read apart now read it as blits, so their imports stay releasable. - Fewer rewrites and lookups. A rebind or detach rewrites only the heap slots of textures over the bytes it moved; host-page alias lookups visit only the length classes that hold ranges and keep each range's overlapping ranges; a binding and a descriptor each read where a no-copy buffer lies once. - Counters (WorkCounts): host_imports_used and host_imports_read_apart (with its six reasons), host_imports_kept_for_fds and kept imports by cause (of_heap, rebound, pointer, no_stand_in), heap_slots_rewritten, host_mappings_queried (Linux; 0 elsewhere), host_range_lookups, host_remaps_reported, host_remaps_over_imports, host_imports_remapped, host_pointer_imports_made and _bytes_made, no_copy_lies_read, host_imports_rebound_unlisted, host_rebind_imports_made and _covered. - Docs: docs/HOWTO.md on both kinds of release, the RLIMIT_NOFILE soft limit a program raises itself and the new gauges; a FAST-PATHS known gap that a buffer made before a remap reads the new pages on drivers whose pointer imports follow their address, where Metal keeps the old ones (HostMemory::new's contract forbids such a remap); the rustdoc of host_range_remapped. Why: ANV over i915 lists every VkDeviceMemory in every execbuffer, and a pointer import costs about 0.19 us an execbuffer; the consumer's guest keeps hundreds of no-copy buffers live and uses few in a frame. Its swap thread spent 1.54 ms of kernel time a frame querying mappings of a buffer that joined a live import. And a released import's deallocator unmapped pages under a live userptr, losing the device. Verified: - Iris Xe, a guest-shaped lane of 520 pointer imports and 43 command buffers a frame, the idle ones released: objects per execbuffer 536 -> 51, ioctl 4.24-4.31 -> 0.85-1.09 ms a frame, scheduler CPU 4.96-5.05 -> 1.33-1.74 ms a frame, frame p50 5.27-5.43 -> 2.70-3.11 ms. - The fact, probed outside the runtime on the Iris Xe and through tests::pointer_residency on it and lavapipe: a kept import read the pages a remap put at its address. - The detach race on the Iris Xe and RTX 5080 under the validation layer: without the fix 3 of 3 runs failed (deallocators late or on another thread); with it 12 of 12 runs, 15,360 races, each deallocator in the detach or the commit, never late. - A second no-copy buffer over 2040 scattered mappings: 415-418 us -> 0.3-0.6 us. A rebind with 1024 other live textures: 4766 -> 49 us. Alias lookups: a draw -5.3% instructions on host-page frames (RX 7900 XTX). - Device and unit tests: freed_memory, pointer_residency, host_residency, blit_holds, encoder_holds, host_import_counts, host_aliases (up to 45 passed per run); lanes rebinds, rebind_reach, detach, detach_textures, host_memory, no_copy_heaps, dma_buf_imports, draw_work (74 passed on lavapipe, 30 on the Iris Xe for the deallocator fixes). clippy -D warnings (plain, m2v_gpu, m2v_cpu_icd) and rustdoc. |
||
|
|
d485925af2 |
Keep the commit path off the GPU's wake and the scheduler's lock: cached uploads, timestamps at completion, primaries begun ahead
A command buffer's encoding, commit and property reads now make no call that waits for a powered-down GPU or for the scheduler's submission, as Metal's return at once. What changes: - Upload arenas (argument, handle and root tables, constant blobs, neutral buffers, status words) take host-cached, host-coherent system memory (MemoryClass::Shared) instead of write-combined memory, which preferred device-local memory on a discrete GPU. Unified-memory devices are unchanged; a device with no host-cached coherent memory keeps its device-local type. No flush is needed: Vulkan defines coherent memory as needing none, and a submission orders the host's earlier writes. New WorkCounts::upload_chunks_in_device_memory. - The calibration pair that places GPU times on the host clock (vkGetCalibratedTimestampsKHR) is read by the completion turn, not at commit. The placement and its pair cache are unchanged; UncalibratedGpuTimes now says the calibration failed as the command buffer completed. - A completed command buffer's settled spare pool begins one primary ahead on the completing thread, with the spares' lock released and only where no thread waits on the command buffer's gate, so the next command buffer's first encoder records into it instead of beginning one. The pool passes between threads under the spares' lock, which is all vkBeginCommandBuffer's external synchronization asks. WorkCounts primaries_begun_ahead and encoder_primaries_begun_ahead. - A timed command buffer's timestamp slot is reset on the host (vkResetQueryPool, a Vulkan 1.2 required feature the runtime enables) as it takes the slot, so no command buffer the GPU runs resets a query; an adopted device keeps the command resets. WorkCounts timestamp_slots_reset_on_host. - kernelStartTime and kernelEndTime are two atomics beside the command buffer's state, and status and error an atomic and a once-set error published at each transition, so a read waits for no replay or submission and a commit takes no new lock. An Error status always finds its error. - WorkCounts counts the command buffers begun by what they were begun for (encoders, segments, continuations, secondaries, batch work and barriers, kept barriers, internal), printed by frame_costs. - docs/HOWTO.md notes NVIDIA's runtime D3 wake (about 1 s after about 15 s idle) and how a host that wants none keeps the GPU powered; never required. Why: on an RTX 5080 laptop GPU in runtime D3, the first write into device-local host-visible memory after 20 s idle waited 977 ms for the wake, and so did the commit's timestamp read (a commit took 973-977 ms; Metal's returns at once). On ANV a begin clears the command state, 8 to 20 us each, 0.80 ms of the Iris guest's 17 ms frame. And the scheduler holds the state lock through a batch's replay and submission, so a status or kernel-time read waited 60-65 ms behind 131,072 fills. Verified: - RX 7900 XTX, release A/B: encoding-thread CPU 5.27 -> 4.79 ms a frame with cached uploads, the vertex-heavy GPU time unchanged (28.18 -> 28.19 ms); draws_setting_bytes_write_no_device_local_memory fails without the change on the XTX, RTX 3090 and RTX 5080. - RTX 5080 laptop: a frame's commit after 20 s idle 973-977 ms -> 0.02-0.03 ms; the wake is now in the wait, as Metal's commit-and-wait shows it. gpu_times and degrade_notices 27 passed on it and on lavapipe. Host-reset slots saved about 1-2 us of GPU time a command buffer there; neutral on the Iris Xe. - Iris Xe: encoding-thread CPU 4.96 -> 4.62 ms a frame and a pass open 5.71 -> 2.77 us with primaries begun ahead; 95.85 of 97 encoders a frame took one. - runtime_lane::property_reads on the RX 7900 XTX and Radeon 780M fails without the change (reads of 60.3-65.1 ms) and passes with it (longest read 0.022-0.097 ms); on the M3 Max under MoltenVK it passed with 0 slow reads and the commit allocation bound held at 4.00. A new test checks status reads Completed in the completed handler, after the wait and in a deallocator. - Unit tests: spares, gate, exit_guard, gpu_time, completion, command_buffer (up to 218 passed per run); clippy -D warnings (plain, m2v_gpu, m2v_cpu_icd) and rustdoc. |
||
|
|
6b322fb50f |
Cut the cold making of half-heavy shaders on ANV and RADV: controlled half rounding and the device's half widening
On Intel's ANV, CoreAnimation's A2Xghfc fragment shader (313k words) took
about 14 s to make cold, for each of three states. The consumer's x86 macOS
guest stalled with "no completion in 10 s" on its first boot. Native Metal
makes it in 0.48-0.56 s on the M3. brw (Mesa's Intel backend) spends that
time in its register allocator. Its interference build is quadratic in
instruction count, it spills, and it retries several scheduling modes. Most
of its input was our half arithmetic. Two cuts, each the cheaper form, are
taken on ANV and RADV.
1. A half result computed in float rounds through the device's conversion
pair under the float controls (QuantizeForm::Controlled). It replaces
OpQuantizeToF16 plus a denormal arm, about 11 NIR operations per lane.
- The form: an OpFConvert to 16 bits and back, each decorated
NoContraction, in an entry that declares RoundingModeRTE,
DenormPreserve and SignedZeroInfNanPreserve for 16 bits, plus the
modes the device's independence ties to them (ANV: RTE for 32 and 64
bits; RADV: RTE and DenormPreserve for 64 bits). The modes are
declared post-lowering (new ExecMode kinds), and the requirements
carry the FloatControl properties.
- Exact by the Vulkan spec under either HalfRoundingPolicy: conversions
are correctly rounded, and NoContraction forbids folding the pair. No
fact, no note.
- A new DriverWorkaround, HalfConversionPairFolded, keyed on NVIDIA's
proprietary driver, keeps NVIDIA on its previous forms. NVIDIA
615.71.09 on the RTX 3090 folds the pair even under NoContraction and
every mode combination, and the PackHalf2x16 and u16-bitcast forms
fold the same way: 2,231,288,832 of 2^32 narrowings unrounded. A
plain-Vulkan repro gives 16,775,680 of 2^24 unrounded on the 3090 and
0 on ANV.
2. A half read from its bits (a load, a reinterpretation, a texel's bits) is
the device's widening under NanMinMaxPolicy::Native, the default: each
u32 lane is bitcast to f16x2 and converted to 32 bits, in place of a
12-op integer decode. A half texel takes that conversion's NaN (no keep).
- Every non-NaN half is exact by the spec: DenormPreserve covers
"values obtained via unpacking an integer into a vector of values
with smaller bit width".
- A NaN's bits are the device's, recorded as NativeNanEncoding
(native-nan-encoding), now also announced on ANV and RADV pipelines
that decode halves. A half stored back unchanged keeps its bits.
- NanMinMaxPolicy::Exact keeps the integer decode and the keep. There,
every half widened to float answers Metal's 0x7fc00000 for a NaN, as
the M3 does over every pattern from memory, constant memory, selects
and texels.
Where brw's time went, measured on A2X (a2x-s96): after cut 1, 49.6k NIR
operations, of which the rounding pairs were about 10.7k, half decodes from
memory 8.6k and texel NaN keeps 2.6k. The rest was below 5% each.
Exactness probes:
- Cut 1 (candidate half(x) over all 2^32 f32, and half + - * over every
pair): 0 non-NaN mismatches on ANV Iris Xe (Mesa 26.2.4), RADV 780M
(Mesa 26.2.4), and the 780M and RX 7900 XTX (Mesa 26.0.8).
- Cut 2 (every half pattern): 0 non-NaN differences on ANV and RADV.
- The M3 confirms Metal equals the integer reference everywhere.
Cold making (A2X, base against each cut):
- ANV Iris Xe: 13.6-14.3 s, then 5.75-6.16 s, then 4.06-4.36 s. Peak RSS
1.28 GB, then 0.50, then 0.35. GPU time per draw 4.62 -> 4.48 ms.
- RADV 780M: 0.80-0.84 s, then 0.53-0.55 s, then 0.38-0.47 s. GPU time per
draw 4.05 -> 3.43 ms after cut 1, then within its clock states' spread.
In the consumer's cold boots on ms01 (Iris Xe), A2X went from 14 s per
state, plus two 38 s remakes, to 4.0-4.3 s. The suite's pipeline making went
from 126 s to 16.7 s, with no stall. Repeat boots show metalwin unaffected:
its frame rate follows other GPU work at session start, not this change.
Tests:
- engine_native_half: the controlled conversion, and a half read from memory
under both NaN settings, NaNs stored back.
- device::tests::profile::nvidia_carries_the_folded_half_conversion_pair.
- lower::arith::tests: narrow, round_texel, half_texel, texel_round.
- spirv::requirements; spirv::builder::ops.
- Updated expectations: engine_arith half rounding, engine_spirv_cross_forms
fma, engine_metal_routines frexp (the device's NaN under the default,
Metal's under Exact).
- The validation lanes driver_deviations and native_maths expect the
controlled form.
Docs: the FAST-PATHS half-rounding row (scope) and a new row for the
widening; the NativeHalfConversion and NativeNanEncoding entries in API.md and
their rustdoc; HalfRoundingPolicy and NanMinMaxPolicy rustdoc; HOWTO's driver
note; REFUSALS regenerated. A known gap is added to the texel-NaN row: on
ANV a 16-bit float NaN texel kept as half reads back 0xFE00 from ANV's image
decode, even under Exact (announced as device-nan-encoding). SEMANTICS_VERSION
1759, runtime pin recomputed, RUNTIME_VERSION unchanged.
Tables: the golden hashes, 274-389 cells on each ANV and RADV column across
both cuts, and NVIDIA's profile fingerprints, whose words are unchanged. The
authored compile census: artifact hashes on the 780M and RPL-P ANV columns,
with no status change. No MoltenVK, lavapipe or floor cell moves.
Verified on development-fast (batches f18-f24): every lane green on the RTX
3090, ANV Iris Xe, RX 7900 XTX, both 780Ms, lavapipe and the M3 Max, plus the
CPU suites, case qualification, clippy in every configuration, docs and
packaging. Not run on the RTX 5080 Laptop (host offline; whether its driver
keeps the pair is unmeasured).
|
||
|
|
0175289314 |
Batch the development-fast round: tessellation without tessellationShader, primitive ids, mesh tooling, color groups, the vk12 floor, runtime timing and teardown fixes
One commit of the 247 on development-fast (720ef1ce9a..9f46fdf80d), squashed at the user's request. Translator: - Tessellation on a device without tessellationShader: Metal's tessellator emitted as SPIR-V, a one-workgroup scan placing each patch's triangles in Metal's order, and the post-tessellation function as a plain vertex stage (EmulatedTessellationDraws; SEMANTICS 1739, ARTIFACT_FORMAT 419). - [[primitive_id]] on a device without geometry or tessellation shaders, as a flat varying the vertex function writes; indexed lists, lines and points drawn de-indexed (RuntimeGap::PrimitiveIdIndices). - Fragment functions of more colors than the device draws at once, compiled in color groups (PrecisionNote::ColorAttachmentGroups). - Object functions' threadgroup memory from the render encoder; a kernel's mesh draws from an indirect command buffer; mesh payload sizing. - The Vulkan 1.2 floor profile (vk12-floor) and the gates it needs; Metal 27.0.1 answers as the M3 Max. - Overflow tests in the runtime-built modules by the product's high word (NVIDIA's compiler fails the division form), guarded crate-wide by tests::owned_divisions. Runtime: - Color-group passes replayed per group over twin depth/stencil; snapshot and copy-back cost cuts. - Command buffers finish on the queue waiter that saw them; the waiter holds no device handle, so a program's drop after its wait is the device's last. - Every object an encoder was handed held until its command buffer completes; deallocator order and announcements. - Driver defects recorded and announced: ANV counts a visibility sample once per color output (visibility-count-per-color); MoltenVK fails pending work when memory that held a device-address buffer is freed, so freed memory waits for the work in flight (host-deallocator-delayed). - RenderCommandEncoder::set_object_threadgroup_memory_length; Visibility::counting(). Validation: mesh tooling (object, mesh and ICB-mesh cases on both executors), the authoring census closed, the queue storm judged in Metal's unit, load-robust exits and indirect-census bounds, and the golden hashes, printouts, fixture inventory and authored compile census blessed. Docs: FAST-PATHS.md trimmed to a ledger of what is true now; API.md's catalogue and accepted differences, REFUSALS.md and METAL-COVERAGE.md current. Verified on development-fast before the squash: the full suites on the RTX 5080, RTX 3090, RX 7900 XTX, Radeon 780M, Iris Xe, lavapipe and the M3 (MoltenVK and the Metal oracle), lint in every configuration, rustdoc, doc tests, packaging and public case qualification; the timing and teardown lanes x5 on every venue; the authoring-capability census 16656/16656 with 0 unresolved, the vk12-floor translation census at 6139 translated with the slowest row 794 ms and peak 126 MiB. The tree is development-fast's at 9f46fdf80d. |
||
|
|
dd5a19aea1 |
Alias a padded texture that only reads by default, the shadow behind PaddedReadsPolicy::Shadow
The padded-reads work packet (the owner's choice): a padded texture that is only read aliases the
buffer by default, under the same documented first-move gap as tight aliases, checked per driver;
the exact shadow stays behind PaddedReadsPolicy::Shadow, which exact_answers() selects.
What: a 2D texture (or array) over a buffer whose rows or slices lie with bytes between them, and
whose usage as Metal reports it holds no RenderTarget, ShaderWrite, ShaderAtomic or block writes
(Unknown reads as 0x17, so it stays a shadow; a swizzled texture reports ShaderRead |
PixelFormatView and reads), is now an image over the buffer's bytes at Metal's row pitch, as a
texture of packed rows is: the device's own linear image (PREINITIALIZED over ordinary memory, for
host allocations over a no-copy buffer), a DRM_FORMAT_MOD_LINEAR image at that pitch, or one over
a dma-buf of the pages. Its subresources may hold the bytes between its rows and its last row's
padding (to row_pitch x rows); a driver whose image reaches past that is refused as for packed rows
(lavapipe's height rounded up to 4). A render target or a texture a shader writes stays a shadow.
The rebind remakes the image under the same rule (AliasKind::Linear keeps it).
The switch: DevicePolicy.padded_reads, PaddedReadsPolicy::{Alias (default), Shadow};
DevicePolicy::exact_answers() selects Shadow, the runtime's shadow copied in before each use. It
is the runtime's alone: no ProfileFields carries it, so no profile fingerprint moves
(tests::fast_paths::the_runtime_s_padded_reads_choice_keys_no_profile) and SEMANTICS_VERSION
stays. The owner's ruling (relayed by reims-vgpu-orchestrator, 2026-10-14 15:55): "I'll take 1 &
2", (2) being this, "exact to the same standard as tight aliases", under 30c8b4bff8's first-move
known gap extended to the padding bytes, checked by the same per-driver lane check.
Why it is the same standard: the first move is the only layout transition a runtime image takes.
- Every image memory barrier the runtime records is a first move (texture/first_move.rs
FirstMove::barrier), a new image's own (storage_form.rs, host_copy.rs; never an alias), or a
caller-wrapped image's Transition (submit.rs via texture/wrapped.rs).
- The tracker's barriers are VkMemoryBarriers (tracker.rs Barrier::record), which transition no
layout.
- Blits into a texture copy in GENERAL: blit_texture.rs's vkCmdCopyBufferToImage and
vkCmdCopyImage. VUID-vkCmdCopyBufferToImage-dstImageLayout-01396 and
VUID-vkCmdCopyImage-dstImageLayout-01395 allow GENERAL; GENERAL "supports all types of device
access".
- "Each source region specified by pRegions is copied from the source buffer to the destination
region of the destination image". The Memory Model: "A memory operation must not affect memory
at a memory location not within its set of memory locations".
- Every descriptor names GENERAL (binding.rs, heap_sets.rs).
- A texture over a buffer has one level (linear_plan's MipmapLevelCount), so generate_mipmaps
leaves it, and optimize_contents_for_gpu_access records nothing.
- A texture without RenderTarget usage has no COLOR_ATTACHMENT usage. A pass renders it through a
stand-in, copied in GENERAL, so no load or store operation reaches its image.
How:
- linear_plan's padding() becomes holding(layout, usage, policy) -> Result<Holds, String>, with
Holds::{Texels, Padding}, Holds::fits (texels_alone, or the new padded_alone) and only_reads.
- aliases() takes the Holds. So do alias_image, dma_buf_alias_image (DmaBufTexels.alone),
host_alias_unbound, host_pitched_image, and the pointer and dma-buf rebinds.
- storage_over_buffer decides it once, from texture_usage (the effective usage), so the shadow's
reason no longer reads the raw descriptor's RenderTarget bit. The reason of a read-only texture
shadowed under the switch names PaddedReadsPolicy::Shadow.
- RUNTIME_VERSION 1211 (renumbered at compose); the runtime-sources pin is recomputed at this tree.
Docs:
- FAST-PATHS.md: a fast-defaults row (padded_reads = PaddedReadsPolicy::Alias/Shadow, ANV's 0.63
ms copy in per tile use and 135 vs 41 us making).
- FAST-PATHS.md: the padded-row shadow row now covers textures that render or that a shader
writes.
- FAST-PATHS.md: the first-move gap row now covers the bytes between rows, with the GENERAL anchors
in prose and the M3 Max probe's point (Metal never writes padding, even under concurrent CPU
writes).
- API.md's shadowed-texture entry, ShadowedTexture's rustdoc, HOWTO.md, interop.rs and dma_buf.rs.
- The refusal surface is unchanged (refusal_surface.py --check).
Verified so far:
- clippy -D warnings, all targets, all features, --cfg m2v_cpu_icd: clean (um780, Rust 1.98.1).
- cargo fmt --check: clean.
The unit and lane runs follow with the lane checks' commit.
Check per driver that a padded texture that only reads keeps every byte of its pages:
What: three lane tests in runtime_lane::pitched_surfaces, under PaddedReadsPolicy::Alias (the lane's
own devices take exact_answers, so Shadow), each over no-copy buffers of anonymous pages:
- a_texture_that_only_reads_keeps_every_byte_of_its_pages: a ShaderRead texture over each of the
11 layouts. Its first use is a fragment function's read through its image, before anything else
touches the pages: it must read the pages' texels, and every byte of the pages, the bytes between
the rows among them, must be unchanged. That is the image's first move, the known gap
|
||
|
|
30c8b4bff8 |
Shadow a padded texture over a buffer exactly, and cut the shadow's cost
The padded-texture work packet. A texture over a buffer whose image would hold bytes that are not its texels is drawn through a shadow image with exact copies, since a render pass or a layout transition may write those bytes. Then the shadow's cost is cut, exactly: no copies for a pass that reaches no tile, a copy back bounded by the draws' scissors, and cost lines that show each part. Shadow a texture over a buffer whose image would hold bytes that are not its texels: A texture over a buffer is a linear (or DRM_FORMAT_MOD_LINEAR) image over the buffer's bytes only where every byte of the image's subresources is one of its texels: its rows lie one after another (or it has one), its slices likewise, and its last subresource ends at its texels' last byte or before. Anything else is the shadow, whose copies address the buffer's texels alone. The Metal texture over an MTLBuffer (MoltenVK) is exempt: every write through it is Metal's own. Why: Vulkan lets a render pass's load and store operations "read and write back any memory locations within the image subresource bound for that attachment" (renderpass.adoc, Load and Store Operations), and VkSubresourceLayout's size "includes any extra memory that is required based on rowPitch", so the bytes between padded rows lie inside the subresource. Metal leaves them as the program writes them. No query promises otherwise, so no image may alias padded rows. Bytes past every subresource stay allowed: Memory Aliasing bounds the bytes a write through an image affects to "those overlapped by the image subresources that were written". Measured on lavapipe (Mesa 26.2.4 llvmpipe, gem10) at the round's base: pitched_surfaces' 657x128/5312 RGBA16Float tile took lavapipe's own linear image (its pitch 660 texels rounded to 64 bytes is the lane's 5312), and a clear-blend-store pass rewrote 13 padding bytes in 13 rows (row 3 byte 5265 0x7c -> 0x7e: texels 657..659 of its 4-texel blocks read and written back, signaling NaNs quieted). The reliance predates |
||
|
|
0307fb8c9d |
Run every Linux CI step in the gate's container, and fix what the gate caught
The Linux gate's work packet: CI's Linux steps now run in the gate's own container, and the failures that run found are fixed: depth and stencil formats over a DRM_FORMAT_MOD_LINEAR image, test IR that LLVM 21 rejects, and a frame-cost check that allocated. Run every Linux step of ci.yml in the Linux gate's container: What: scripts/linux-gate-ci gains the three steps ci.yml's Linux job runs and it did not: "Clippy under each feature alone" (metal2vulkan with no feature and with serde, ash and cli each alone; metal2vulkan-runtime; metal2vulkan-air with no feature and with serde), "Build the new API's consumer reference" (scripts/api-docs) and "Package the published crates". Its "Test metal2vulkan" step now tests the packages ci.yml's does (metal2vulkan, -air, -runtime and -devtools), where it tested metal2vulkan alone. The steps run in ci.yml's order, each with the container's build share. Why: the script's header says every Linux run: step of ci.yml has one step here, and docs/VALIDATION.md presents the container as ci.yml's Linux job; a change that broke only a feature-alone build, the reference, packaging, or the AIR front end's, runtime's or dev tools' tests passed the container and failed CI. Verified: bash -n; the steps compared one by one with ci.yml at |
||
|
|
1cf79a9617 |
Make textures over surface buffers cheaper, laid at Metal's row pitch where drivers allow
A shadow of a texture over a buffer starts as the buffer's memory lies, instead of zeros that the copy-in then overwrites, and a format's linear-modifier features are asked of the driver once. A no-copy texture is laid at Metal's row pitch as a linear image over the buffer wherever the driver takes that explicit pitch, and a driver's refusal is remembered per exact image (up to 256). The lanes check textures at a browser's padded row pitches and say which pitches each driver takes. RUNTIME_VERSION 1186. Gain: a surface texture's shadow on ANV 1048 -> 135 us, RADV 484 -> 90 us. With the pitched images, every padded surface aliases on ANV with no shadow: a tile 1048 -> 41 us. Verified on the original branches: the runtime lanes on RADV, ANV and NVIDIA. Known open: pitched_surfaces::a_half_float_tile_reads_writes_and_renders_as_metal fails on lavapipe (a clear-blend-store pass writes a few padding bytes past the row), as it did on the original branch. This squashed commit was not re-tested on its own. |
||
|
|
11715e2a3f |
Import no-copy memory a driver refuses from the caller's dma-bufs
RADV imports host pointers through amdgpu userptr with ANONONLY, so it refuses MAP_SHARED memfd pages (QEMU's memory-backend-memfd guest RAM and views of it): every no-copy buffer, heap and rebind over them was refused, and a macOS guest could not boot on AMD. NVIDIA imports the same pages. What: - The five no-copy entry points (new_buffer_with_bytes_no_copy, both new_heap_with_bytes_no_copy calls, Buffer and Heap rebind_bytes_no_copy) take a HostMemory; HostMemory::with_dma_buf adds a retained DmaBufSource. - Where the pointer import is refused, and only there, on any device that lists VK_KHR_external_memory_fd and VK_EXT_external_memory_dma_buf, the runtime asks the source for dma-bufs of the window's pages (chunks cut at the device's sparse granule, sized by the caller within udmabuf's default limits) and binds one buffer over them: plain for one chunk, sparse for several (vkQueueBindSparse signalling queue 0's timeline; later work waits on it, no host wait). Every path that imported before is unchanged. - Textures over such pages get a dedicated DRM_FORMAT_MOD_LINEAR image import of their own pages where the driver takes the plane offset and row pitch (multiples of 256 on RADV), with 64-bit modifier features; elsewhere, or on a source error, the existing shadow path. - The extensions are enabled outside the compile profile: no device's enable set, fingerprint or ARTIFACT_FORMAT_VERSION changes. The translator crate is unchanged. - Imports free inside exit-guard sections; the source is never called with a runtime lock held. WorkCounts gains dma_buf_imports, dma_buf_sparse_buffers, dma_buf_images and dma_buf_image_fallbacks. Verified: - Product suites 4553/4553, validation suite 1289/1289, clippy in every configuration, rustdoc -D warnings, scripts/api-docs. - runtime_lane::dma_buf_imports and rebinds on RADV Mesa 26.2.4 (validation layer clean), the RTX 3090 and lavapipe (pointer imported, source never called), and dma_buf_imports on RADV Mesa 26.0.8. - reims-vgpu on the Radeon 780M (RADV 26.0.8, udmabuf at its defaults): a macOS 26 guest cold-boots to the desktop and runs Safari; 5,119 dma-buf requests, none refused. - 64 MiB on RADV 26.2.4, release: pointer import 187 us; one chunk 665 us; 16 chunks 16.9 ms, about half of it the refused pointer attempt. The old host-fence bind waited 1.26 s behind queue-0 work on RADV 26.0.8. |
||
|
|
13b279df1b |
Squash 11203 commits of translator, runtime, and validation work
Rolls up everything since
|
||
|
|
43c46ac8a2 |
Squash 680 commits of translator, validation, and corpus work
Rolls up everything since
|
||
|
|
08970cacd2 |
Consolidate translation, linkage, and validation work
Squash 147 commits (2026-08-20 through 2026-08-31) into one change on top of the exact-kernel-grid work. Covers native lowering and pointer/layout construction, AIR intrinsic and funnel-shift coverage, BDA address preservation across aggregate calls, CFG structurization, function-constant and visible-function specialization, the 30-second translation ceiling, the authored-case corpus and linkage validation suite, and refreshed byte-exact MoltenVK evidence. The kernel-grid lowering in this tree supersedes the 324-line variant in the parent commit; that file is reduced to its current 139-line form here. Resulting tree is identical to 7174c7b. Prior history remains reachable at tag pre-squash-backup and branch backup/pre-squash-7174c7b. Claude-Session: https://claude.ai/code/session_01D1u4vU7Mr5QNWrnnRHC8iS |
||
|
|
9ff250502c |
Make exact kernel grids safe by default
Model kernel dispatch geometry as a typed contract shared by lowering, reflection, validation, and the CLI. Cull surplus dispatchThreads invocations using fixed or reflected push-constant grid bounds, make that safe dynamic-grid path the default, and require an explicit whole-workgroup assertion to omit it. Reject unsafe source-barrier kernels before every product emission facade by following the selected AIR entry graph, including quoted LLVM symbols. Exercise the same default contract in authored candidate validation and document the host ABI. Keep corpus audit parent concurrency bounded by feeding isolated translation workers from scratch-backed stdin files instead of creating one feeder thread per row. This removes the scoped-thread exhaustion that aborted late full censuses while retaining child decoding inside the time and memory watchdog. Verified with format checking, warnings-denied workspace clippy and Rustdoc, validation tests at concurrency 16, the unchanged downstream repro, a forced 88,819-row audit completing in one invocation at jobs 16, failure retries, and a zero-read warm pass. |
||
|
|
8e95e84d0c |
Close specialization and descriptor audit gaps
Distinguish image descriptors from texel buffers, scope synthesized binding occupancy by descriptor set, and decouple the Metal texture source limit from configurable descriptor ranges. Centralize retry finalization and runtime sampler projection so layout and specialization contracts cannot drift across paths. Refresh consumer documentation and add adversarial descriptor tests. |
||
|
|
12abadb798 |
Add caller-selected descriptor layouts
Thread a versioned, validated descriptor layout through emission, reflection, synthesized resources, retry-created address tables, and Vulkan validation. Preserve the existing ABI as the explicit default and cover cross-stage separation, static samplers, embedded textures, raw aliases, invalid ranges, and default byte identity. |
||
|
|
f3e376361b |
Specialize embedded runtime storage images
Route writable argument-buffer textures, including fixed descriptor arrays, through the runtime storage-image format and capability contract. Reflect their applied state by synthetic resource index and teach authored validation to resolve structural owner/offset identities through reflection before candidate translation. Bump reflection and executor fingerprints so stale outputs are not reused.\n\nVerified with cargo fmt, warnings-denied workspace clippy and Rustdoc, 1364 serial product tests, and 144 serial validation tests. |
||
|
|
547a59d99b |
Specialize runtime storage image formats
Accept runtime storage surface formats and host feature facts by Metal texture index, specialize image types before interface creation, and reflect the exact explicit or formatless contract. Track runtime origins through arrays and image aliases so every read, write, imageblock write, emulated fetch, and atomic operation checks the required capability or refuses honestly.\n\nWire authored validation resources into the same product options, bump the reflection and candidate executor contracts, document consumer use, and cover type splitting, dependent loads, exact formatless capabilities, atomics, incompatibility, missing bindings, imageblock writes, and pixel-gather storage reads.\n\nVerified with workspace clippy -D warnings, warnings-denied all-features Rustdoc, serial product and validation suites, both packaged AIR reproductions plus spirv-val Vulkan 1.3, and release measurements under 0.5 seconds / 23 MiB RSS. |
||
|
|
f263d8a195 |
Reject lost runtime sampler specialization
Propagate exact sampler state through bounded sampler-typed SSA aliases and mark mixed joins ambiguous. Refuse pointer-selected runtime samplers instead of silently substituting the default sampler and returning to native sampling.\n\nAdd a selected-sampler regression and clarify the consumer contract. |
||
|
|
8b78eaca3b |
Expand macOS 26 AIR translation coverage
Overhaul the validation workflow around sharded authored cases, dependency-exact observations, incremental indexed corpus audits, bounded parallel translation, and native Metal/Vulkan comparison.\n\nExpand native AIR lowering, reflection, linked-function specialization, resource and stage-interface support, and structural CFG/pointer repair across the harvested macOS 26 corpus. Add exact intrinsic inventory, distributed 16x16x16 matrix lowering, explicit opaque tensor linkage, and regression coverage for the newly supported feature classes.\n\nThe final corpus verification accounts for all 88,819 indexed AIR modules under the current product fingerprint: 65,355 translate and validate directly, 23,464 require exact authored linkage, and zero fail or remain unresolved. |