master
16
Commits
| Author | SHA1 | Message | Date | |
|---|---|---|---|---|
|
|
b755b42af5 |
rt docs: two private intra-doc links that no longer resolve or are redundant
CI's "Private intra-doc links" step holds metal2vulkan-runtime at 0 diagnostics; development carried 2 (found by lane d3dsync's gate, jobs m3-max-70845, 70861, 70891): - pipeline.rs: a kernel interface's `threadgroups` doc linked `Variant::threadgroup_lengths`, a field Variant does not have (the encoder holds the lengths as set; a variant keys them as `lengths`, whose words follow `threadgroups`' order, encoder.rs ~1554). It links `Variant::lengths` now. - function_table.rs: `[`MAX_BUFFER_LENGTH`](crate::MAX_BUFFER_LENGTH)` is redundant where the name is in scope; the plain link resolves to the same item. Verified: the private-items Rustdoc pass for every crate, in the job named in the follow-up. |
||
|
|
28e2b0e6ca |
Validation: a kernel case's visible-function tables run through the runtime
The runtime candidate makes each table the case binds of the pipeline state (newVisibleFunctionTableWithDescriptor: of its size, each authored entry set to the handle of its linked function made with the case's constants, as the Metal oracle sets it) and binds it at its buffer index. ToolingRequirement::KernelFunctionTable, which held such cases to Metal alone, is retired; a render stage's table stays the runtime's limit (RenderFunctionTable). ENGINE_EXECUTOR_ABI does not move: no recorded row ran a kernel table case (they were refused). The runtime README states the device answer, the encoder's bind, the state's handles and tables, and the known gaps (a table's 64 KiB block, a consumer-compiled kernel's handles, an argument buffer's table). The coverage table marks the compute items implemented; METAL-COVERAGE.md and CONFORMANCE-COVERAGE.md are regenerated. Adds the owned linked module visible_table_ops.metal, whose companions scripts/regen-air-fixtures writes on the Mac. Verified: the lane's jobs. |
||
|
|
bbb3d53484 |
Runtime: a compute state's visible-function tables call the functions their entries hold
A compute pipeline state answers functionHandleWithFunction: for its linked functions (the translator's FunctionHandle words), makes visible-function tables (newVisibleFunctionTableWithDescriptor:) whose words sit in a Shared block the runtime takes, writes their entries (setFunction:atIndex:, setFunctions:withRange:) and answers each table's gpuResourceID. The compute encoder binds a table at a buffer index (setVisibleFunctionTable:atBufferIndex:) through its buffer path, and the command buffer keeps the words until it retires. The device answers supportsFunctionPointers YES. An entry past a table's size is Refusal::FunctionTableIndex and writes nothing. The translator's bind module makes the table's header and entry offsets public, so the runtime writes the layout the shader reads. Tests: function_tables (device cfg) dispatches through tables of two orders, a null entry, no entries, an unbound slot and an entry set after encoding, and compares every word; the conformance rt side runs the compute visible-table cases. Evidence is in the lane's jobs. |
||
|
|
5d725aeec7 |
Delete metal2vulkan-runtime, with every test and script that read it
The cutover deletes the old runtime: crates/metal2vulkan-runtime and its workspace member go. Nothing in the workspace depends on it any more: the harness and conformance lost their old arms, and validation dropped its dependency in its own commit. Adapted in this commit, so no gate reads the deleted tree: - CI and scripts/linux-gate-ci: the crate's per-feature clippy group, its `-p` in the Windows clippy and the test step, and its private-doc-links row go. Packaging needs no edit: the workspace's published crates are now metal2vulkan and metal2vulkan-air. - The published-crates test lists those two; devtools' carried trees and the five nextest groups of the old crate's tests go. - scripts/api-signatures: the crate leaves CRATES, FLOORS and the header, its self-test trees name rt (read by the same rules), and the table is re-blessed (the old crate's 4555 rows go); api_signatures.rs pins the three crates left. - scripts/refusal-surface: the old crate's tree and its sections go (RuntimeGap, AppleOnly, Problem and the problem enums it forwards to), with their 87 reach rows, the `--delegations` verb and the test that counted the old Problem's delegations; docs/REFUSALS.md is regenerated. The basis check now holds rt's refusal enums alone, which it already required. - scripts/api-cost-coverage goes: it measured only the old crate's surface. - feature_vocabulary.rs: the old crate's two enable tables go; the Khronos and validation tables stay held to the vocabulary. - The conformance coverage generator's by-hand roots read rt instead of the old crate, and docs/CONFORMANCE-COVERAGE.md is regenerated (MTLResourceOptions' row, which only the old crate modelled, gives way to rt's MTLCommandBufferError). - scripts/matrix: the harness times the new runtime alone (`--runtime new`), so the rules that judged it against the old one go: the new-over-old budget with its floors (floors.tsv, gpu-floors.tsv), ceilings, card variance and status table (status.tsv), the frozen arm, the base spread and the timing once more it set off, the re-timed pairs, the five creation rounds and the old runtime's parked tests and records. A harness row's time is judged as a cross-GPU outlier, with its alone runs as before, and the frame and burst rows by their stored instruction counts; the creation rows run once, in their own process. docs/VALIDATION.md's matrix section says these rules. Checked locally (python, no build): signatures.py --check and --selftest, refusal_surface.py --check, --selftest and --missing-basis, coverage.py --check and --selftest, and scripts/matrix's 49 tests pass. The compile gate (fmt, clippy plain, --cfg m2v_gpu and --cfg m2v_cpu_icd, Windows clippy for gnullvm and msvc, workspace Rustdoc, packaging, the touched crates' suites on the host and on lavapipe) runs on this sha as potluck jobs that the landing note names. |
||
|
|
2c21b3e6f1 |
A recovery carries indirect command buffers, visible function tables and argument encoders; one test over every kind
What: a device's recovery now carries the three kinds a program makes that it left the lost generation's, so each is the same object on the new VkDevice, as Metal keeps its objects: - An indirect command buffer (`indirect_command_buffer/carry.rs`). Its records' storage and its slots past them are buffers of the runtime's own whose `contents` pointer no program holds, carried as such (`Buffer::carry_runtime`): in the runtime's own pages, the same pages and the records as they are; in pooled host-visible memory, new memory, the records lost with the VkDevice (vkspec 5.2.3), written again as a new buffer's: its header, every command reset. The program each command's state runs is the state's program there (made by the state's carry, after it), or a released state's made again there, as are the programs it keeps for GPU-written records (`released_programs.rs`); its kept chunk recordings go; the new generation's keepers list it where the GPU may write it. Its records ID, address, gpuResourceID, uniqueIdentifier and label are the line's and stay. - A visible function table (`function_table/carry.rs`), after its pipeline state: its words buffer carried the same way; where it went to new memory, the words written again from a host copy the table now keeps of what the CPU wrote (`TableShared::writes`), so its entries call what they called; listed among the new generation's tables. A table whose state stays the lost generation's stays with it. - An argument encoder: it holds no Vulkan object, so its device becomes a `LineDevice`, the handle carried; `ArgumentEncoder::device` answers the generation handle by value (it answered a borrow). The registry keeps both buffer kinds weakly (`Carry::indirect_command_buffer`, `Carry::function_table`), the recovery carries them after the pipeline states, and its notice counts them (`", and N indirect command buffers, M of them whose records were lost (every command reset)"`, `", and N visible function tables with their entries"`). The docs of what a recovery carries and leaves say so: `RuntimeGap::MadeBeforeRecovery`, `Degradation::DeviceRecovered`, docs/API.md, the runtime's README, `device/carry.rs`. Why: after a 3090 recovery, `resetCommandsInBuffer:withRange:` on an indirect command buffer made before it was refused (`MadeBeforeRecovery`) thousands of times and every later command buffer of the pass failed, where Metal's buffer goes on. The whole class at once: every kind a program can make, each with its carry status, was listed for the change (none other was left uncarried that holds only what the program could make again; sparse heaps and textures and pooled `Shared` buffers stay left, as documented). Test: `device_recovery_every_kind::every_kind_of_object_made_before_a_recovery_serves_after_it` makes one of each kind (a queue, a `Private` buffer, a heap and a placed buffer, a texture, an event, a shared event, a fence, a sampler state, a depth/stencil state, a library and function, a compute and a drawing state, an address pool, a rasterization rate map, a binary archive, a dynamic library, an indirect command buffer of dispatches executed before and one of draws, an argument encoder, a visible function table called before), recovers, uses each on the next generation by command buffers that complete (the indirect buffers reset by a blit and encoded again, the table called and set, the encoder writing), and ends with the lost VkDevice gone while all live. Helpers made `pub(super)` in the pipelines and states recovery tests. Verified, at the change on |
||
|
|
c7362776d0 |
Let carried textures' and pipeline states' parts go at the lost generation's rest
What: a recovery's carried textures and pipeline states let go of their parts on the lost generation once it comes to rest, as buffers already did, so the lost VkDevice goes while they live. - device/carry.rs: LetGo<T>, the let-go cell MadeOn was (MadeOn is now LetGo<Device>), and PartsCalls/CallHold, one guard generalised from the buffer's calls and HeldParts: a call outside command buffers' work counts itself, and a release at rest waits for the last call to end. Buffers use it unchanged in behaviour (Buffer::held_parts, LostBuffer, LostPlaced, LostHost). - Pipeline states: StateShared.program and ProgramLink.program are LetGo cells. The carry hands the lost generation a LostProgram, which drops the state's program there in place at rest (its variants' objects, plans, makings and its Device). reached() skips programs let go of. The state keeps its own copy of its label, so label()'s borrow outlives the program. Holds: the public state methods that reach the program, program(), Debug, and the argument encoder's and indirect commands' set paths. - Textures: TextureShared's per-generation parts (storage, moved, pending_move, usage_shadow(_making), faces, snapshot, kept_backings, render_shadow, facts, planes_in_place) move into Parts in a LetGo cell, read through Deref. The carry hands the lost generation a LostTexture. At rest it leaves the texture's slot in the lost generation's table and heap sets, hands the caller's range token to the parts on the next generation, and drops the parts in place. Parts with a handed-out VkImage (Texture::vk_image) stay until the texture goes. Texture::s() skips parts let go of. Holds: the public texture methods that reach parts, and vk_image; a view's hold holds its root texture too. slot_keeper names a texture buffer's generation by its texel views, not by the buffer's serving generation. - WorkCounts::lost_programs_released and lost_textures_released, counted on the line. - Public signatures: ComputePipelineState::device, RenderPipelineState::device, FunctionHandle::device and VisibleFunctionTable::device now answer an owned Device. The last two also borrowed from the state's program. Command-buffer paths use the crate-private borrowing generation(). api_signatures is blessed. - Docs: the carry module docs (device, pipeline, texture), docs/API.md's recovery entry, the runtime README's recovery paragraph, vk_image's doc. - Tests: the four recovery tests in 99dbc69666 also assert the counters. Why: a carried texture kept its images on the lost generation, and a carried state its program there, until the object went, so the lost VkDevice lived as long as any of them. A long-lived program kept it for good. Verified: cargo check of the workspace, all targets and features, under no cfg, m2v_gpu and m2v_cpu_icd, clean but for one validation call site fixed here (jobs m3-max-23824, 23852). The lavapipe lane (the tests of 99dbc69666 before and after), the suite, lint and the 780M run follow. |
||
|
|
4ae4f9b5d4 |
An object's device stays a generation handle across a recovery
What: a fence, a depth/stencil state, a library and its functions and an address pool hold their device as a LineDevice (device/carry.rs): a root handle, which their own checks match by the line as before, and a chain of generation handles, kept by the generation's carry registry. device() answers the generation handle of the generation the object was made on, else of the one a recovery carried it to last, as a carried buffer's or texture's device does. The recovery links the next generation's handle after the lost one and lets the lost one go at the lost generation's rest (MadeOn, a LostParts entry), so the object still holds nothing of the lost generation once it rests; a handle a caller took keeps meaning its generation and keeps it alive while held. A library's functions share the library's chain. The internal checks (encoders' fence and depth/stencil checks, sparse fences, dynamic libraries, function handles, pipeline additions, compute creation from a function, a pool slot's placement) use the new root_device() accessors. Docs: the four modules, carry.rs, MadeBeforeRecovery, the runtime README. REFUSALS.md regenerated: unchanged. Why: RV 2155-2159 made those device() accessors answer a root handle, an API break: a root's raw() answers whichever VkDevice serves and lets go of the one it answered before, so a consumer that takes `new_fence().device()` as the serving generation's handle destroyed objects made on the lost VkDevice through the new one's handles (SIGSEGV in vkDestroyCommandPool on ANV). Verified: see the lane run reported with this sha (the test commit before it fails, this one passes). |
||
|
|
07a21899ed |
Runtime: contents of a detached no-copy buffer answers the caller's pointer of the pages it lay in last
Metal's contents answers the last pointer across a detach (the caller's pointer of the last replace), and the consumer's host library expects contents unchanged across detach and replace; the runtime answered None. Buffer::contents now answers that pointer while a no-copy buffer, a two-copy Managed buffer (either host copy route) or a no-copy heap's buffer is detached. The runtime itself reads and writes nothing through it: every internal caller takes the new crate-private mapped_contents, which keeps the old answer (None while detached), and buffer::Detached keeps the old mapping's address only to answer contents. Tests: tests::detached_contents (Shared and Managed no-copy buffers, and a no-copy heap's buffer) maps the pages with no access while detached and runs a blit and a synchronize of the buffer; managed_copy_device's detach legs and the validation detach lane assert the pointer. Docs: Buffer::contents, detach.rs, docs/API.md, the runtime README. |
||
|
|
ec9706e6e3 |
Survive the loss of the VkDevice: the device is a line of generations
Metal's MTLDevice survives a GPU recovery; the runtime's device refused every call with DeviceLost from the first loss on, and the consumer ends its VM at the first refusal. Now a device the runtime made is a line of generations (device/line.rs), each a DeviceShared over its own VkDevice, and the first call that needs the device after a loss makes a new VkDevice of the same physical device, options, queue families and extensions. - Two kinds of handle. The program's device (and its clones) is a root handle: it holds the line, pins no generation, and every public Device call goes to the generation that serves (each public method forwards to its *_now body). Objects hold generation handles, so their Vulkan calls, drops included, reach their own VkDevice alone. A generation handle's check is one relaxed load of the line's generation (Device::generation_serves). - A draw pays nothing for it. A command buffer takes its generation once, as it is made (CommandBuffer::generation); its encoders' per-draw reaches (work counts, fresh-unwritten and alias records, sampler-slot changes, attachment read notices) read it there, not through a device handle's kind. A bind's device check is one compare of the cells the two handles hold, inlined, its refusal (Device::foreign) out of line. - The state machine (Live, Lost, Failed): the claiming call recovers, every other call waits (a notice past 10 s, waiting on); threads command buffers' completion depends on never wait. Recovery: the lost generation's command buffers in flight fail through its completion path, its queues drain under their locks, create_on makes the next VkDevice, the queues are retired. - Command-buffer answers, as a real loss is one more hang: the oldest incomplete batch's command buffer fails GpuHang (exact on one VkQueue; on two or more the queue whose oldest incomplete batch was submitted first, said so in the notice), counted against its queue so the second revokes it (AccessRevoked); the others GpuRecoveryVictim; one committed on the hang's queue before the recovery runs nothing and completes with no error; one made before and committed after fails GpuRecoveryVictim. One loss names one hang: a batch that went to the driver just before the loss and reached the lost device's completion after the loss took the pending batches fails with it, as a victim (its own wait need not fail: the test hook's VkDevice runs it), and no later failure of the lost device names a second hang. - Command queues survive: a queue is a root handle and a cell of its place on one generation (VkQueue, slots, pools, hangs), which a recovery retires and the next command buffer re-makes; label and GPU-error count go on. - Objects made before a recovery are refused where they meet the new VkDevice or need their lost one: RuntimeGap::MadeBeforeRecovery, at the 38 lost-device checks (Device::lost_refusal) and at every foreign-object check of one line (Device::foreign). DeviceLost stays for a device the consumer made. - Carried across generations: the address space, resource IDs and the passing holds a making waits out before it takes one, unique identifiers, counters and the announced notice kinds. - A device handle is an enum of the two kinds (24 bytes, was 16): the shadow merge's copy-back dispatch, which holds handles, is boxed (clippy's large_enum_variant). - Device::recover_for_test (public, documented) runs the whole path with no GPU fault; RuntimeGap::AdoptedDeviceRecovery on an adopted device. - Degradation::DeviceRecovered (device-recovered), announced at each recovery with the culprit and its time. WorkCounts::vk_devices_live, vk_devices_made, device_recoveries: two VkDevices while objects of the lost one live, one after. Docs: docs/API.md catalogue entry, the runtime README's device-loss section, FAST-PATHS known gap (a make whose own submission first meets the loss is refused DeviceLost), docs/REFUSALS.md regenerated (refusal_surface.py names a forwarded body's sites by its public method), api_signatures blessed. Tests: runtime_lane::device_recovery (hang and victims, command buffers on their way to the driver at a recovery, MadeBeforeRecovery and the VkDevice bound, revocation at the second hang, a command buffer made before fails as victim, all under the validation layer; a recovery that finds nothing of the queue scheduled names no hang, its command buffers victims), tests::device_recovery (the hold of the hang's queue between a loss and the recovery), detach_lost and the MoltenVK lost-device lanes updated to the recovery's answers. Verified: - lavapipe: runtime suite and touched validation tests 1850/1850, surface 19/19 (m3-max-5695, gem10, before the rebase onto |
||
|
|
8e65408e85 |
Resolve the runtime's broken private intra-doc links, and lower its ceiling to 0
CI's private intra-doc link step reported 148 for metal2vulkan-runtime on
macOS and 149 on Linux at
|
||
|
|
057a44d028 |
Take no shared lock at a draw of a kept shape: the encoder keeps its state's settle; tables and quiet formats told lock-free
Three locks every full draw took of objects draws on other threads share: - GraphicsState::settle_shape's per-program cache. Each bind state of an encoder's LiveBind (the one in place and each set aside) now keeps what its last recorded draw settled (live_bind.rs SettledHere: the variant and plan, the program named by a Weak, the buffer forms). A draw of the same program in the same forms whose shape is the kept one (the very Arc) settles as it, with no lock: settle_shape's answer is a function of the shape and the forms alone. Only a draw that recorded keeps it, so the encoder holds its pipeline state and the command buffer the variant's objects; SpareLiveBinds::give empties every kept settle as the encoder ends, so a spare state holds nothing alive. A refused settle keeps nothing. - GraphicsState::function_tables locked the device's function-table registry. A program now notes, once, that it made a visible function table (Program::made_tables, set as the table is registered); a state that never made one lists none without the registry. - VariantObjects::degrade_bound_formats locked quiet_formats. A variant that tests no slot's format keeps its quiet answer in an AtomicBool (quiet_untested); one that tests slots still locks. What remains on a full draw's path: Arc clones and drops of shared objects (the settled variant, plan and shape on a kept settle, the shape a pipeline state's cache found, the DeviceShared, the retained pipeline state and variant objects), the LiveBind mutex (per encoder, uncontended), and quiet_formats for variants that test slots. A draw again (render/draw_again.rs) takes none of them. Test: src/tests/shared_draw_locks.rs counts, in builds with debug assertions, every lock taken through device::shared_draw_lock (the three sites) on the encoding thread: an encoder's first draw takes some; 8 later draws of the same shape, each after a call (so each takes every step), take none. Negative controls, each fix disabled alone: 8 locks each time (verified on MoltenVK, M3 Max). host_ab encode, release, 10k draws per command buffer, us/draw, three interleaved rounds (median of round medians / mean / max of round p90s), Apple M3 Max, MoltenVK 1.4.2, one thread: static 0.049 / 0.049 / 0.056 -> 0.049 / 0.049 / 0.054 offset 1.525 / 1.530 / 1.593 -> 1.498 / 1.498 / 1.538 bind 1.724 / 1.725 / 1.765 -> 1.703 / 1.704 / 1.741 The same on the NVIDIA RTX 5080 Laptop GPU (Linux), one thread; round 1 of each clean, round 2 of the lock fix perturbed (its p50 2.3 times its p10, other load on the host), round 3 pending: static 0.054 / 0.056 / 0.069 -> 0.053 (r1), 0.060 (r2) offset 2.071 / 2.128 / 3.519 -> 2.010 (r1), 4.721 (r2; p10 2.013) bind 2.191 / 2.225 / 3.899 -> 2.139 (r1), 5.384 (r2; p10 2.155) (left: the draw-again commit alone, three rounds). One thread takes no contended lock either way, so a change within noise is what one thread shows; the fix is for draws on several threads at once, whose numbers on both hosts come with the report. (cherry picked from commit 6f157d8498632a8850795b5ed6fc97d7433c4c95) |
||
|
|
12aa3ba277 |
Place device-made texture buffers' texels and function tables' words outside the Metal space
What: a texture buffer the device makes (`newTextureWithDescriptor:`, `newSharedTextureWithDescriptor:`; `Device::new_texture_buffer`) lies over a buffer made by `new_buffer_placed` at `AddressPlacement::Outside`, otherwise as `new_buffer` makes it (kept among the program's resources, announced alike); a visible function table's words buffer is placed `Outside` instead of `Any`. address.rs's "Outside the space", the two modules' docs and the runtime README say so. Why: Metal shows no program an address of either. MTLTexture and MTLVisibleFunctionTable answer a `gpuResourceID` and no `gpuAddress`, and the runtime exposes neither buffer: no getter answers a device-made texture buffer's buffer, and a table's words are reached through its binding at a buffer index, its resource ID in an argument buffer (set 1's function-table array) or its words' Vulkan device address (`VisibleFunctionTable::listed`). A texture buffer's texels are read through texel views and the texture table by ID. Nothing reads either relative to the Metal space, so taking a range of it only moved the program's own `Any` buffers and could refuse its pins, unlike a texture of its own memory, which takes none. Heap texture buffers stay in their heap's range, which Metal exposes. Tests (validation lane, device): `texture_buffers_the_device_makes_lie_outside_the_metal_address_space` and `a_table_s_words_lie_outside_the_metal_address_space` hold the whole space with one address pool (`pool_slots::holding_the_space`, which checks that a buffer at `Any` is then refused `OutOfMemory` and one `Outside` is made), and make a plain and a shareable texture buffer (the CPU reads back what it wrote) and a function table (a kernel calls the functions it holds once the space is free again for the dispatch's output). Verified on the M3 Max (MoltenVK): both pass. (cherry picked from commit c62deff2e3504ef6d71cd8a49ae914adbbb572d5) |
||
|
|
1366be1718 |
Read the problems a Problem forwards to, and hold each to a basis
The steps this packet landed as, in order: - Keep the quoted Metal messages out of rustdoc's link syntax - Record the runtime sources' hash after the sub-problem basis lines Content: the tree of `development` at 3ade9d9999, unchanged. |
||
|
|
9ed028eb5c |
Take the empty switch for a table call nothing linked can answer
The steps this packet landed as, in order: - Take the table's own count off the runtime's public surface Content: the tree of `development` at 5a23469901, unchanged. |
||
|
|
e320a1f475 |
Drop design-record, work-package and evidence codes from comments, and retire vk12-bare from the corpus
Comments, fixture notes and docs lose their design-record numbers, work-package codes and evidence codes; lines that earlier commits of this series added carry their cleaned text there, so this commit holds the cleanup of lines that predate the series, the retired vk12-bare profile's corpus rows (a rationale and two observation rows), and docs/FAST-PATHS.md's measurements stated as they stand. Thirteen hash-keyed files keep their citations, because their bytes are case or record identities: eight case-keyed .ll fixtures and five parity sources. Verified: the CPU suites (4997 of 4997 and 1328 of 1328), clippy, rustdoc and doctests. Folds in: - Drop evidence codes, design-record numbers and work-package codes from comments and fixture notes - Drop the retired vk12-bare profile from the corpus - Say the fast-path ledger's measurements as they stand, without commits, rounds or host incidents - Keep the case-keyed .ll fixtures byte for byte - Keep the parity lanes' fingerprinted sources byte for byte |
||
|
|
13b279df1b |
Squash 11203 commits of translator, runtime, and validation work
Rolls up everything since
|