ca39c8f6851bf448b9f1db85f3875f9c8a8965e1
25
Commits
| Author | SHA1 | Message | Date | |
|---|---|---|---|---|
|
|
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. |