ea34cfbee8bb2d4e2fddfcc9e428be0393ded5ff
49
Commits
| Author | SHA1 | Message | Date | |
|---|---|---|---|---|
|
|
8b91272bc8 |
🔥 Drop the dependencies nothing reads
Cargo warned of three on Linux: reims-vgpu-core's bitflags, which no code of it reads; the workspace's proptest, which no crate names; and the VideoToolbox backend's codec crate, which only its macOS module reads. The first two go, and the codec crate becomes a macOS dependency of the backend. |
||
|
|
4ea9311040 |
🐛 List reims-vgpu's optional Vulkan deps in Cargo.lock
Effort commit 6c171a10f made metal2vulkan-runtime and reims-vgpu-video-vulkan optional dependencies of reims-vgpu, but the lock's dependency list for reims-vgpu never named them, so every build that may write the lock rewrote it. The lock now lists both. It keeps metal2vulkan's git source lines out, as the committed lock does: it resolves --locked under a local patch of the pinned rev. |
||
|
|
47e1136828 |
🐎 Find Annex B start codes with memchr's vectorized search
Every H.264 and HEVC picture the Vulkan decoders take is Annex B, and its NAL units are split at their start codes by a search over each byte: on msi's RTX 5080 the host's parse of a picture took 39 us p50 at 1080p and 87 us at 2160p (decode-perf run 1), growing with the picture's bytes. memchr's memmem search finds the same start codes at 32 to 37 GB/s on the M3 Max over the lane gate's streams, against 2.6 for the byte-wise window: about 1 us of a 1080p picture's 34 KB, and 2.5 of a 2160p one's 86 KB, rather than 13 and 33. memchr was already in the lock, through the regex crates. |
||
|
|
770f363739 |
🆕 Decode H.264 on Vulkan Video into images the caller supplies
The product will decode the guest's H.264 on the GPU it draws with, through metal2vulkan's own device, straight into the GPU copies of the guest's IOSurfaces, which the guest's Metal then samples per plane. VA-API and NVDEC decode into surfaces of their own, which would need a copy into those images. reims-vgpu-video-vulkan is the codec crate's H.264 decoder over Vulkan Video (VK_KHR_video_queue, _decode_queue, _decode_h264), 8-bit 4:2:0 progressive as that decoder takes it: - VideoDevice runs on another's instance, device and decode queue (from_raw), or makes its own with a graphics and a video-decode queue, VK_KHR_video_maintenance1 and unifiedImageLayoutsVideo where present, and says why where no device decodes H.264 (create); - h264_capabilities answers per profile from vkGetPhysicalDeviceVideoCapabilitiesKHR, for the guest's answers; - each picture decodes into a SurfaceImage its SurfaceSource gives (NV12, optimal, mutable format with extended usage, shared between the graphics and decode families), which is also its DPB slot, as the 5080 offers only DPB_AND_OUTPUT_COINCIDE; never copied. Layouts stay GENERAL with unified layouts, else each decode leaves its target in the DPB layout; - the session's parameters object holds the stream's SPSs and PPSs as std structures, made again where one changes; the DPB's references map to slots, a lost frame's stand-in sharing its source's; - each decode signals the decoder's timeline semaphore, whose value each picture names; what a decode in flight uses goes only once it is passed; - DecodeImages and Picture::read_back serve the tests and tools. examples/vulkan-h264-framemd5 prints each frame's NV12 MD5 as the VA-API backend's does, and tools/h264-check.sh runs it over the VA-API check's streams and references. |
||
|
|
46324049a2 |
🐎 Take a command buffer on its doorbell's thread
rvg_graphics_device_mmio_write_taking is rvg_graphics_device_mmio_write, except that a DOORBELL write of a command queue's ring first offers the queue's next COMMAND_BUFFER to the host on the writing thread. Under QEMU that thread is the guest's vCPU. Where the buffer asks for its CB_SUBMITTED and nothing need be waited for, the vCPU takes it: it makes the buffer's command buffer, posts its CB_SUBMITTED onto the queue's completion ring and raises the queue's vector. It then hands the rest to the queue's service thread, which walks and commits the buffer before it takes anything more of the queue's. The guest's commitAndWaitUntilSubmitted no longer waits for that thread to wake, which costs about 85 us on msi's host, the exit of an idle CPU from its deep C-state. Nothing on the vCPU waits. Every lock the take needs is tried: the queue's claim, which its service thread holds from its take of a message to the hand-over; the queue's submission ring; the control submission ring; the compile table; and the decoder. Where any is held, the buffer stays on the ring and the write wakes the queue's thread, as rvg_graphics_device_mmio_write does. It also stays there where: - a ring-0 message published before it is not carried out yet; - it waits for an event, or a buffer before it holds its queue; - a pipeline it names is compiling; - a device cache it uses wants a fill, or a wait for one; - its queue holds 48 command buffers made and not completed (the platform's commandBuffer waits at 64); - it does not ask for its CB_SUBMITTED. The CB_SUBMITTED's post on the vCPU waits for nothing either. Where the completion ring is busy or full, the service thread posts it before the walk, where the post is today. The decoder's lock is taken on the vCPU and let go on the service thread after the commit. So every message the guest sends after it sees the CB_SUBMITTED is carried out after the buffer's commit, as it is today. Class: FREE. Only the thread that posts a buffer's CB_SUBMITTED and its timing change. Each queue's events keep its order: the vCPU takes only while the service thread holds none of the queue's messages, and the service thread carries out what the vCPU took before it takes the next. The interrupt still follows its ring write on the same thread. The C API gains the function, additively: the header and api.md list it, and section 5 names the calling thread for raise_interrupt inside it, which must not wait for a lock the host holds while it calls the function. rvg_graphics_device_mmio_write and its "Calls back: never" are unchanged, and so are the pins (re-recorded, no difference). The decoder's lock crosses threads through parking_lot's arc_lock and send_guard. |
||
|
|
1f57dd0cd0 |
🆕 Key libraries by content, and keep them on the host
Every process that loads QuartzCore's shaders sent the whole library over the region, and the host built it again. Now the bundle takes the AIR slice's content key (SHA-256 of the .metallib without its bitcode section, whose functions the HASH tags name) and asks the host first with LIBRARY_LOOKUP. On a hit the new id is bound to the library the device made for any process, and no bytes cross. On a miss the slice goes as before, now with its key. The host keeps a library under a key only where it computed that key from the bytes itself, checked every HASH tag against its bitcode, and found the functions cover the bitcode section. Every AIR metallib of macOS 27's system covers it. A lookup can then only bind content with that key, on Metal as on the Vulkan platform. A wrong key makes the library uncached. Libraries no id names stay in a 64 MiB least-recently-released list, so a restarted WindowServer still hits. Library creates are now answered with COMPLETE, and the kext waits for the answer (for a region-streamed library, its last chunk), so a refusal is nil and an NSError at newLibrary*, as in Metal. They are made on the compile pool, off the control thread. A pipeline create that names a library still being made waits for it on its compile thread, and a destroy of such a library keeps ring order. |
||
|
|
9ba5f92c7b |
🆕 Add the stage 3 host decoder's first slice (state objects)
The host side of the stage 3 Metal-call stream begins: GraphicsDecoder, in the reims-vgpu graphics module, generic over the Platform, so it drives Metal on macOS and the Vulkan platform on Linux. This slice carries out the descriptor-free state objects and object destroy: EVENT_CREATE, FENCE_CREATE, SHARED_EVENT_CREATE and QUEUE_CREATE each map straight to a GpuDevice call, and the decoder keeps an obj_id -> handle table that a destroy drops (releasing the object, since handles are refcounted). These objects need none of the resource manager's paging or validity machinery, so the table is the whole of their lifetime; the memory resources and the command-buffer encoder stream, which do, follow and reuse reims-vgpu-core's resources::manager. Unit-tested against the testkit's fake platform: each create calls the platform once and holds its handle, a destroy drops it (and a destroy of an id the host never made is not an error), and an unknown command and a short message are reported. Not yet wired into GraphicsDevice's ring loop. Adds zerocopy to reims-vgpu to read the wire records. |
||
|
|
59df0ffbb5 |
🆕 Add the reims-graphics device to the C API
QEMU drives devices through the C API, so the graphics device gets seven functions there: create and release, the region QEMU maps as BAR 2, BAR 0's reads and writes, the doorbell file QEMU's ioeventfd fills, and the bus reset. Its two callbacks raise the MSI-X vector and ask QEMU's dirty log whether the guest wrote the scanout. Both run on the device's threads with no lock of the library's held, so QEMU may take the BQL inside them, and no function waits for those threads. The additions are strictly additive (docs/api.md section 1): new functions, types and constants, and status 17, RVG_ERR_HOST_RESOURCES, for a host that refuses the region's memory, a pipe or a thread. The C harness calls each new function and drives one GET_DISPLAYS through the region to its interrupt. |
||
|
|
c13f8acb62 |
🆕 Show the reims-graphics display in a window of the library's
GraphicsDevice puts the reims-graphics host side behind the Rust API, with its display in a library window, so a host gets the whole device from one object as it gets apple-gfx's display. The window keeps its size, and the display offers the guest that size in pixels at the host screen's rate, telling it when the person resizes: the guest's scanout then matches the drawable, and the sink blits it 1:1. The sink imports the device's region once as a no-copy buffer on the platform (Metal, or the Vulkan platform's runtime) and blits the scanout out of it into each drawable, so the GPU reads the guest's pixels in place and the CPU copies nothing. The buffer's deallocator holds the region, keeping it mapped until the GPU lets it go. The guest's cursor image becomes the host's cursor over the window. The scanout is shown again only where the host's dirty log says the guest wrote it, which the host answers through scanout_written. |
||
|
|
3aad9dbd61 |
🆕 Add the reims-graphics device's host side
The device's host side runs in the host's process, which maps its region into the guest as BAR 2: private anonymous memory zeroed with stores, as RADV imports no shared mapping. It answers the registers, takes the control submission ring on a thread of its own with the consumer_idle handshake, so a busy ring takes no doorbell, and answers on the completion ring, raising MSI-X vector 0 only where the guest armed it. A refresh thread at the display's rate asks the host's dirty log whether the guest wrote the scanout and has the screen show it only then, sends VBLANK while it is on, and tells the guest a new mode with DISPLAY_CHANGED. No callback of the host's runs inside a call of the host's or under a lock of the device's, and nothing the host calls waits for the threads, so QEMU's callbacks may take the BQL. The design leaves open what a broken ring, a full completion ring and an unsolicited event's seqno do: a broken ring is left until a reset, the control thread waits for room (a VBLANK with no room is dropped), and an event that answers nothing carries seqno 0. |
||
|
|
d1958aecfa |
🆕 Add the reims-graphics wire format and its C header
The guest's kext and option ROM are built in parallel and need the device's wire format before the host side exists: its registers, the region's layout, the rings' header and the control commands and events of the design's stage 2 wire protocol. They live in a new crate, reims-graphics, which will hold the device's host side too, and cbindgen writes them into include/reims_graphics_wire.h, which cargo xtask header --check keeps equal to its output, as it does reims_vgpu.h. Two fixes to the design's tables: a control ring's byte ring is 32 KiB, the largest power of two after its 256-byte header in its 64 KiB (64 KiB less the header is no power of two), and a pad's header is its type and size alone, since the bytes left before a ring's end may be 8. A u64 that would follow a u32 at an offset not a multiple of 8 has a reserved u32 before it, so C and Rust lay the records out alike. |
||
|
|
95644d758d |
🆕 Add the VideoToolbox and M2 scaler devices to the library and QEMU
A macOS guest hands its VideoToolbox sessions, and its
IOSurfaceAccelerator's scaling and conversion, to the host through two
virtio-PCI devices, 106b:1a03 and 106b:1a0b, as Virtualization.framework
gives them. The library gains their host side, VideoDevice and
ScalerDevice over core's host session and scaler, and QEMU their
transports, apple-videotoolbox-pci and apple-m2scaler-pci, with no
properties of their own.
The library picks each device's backend itself and logs why, on the GPU
apple-gfx-pci's device runs on, taken from the runtime's identity of it:
NVDEC and NVENC on an NVIDIA GPU, else VA-API on its render node, and
VideoToolbox on macOS. The scaler device exists on every host and refuses
its features where it cannot transform; a guest message over 16 MiB is
answered -12904 unread.
For the host: the C API gains rvg_video_device_* and rvg_scaler_device_*,
additively. For the guest: a VM given the devices has the host's video
decode, encode and scaling.
Source: c5b409362 375acb462 8be7593eb fbbeebfb2 e3d5616a4 60d08c4f4 c4c476643
fe105edcb 36a6a82c6 ee2b1ca71 d7d5cfede b15f40717 a07ffd70b bfe6b8338
7433026a9 0030b24a7 64497f931 76acbacc7 3bf366e81 6d3b97a59 fa5b4aafc
401e0b727 1af53ce1a 0fa52d070 ce6eab571 33b40ae4a 82beaf64a ef26f02e1
08bb763c4 5ff2dd73f 62e19c8ef ce406ddb2 fd92f66c4 52fba93c9 e179dc0bd
b5f40ad74 d01bbdc9e 950a7e024 601c23067 9857b1fc8 b427bebfb 55a1d96e7
a0243edfc ef54c395f c23c83073 bc6fcdaa7 1b783baca
|
||
|
|
89cf86b649 |
⬆️ Build on metal2vulkan bde1abe95b's runtime
Move the runtime from 62cad6be54 to bde1abe95b, its development at its green gate (runtime version 1496 to 1499; the shader caches miss once). Cargo.lock takes sha2 0.11 and the crates it needs, and stays stripped of the runtime's source lines. For the guest: a fast-math state blending into BGR10_XR_sRGB or RGB10A8_2P_XR10_sRGB beyond the narrow blends is made, where it died (a tester's RTX 4080 at WindowServer's aegir_luna_fsh); one GPU pool block per queue ends the completed-handler lag under the terrain demo; out-of-range threadgroup, alloca and constant indices read the last element. No degradation kind or policy field moved, so DIES, HEARD, REIMS_VGPU_EXACT and the accuracy ledger stand. Source: 5983391e2 |
||
|
|
565e650907 |
🆕 Allocate the library's memory with jemalloc on the shipped targets
On x86-64 Linux and arm64 macOS the C API's crate makes jemalloc the global allocator, so every Rust allocation in the library, metal2vulkan's runtime's among them, goes through it. FIFO 1's commands allocate memory that the runtime's threads free, and glibc refills its arena for each such block on the allocating thread: on ms01's Iris Xe a Finder drag ran at 36 frames/s under glibc and 42 with jemalloc preloaded into QEMU. jemalloc's symbols stay prefixed, so QEMU's C code, the drivers and Apple's frameworks keep the system's malloc. On macOS jemalloc is built with no malloc zone (the workspace's cargo config), as its zone would otherwise register ahead of the system's in every host that links the archive whole. No block crosses between the two allocators: the suspend bytes the host is handed go back through rvg_bytes_free, and the blocks the Metal platform gives NSData and dispatch_data to free are malloc's own. Nothing the guest or the host observes changes. A Mac's `cargo xtask check` type-checks Linux with no Linux C toolchain, so it points jemalloc's build script at an empty archive for that target, as it leaves SDL unbuilt there: nothing links. |
||
|
|
e17d3c2460 |
🎨 Record the lock against a local metal2vulkan checkout
A [patch] in a .cargo/config.toml above the checkout points metal2vulkan at a local tree, which drops the three git source lines from Cargo.lock. Committing that keeps the owner's tree clean while the patch is active. Without the patch, cargo writes the lines back from the pinned rev, and the lock regenerates byte for byte as before; --locked builds need the patch or a regenerated lock. |
||
|
|
98fe2a3bd5 |
🆕 Replace the tree with libreims_vgpu and its C API
This repository now holds libreims_vgpu, a Rust library that is the host side of the paravirtualized GPU macOS guests drive, in place of Apple's ParavirtualizedGraphics.framework: the library and its C API (reims_vgpu.h), the PCI device's option ROM, QEMU's apple-gfx on that API (vendor/qemu), the behaviour-lock suite that drives the C API as QEMU does, and reims-ctl, the VM manager users run. README.md says what it is and how it is laid out, and AGENTS.md how to change it. Every file of the earlier tree is replaced. vendor/qemu moves to the steelbrain/reims-vgpu branch of the same public repository. |
||
|
|
423806da57 |
testkit: share the allocation counter, and measure the rail's warm draw with it
The counting allocator the model's structural-zero suite carried is wanted by the rail's suite too --- two of the plan's required zeros, "heap allocations per steady-state draw" and "full binding-table rebuilds on an unchanged draw", are the rail's. A second copy of a `GlobalAlloc` is a second thing to get subtly wrong, which is the same argument that put the capture's loaders in this crate rather than in three. So it moves to `testkit::allocations`, and `AGENTS.md` says the crate carries instruments as well as fixtures. The rail's suite measures three things. An unchanged draw --- the one the plan's zero is about --- asks `BindingTable::is_clean` and nothing else, and that is zero trips with the bindings still readable afterwards, which is what makes "unchanged" mean the contents survived rather than that they were dropped. A draw that did rebind two slots costs the same on a 512-slot table as on a 31-slot one, which is the whole value of the dirty set; the three trips it does cost are `take_dirty`'s replacement masks, one per binding kind, and the test names them so the number is a recorded fact rather than a tolerance. Sixteen frames of take-submit-recycle over a fixed descriptor ring cost nothing at all, which is what a pool that was supposed to remove a per-frame heap cost has to be able to say. Co-Authored-By: Claude Opus 5 (1M context) <noreply@anthropic.com> |
||
|
|
896d6d8ab2 |
sampler: six tables for one descriptor, and the guest ordinal that reaches all of them
The first replacement subsystem a guest actually runs through. Until now production consumed two modules of `reims-vgpu-vulkan` (`queues`, `memory`) and nothing of `reims-vgpu-core`; a sampler was decoded to engine enums by `translate::sampler`, restricted by `vulkan_conformed_sampler` beside the cache, spelled back into Vulkan by five more functions, and refused for two capabilities at a third site. Six places to keep in step about one `MTLSamplerDescriptor`, and the only thing they could do to each other was disagree about which ordinal means what. Now the ordinals travel as the guest wrote them from decode to the sampler cache, `reims_vgpu_core::sampler::SamplerShape::checked` is the one parse, and `reims_vgpu_vulkan::sampler::plan` is the one decision. `translate/sampler.rs` keeps only `PRESENT_BLIT_FILTER`, which translates nothing. **The protocol layer conformed where it used to refuse.** It rejected any unnormalized-coordinate declaration that broke the restriction both APIs place on one; production conformed it and drew. Refusing is the wrong half: both APIs state the restriction as a requirement on the caller, so a declaration that breaks it already left the documented region and what Metal's driver did with it is not knowable — while every field the conformance changes is one an unnormalized sampler cannot consult (no derivative, so no level and no anisotropy; no period, so no repeat). The comparison stays a refusal, because it changes *what the shader reads* and no nearby sampler reads the same thing. It also checked the R axis, which `-01075` does not name and a 2D-only sampler never consults — that alone would have refused the common `r_address = Repeat`. Two production behaviours change deliberately, both toward the guest: - Anisotropy above one on a host without `samplerAnisotropy` was a decline that cost the whole draw. It is now clamped, which is what Metal does and what the device has no way to refuse honestly — the difference is sharpness, not a wrong image. - Two disagreeing border modes on one sampler used to bind transparent black silently, giving one axis a border the guest did not ask for. It is now a typed refusal on the always-on channel: Vulkan has one border per sampler and picking one is a soft wrong edge that reads as a filtering artefact. `SamplerAnisotropyUnsupported`, `SamplerMirrorClampToEdgeUnsupported` and `SamplerUnnormalizedCompare` are replaced by two delegating variants, so the layer that owns a refusal is the layer that names it. Four `TranslateReason` ordinal variants and seven `DrawPreparationDecline` variants go with them — an unknown `MTLSamplerAddressMode` is refused by the layer that knows where that enum ends, not by the layer that copies it. The three tests deleted with `translate/sampler.rs` are not lost: enum totality is `protocol::sampler`'s round-trip sweep, and both documented collapses are asserted in `vulkan::sampler`. What this site keeps is the *join* — that the cache key reaches those layers as the declaration the guest wrote, which a test on either side alone cannot see. A new sweep asserts every unnormalized declaration the protocol admits satisfies all six `VkSamplerCreateInfo` VUIDs, because the two rules are stated in different vocabularies and neither side can assume the other agrees. Verified: feature-matrix all arms warnings=0 (Metal arm included — it compiles `types.rs` too); `reims-vgpu` vulkan lib 2115 pass serially; vulkan crate 468+8; protocol 371; clippy and rustdoc clean on all four crates. Warning set on the vulkan arm is byte-identical to before the change. Co-Authored-By: Claude Opus 5 (1M context) <noreply@anthropic.com> |
||
|
|
73703ba58c |
vulkan: the rail becomes a crate, starting with the layer that places memory
`reims-vgpu-vulkan` exists. The architecture names one layer as the sole executor of the semantic model and the only place host capabilities become placement and transfer policy, and "only place" is a claim a module boundary cannot hold — a placement decision one `use` away from device state will eventually read some. So it is a crate whose dependency list says what it may see: `ash`, `reims-vgpu-core`, the refusal vocabulary, and the operator switches. No QEMU, no device model, no guest-RAM ownership, no decode. Its first content is `backend/vulkan/caps/memory_topology.rs`, moved whole and unchanged apart from `crate::observe::fail` becoming `reims_vgpu_observe::fail`. That module *is* "host capabilities become placement policy": it classifies unified against discrete from two structural signals, never a device name, and selects a memory type by preference with the required flags always as the fallback — so a misclassification is a performance bug and never a correctness one. It brings its own seventeen tests and the synthetic device shapes they run against. The rest of `caps/` cannot follow yet and the reason is worth recording: `device_features.rs` reads `backend::vulkan::translate::pixel` in production code, and `translate/` in turn reaches `runtime::census`, `runtime::decode`, `runtime::spirv_vertex_input` and `engine`. The legacy backend is woven into the runtime by 284 references across 25 modules; extracting it piecemeal produces a `caps` split across two crates, which is worse than either end state. It leaves at the cutover, and what grows here before then is the replacement executor. `fixtures` is `pub` rather than behind a `testing` feature: the consumer that needs it is in another crate, and a feature would either pull this rail into a Metal-only test build or fork the fixtures — a second answer to what an AMD APU's memory looks like. Counts: the vulkan arm 2209 -> 2192 and the replacement crates 532 -> 552, which is the same seventeen tests on the other side of a crate boundary. The replacement-crates matrix cell now names the testkit and the rail too, so neither can empty quietly. |
||
|
|
cf42142b63 |
testkit: how a suite reaches the capture is one crate, not three copies
Three suites read Apple's captured records — the wire crate's layout tests, the
model's fixture oracle, and the device's decoder tests — and each carried its
own `fixtures()`, its own `unhex()`, and its own spelling of where the files
live. Two wrote the directory as `{manifest}/../reims-vgpu-wire/fixtures` and
one as `{manifest}/fixtures`, which is the same directory only as long as nobody
moves a crate.
The presence probe was already shared, by `include!`-ing one file from three
build scripts, with a comment arguing a build-dependency crate for twenty lines
would cost more than it carries. That was true while twenty lines was all there
was to share. `reims-vgpu-testkit` now carries the whole of "how a suite reaches
the capture" — the probe, the loaders, the hex helper, and one answer for the
directory — so `include!` across a directory boundary stops being the mechanism
and the twenty lines stop being the whole crate.
`oracle/fixture_presence.rs` is deleted; the three build scripts take the
testkit as a build-dependency and the three suites take it as a dev-dependency.
Counts: replacement crates lib 508 -> 532.
Unrelated and pre-existing: `-p reims-vgpu-wire --test oracle_fixtures` fails 12
of 35 against the capture currently on this machine — manifest rows and the
capture disagree about several compute selectors. Confirmed identical at the
parent commit in a throwaway worktree, so it is not from this change; it is a
stale capture or a stale row set and it wants its own investigation.
|
||
|
|
63a93c79fd |
protocol: one vocabulary, one crate — reims-vgpu-contract is absorbed
The last four modules cross — `pixel_format`, `mipmap`, `iosurface_pages`, and the `checked` glob — and with nothing left in it, `reims-vgpu-contract` is deleted rather than left as a shim. Two crates had the same job under two names: "backend-neutral vocabulary" and "the layer that assigns meaning to a wire tag" are one description. Two crates for it means two places to look for a rule and two places for it to drift, and the device was already writing both spellings — `crate::contract::pixel_format` next to `reims_vgpu_protocol::extent` — for facts at the same altitude. There is one spelling now: `crate::protocol::`, across 88 files, tests and conformance included. The moved modules take `alloc` imports because protocol is `no_std`, and protocol takes a dev-dependency on observe with `std` on, because their tests assert what a refusal *renders* as and rendering is the sink's half. Resolver 2 keeps that feature out of builds that do not compile tests — but `--all-targets` does compile them, so the existing matrix cell would let a `std::` into the library unnoticed. A `protocol / no_std library` cell at `--lib` scope is what notices. Counts: support crates lib 351 -> 270, replacement crates 425 -> 508, and `reims-vgpu` itself unchanged at 2138 lib tests. AGENTS.md's ownership list is updated for both new crates, including `reims-vgpu-core`, which it had never named. |
||
|
|
3881a15a1d |
protocol: three more contract modules, and the two dependencies they need
`draw`, `gva` and `gva_resolve` move across. With them, `reims-vgpu-protocol` gains the two dependencies the absorption always implied: - `reims-vgpu-paging`, because `gva_resolve` is the mapping between the guest page-table walk's statuses and the fail channel's vocabulary, and neither of those crates can carry it. - `reims-vgpu-observe` with `default-features = false` — `Decline` and `Refusal` and nothing else. Taking the vocabulary without the sink is what keeps this crate `no_std`, and it is the dependency the whole layering argument was about. `mipmap` was moved and then moved back: it reads `pixel_format`, which builds two lazy lookup tables through `std::sync::OnceLock`. Splitting the format vocabulary from texel conversion is a real decision — converting bytes is an executor's job, naming a format is not — and it deserves its own commit rather than being smuggled in behind a mechanical move. Counts: replacement crates lib 420 -> 425, support crates 356 -> 351. |
||
|
|
20140505cf |
memory: the guest-RAM bound becomes a crate, so the bound is structural
`runtime/guest_ram.rs` moves to `reims-vgpu-memory` and is re-exported under the path every caller already writes, so no call site moved. The module's claim has always been that nothing above it can name a byte of guest RAM except through an import that is alive and a slice that has been bounds-checked against it. Inside one crate that was a discipline; as a crate it is a compiler's answer. `reims-vgpu-memory` depends on the contract, the paging runs and the observe channel and on nothing else — it cannot see a resource table, a Vulkan handle, a QEMU structure or the device model, so there is no second way to answer "how big is this" and nowhere for a raw pointer and an offset to escape together. Four `#[cfg(feature = "backend-vulkan")]` gates go with it. They were dead-code suppression for the Metal-only build, not a statement about a rail, and in a library crate a `pub` item is never dead — so the footprint's allocation identity, page membership, span and release store are simply public now. That is one fewer place where a `cfg` looks like it is answering "which rail is running". 20 tests move with the module: reims-vgpu 2158 -> 2138, reims-vgpu-memory 20. Feature matrix all arms warnings=0 with the new crate in the support-crate cell; clippy and rustfmt clean. Co-Authored-By: Claude Opus 5 (1M context) <noreply@anthropic.com> |
||
|
|
b4429dd022 |
config: the environment is how a switch arrives, not what a switch is
`reims-vgpu-env` becomes `reims-vgpu-config`, re-exported as `crate::config`, and every call site moves with it. The rename is the point. What the crate owns is a declaration, a total type for each value, membership in `ALL`, and the rule that an override may only *narrow* what this device does and may never widen it. None of that is a fact about environment variables — the environment is the delivery mechanism, and naming the crate after it invites a second mechanism to arrive as a second place the set is written down. A second reader in front of the same declarations is the shape that stays correct. Nothing about the parse, the switches or the narrowing rule changes. 161 call sites, the observe crate's draw-log read, the feature matrix's crate list and the QEMU build script's comment all move together, and the workspace still builds on every arm. reims-vgpu-config 15 tests, reims-vgpu 2158 — both unchanged. Feature matrix all arms warnings=0; clippy and rustfmt clean. Co-Authored-By: Claude Opus 5 (1M context) <noreply@anthropic.com> |
||
|
|
a18d849c4b |
core: Apple's own records reach the model, and nothing is refused for its shape
The Seam 1 exit oracle. `reims-vgpu-wire` captures what the serializer emits,
`reims-vgpu-protocol` lifts those layouts into records and `reims-vgpu-core`
turns them into operations; this is the first test that puts the whole path
against bytes Apple actually produced.
The claim is narrow on purpose: **a record the serializer produced is never
declined for a reason about its shape.** The model may decline an operation
whose ledger row is open, settled as a refusal, or reachable only by selector —
those are contract answers, they are printed, and they are not failures. What it
may not do is call a well-formed record short, over-long or over-counted,
because that is the guest's work lost to a layout this project has wrong. The
device crate's equivalent test found four real divergences exactly that way.
Reading, over 356 captured records (111 of them object lifecycle, which is a
different transaction with no encoder):
resolved 164 · open contract 74 · reachable only by selector 6 ·
settled refusal 1 · wrong shape 0
The six that reach no row are checked rather than counted: the ledger is keyed
by opcode and six of its rows carry none — the blit `withCommand:` selectors
write their command argument *into* the opcode field, and the info rail's
coordinate mapping is a request rather than a record — so the test asserts each
one's selector matches an opcode-less row. Anything else would be an opcode
Apple emits that the ledger has never heard of.
The second test is the one a single decode cannot make. A capture arena is
zero-filled exactly where a guest's ring is not, so a field read *wider* than
the serializer writes agrees with the fixture by accident. It repaints every
unwritten bit of the oracle's measured mask to all-zero and then to all-one and
requires the same resolved operation both times: 56 records have unwritten bits
and none of them moves the model's answer.
The third checks the boundaries, which carry no opcode and so cannot go through
`resolve::operation` at all — and that is exactly why they must not be dropped
from the sweep. A protected begin-segment writes three records and only two are
headers; the envelope's payload is eight bytes and read as a header it would
call itself a render segment. What tells them apart is the measured written
mask, not a field name: a header allocates eight bytes and writes seven, the
payload writes all eight.
Fixtures are not committed, so without them all three stand down as `ignored`
through the same build-time probe the other two suites share.
reims-vgpu-core: 212 unit tests plus 3 fixture tests. Feature matrix all arms
warnings=0; clippy and rustfmt clean.
Co-Authored-By: Claude Opus 5 (1M context) <noreply@anthropic.com>
|
||
|
|
12c179dcb3 |
protocol: the absorption of contract starts where observe does not reach
The end state has `reims-vgpu-protocol` as the one layer that assigns meaning to wire tags, with `reims-vgpu-contract` absorbed into it. The obstacle is not the code: contract depends on `reims-vgpu-observe` for its refusal vocabulary, observe is `std` — a thread and a file — and protocol is `no_std`. So the move happens module by module, observe-free modules first, rather than waiting for a trait split that is not on any seam's critical path. `extent` is the first, and it moves because the next thing that needs it cannot reach it. `reims-vgpu-core` is about to grow the resolved payloads for the blit class, every one of which is copy geometry, and core sees protocol and nothing else. Restating an extent there would put the guest API's mip arithmetic in two crates. `BlockGeometry` travels with it, out of the format table. It is texel geometry — which grid one unit of storage covers is the same kind of fact as how big a mip level is — and the format table is what *answers* it for a given format rather than what it belongs to. Its three call-site families all spelled it `pixel_format::BlockGeometry`, so the move is visible at every use. `alloc` joins protocol for `tight_pyramid_spans`, whose result is one span per mip level and whose length the caller does not know in advance. `alloc` is still `no_std`; the boundary this crate defends is the host, not the heap. Two doc links stayed behind rather than following: `packed_span_estimate` and the `R8/RG8/RGBA8` byte widths live above this crate now, so the text names them instead of linking, and the test spells the three byte counts it needs. This arithmetic takes a byte count, not a format, which is why it could move at all. |
||
|
|
238a88bd68 |
core: the semantic model gets a crate that cannot reach a host
Every accepted guest packet is going to be an ordered transaction with an exact dependency envelope, where the only things that advance semantic state are immutable facts an executor returns. That model has to live somewhere that cannot reach a Vulkan handle, a Metal object, a QEMU structure or a guest-RAM pointer — otherwise "backend-neutral" is a habit, and habits do not survive the first convenient import. So it is a crate, and its dependency list is the claim. `identity` is the names. A guest sends 32-bit numbers that all mean different things, and a `u32` parameter list lets any two be swapped without the compiler noticing — including two namespaces that overlap numerically, where acting on one as the other was measured and could only ever destroy an unrelated object that shared an integer. Each is its own type now. Two of them carry arithmetic the readers used to be trusted to remember. `StampValue` wraps at 32 bits, so "has this point been reached" is the sign of a wrapping difference and not `>=` — a plain comparison parks a channel forever on a stamp the device already wrote, and the correct line was spelled inline at each reader, which is the kind of one line the next person writes as `>=`. `SessionGeneration` saturates rather than wrapping, because a wrapped generation lets a lease from an ancient reset compare equal to a live one and the failure looks like a valid name. `transaction` is the envelope, and the rule that keeps it honest. Five payloads — exec, resource lifecycle, query, present, control — and `Control` is the one that could rot into a bucket. A command may be `Control` only when its contract is a real control operation or an acknowledged no-op; a command whose contract is *unknown* has no class at all and is a typed refusal at ingress, because a transaction the model cannot describe must not be given ordering and completion guarantees it cannot honour. That rule cannot be checked by reading the file, so it is checked against the closure ledger: the classification is total over every packet class the ledger has judged and empty over every one it has not. Which also means the five blocking rows in that ledger are now blocking something concrete — the model refuses those packets rather than accepting them into a bucket. Co-Authored-By: Claude Opus 5 (1M context) <noreply@anthropic.com> |
||
|
|
ebe1e62e9e |
info: eighteen questions, one arm, and no line when the other seventeen go unanswered
The info encoder is the only one that asks rather than tells. Every selector carries a `(reply_buffer_ref, reply_offset)` pair naming the memory the answer goes in, and the guest reads that memory back whether or not anything was written into it. So an info record this device ignores does not cost the guest a command — it hands the guest whatever the reply buffer last held and lets it be read as a heap's host address, a pipeline's imageblock geometry, or a coordinate mapping. A wrong answer travels further than a missing one. `handle_info_record` matched one opcode of eighteen and returned on the rest. That one (`0x1d1`) declines every time, so the whole rail was silent: a boot in which the guest asked eighteen questions and got none read exactly like a boot in which it asked none. Every info record now reaches one report site, `0x1d1` included — its arm logs where the answer *would* go and does not compute one, so it is unanswered like the rest, and routing it through the same site means an arm that starts answering it has to return before reaching here. The reason comes from `protocol::closure` rather than from a list beside the rail, which is what stops the ledger and the runtime drifting apart. Three things it can say, and they are not one slug: the ledger has the query as unresolved (expected — this is the traffic that would resolve it); the ledger judged it implemented, a proven no-op, or refused and this rail has no arm for it (a contradiction, and the line carries what the ledger claimed so a reader can tell which of the two is wrong); or no row exists at all, on a rail whose opcode space is otherwise fully enumerated, which is a decode desync rather than a dropped command. The route counter is per opcode. Ten of these selectors write the identical record and differ only in which kind of object they ask about, so "the guest issued 4 000 info queries" cannot say whether the device owes it a heap address or an imageblock size — and those cost very different things to answer. Which of the eighteen a real guest actually asks is what closes those nineteen unresolved ledger rows, and until now nothing could count them. Co-Authored-By: Claude Opus 5 (1M context) <noreply@anthropic.com> |
||
|
|
4575edf728 |
protocol: what the device owes the guest is one table, and 79 rows of it are blank
The replacement architecture cannot declare its vocabulary exhaustive until
"exhaustive" is a measurement. Today it is a claim each rail makes separately:
every executor can point at an arm for the records it has seen, none of them
can say what happens to the records it has not, and the same operation reads as
a deliberate no-op in one rail's comment and a dropped command in another's
with nothing able to compare the two.
So this is the measurement. `reims-vgpu-protocol` is the first layer allowed to
say what a wire tag *means* — wire says which bytes a record is made of and is
deliberately unable to say what is owed in return — and it depends on wire
alone, `no_std`, so the compiler keeps it that way.
`closure::LEDGER` carries one row per decodable operation and exactly one of
four outcomes: implemented, no-op on a *named* capability cell, unsupported
with the refusal it lands on, or unresolved. Two readings are deliberately
unspellable. "The current workload does not issue it" is not an outcome,
because a workload is not a contract; "the old backend drops it too" is not an
outcome, because the old backend is what is being replaced. Everything that
would have been either is unresolved, which is honest and which counts.
The row set is not curated: the wire manifest enumerates the serializer's
selectors from the Objective-C runtime, and the tests require a row for every
`(class, opcode)` it records and every selector it covers without a fixed
opcode. A new selector stops the tests until someone records what the device
does about it. The converse needed an escape and gets a named one —
`class_copyMethodList` does not walk superclasses, so the residency pair the
encoders inherit is real and invisible to the manifest; `BASE_CLASS_OPS` names
those four rather than letting "absent from the manifest" mean "does not
exist".
The first reading, over 195 operations:
94 implemented, 21 proven no-op, 1 refused, 79 unresolved
Root 10/28, Render 32/85, Compute 13/34, Blit 5/28, Info 19/20
The info rail is the finding. Eighteen queries reach an encoder that decodes
one of them, and that one always declines — the guest hands over a reply buffer
and reads it back regardless, so every unanswered query is a wrong answer
rather than a dropped command. `getTileDimensions` is the same shape one rail
over. Eight of the eleven object destroys have no per-kind registry to retire.
Both compute fence opcodes are guest-stated ordering nothing executes.
No behavior changes here. The ledger is what the remaining seams reduce.
Co-Authored-By: Claude Opus 5 (1M context) <noreply@anthropic.com>
|
||
|
|
a0205804bf |
deps: metal2vulkan reflection reaches version 41
Bumps the pinned rev from `42a7998` to `9e0e99a`, 40 commits. `REFLECTION_VERSION` goes 32 -> 41, and `census_reflection_wellformed` already compares against the constant this crate was built with, so the skew a stale cached reflection would cause names itself on the fail channel rather than being bound. # The one compile break `ShaderReflection` gained `max_work_group_size: Option<u32>` — the `[[max_total_threads_per_threadgroup(N)]]` ceiling the entry was compiled under. Five hand-built fixtures name every field, so each gets `None`. Nothing on the hot path reads it yet: it exists so a consumer choosing a dispatch shape can ask the bound rather than discover it as a translate refusal. That refusal is new and is the one behavior change a guest can reach. Translation now rejects a `kernel_local_size` whose product exceeds the ceiling, so an over-wide threadgroup becomes a typed translate failure instead of a dispatch nobody checked. `translate_kernel_air` is where it surfaces. # Two new descriptor kinds this device deliberately does not adopt `SynthesizedNullTexture` and `SynthesizedReadSampler` are descriptors the translator binds so `air.get_null_texture_*()` and `air.get_read_sampler()` have a legal SPIR-V type. No Metal argument stands behind either, and reflection reports them only when the finished module still declares one. They are **not** added to `is_texture_kind` or `reflected_sampler_binding`. Their `metal_index` is a synthetic ordinal counted per placeholder, not a `[[texture(n)]]` or `[[sampler(n)]]` index, so admitting them to either lookup would let placeholder 0 answer a query about Metal texture 0 — a wrong descriptor with no error anywhere. `texture_shape_for_binding` gates on `is_texture_kind` for exactly this reason and keeps answering `Absent` there. Nothing had to be taught to bind them because the binding was never reflection's to describe: `ShaderVariant::of` and `used_binding_absent_from_layout` both walk `declared_binding_numbers` over the module itself, and `runtime::compute_exec` provisions a neutral sampler and a neutral sampled image for every binding of those classes the guest left empty. The module was already bindable before reflection could name these; reporting them changes what can be said about the module, not what is bound into it. `unsupported_vulkan_resource_kind_name` therefore leaves both at `None`. That list is for shader work with no provisioning path, and these have one. # Also upstream, needing nothing here `spirv_val_bytes` and `air_to_sanitized_ll` stop writing fixed file names into a caller-supplied scratch directory, which is what made a `spirv-val` failure possible in a module that was fine when two processes shared one directory. The boot scripts' scratch dir is unchanged. Verified: default (Metal) 1407, `backend-vulkan` 2228, both arms 2228 — serial, 0 failed. Integration through MoltenVK: `vk_engine_parity` 55, `vk_engine_compute` 16, `vk_engine_batch` 15, `reflection_adoption` 4, `reflection_probe` 1. fmt clean. `clippy --features backend-vulkan --all-targets -D warnings` reports seven dead-code and unused-import errors; a detached worktree at the parent commit reports the same seven, so they are the documented baseline and not this change. Not run: conformance, and no live guest boot. This bump carries no guest-visible translation change on the paths above, but the Vulkan rail has not been driven by a real guest against this rev. |
||
|
|
07cfe578c5 |
metal2vulkan: the translator moves to 42a79985, which reflects fewer bindings
Forty commits upstream. The ones this device can see are in reflection and emission: bindings no instruction reads are no longer shipped, a read that never samples no longer carries a sampler, each reflected resource is named once, the address table is read off the module rather than predicted, and a handful of emission decisions stop following hash-map iteration order, so a translation is now byte-stable across runs. The rest is internal — one dominator core instead of three, a revision-keyed structurizer cache, and typed declines where a phase used to report only its first contract break. Our consumed surface is unchanged. Checked on all three arms (Metal, Vulkan, both), 1341 lib tests and every integration suite serially, including the MoltenVK engine suites that bind reflected static samplers and storage buffers. No live guest or conformance run yet. |
||
|
|
2de1663909 |
metal: the rail presents into the host window, and QEMU's display is no longer the arm64 screen
The Metal rail was the last thing on this device still drawing through QEMU's Cocoa display. That made the one measurement a `--backend both` binary exists for — the same guest stream through native Metal and through MoltenVK, with one variable changed — a comparison across two different display stacks: two compositors, two present cadences, two input paths, and a frame that differed between the rails with no way to say which layer changed it. So the Metal rail gets a presenter of its own. `backend/metal/window.rs` is a `CAMetalLayer` on the window's own `NSView` and a one-triangle render pass that fits the published frame into the next drawable; it is reached through the six `Backend::window_*` methods the previous commit introduced, so the window itself learns nothing about which rail it is talking to. Both rails now fill one window, one event loop, one viewport and one input path. Three decisions worth naming: * **CPU bytes, always.** This rail retains no texture past the encode that produced it, so there is no resident for a present to name and `WindowResident` still carries no Metal variant. That is not a step down: the Cocoa path read the same frame back through host memory before this window existed, so nothing here adds a copy. * **A render pass, not a blit encoder.** The frame has to be aspect-fitted and `MTLBlitCommandEncoder` cannot scale. The viewport is `aspect_fit` — the same function the pointer path maps through, so presentation and input stay one unit — and the pass's clear colour is the letterbox. * **A sublayer, not the view's layer.** `setLayer:` makes a view layer-hosted, and winit's view is already layer-backed; handing AppKit's own layer over puts two owners on one object. Hosting underneath is also what MoltenVK does for a `VkSurfaceKHR` here, so the two rails end up presenting through the same kind of layer. `addSublayer:` retains, so the presenter removes itself on drop — without that, detaching leaves the last frame frozen on a live layer. `host-window` no longer implies `backend-vulkan`; it names the windowing stack and nothing else, and each rail's surface half travels with that rail's feature. The meson `metal` arm builds it, and `vm/boot-arm64.sh` now chooses `-display none` for the device rather than for one of its rails. Four raw-Metal calls this needed are added checked, in the module that exists for exactly that: `newLibraryWithSource:` (metal-0.33 asserts on a nil library, inside a frame the event loop calls, where a panic aborts the process), `newFunctionWithName:`, `newRenderPipelineStateWithDescriptor:`. The NSError text walk the first two need was already written twice and is now written once. Verified live, arm64/macos-13/reims-vgpu-mmio, `REIMS_VGPU_RAIL=metal` on a `--backend both` build: `display=reims-host-window backend_rail=metal`, the window opens at 1920x1080, 144 frames published across the boot with `dropped=0`, and no `metal_window_*` refusal in the whole run. The guest settles to `draws=0` at an idle desktop and a QMP pointer move brings it straight back (`draws=42`) with the window publishing fresh frames — so the quiet is an idle guest, not a wedged one. The picture itself is checked by rendering, not by looking: this host's display was asleep and every screen capture came back black, so the two new tests run the presenter's real encode into a readable texture. A 2x2 source into a 2x2 target lands every destination pixel centre on a source texel centre, so orientation is an exact comparison rather than a tolerance; a 2x1 into a 2x2 proves the fit and that the bars are the clear. Both would have caught a flipped `uv` or a viewport that quietly covered the whole target — neither of which any counter reports. Also: feature matrix green on all five cells, `cargo test` green on metal, vulkan+host-window and both+host-window (1381 / 2179 / 2260 lib tests). |
||
|
|
1bf7f90ce5 |
contract: the protocol vocabulary cannot name a backend, and now the compiler says so
Component: crates/reims-vgpu (contract, runtime/compute_exec) plus the new crates/reims-vgpu-contract. Pathway: all three. Structural; no guest-visible behavior and no rail-specific term. Contract: the catalogue's F0 item asks for a backend-neutral semantic vocabulary — decoded enums, descriptors, geometry, pixel formats, pass actions, page arithmetic, exact refusal values — with Vulkan handles, SPIR-V, memory placement, descriptors, queue families, image layouts and host capability policy kept out of it. `contract/`'s own doc already said "pure data and pure functions only — no guest state, no GPU, no QEMU", and every module in one crate could reach every other, so the rule held only while someone was reading. Owner: the crate graph. Behaviour changed: none at runtime. `src/contract/` becomes `reims-vgpu-contract`, depending on the wire views, the paging walk, and the decline vocabulary — nothing else is in scope, so a contract check cannot name an `ash` type, a Metal object, a QEMU type or this device's state by accident. It is re-exported as `crate::contract`, so no call site moves. The move produced one thing the doc could not. `Extent3` is shared between this decoder and the backend it dispatches through, and `compute_exec` carried an inherent `impl Extent3` whose two constructors refuse with `ComputeStatus` and read a decoded `Size3` — device vocabulary the contract crate cannot name. The orphan rule rejected it. They are now `extent_from_wire` and `extent_from_indirect` free functions in the decoder that owns those types, with the same arithmetic and the same refusals; the extent type stays shared and only the narrowing that produces it from this device's wire moved. `iosurface_pages`' fixtures took the arm64e page size from `model`, which re-exports the shift from `contract::gva` and widens it locally for its own address arithmetic. The test now derives the same `u64` from the same shift on this side of the boundary, so the two still cannot disagree in value. Test: no new behaviour, so no new regression test; the counts are the claim. 2274 tests in `reims-vgpu` before, 2165 plus 109 in `reims-vgpu-contract` after — the same 2274, none dropped or silently cfg'd out. The feature matrix's support-crates cell counts the new crate too. Verified: `cargo test -p reims-vgpu --no-default-features --features backend-vulkan,host-window -- --test-threads=1` (2165 + 97, 0 failed); `cargo test -p reims-vgpu-contract -p reims-vgpu-env -p reims-vgpu-observe -p reims-vgpu-paging -- --test-threads=1` (109 + 13 + 45 + 36, 0 failed); all three main clippy arms plus `-p reims-vgpu-contract`, all with `-D warnings`; `scripts/feature-matrix/feature-matrix.sh` all cells PASS; `cargo fmt --all` and `--check`; the rustdoc link pass, whose unresolved-link multiset is byte-identical to the parent's; a release staticlib build carrying no test log path. Not verified: no VM boot and no conformance battery were run. `reims-vgpu-wire`'s twelve oracle-fixture failures remain inherited debt, unchanged and untouched. |
||
|
|
4fdd3d6efc |
observe, env: make the layering below the device a fact the compiler checks
Component: crates/reims-vgpu (observe, env, contract, runtime) plus the new
crates/reims-vgpu-env and crates/reims-vgpu-observe. Pathway: all three.
Structural; no guest-visible behavior and no rail-specific term.
Contract: the catalogue's F0 item asks for a backend-neutral vocabulary — a
protocol layer that can name a refusal without naming a backend, with
observability and configuration extracted as behaviour-free support beneath it.
`observe`'s own module doc already made the claim in prose ("the sink must sit
somewhere `translate/` and `caps/` can name their reason type without depending
on `runtime/`"), and nothing checked it: every module in one crate can reach
every other, so the direction held only as a habit.
Owner: the crate graph. Behaviour changed: none at runtime. `env.rs` becomes
`reims-vgpu-env`, and `observe`'s sink, decline vocabulary, `Emit` builder, slug
registry, driver watch, footprint and phase clock become `reims-vgpu-observe`.
Both are re-exported under the paths callers already write — `crate::env::…`,
`crate::observe::fail(…)`, `crate::observe::Decline` — so no call site moves. A
layering change that also rewrote three hundred call sites would be two changes
reviewed as one.
`ladder` and `panic` stay in `reims-vgpu`: both name `runtime` types, which is
precisely the dependency the split is drawing a line under.
The split immediately produced one thing prose could not. `contract::gva_resolve`
carried `impl Refusal for ResolveStatus`, with both the trait and the type now
foreign to `reims-vgpu` — an orphan-rule error, and an honest statement that
`reims-vgpu-paging`'s walk status and `reims-vgpu-observe`'s vocabulary meet in
neither crate. It is now `walk_refusal(&ResolveStatus) -> Option<&'static str>`
with the same twelve slugs, and `MemError::slug` delegates to it exactly as it
delegated to the impl.
Test-only surface: `FailCapture`, `fail_log_path`, `forget_all_latches` and the
slug-collision panic are used by tests compiled separately from the crate that
defines them, so they are gated on `any(test, feature = "testing")` and
`reims-vgpu` turns the feature on from `[dev-dependencies]`. Verified that the
shipping artifact does not: `cargo tree -e features` shows `testing` only under
dev-dependencies, and the release staticlib contains `/tmp/reims-vgpu-fail.log`
once and no per-pid test path, so the background writer and the flood detector
are the ones that ship. The writer's flood machinery is `cfg`'d to the
configurations that use it rather than given an `allow(dead_code)`.
Test: no new behaviour, so no new regression test. The existing suite is the
evidence, and the counts are the claim: 2332 tests before the move, 2274 in
`reims-vgpu` plus 45 in `reims-vgpu-observe` plus 13 in `reims-vgpu-env` after —
the same 2332, none dropped or silently cfg'd out. `scripts/feature-matrix`
gains a support-crates cell so a future module move does not read as the
emptied-arm loss its own warning is about.
Verified: `cargo test -p reims-vgpu --no-default-features
--features backend-vulkan,host-window -- --test-threads=1` (2274 + 97, 0
failed); `cargo test -p reims-vgpu-env -p reims-vgpu-observe -p
reims-vgpu-paging -- --test-threads=1` (13 + 45 + 36, 0 failed); all three main
clippy arms plus `-p reims-vgpu-observe --features testing` and the bare arm,
all with `-D warnings`; `scripts/feature-matrix/feature-matrix.sh` all cells
PASS; `cargo fmt --all` and `--check`; the rustdoc link pass, which loses nine
pre-existing unresolved links and adds none; a release staticlib build.
Not verified: no VM boot and no conformance battery were run.
`reims-vgpu-wire`'s oracle-fixture tests fail 12 cases when the gitignored
fixtures are present. That is inherited debt, not this change: the same 12 fail
identically on the parent, run from a separate worktree with
`REIMS_WIRE_FIXTURES_DIR` pointed at the same fixtures. Nothing here touches
that crate.
|
||
|
|
9fd39f56f8 |
compute: an exact-thread launch reaches the device as the regions that tile its grid
Component: crates/reims-vgpu — runtime::compute_exec, backend::vulkan::engine
(types, exec_compute, caches, compute_validation), runtime::spirv_bind,
runtime::m2v_cache, env. Pathway: x86 macOS / Linux Vulkan, plus the shared Rust
both arm64 pathways compile. Rail: none exercised; see NOT VERIFIED.
Contract
metal2vulkan is repinned d98eae7 -> 47009b2, whose reflection schema v30 replaces
surplus-invocation culling with exact boundary-region decomposition. The consumer
contract for a translated compute kernel becomes:
- KernelDispatch::ThreadsPushConstant { offset } is gone. The dynamic form is
ThreadsDynamic { offset }; ThreadsFixed { threads_per_grid } and Workgroups
remain, and push_constant_range() now answers Some for ThreadsFixed at the
translator's default offset.
- The per-dispatch payload is 48 bytes, twelve packed u32: logical thread grid,
thread base, threadgroup base, logical threadgroup grid. It was 12 bytes.
- ThreadsDynamic and ThreadsFixed require plan(nominal_local_size,
dynamic_threads_per_grid), which returns up to eight regions, each with its own
local_size, group_count, thread_base and threadgroup_base.
- Every returned region must be issued, each against a pipeline specialized to
its exact local size through the three KERNEL_LOCAL_SIZE_SPEC_IDS, preceded by
that region's payload written at the reflected offset. Workgroups bakes plain
local sizes and is the only single-pipeline, single-dispatch form.
- meta::TextureFormat gains Rg32f, SPIR-V ImageFormat ordinal 6.
Owning invariant: an exact-thread launch missing its regions is unrepresentable.
ComputeDispatch carries the launch form, so regions cannot be dropped between the
reflected contract and the recorded command buffer.
Behavior
ComputeRequest::{grid, threads_per_grid_push} become ComputeRequest::dispatch:
ComputeDispatch, either Workgroups([u32; 3]) or Regions { push_offset,
threadgroups_per_grid, regions }. Both forms answer threadgroups_per_grid() and
push_constant_range() uniformly, so census, zero-work validation and pipeline
layout creation stay answerable without walking the regions.
Why it matters: issuing an exact-thread module as one rounded-up dispatch runs
invocations past the guest's thread count, and issuing only its interior region
drops the guest's boundary threads. Neither shows up as an error — both return,
with the wrong bytes in the guest's buffer.
ComputePipelineKey gains local_size: Option<[u32; 3]>, so one exact-thread module
yields one pipeline per distinct region workgroup size, each created with a
VkSpecializationInfo over the translator's spec ids. The cache stays content-keyed
on that size, so a steady dispatch shape pays no create after its first launch.
exec_compute binds descriptors once, then per region binds that region's pipeline,
pushes its payload and dispatches its group count. No barrier separates the
regions: one Metal dispatchThreads orders nothing among its own threads, and
consecutive Vulkan dispatches without a barrier carry the same permission to
overlap.
ComputeDispatchPayload names the twelve-word payload once, so the field that
carries it and the byte range the layout declares are the same width by
construction; an inline const assertion holds that width against the translator's
own published size.
Refusals are typed rather than clamped. kernel_dispatch_launch declines
GridOverflow, PushRangeUnavailable and PlanRefused; the validator gains
NoDispatchRegions and ZeroDispatchRegion, both of which are guest work the device
would otherwise silently drop.
spirv_bind maps TextureFormat::Rg32f to ImageFormat::Unsupported(6), the format's
own SPIR-V ordinal. The device names no two-channel 32-bit float storage surface
in either StorageImageSelector or TexelLayout, so this is a typed refusal rather
than an invented mapping, and it round-trips through raw/from_raw unchanged.
REIMS_VGPU_AIR_CAPTURE writes each translated AIR blob to /tmp/reims-vgpu-air/ as
<stage>-w<spirv_words>-<air_digest>.air. The word count is the join a translator
handover needs: a driver quarantine line and a validator refusal both quote it,
and neither can name the AIR that produced it. The capture runs after the
translation it describes and every write is best-effort, so a capture boot makes
the same guest-visible decisions as an ordinary one.
Carried repairs, red before this change and not caused by it
- pipeline_resolve and draw/tests built ShaderReflection without
descriptor_layout, kernel_dispatch, runtime_sampler_specializations or
runtime_storage_image_specializations, so the lib-test target did not compile.
The field set is byte-identical between the two pinned revisions, which is what
proves this was not the bump.
- engine::retire_guest_import tripped clippy::question_mark.
- mapper bound `alias` in a pattern used only under cfg(backend-vulkan), so the
Metal arm failed unused_variables. Rebound inside the cfg blocks rather than
silenced with an allow.
- tests/vk_engine_compute.rs::assemble_spvasm invoked spirv-as with no
--target-env. A current SPIRV-Tools defaults to SPIR-V 1.6 while the engine
validates under Vulkan 1.2 semantics, so 12 of 16 compute tests failed on the
module header version before reaching any behavior. Pinned to vulkan1.2, the
device's stated baseline.
cargo fmt also reformatted pre-existing unformatted code in eight files this
change does not otherwise touch; those hunks are whitespace-only.
Verification actually run
Host: Linux x86_64. Backend: Vulkan. No VM.
- Focused: exact_thread_regions_tile_the_logical_grid_exactly walks every thread
coordinate the planned regions launch and requires the multiset to be exactly
the logical grid — nothing outside it, nothing twice, nothing missing — across
an every-axis boundary, a single-axis boundary, and exact multiples. Four more
cover the whole-workgroup record, the absent push range, the refused u32
overflow, and the reflected offset.
- Red-witness proxy: truncating kernel_dispatch_launch to one region makes that
test fail on unlaunched threads. The probe was edited out the same way it was
edited in.
- compute_m2v_float_mul4_add3_known_result runs a real m2v-translated kernel
through the new path on this host's GPU: nominal local size 64, eight threads,
one boundary region specialized to a workgroup size of 8, and the known CPU
formula holds.
- cargo test -p reims-vgpu --no-default-features
--features backend-vulkan,host-window -- --test-threads=1:
2325 + 4 + 4 + 1 + 15 + 16 + 55 + 2 pass, 0 fail, 2 ignored.
- All three clippy arms with -D warnings: clean.
- scripts/feature-matrix/feature-matrix.sh: all arms PASS.
- cargo fmt --all then --check: clean.
NOT verified
- No VM boot, on any rail or pathway. The x86 macOS / Linux Vulkan conformance
battery has NOT been run for an identified control or for this candidate, and
the compute dispatch change is guest-visible on that pathway. This commit does
not meet that gate; it is stated debt, not a clean result.
- Neither arm64 pathway was exercised. Metal-direct and MoltenVK are unproven.
Metal tests only cross-compile from this host; they were not run.
- The pinned revision is 47009b2, but the offline translator experiment that
exonerated the bump for the fragment-code-size boot failure was run against
08970ca. Seventeen upstream commits sit between them, including a nesting
structurizer that replaces state-machine flattening for reducible control flow,
which is plausibly load-bearing on emitted code size. That measurement has not
been repeated at the pinned revision.
- reims-vgpu-wire layout-truth tests were skipped for want of their gitignored
fixtures. Wire layout was not verified.
Co-Authored-By: Claude Opus 5 (1M context) <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01Mhai7zvwkh47SQ3pY6vSS6
|
||
|
|
4ed6cfd511 | ⬆️ Bump vendor locks | ||
|
|
ea35df4daa |
metal2vulkan: bump pin to nkhaooat fork with float/phi parser fixes
Pin to nkhaooat/metal2vulkan commit ccd0e3a which includes 5 LLVM IR parser bug fixes that caused shader translation failures on macOS Ventura x86 guests: 1. f0x hex f32 literal parsing (LlValue::Float32Bits) 2. Decimal float to Half type conversion 3. NaN/Inf special literals (+qnan, -qnan, inf, -inf, snan) 4. Phi incoming typed vector constants (parse_phi_incoming_value) 5. phi_parse_error diagnostic field on TirInst Verified on 7-hour YouTube stress test: 0 phi errors, 0 m2v refusals, 0 draw skips, 0 device_lost, 0 VRAM crashes. Top bar blur effect works. Stable 28 fresh draws/sec at 27.3 Hz for entire run. QEMU RSS stable at 16.8GB with no leak. Previous pin: steelbrain/metal2vulkan 9ff25050 (v22 descriptor layout) New pin: nkhaooat/metal2vulkan ccd0e3a (v22 + 5 parser fixes) |
||
|
|
26a617bbbe |
Merge origin/master into fix/vram-alias-lifetime
Resolved conflicts in: - qemu/abi.rs: kept our PageAliasCensus and ReimsVgpuMapPagesFailure layout tests - drain/census.rs: kept our note_drain_tranche signature with host parameter (needed for emit_alias_pressure which calls host.page_alias_census()) Master brought in PRs #53 (BC/cubemap/depth contracts), #54 (stability-fixes-v7: integer RT, clear-only, topology, pipeline-cache, census refactor), #55 (host window input capture, cargo fmt). |
||
|
|
f334d628ea |
Capture host desktop shortcuts for the host-owned window
The host window forwarded no modifier chord the desktop had claimed for itself. On the session this was recovered from, the compositor held 63 Meta/Alt/Ctrl combinations as global shortcuts — bare Meta, Meta+A, Meta+V, Meta+Q, Meta+W, Meta+T, Meta+0..9, Alt+Tab among them. A macOS guest reads host Meta as Cmd, so that set is close to the guest's entire shortcut surface. The keys were consumed before any client saw them, so `input_map::keycode_to_evdev` — which already mapped every modifier to the correct evdev code — was never reached. The mapping table was never the defect. Component: crates/reims-vgpu/src/host_window. Pathway: x86 macOS / Linux Vulkan, PCI (reims-vgpu-pci). Rail: macos-13. Also implemented, not exercised: X11 and macOS hosts (see below). API contract implemented ------------------------ keyboard-shortcuts-inhibit-unstable-v1: creating a `zwp_keyboard_shortcuts_inhibitor_v1` for a (surface, seat) obliges the compositor to forward every key event from that seat to that surface instead of acting on its own shortcuts; destroying it restores them. The compositor confirms with `active` or declines with `inactive`, so "the request was sent" and "the shortcuts are ours" are different claims and are not conflated — `set` round-trips and reports a decline as a typed refusal. Wayland `wl_keyboard.leave`: the client must treat all keys as released. The windowing library's Wayland backend delivers only a focus-loss notification and an empty modifier set, where its X11 backend synthesises per-key releases. Nothing downstream closed them, so a key held when the compositor claimed a chord stayed down in the guest for the rest of the boot — and every later keystroke was then read by the guest as modified. That compounding is why the window looked like it forwarded no modifiers even for keys that did arrive. X11: `XGrabKeyboard(dpy, win, True, GrabModeAsync, GrabModeAsync, CurrentTime)` redirects key events to the grabbing window and overrides the window manager's passive grabs. Async on both modes deliberately: a synchronous grab would need `XAllowEvents` per event, and freezing the server's keyboard from the process that is also presenting is how a desktop becomes unrecoverable. Released in `set` and again in `Drop`, because a leaked grab outlives this process and leaves the whole session unable to type. macOS: `NSApplicationPresentationDisableProcessSwitching` plus `DisableHideApplication` is the whole of what an unprivileged application may claim. The window server keeps a reserved set regardless; taking it needs a `CGEventTap` holding Accessibility permission, which cannot be obtained programmatically. That arm therefore reports `window_capture_partial still_host_owned=window_server_reserved_chords` once rather than presenting itself as full capture. Owning invariants ----------------- `host_window::keyboard::HeldKeys` is the only thing that can emit a key-down, so "every down is closed by an up" is a property of the type rather than an obligation re-assembled at each call site. Release is total: releasing a key that is not held emits nothing, because there is no down for it to close. `host_window::keyboard::GrabState` is the focus-and-latch machine; capture is wanted exactly when the window is focused and the operator has not latched a release. The two travel as one `KeyEffect` because applying half of a transition is the defect itself — a grab dropped without releasing held keys strands a modifier in the guest, and keys released without dropping the grab strands the operator outside their own desktop. Behavior changed ---------------- Key events now route through `Keyboard` rather than straight to the sink. Focus loss releases every held key. Capture engages on focus and is handed back on focus loss and at teardown. Ctrl+Alt+Esc releases the grab, is consumed rather than forwarded, releases the modifiers that formed it, and re-arms when focus returns. Key repeats still reach the guest unchanged — the guest owns autorepeat and no decoded term asks to filter it. The escape hatch is deliberately Ctrl+Alt+Esc and requires both a Ctrl and an Alt, which keeps it clear of the guest's own Force Quit: Cmd+Option+Esc reaches the host as Meta+Alt+Esc, carries no Ctrl, and is forwarded whole. `host_window::capture` is a `cfg`-selected platform module rather than `cfg` blocks inside one function body, because blocks make which arm is the tail expression depend on the target — the same source is then idiomatic on one host and a lint failure on another. Every dependency added is already in the graph as a transitive of the windowing crate at the same version; this only names what is now called directly. Verification actually run ------------------------- Focused regression: `host_window::keyboard` — 14 tests. Demonstrated failing without the repair by neutering `HeldKeys::release_all` in place and restoring it: `focus_loss_releases_every_held_key`, `shutdown_releases_held_keys` and `ungrab_chord_releases_grab_and_is_not_forwarded` fail; the other 11 pass. Plus 2 in `host_window::capture`. Full `reims-vgpu` suite serially on `backend-vulkan,host-window`: 2246 lib + 93 integration, 0 failed. Feature matrix: all arms PASS. Doc link pass: 5 warnings, all pre-existing, none in the new modules. `cargo fmt --all --check` clean. Clippy `-D warnings`, all clean: aarch64-apple-darwin/backend-metal; host/backend-vulkan,host-window; x86_64-unknown-linux-gnu/backend-vulkan, host-window; and aarch64-apple-darwin/backend-vulkan,host-window. That fourth arm is not in the required matrix and is the only one that compiles `target_os = "macos"` together with `host-window` — it caught a real error in this change that all three required arms reported clean. The required matrix does not cover the arm64 macOS window pathway. Live: boot 1, macos-13, x86/PCI/Vulkan, host window, Wayland session. One clean log (`vk_caps` = 1). `window_capture_mode mechanism=wayland_shortcuts_inhibit` at t=7 — the manager and a seat bound over the window's own display connection and the foreign surface pointer was accepted. Zero FAIL lines in the whole log. Presentation unaffected: ~28.5-30.8 Hz steady, busy_acquire=0, no swapchain churn after the initial recreate, no panic. The operator drove that window and confirmed the modifiers reach the guest. Not verified ------------ Boots 2 and 3 were still in flight when this was committed; only boot 1 is reported above. One green boot does not establish a rate. The `window_capture_engaged` census does not appear in an unattended boot, because capture arms on focus and nothing focuses the window. So the log proves the capture was constructed against the live compositor, not that an inhibitor was created and accepted — that link rests on the operator's interaction, which is one person, one session, one rail. No automated probe drives the host window's keyboard: QMP input bypasses this path entirely and exercises none of the changed code. The stuck-modifier repair is covered by unit tests over the state machine, not by a live measurement. The X11 and macOS arms compile and are lint-clean; neither has been run. No other rail was booted, and the arm64 pathways were not exercised at all. Co-Authored-By: Claude Opus 5 (1M context) <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01USFNnwBSxQBohnC19FZjLT |
||
|
|
b35148412b |
metal2vulkan: bump pin to 9ff25050 (descriptor specialization + binding collision fix)
Update metal2vulkan from 8b78eac to 9ff25050 (16 commits, Aug 20-22): Upstream changes: - Fix descriptor binding band collisions (commit 7cf240e): replaces overlapping texture/sampler bands with checked non-overlapping bands. Textures [32,160), samplers [160,192) — no more collision at binding 72. - Specialize runtime sampler state structurally (04666b0) - Specialize runtime storage image formats (547a59d) - Specialize embedded runtime storage images (f3e3763) - Add caller-selected descriptor layouts (12abadb) - Make AIR vector layout authoritative (adb19e2) - Make exact kernel grids safe by default (9ff2505) - Close remaining AIR layout seams (d7d64f5) Adapter changes in reims-vgpu: - reflected_storage_image_format: map 6 new TextureFormat variants (R8, Rgba8, R16ui, R32i, Rgba32i, Rgba32ui). Integer-only formats (R16ui, R32i, Rgba32i) map to Unsupported with typed decline reasons. - ShaderReflection construction sites: add 4 new fields (descriptor_layout, kernel_dispatch, runtime_sampler_specializations, runtime_storage_image_specializations) to all 5 test construction sites. - widen_sampled_bands test: rewritten for non-overlapping bands. SAMPLED_TAIL_WIDEN_OFFSET is now 0; the widen is an identity pass. Test asserts bindings are unchanged rather than return count. All 2200 lib tests pass. QEMU builds clean. |
||
|
|
775fdc659e |
vgpu: bump metal2vulkan pin to 22358a143 (compositor struct-layout fix)
Component/pathway: metal2vulkan dependency pin. Affects every pathway that
uses the translator's MTLB->AIR->SPIR-V encode; verified on x86 / Vulkan.
What changed: bump the pin from 8b78eaca to 22358a143. That range is exactly
one translator commit -- "Advance struct members by their vector allocation
size" -- which corrects the AIR struct-member stride so bytes following a
3-lane RGB vector in a compositor fragment shader are no longer corrupted.
The device code is unchanged; the bands (texture 32, sampler 64, colorinput
96), the 9 TextureFormat variants, and the ShaderReflection API are identical
between the two pins, so the pin is the whole diff.
Why: the guest's WindowServer compositing showed heavy rendering artifacts and
transparent popups. The struct-stride corruption was the cause of the heavy
class.
Verified: driven x86/PCI boot, macos-26 rail (reims-vgpu-pci, --testing).
Heavy artifacts gone; WindowServer reached the desktop and composited (Apple
menu, Spotlight, dock all driven via QMP). Fail channel empty at idle; 0 guest
kernel panic; 0 storage/binding-band refusals (no fmt_storage / bind=484).
Compiles clean lib+tests under backend-vulkan,host-window; the widen-band unit
test passes at this pin.
Not verified / not fixed:
- Residual: the Apps/Apple menu still renders body-as-shadow-only and dock-icon
hover produces artifacts. Device signature is frag_declared_descriptor_unbound
on tex0 at binding=320 (fragment texture 0, the menu's vibrancy backdrop) ->
1x1 neutral fill. Tracked for a follow-up device-side decode/bind
investigation; not addressed here.
- Going forward in the translator is blocked: 2725340 ("Bind all reflected
texture aliases") cleared the descriptor-unbound counters but did not change
the popups and regressed WindowServer (crash to login screen); the
sampler/storage-specialization commits beyond it reintroduce the storage-band
refusal.
- clippy -D warnings is not clean on this host: 51 chunks_exact_to_as_chunks
lints from a newer-than-pinned local toolchain (rust 1.98), all pre-existing
(this commit changes no Rust source), none introduced here.
- Other pathways not booted: arm64/Metal, arm64/Vulkan, and the discrete-host /
import-off copy rails.
|
||
|
|
76258b3e2c |
⬆️ The translator grew a stage and five reflection fields, so the pin moves and the shapes follow
Component: crates/reims-vgpu, Vulkan pathway (the metal2vulkan dependency and its two reflection consumers). metal2vulkan moves from 1b013834 to 8b78eaca, its current head. The bump is not source-compatible, and all but one of the breaks are in fixtures: - `reflect::ShaderStage` gained a `TessellationEvaluation` variant. The only match on that enum in this crate is `log_folded_function_constants`, whose stage tag is now `te` alongside `v`/`f`/`k`. That is the single behavioral edit; every other consumer holds the type whole rather than its ordinal, so nothing else had to move. - `reflect::ShaderReflection` gained `argument_buffer_fields`, `depth_qualifier`, `tessellation`, `implicit_imageblock_attachments` and `fragment_imageblock`; `reflect::ResourceBinding` gained `footprint` and `stage_input_location`; `reflect::DescriptorLocation` gained `count`; `meta::TextureShape` gained `array_length`; and `meta::FunctionConstant` gained `abi_type_encoding`. The three fixture builders in `runtime/spirv_bind.rs`, `runtime/draw/tests.rs` and `runtime/m2v_cache.rs` construct these structs literally, so each names the new fields at its inert value. The fixture descriptors are scalar resources, which is why their `count` is 1 rather than a capacity. Two newly-published facts are read by nothing yet and are left that way rather than half-wired. `DescriptorLocation::count` now carries the real capacity of a texture-handle array, while the layout built from reflection in `backend/vulkan/engine/caches.rs` still asks for one descriptor per binding; that is the pre-existing behavior, not a regression from this bump, because the field did not exist to honor before. `ResourceBinding::footprint` likewise gives an audited byte size where the narrowing rail currently reasons from `extent`. Both are worth a change of their own, with a test that fails without it. Verified: all three clippy arms clean under `-D warnings` (backend-metal on --target aarch64-apple-darwin, and backend-vulkan,host-window on the host and on --target x86_64-unknown-linux-gnu); `scripts/feature-matrix` passes every arm at warnings=0 with lib=1974 and all_targets=2063, both unchanged across the bump; the backend-vulkan,host-window suite is green run serially, 1974 lib tests plus the integration binaries, 0 failed. Not verified: no live VM boot was run for this change. A driven macos-26 boot was observed during the session with 264 of 264 async translates reporting ok and no tier-retry trace, but its fail log held two boots whose builds could not be told apart, so that reading is not claimed as evidence for this pin. The backend-metal test functions did not run at all — no Apple host — and the wire layout fixtures are absent from this checkout, so both report as untested rather than as passing. The new `te` stage tag has no observed firing: no shader in those boots carried runtime function constants. Co-Authored-By: Claude Opus 5 (1M context) <noreply@anthropic.com> |
||
|
|
0ae50f4e67 |
⬆️ The translator pin moves to the rev that declines the uber shader in seconds, because 205 of every boot's first 250 seconds were spent producing a module that was then rejected
`crates/reims-vgpu` dependency pin. Affects both Vulkan pathways; measured on x86 macOS / Linux Vulkan. `3fbe8e51` -> `1b013834` (upstream `master`; `git ls-remote` first, as `bugs/README.md` says). The CoreAnimation compositing fragment shader — one blob per guest line, 88 692 bytes of AIR on macos-26 and 73 360 on macos-15 — reaches the FALLBACK path on both revs, so this does **not** fix the dock background, the red band or the hover tooltip. What it changes is what the failure costs: | input | 3fbe8e51 | 1b013834 | |---|---|---| | macos-26 uber fragment | 200 s, 882 604 B of invalid SPIR-V | **5 s**, no module | | macos-15 uber fragment | 187 s, 767 264 B of invalid SPIR-V | **3 s**, no module | Timed back to back on the same quiesced machine, release CLIs built from the cargo checkout of each pinned rev. That translation is on the boot path and it is synchronous with the guest's first composite. The driven macos-26 boot at `1e53bbdc` gated on a composited desktop at t=250 s, and its own async census puts this one translation from t=28 s to t=234 s of that. So the expectation is roughly three and a half minutes off time-to-desktop, on both rails. The old rev also emitted a module the device then had to validate and reject (`spirv_validate reason=module_rejected words=220651`). The new one declines before emitting, which is the honest shape: `[tier-census] fallback`, `FALLBACK (translate failed)`, no `.spv`. `bugs/construct-tree-reuses-a-merge-block/` is updated rather than closed — the double-claimed merge blocks are the defect still to fix, they are simply no longer reachable to count from the CLI. Its `repro.sh` now reports the no-module outcome instead of dying on the missing file. Verified: 1790 lib + 1878 all-targets green on `backend-vulkan,host-window --test-threads=1`; clippy `-D warnings` clean on all three arms (the Metal arm's only output is the pre-existing `block v0.1.6` future-incompat note, not a lint); `scripts/feature-matrix` warnings=0 on all three. Not verified: **no boot on this pin yet.** The time-to-desktop claim above is derived from the offline timing plus the previous boot's census, not measured on a boot, and the six-rail sweep this pin change warrants has not been run. Both are the next step. Nothing here is evidence about rails 11-14. Co-Authored-By: Claude <noreply@anthropic.com> |
||
|
|
82542cc986 |
⬆️ The translator pin moves to the rev that answers the extent request, because the buffer bindings this device copies whole now say how far the shader can reach
Component: `crates/reims-vgpu`, Vulkan pathway (the reflection ABI is
translator output; the Metal-direct arm does not read it).
The capability request written up under `bugs/buffer-binding-extent-and-access`
asked for a conservative per-binding byte extent, because the consumer sizes
every guest buffer bind by the window the guest declared and had nothing else
to size it with — measured at 2.71 GB/s of gathered bytes against a declared
argument type of at most 512 bytes. Upstream shipped it. This moves the pin
from `2e297dc8` to `3fbe8e51` and makes the tree compile and pass against it.
What the new ABI carries, at `REFLECTION_VERSION` 3 -> 4:
- `ResourceBinding::extent: Option<BufferExtent>` — `Object { bytes }` when AIR
bounds the binding to one object, `Unbounded` when it declares an element
size but no length, `Unknown` when the metadata cannot tell those apart.
Only `Object` may narrow a staged window; the other two mean "keep the whole
caller-provided window", and an understated extent is a silent corruption
rather than a slow frame.
- `ResourceAccess` grew `Unused` and `WriteOnly`, so a binding the specialized
entry never dereferences is now nameable.
- Buffer type names and declared sizes are populated on all three stages.
No behavior changes here. This commit is the pin move plus the four literal
`ResourceBinding` constructions in test helpers that the new field broke:
three are non-buffer bindings, where the ABI specifies `extent: None`, and the
shader-pull vertex helper in `runtime/draw/tests.rs` now carries
`BufferExtent::Unknown` — what the translator emits for a buffer carrying
neither an object size nor a type name, so the helper keeps describing a
buffer the consumer is not allowed to narrow.
The version check that gates this is `census_reflection_wellformed` in
`runtime/spirv_bind.rs`, which refuses a reflection whose `reflection_version`
is not the one this consumer was built against. Reflection is cached in memory
per translate (`runtime/m2v_cache.rs`), never persisted, so the 3 -> 4 bump
cannot leave a stale on-disk entry behind.
Verified on this Linux host:
- `cargo test -p reims-vgpu --no-default-features --features
backend-vulkan,host-window -- --test-threads=1` — green; the lib suite and
every integration binary pass, 52 passed / 0 failed in the largest.
- `cargo clippy -D warnings` clean on the vulkan+host-window arm and on the
`--target aarch64-apple-darwin --features backend-metal` arm.
Not verified: no VM boot was taken for this commit, because it changes no
device behavior — the extent field is carried and not yet read. The
`crates/reims-vgpu-wire` fixture tests report `ignored` as they do on every
non-Apple checkout. The `backend/metal/` test functions are compiled by the
cross-target clippy run but, as always on a Linux host, are not executed.
Co-Authored-By: Claude <noreply@anthropic.com>
|
||
|
|
4ff8d00b86 |
⬆️ Every rail's compute kernels translate, because the tier that dissolves the handle aggregate now does
crates/reims-vgpu, x86 pathway. Bumps the `metal2vulkan` git `rev` from
`8d982e6` to `2e297dc` ("Fix inline SROA resource aggregate handling"), the
public repository's `master`. No source change here; the API is unchanged.
This closes the class `c2064d5d` could only reach. That commit moved the pin far
enough for the retry cascade to *classify* the failure as pointer-typing and try
`val-ptr:inline_sroa`, and measured that the tier then declined on every real
kernel — the aggregate survived SROA because CoreImage's `Sampler_h` is built in
one function and destructured in another. `2e297dc` fixes the SROA handling, and
the two defects packaged out of this tree both go away with it.
Offline, against the twenty distinct kernel AIR blobs recovered from leftover
`/tmp/reims-vgpu-m2v-cache-<pid>/` scratch directories:
8d982e6 ok=17 invalid=3 fallback=0
2e297dc ok=20 invalid=0 fallback=0
All three known repros now emit a module `spirv-val` accepts, and no previously
valid kernel regressed.
Six-rail driven sweep, 25 s Safari drag each, one pinned QEMU build, machine
idle. `spirv_module_invalid` / `module_rejected` / `engine_run_unsupported`, all
three of which count one cause at three layers:
rail 11 12 13 14 15 26
f9832ce 0 0 0 6 6 5
8d982e6 0 0 0 6 7 6
2e297dc 0 0 0 0 0 0
Zero on every rail. Every one of those was a compute pipeline refused for the
boot's life and every `DispatchThreadgroups` on it declined, so this is guest
work that now runs — CoreImage's Lanczos downsample family and
`ci_conv3x3sym_affine`, the kernels behind wallpaper scaling and thumbnailing.
No rail wedged this time (`driver_call_outstanding=0` on all six, `dev=1` on all
six). The quarantine hazard `c2064d5d` documented did not fire because this
change moves compute modules and not QuartzCore's uber fragment shader, so the
learned `create_graphics_pipelines` digests still matched — macos-15 refused 12
calls by name and macos-26 refused 18, both rendering. That is the containment
working, not an absence of the hazard: a translator change that *does* move that
shader's bytes will still cost one wedged boot per rail.
Verified: 1721 lib tests green (`--test-threads=1`); clippy `-D warnings` clean
on all three arms (aarch64-apple-darwin/backend-metal, host
backend-vulkan,host-window, x86_64-unknown-linux-gnu/backend-vulkan); the
six-rail sweep above, all six reaching the desktop.
Not verified: arm64/Metal (no Apple host); the copying rails
(`REIMS_VGPU_GUEST_IMPORT=off` not re-run — this touches no guest-memory upload,
writeback or bind); and whether the recovered kernels produce visibly different
output, which no instrument here measures.
|
||
|
|
c2064d5d0f |
⬆️ The translator pin reaches the tier that could rescue a lost compute kernel, which it then declines
crates/reims-vgpu, x86 pathway. Bumps the `metal2vulkan` git `rev` from
`f9832ce` to `8d982e6` — the public repository's `master`, one commit ahead of
the pin. No source change here; the dependency's API is unchanged and nothing in
this crate needed adjusting.
Why this commit and not the upstream fix it was supposed to enable. Twelve
compute modules a boot are refused by `spirv_validate` on macos-14/15/26 with
The Object type (OpTypeImage) does not match the type that results from
indexing into the Composite (OpTypePointer)
and every one of them is a real `DispatchThreadgroups` the guest loses.
metal2vulkan already owns a repair for that shape: the `val-ptr:inline_sroa`
retry tier dissolves the local aggregate, and a synthetic repro of the shape —
a kernel packing a loaded texture and sampler into a by-value struct — is
rescued by it. The tier is only reached when `classify_validation_error` calls
the failure `PointerTyping`, and at `f9832ce`
`is_pointer_typing_validation_error` does not contain that error's string.
`8d982e6` adds it as a single `||` arm. Without this bump no cascade tier can
ever fire on this class; with it the tier is reached.
It is reached and it still declines. Measured, six-rail driven sweep, Safari
window-drag probe, one pinned QEMU build per sweep:
rail 11 12 13 14 15 26
old pin 0 0 0 6 6 5 spirv_module_invalid
new pin 0 0 0 6 7 6
The `15` column is inside that rail's known bimodality (6 and 7 both observed on
the old pin). The rejected modules on macos-14 are byte-identical across the two
pins — same word counts, same validator line numbers, same result ids — so the
cascade's verdict on these kernels did not change. There is no persistent
SPIR-V cache that could be serving stale bytes: `m2v_cache` is in-process and
its scratch directory holds only the three `.air` inputs. So this buys no guest
work today. It is committed because it is verified harmless and because it is
the floor the real fix has to stand on.
Also corrected: both kb entries prescribed lowering the opaque struct member to
`OpTypeImage`. That is not implementable. `VUID-StandaloneSpirv-None-04667`
rejects `OpTypeStruct` containing an opaque type at the **declaration**, with no
instruction involved — verified with two hand-written modules through
`spirv-as`/`spirv-val --target-env vulkan1.2`. The only legal lowering is the
one `inline_sroa` attempts: the handle never enters the aggregate.
One operational consequence, and it is the reason macos-15 and macos-26 wedge
once after any translator change. `driver_quarantine` keys a refused driver call
by the ordered SPIR-V module digests of that call, and this bump moves
QuartzCore's CoreAnimation uber fragment shader (macos-15 261597 -> 262185
words, macos-26 296254 -> 296846). The learned entries no longer match, so the
first boot on each rail makes the `create_graphics_pipelines` call NVIDIA's
compiler never returns from, wedges holding the device lock, and shows a frozen
boot logo. The containment then works exactly as designed: the kill leaves the
breadcrumb, the next boot records the new digest and refuses the call by name.
Confirmed on both rails — macos-15 came back at `quarantined=6 outstanding=0`
and macos-26 at `quarantined=10 outstanding=0`, both `dev=1`, both rendering.
Verified: 1720 lib tests green (`--test-threads=1`, unchanged count); clippy
`-D warnings` clean on all three arms (aarch64-apple-darwin/backend-metal,
host backend-vulkan,host-window, x86_64-unknown-linux-gnu/backend-vulkan);
six-rail driven boot as above, all six reaching the desktop with `dev=1`.
Not verified: the arm64/Metal pathway (no Apple host); the copying rails
(`REIMS_VGPU_GUEST_IMPORT=off` not re-run — this change does not touch
guest-memory upload, writeback or bind); and why `inline_sroa` declines the real
CoreImage kernels when it accepts the synthetic one, which is the next question
and needs those kernels' AIR.
|
||
|
|
45766908a2 |
🚚 The resolution algorithms move to a crate that cannot see the host
Component: new crate crates/reims-vgpu-paging; reims-vgpu contract/gva_resolve,
runtime/{gva_mem,gva_view,guest_window_regions,draw/vulkan}; reims-vgpu-wire mem.
New workspace member reims-vgpu-paging (#![no_std] + alloc, depends only on
reims-vgpu-wire): the layer between the wire crate's page-table format and the
device's policy. Membership test, stated in its lib doc: needs a fixture →
wire; needs alloc but no host → paging; needs HostOps / the device model / the
failure channel → reims-vgpu. The boundary is structural — the crate cannot
name observe, DeviceState or HostOps.
Moved, with their tests:
- resolve: Task/TaskRoot/ResolveStatus/Translation, read_task_root,
translate_root, translate_root_run (from contract/gva_resolve). The
observe::Refusal impl for ResolveStatus stays device-side next to the
channel it feeds; contract/gva_resolve is now that impl plus re-exports
under the device's established names.
- span: pages_spanned (from runtime/gva_mem).
- runs: contig_page_runs and contig_run_count (from runtime/gva_view), plus
new coalesce_window — the byte-carrying stretch cutter extracted from
draw/vulkan.rs's coalesce_pages_to_runs, which now does only the host side
(one map_pages per stretch). coalesce_window additionally refuses page == 0
and head_off >= page, which the inlined arithmetic would have underflowed
on; no current caller can pass either.
- regions: guest_window_regions wholesale (planner, findings, tests);
runtime/guest_window_regions is a re-export shim.
The guest-memory seam is now the wire crate's GuestMemory everywhere:
PhysReader and the PhysAsGuestMemory adapter are gone, and wire's mem gains
the standard reference blanket impl (with a test that slice_at forwards
rather than degrading to the refusing default) so &dyn GuestMemory feeds the
generic walk.
Test accounting: device lib 1610 -> 1596 (14 moved: 7 resolve, 6 regions, 1
pages_spanned), paging 19 (those 14 + 5 new coalesce_window/contig tests),
wire 143 -> 144 (the blanket-impl test). Nothing dropped.
Verified: paging tests 19 passed; device lib 1596 passed (vulkan,host-window,
--test-threads=1); wire 144 passed (+1 integration, 34 fixture tests ignored
as always on a non-Apple checkout); clippy -D warnings clean on paging, wire,
and all three device arms; feature-matrix all arms compile, lib=1596
all_targets=1683. Not verified: no VM boot, no measurement.
Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
|
||
|
|
93c10105fd |
✨ The wire format gets an oracle, and driving every selector through it found the records this device was losing in silence
Components: `crates/reims-vgpu-wire` (new derivation crate and its capture harness), `crates/reims-vgpu` (decode, exec, backends, contract), and `scripts/wire-oracle`. Both pathways; both backends. 91 files. Squash of 115 commits. Their individual bodies — each carrying its own derivation, counters and verification record — are reachable from the reflog and from the `pre-squash-backup-56a87f3` branch until it is deleted. ## What this is The wire format had no ground truth. Every offset, width and opcode in `runtime/decode` was an inference from traffic, and nothing in the repository said what the right ones were, so an audit could only read the decoders against themselves. `reims-vgpu-wire` replaces that: the guest-side userspace serializer ships on every macOS install, `-[PGSerializer initWithDevice:objectRefAllocator:]` takes a protocol rather than a paravirt device, and its allocator needs exactly one method — so a harness can call a Metal API on a bare-metal Mac and get back the exact bytes a guest would put on the wire, in milliseconds, with no VM. Every layout in the crate traces to the Objective-C type encoding or to perturbation of that live serializer, and every one is pinned by a fixture of bytes Apple emitted. Nothing is derived from a corpus. ## What it found The instrument is `tests/wire_fixtures_reach_the_decoders.rs`, which puts every fixture through this device's decoders and distinguishes three verdicts: a record that decoded, an opcode with no implementation (a gap, reported), and a well-formed record refused for its *shape* (a failure, because that is a layout this project has wrong). Twenty `:bug:` commits came out of it and out of driving the selectors, and the shapes repeat: - **Opcodes that were simply the wrong number.** Render residency at `0x86`/`0x87` where Apple emits `0x1b`/`0x89`. The sampler binds carrying LOD clamps, `0x80`/`0x71`, reached no arm at all, so the sampler stayed unbound. - **Records refused for a length four bytes off.** Every compute resource barrier, refused wholesale. - **Fields read wider than the serializer writes**, which is the single most common defect here and was invisible before the written-bit measurement: `copyFromTexture:toBuffer:` read two bytes of the guest's ring as blit options; the heap texture's one-bit `useOffset` was loaded as a `u32`; the ICB descriptor's `options` is sixteen bits; a colour attachment's `level` was loaded thirty-two bits wide with `slice` immediately above it, so a pass rendering into array slice 1 reported mip level 65 536 and lost its slice. - **Caps with no citation.** A 32-entry bind cap dropped a 40-slot texture bind whole; the ICB descriptor's flag word carries ten bits and this device carried two. - **A whole guest feature lost.** Tile shaders: nineteen selectors, nine opcodes, every one reaching the render catch-all, so a guest running one lost every bind and every dispatch. The catch-all is the trap that hid several of these: an `Ok` from `render::decode` is not a decode, because `Kind::OtherAccepted` claims anything inside the accepted window that no arm matched. It is a `NotImplemented` verdict to the instrument now. ## Capability flags All sixteen serializer capability pairs default off, which is measured every capture rather than assumed. Several selector families emit nothing until their flag is forced, so silence at the default state is a statement about the harness and not about Apple — and nineteen manifest rows had claimed "Apple emits no operation" on exactly that evidence. Driving them found real opcodes behind `TileShaders`, `BlitEncoderSPI`, `CommandBufferJump`, `DynamicAttributeStride`, `VertexAmplification`, `ImageBlocks`, `ComputePassDescriptorDispatchType` and `ProtectionOptionsEnvelope`. Two more — `DispatchThreadsIndirect` and `InsertCompressedTextureReinterpretationFlush` — had been filed as records Apple *refuses*, where the refusal was this harness's inputs. Three passes now run every capture: all flags forced, each flag alone (which attributes a gated selector to the flag that unlocks it), and a byte-level diff of each pass against the default (which catches a flag that changes what an existing record *contains* — including one that changes the record's **opcode**, not its length). ## Consolidation Roughly 230 wire facts were declared once in each crate, agreeing, with nothing comparing them; every one now reads the wire crate's declaration, and where a device offset names a field a wire struct declares it uses `offset_of!` so a rename fails the build. The x86 GVA page-table format and its multi-level walk moved to `reims_vgpu_wire::page_table` over a two-method `GuestMemory` seam, leaving the translation cache and typed refusals in the device. Each tier grew a roster test comparing the device's opcode set against the manifest. Separately, `contract/iosurface_pages::build_table_plan`'s two-candidate page table chase was measured across 223 resolves on two deliberately different driven arm64 workloads — both fields populated every time, one winning every time — and deleted as a fallback, with the field test kept as a refusal and a third boot taken after the deletion to confirm it. ## Verification Per-change verification lived in the squashed commits. What holds at this tree: - `cargo test -p reims-vgpu-wire --lib -- --test-threads=1` — 133 passed, 0 failed. - `cargo clippy -p reims-vgpu-wire --all-targets -- -D warnings` — clean. - `cargo clippy -p reims-vgpu --all-targets --no-default-features --features backend-vulkan,host-window -- -D warnings` — clean. The x86 Linux arm's tests had not been compiling and now do; the `backend-metal` clippy arm went from 128 errors to zero, 31 of them exempted at three module declarations with the reason recorded rather than boxed. - Driven boots on both pathways produced the counters cited in the module docs. Not verified at squash time: the `backend-metal` test arm still reports six pre-existing failures, all in `runtime::storage_flush::tests` and all exercising `flush_render_one`, which is a fail-visible stub without `backend-vulkan` — these are Vulkan-rail tests compiled unconditionally, not a Metal defect. No VM boot was taken for this squash itself. Fixtures are Apple-host-only and are not committed; no third-party bytes are in this tree. |
||
|
|
a61a5e1272 | 🆕 Open Source reims-vgpu |