af690afff29244d4e3f583a2ba01ff4a74db4921
64
Commits
| Author | SHA1 | Message | Date | |
|---|---|---|---|---|
|
|
313d049cdd |
🆕 Count each decoded picture handed the guest by its class
A report at the default level could not say what the guest's readers were handed. The session's end line, which counts its pictures, is at info, and with logs off the library writes warn alone. Only a session's first picture that did not decode was said at warn. Each picture a decode hands the guest is now counted in one of three classes, from the session's own state, with no pixel read and nothing added to a picture's path: - video-pictures-handed-landed: it landed in its output; - video-pictures-handed-failed: it failed to land, or its decode was refused at its take (its command buffer faulted); - video-pictures-handed-undecoded: no decode ran for it, as a decode answered no picture (a stream entered at a P picture among them). The counts are per process, in the degradation counts that reims-ctl report asks for at any level. They are also per session, on the session's end line, which now says how many decodes were refused at their take. Nothing changes for the guest. each_picture_handed_the_guest_is_counted_in_its_class holds the classes, and docs/conventions.md lists the codes. |
||
|
|
7fafb7f9fb |
🆕 Stamp the build's commit into reims-ctl and the library
A report could not say which builds it came from: reims-ctl's version was the package's, and the library named its commit only where `cargo xtask dist` set RVG_BUILD_COMMIT, so a QEMU or reims-ctl from another build than the install's went unseen. Each is now stamped at build time by a build script of its own, with no new dependency: `git rev-parse HEAD`, `-dirty` where a tracked file of the tree differs from it (Cargo.lock aside, which a build rewrites), and `unknown` outside a checkout, never failing the build. The library's is reims-vgpu-c's, handed to the Vulkan crate at the C API's first call, so every build of it carries it, not only dist's; xtask's RVG_BUILD_COMMIT and the recorder's own read of it go. `reims-ctl --version` shows its stamp. The ask for the counts writes the library's build line, `reims-vgpu: build <commit> on metal2vulkan <pin>`, and system.txt's head names reims-ctl's stamp, the running library's as the QEMU log names it, the install record's commit and the metal2vulkan commit, with one plain line where the commits differ. Display only. |
||
|
|
f2be18b911 |
🆕 Write a pacing line at the host's ask for the counts
A report of a slow app has said what degraded, not what held the app back: the guest's own CPU work, the host's GPU, or the library's threads. At the ask for the counts (rvg_write_counts, QEMU's x-write-counts), where the ask before it was 2 to 60 s earlier, the library now writes one line over the span between the two: each display's presents a second with the interval's p50 and p99, the GPU's time per frame (p50, p99) and busy share from the command buffers' GPU start and end times, merged where they overlap, and the CPU of QEMU's vCPU threads, of ours by role (decoder, completion, window, video, the rest by name) and of the rest of the process. The state is fixed: a ring of 4096 shows per display and a few atomics for the GPU, nothing allocated per frame. Thread times are read only at the ask: /proc/self/task on Linux (with a table of the names Linux cuts at 15 bytes), task_threads and thread_info on macOS, a ToolHelp snapshot and GetThreadTimes on Windows. rt gives no GPU times for its own command buffers (uploads, fills, staging copies), for one that ended in an error, nor for the host's video codecs; the line counts the ones without times. reims-ctl report asks twice, 10 s apart, before vulkaninfo loads the GPU, and its help, conventions.md and api.md say how to read the three verdicts beside the guest's `top -o cpu -l 2`. A diagnostic: nothing decides on it, the guest sees nothing new, and the C API gains no call, so QEMU's side is unchanged. |
||
|
|
ac5b41b2ed |
🐛 Fail a buffer as internal where the platform refuses a host copy
What the guest observes changes. e00ce9ff74 failed a guest's command buffer with MTLCommandBufferErrorOutOfMemory where the platform refused a copy the host made for it: a fill or a copy into a wide home at its begin, rule 1's copy into a plane's other shapes, or a copy between a cache and its wide home at an encoder's end. Nothing ran short of memory there, and an app may answer OutOfMemory by letting go of caches of its own, so that answer was wrong. Such a buffer now fails with MTLCommandBufferErrorInternal; OutOfMemory stays on the existing route, a cache's buffer whose memory the platform refused. The platform's refusal of a command does not say why it refused, and copy() answers a copy that made no view or staging piece the same way, so every refused copy answers the internal error, and none is mapped to OutOfMemory. Where one command buffer meets both kinds, the memory's wins. The host's writers' fence update at a guest encoder's end, which those copies wait for, now folds its answer too: refused, the copies could not wait for the encoder's writes, so the buffer fails with the internal error, counted under a code of its own, surface-fence-refused, since it is no copy. The compute encoder answered nothing of its commands, so ComputeEncoder gains update_fence, which answers Encoded as a blit or render encoder's command does, and CommandBuffer gains fail_internal, which rt keeps as it keeps a skipped dispatch's failure: the first failure set is the one the buffer ends with. Two new tests pin the fence fold, for a blit and a compute encoder; the fill and rule 1 tests now expect the internal error and no OutOfMemory, and the refused-memory test no internal error. Red before (m3-max-78155: the four failed, the memory test passed). Green after: the reims-vgpu fake set (m3-max-78157, 1172 passed, 115 skipped), its surface, shape and command buffer rt tests with rt's compute and command buffer tests on the 5080 (m3-max-78159, 48 passed), and reims-vgpu-vulkan's own (m3-max-78160, 789 passed, 1 skipped). |
||
|
|
aaedba617b |
🐛 Answer a download failed where the platform refuses its copy
What the guest observes changes. Before, each copy the host makes for itself between a surface's device cache, its shapes, its wide home and its pages took the platform's answer to each command with go_on(), so a refused one changed nothing of the caches' state. A shape whose write-back was refused was marked written back, a refused fill marked its shape filled and the cache at the new generation, and a SURFACE_DOWNLOAD whose copy into the pages was refused was answered RGFX_STATUS_OK over the pages' older bytes, and never copied again. Now each such copy folds its commands' answers, by the ruling that keeps today's behaviour for the guest's own commands alone, and a refused one, or an encoder the platform made not, leaves what it was to move as not copied: - A shape whose write-back was refused stays dirty, and one whose fill was refused owes it still. A refused fill of the buffer leaves the cache at its older generation. - A download whose copy into the pages was refused, or that waits for a copy that landed short (a refused later round of one that circulates its pieces), is answered failed (RGFX_STATUS_REFUSED) through the driver's existing path, where it was answered OK on stale bytes before. The cache stays written, so the next download copies it again. A refused copy's pieces put none of their bytes into the pages. - A fill or a copy into a wide home refused at a command buffer's begin, and a write's copy into its plane's other shapes or a copy between a cache and its home refused at its encoder's end, fails that command buffer with MTLCommandBufferErrorOutOfMemory, as a cache's refused memory already does. - An early copy refused is not made, its command buffer not committed, and the refill it carried no longer marks the buffer as holding the pages; that also holds where the platform refuses a copy by runs, which left it so before. The host tries none of these again by itself: the next use, download or release that needs the copy makes it. Each refusal is counted under surface-copy-refused, the process's first logged at warn. The guest's own blits and draws still go on past a refused command. No rt-refused or rt-unbuilt code shows in the degradation counts of the 30 latest kept boot logs, so no boot has reached these paths so far. Five new fake-platform tests, red before (m3-max-78078, all five failed), pass with the fix: the reims-vgpu fake set (m3-max-78128, 1170 passed, 115 skipped) and its surface, shape and command buffer rt tests on the 5080 (m3-max-78131, 31 passed). |
||
|
|
bc613120fd |
🐛 Hold the window's last frame where part of a frame is refused
The platform may refuse a pass or a command of a draw with no death (rt counts it and the command buffer still completes). The window went on past such a refusal and presented what was recorded: a frame with the scanout's blit, the colour's pass, the cursor's or the overlay's pass missing or cut short, shown to the person at the host as if whole. Now a frame of the window in which any pass or command was refused, the cursor's, the overlay's and the overlay-over-black clear among them, is not presented: nothing of it is committed, its presents are let go as at any draw that shows nothing, and the window keeps its last complete frame. The frame is counted under display-frame-refused, which the report's counts carry, and the first is logged at WARN saying the window holds its last frame. The next frame is drawn and judged afresh: no latch, no retry. A colour's table whose draw is refused still answers for itself (the frame takes the colour's pass and is presented), and the host's read of the display already failed on a refused draw. What changed for the host: a frame refused in part is no longer shown. a_frame_the_platform_refuses_part_of_is_not_presented refuses the scanout's copy, the colour's draw, the cursor's draw and the cursor's pass in turn on the fake: red at m3-max-77985 (a refused copy's frame was presented), green at m3-max-77996 (1164 passed, 115 skipped: the Vulkan and cost tests and the seed-1 decode test). |
||
|
|
6ec9f5f87b |
🐛 Draw the colour through its pass where its table's draw is refused
What the host's window shows changes. A colour with no matrix is drawn through a table, which the colour's pass first draws into its own texture; the table counted as drawn once a command buffer that drew it completed. Where the platform refused the table's draw at encode (on the Vulkan platform, metal2vulkan-runtime counts the refusal and the command buffer still completes), the table held nothing drawn and was still taken as drawn: that frame and every later one of the colour went through an undrawn table, its contents undefined, until the colour changed. Now the table's draw answers whether the platform recorded its pass and every command (Encoded). Where it did not, that frame takes the colour's pass, the same per-pixel draw a colour with a matrix takes, so the guest's colour still shows. The refusal is kept in the table's one place, for its colour, what it reads and the drawable's format, logged once and counted under the new code display-table-refused, which the degradation counts report. Each draw for those takes the pass with no table drawn, and the table is drawn again only for another colour, read or format, or after the device's recovery. No frame goes through a table whose draw was refused. Red first: a_table_whose_draw_is_refused_takes_the_pass_until_the_colour_changes failed on the tree before (job m3-max-77937: the frame went through the refused table) and passes with this (job m3-max-77947, every fake test of the display, the reads, the decoder, video_host and core). The Vulkan tests of the table, on_vulkan_the_table_draws_what_the_pass_draws among them, now also check that the table was drawn, and pass on the Iris Xe and the Radeon 780M (jobs m3-max-77948, m3-max-77952). |
||
|
|
fb3108a832 |
🆕 Scale a frame of another size than its place to fill it
A display now offers smaller modes, and its window keeps its size at them, so the window's draw must fill the window with a frame smaller than it. The draw copied the scanout, and a BGRA8 surface, a guest pixel to a pixel at the image's top left, clipped: a smaller mode showed in a corner. One rule now draws what the display shows: a copy where the frame (the scanout, or a presented surface in the drawable's format) is the size of its place, the layout's region, and otherwise a draw of the display's present shaders that samples it over the whole place, filtering linearly. The scanout is sampled through a texture over its pixels in its pages' import, in place, made at its first such draw and kept with the import (made again after a recovery); a refused one keeps the window's frame and counts as the display's refused view (display-view-refused), as a refused view of a surface does. The colour's draw follows the same rule. The host's read of the display (QEMU's console and screendump) draws with it, so it shows a smaller mode scaled to the display's first mode. What the host observes: at a smaller mode the window, and the read, show the guest's frame filling the image's place; while a resized window waits for the guest's next mode, the old one is scaled to the new place rather than clipped. At the display's first mode every draw is the one it was, and makes nothing more: a test holds it for the scanout, a BGRA8 surface and WindowServer's 10-bit one, and others hold the sampled draws and the refused texture; a GPU test holds that a 2 x 2 scanout and surface fill an 8 x 8 drawable on the Vulkan platform. The read's tests held the old draw, a small scanout at the read's top left and the rest black: they now read a scanout of the mode's size pixel for pixel, a smaller scanout scaled over the whole read with its corners at the read's corners, and a smaller surface drawn through the display's view of it, not copied. |
||
|
|
9a14d0e8c6 |
📝 State the pool's host-memory form as GPU memory's one exception [ci skip]
"GPU memory is the runtime's" had no word of PR 178's form, where the pool's blocks are memfds of the library's own that rt imports as dma-bufs, under Linux's KVM on arm64 without KVM_CAP_ARM_CACHEABLE_PFNMAP_SUPPORTED. conventions.md and architecture.md now state it as the rule's one exception, rt's existing import with no new form, and its known gap: built and unit-tested here, run only by its contributor, no lab host of its kind, speed not measured by us. qemu.md's arm64 part says the same, and its table names the fork's change by what it does rather than by a commit only in the contributor's fork. |
||
|
|
54bb7b0b4c |
🆕 Decode HEVC's range extensions for arm64 guests on the host's GPU
An arm64 guest's VideoToolbox paravirtual decoders now take HEVC's range extensions, 4:2:0, 4:2:2 and 4:4:4 at 8, 10 and 12 bits, wherever the host arm's own query lists a decoder of the stream. Until now they took 4:4:4 at 8 bits alone and refused the rest at the session's start. What changes for the guest: - dsta and dsts take a range extensions stream where VA-API lists the decoder of its profile with the render targets and surfaces it needs. iHD on an Iris Xe lists all six profiles, but its Main 12 has P012 and P016 surfaces alone, so 4:2:0 at 8 and 10 bits stays refused there. - They also take it where NVDEC's caps list its chroma format, depth and size: 4:2:0 and 4:4:4 on an RTX 3090. - Where nothing lists the stream, the refusal stays as before and names the stream and the arm's reason. radeonsi lists no decoder of them. - Each picture lands in the format the guest's own software decoder gives the stream, which Dpba names: 420v/x420/tv20, 422v/x422/tv22, 444v/x444/tv44 and their full-range forms. - NVDEC's 4:2:2 is not built: the 3090 lists none, and those streams stay refused there. - The x86-64 caps are unchanged. The codec takes the range extensions at 4:2:0, 4:2:2 and 4:4:4 and at 8, 10 and 12 bits, with their tools. It still refuses extended precision and high precision weighted prediction offsets past 8 bits. Its CPU tests decode streams of each chroma format and depth, and an SPS cut at every length or with any bit flipped is refused or decoded whole, with no panic. VA-API decodes on the stream's range extensions profile into P012, YUY2, Y210, Y212, XYUV, Y410 or Y412 surfaces. The CPU splits the packed ones into the guest's two planes; the GPU still splits XYUV where its import check passed. NVDEC's 4:2:0 lands as Main 10's, and the CPU interleaves its 10 and 12-bit 4:4:4 planes. Each picture the CPU converts is counted as video-pictures-cpu-converted. CoreVideo has no format with the layout of Y210, Y212, Y410 or Y412, and the Mac's decoders answer 422v, not yuvs, for 4:2:2 at 8 bits, so the conversions stay. Under TCG on the Iris Xe, hardware sessions took 0.36 to 0.66 s for 30 pictures at 1080p of every listed profile, against 1.88 to 5.32 s for the guest's software decode (docs/video/devices.md). The conformance suite decodes x265's streams of every listed profile. |
||
|
|
ce6fa476d4 |
🆕 Write the degradation counts when a running VM's report asks
The library wrote its counts line only at a device's reset and at the process's exit, so a reims-ctl report made while the VM ran had none of it in its qemu.log. A host now asks for them with rvg_write_counts (the Rust API's GraphicsDevice::write_counts), which writes the line before it returns, where it changed since it was last written. QEMU's reims-graphics-pci calls it when its new x-write-counts property is set to true over QMP (vendor/qemu b057a987), and reims-ctl report sets it on a running VM before it zips the logs, with a line in state.txt saying whether the library wrote them. A trigger rather than a timer: a timer would touch only the library, but write a line a minute into every log and still be up to a minute old at the report; QEMU forwards no signal the library could take, and Windows has none. For the host: a new C API function and QOM property; QEMU's log gets the counts line at each ask. api.md, conventions.md, qemu.md and the report's help say so. |
||
|
|
dc7c20a579 |
🆕 Count the pictures not drawn into a cache's surface on Windows
On Windows a picture whose cache's planes lie over Direct3D 11 textures lands by a draw from the texture VA-API decoded it into. Where that draw fails, the textures are cleared to the zeros they owe and the CPU's copy lands the picture in them instead: read back, staged, and copied into the planes' images. Nothing counted that: on Windows a plane in such a surface never reaches the GPU copier, so rt-video-gpu-copy-declined counts only pictures with no surface at all, and a failed draw showed only as the landing's info line, the first of each kind. Each picture not drawn is now counted as video-pictures-undrawn, so a report's degradation counts say how many pictures took the CPU's copy after a failed draw. The guest sees nothing new. |
||
|
|
3a2383712e |
🆕 Count a pipeline create naming no function as decode-no-function
The bundle sends a render pipeline create with no vertex function, or a compute create with no kernel (library 0, no name), where the device refused the library the program's functions were to come from: the library is nil, and so is each function made from it. The device counted each such create as decode-bad-reference, the guest protocol error, so a boot's counts line read as dropped work (25 a refused library in Steam's lab boots). The create names no library id, so the device counts what it sees: a create naming no vertex function or kernel, under decode-no-function, a DecodeError of its own. The refused create's warn line now names the kind of create (render, mesh render, compute), and its log kind is the why and that kind together, so the first of each pair is written at warn and the rest are folded under a label that names both on the repeated-lines line; before, every create of one why folded into one count with only the first one's type. What changes for the host's log: the counts line carries decode-no-function where it carried decode-bad-reference for these creates, and the refused pipeline create lines name their kind. The guest sees no change: each create is answered refused as before. No test held the old count; the new test holds the new one and the lines. |
||
|
|
f94107ffa7 |
🆕 Count handles dropped at rt's address while buffers run
A diagnostic only: nothing the guest or the host observes changes. On a platform that places pins only in its blocks (metal2vulkan-runtime), an OBJECT_DESTROY of an object made at the platform's own address, a pin it did not keep or none, is counted under destroys-at-rt-address-in-flight-<kind> where a command buffer of the object's context is posted and not yet committed, or begun and not yet complete. The count is an upper bound on the handles let go of at an address a running command buffer may still use, so a boot's counts line tells whether that stale-address lead applies to this class of object at all. It costs no new lock and nothing per command buffer or per create. The object's unkept::Live records at its make whether it lies at the platform's address, from the pin and address made already compared there; the destroy reads it in the table lookup it already makes, and the context's queues posted and not committed it already reads. Only for such an object does it take the context's drain lock, alone, to read the holds the drain keeps. |
||
|
|
3d53248877 |
🐎 Write NVDEC's 4:4:4 pictures into their surfaces on the GPU
NVDEC's 4:4:4 pictures were read back to the host and interleaved by the CPU into the guest's surface. Now, where CUDA imports the device's exportable buffers, CUDA copies each plane within the GPU into a scratch of the decoder's. videoGather444 then writes them into a Shared buffer over the surface's pages, and the pass is waited for. This is the route NVDEC's 4:2:0 pictures already take, which writes the surface in place. The guest's surface holds the same bytes as before. Each picture written this way is counted as video-pictures-gpu-gathered, and a session logs how many at its end. A refusal before anything is written (no exportable scratch, a plane off a 32-bit word, a plane past the surface or the scratch, a failed pass) falls back to the CPU's interleave, and its reason is logged once per decoder. |
||
|
|
a6ce7fe2ad |
📝 Say the slow answers' first-use waits count main pipelines' [ci skip]
first_use_waits_met sums the waits of every compute variant make rt keeps, whoever started the make. Since rt's finish_pipeline, a compute state's main pipeline is made by its finish, and a dispatch that needs it first waits for that make in flight, or makes it itself: rt counts those waits as unfinished waits, apart from the variants', yet they are variant makes, so the slow answers count them too. The count is right for its code, the compute dispatches' first-use waits; the docs said they were the variants' alone. Say what it counts now, here and in conventions.md: the variants' waits and the compute share of rt-first-use-unfinished-waits, a finish's make among them, and that a draw's waits for a render state's main pipeline are not. |
||
|
|
97963584b8 |
🆕 Finish a pipeline's make with rt's finish_pipeline
The rt platform's state finishes, ComputePipeline::finish and RenderPipeline::finish, now call rt's finish_pipeline: the driver's create of the state's main pipelines, which rt's creators leave out since 951285e7a7, runs on the device's compile thread after the create's reply and before its store. For the guest: a pipeline create's reply no longer waits for the driver's create of its main pipeline, as it did before the pin move; the store, and the command buffers, indirect command buffer writes and function handle and table creates that name the pipeline, still do, so its first draw or dispatch no longer makes that pipeline on its queue's lane, as it did with the pin move alone. Every answer the reply carries is made before the driver's create, so nothing the guest reads changes beside timing. A finish rt fails is the create's late failure, pipeline-finish-failed, as before: the pipeline is stored as made, and a draw or dispatch that needs it makes it again, refused at its encode where that make fails too; the accuracy ledger lists it. A create whose destroy, context close or reset came before its finish began is no longer finished: its pipeline is never stored, so the driver's create would be wasted. A finish already running still ends. A keyed create skipped so keeps its answer as its make answered it. The counts line gains rt's new metrics: rt-finished-pipelines and rt-finished-pipeline-ns, rt-first-use-unfinished-waits and rt-first-use-unfinished-wait-ns, and rt-first-use-unfinished-wait-max-ns at its highest over the process's devices. The ten-second rt summary says the finishes and the unfinished waits, and the trace's rtmetrics event ends with the five values. rt's failed_finishes is not folded: the device's pipeline-finish-failed counts each failure at the platform's seam, where every platform's finish answers (a raise or death in the platform's refusal scope too, which rt never sees) and where the failure's guest-visible effect is decided, so the line carries each failure once. docs/conventions.md's stall rule names the reply ahead of the driver's create as its second exception, and compile.rs's Order, the design doc and the rt platform's pipeline docs say what the finish now does. |
||
|
|
4761ee8f8f |
🆕 Count how long the guest waited for its pipeline creates' replies
The planner reads the pipeline cache's effect on a boot by what the guest waited, and nothing on the counts line said what the guest waited for a pipeline create: rt-pipeline-creation-ns sums concurrent makes, slow-answer-over-make is about rt's pool memory makes, and rt-first-use-variant-wait* is the compute dispatches' variant waits. The counts line now carries, for render, mesh render and compute creates together, each create's wait from the host's take of it off ring 0 to its reply's post: pipeline-create-replies, pipeline-create-reply-ns (summed), pipeline-create-reply-max-ns (the longest), pipeline-create-replies-over-16ms (16.7 ms or more, SLOW_ANSWER_NS), and pipeline-create-waiting-ns, the span during which at least one create waited: their union, so waits at once count once. A refused create, and one destroyed or closed before its reply, which is still posted, is counted at its reply like every other; one let go of with no reply posted ends its wait there, in the span but not among the replies. A diagnostic: nothing changes for the guest. Each create costs two reads of the platform's monotonic clock under a lock of the device's own. |
||
|
|
bdce155511 |
🐎 Keep the GL shader variants the bundle lowered across runs
A GL app's variants were lowered again in each of its runs, on the app's own thread: the GL code generator, our text round trip and the metallib's writing. Heaven on 26.7.2 (an RTX 3090) lowers 411 variants in each run, the second as many as the first, 2 ms at the median and up to 37 ms, 2.1 s in all, and a scene change waits on the lowerings of its variants. Metal's compiler service keeps what it compiled for an app in the app's cache directory; the device lowers GL variants in the app's process, so the bundle keeps them itself, beside Metal's. The store (src/RgfxGLStore.hpp) keeps each lowered variant and stage-in kernel in a file of its own under the user's cache directory, the app's bundle identifier (or its program name) and ai.aneesiqbal.reims-graphics/gl: the path Metal's own cache takes (com.apple.metal there), which a sandboxed app can write too, measured in a 26.7.2 guest. The key holds everything the lowering reads: the variant's IR and plugin data, its bitcode and function types, and the identity of the bundle, the generator, the system's LLVM, the OS build, the builtins file and the generator's environment variables. An entry carries its key and the SHA-256 of its bytes, which a read checks; an entry that does not read whole is removed and the variant lowered again. Writes are atomic (a file of their own, renamed into place). Past 64 MiB an app's least recently used entries go first: Heaven's 298 variants and 34 stage-in kernels take 9.5 MB, so the cap keeps an app's variants at several settings. Any failure leaves the variant to the lowering, as before, and the first is logged once per process. A run asks for some variants more than once: Heaven asks for 75 of its 298 again, 113 lowerings and 490 ms a run, and for 8 of its 34 stage-in kernels again. A memo (RgfxGLMemo, 32 MiB) answers a variant the process asks for again with the bytes it answered first, with or without a store. What the guest reads does not change: a hit answers the bytes the lowering answered (tests/gl_store_tests.mm, a hit and a memo's answer equal to the lowering's byte for byte). tests/bundle_files_check.sh's rule changes on purpose: the bundle now writes a second kind of file of the app's own, in the app's own cache directory, through Foundation as its binary archive is, and still imports none of open(2)'s family. |
||
|
|
f35f6fa8fc |
🆕 Give each pool make's start and end on a slow answer's line
At the pin, rt's AllocationInfo states when a make of its pool began and how long it took (make_start, make_nanos), so the device's BlockMappings keeps both for each of the last 16 makes instead of reading the clock as rt tells it of one. A slow answer's line now gives each make that ran during the answer by its start and end after the ask, a start before the ask negative, with its ms, its allocation's MiB and storage mode and its thread, for example: over 2 makes of rt's pool that ran during it, the last ending 5.000 ms before the answer (each from its start to its end after the ask, a start before it negative: -4.000 to 10.000 ms, 14.000 ms, a Private 16.000 MiB on reims-vgpu.test-maker; 12.000 to 15.000 ms, 3.000 ms, a Shared 32.000 MiB on reims-vgpu.test-maker) A make is among an answer's where it ran during it, from its start to its end: one that began before the ask counts, and how much of the answer each make covered can now be read. rt tells of a make only once it ended, so one still running when the answer is given is still not among them. The docs of overlap, slow_answers and the device's BlockMappings say so, and the cost paragraph drops the clock read a make took. Diagnostics only: nothing changes for the guest or for the C API's host. The counts' codes are unchanged; slow-answer-over-make counts the answers a make ran during. |
||
|
|
1271804ce8 |
🆕 Count the guest's slow answers that ran over a pool make
A ring-0 answer that reaches the guest a frame or more after the device read its command stalls whatever the guest's frameworks wait on, and the makerstall walks tied some of those to rt's 16 MiB pool makes only with a diag build. Every boot and walk now carries it: - reims-vgpu-graphics times each answer given through a CompleteAnswer, PoolAnswer or PrivateAnswer (a clock read at its make and one at its post; none for PRESENT_SURFACE, whose answer waits for the display's refresh) and tells the host of one of 16.7 ms or more (Host::answer_slow). - The rt platform keeps when each of rt's last 16 pool makes ended (rt_platform::overlap, from the device's BlockMappings), and folds rt's first-use variant waits of compute dispatches onto the counts line: rt-first-use-variant-waits, -wait-ns and -wait-max-ns. - reims-vgpu counts a slow answer during which a make ended, slow-answer-over-make with slow-answer-over-make-max-ns, logs the first of each command type with its makes and, for a BLOCK_RELEASE or a POOL_GIVE, the split of its waits, and counts the first-use waits that met any slow answer, slow-answer-first-use-waits. A diagnostic: nothing the guest sees changes. |
||
|
|
6fdc5a3ee4 |
🐎 Copy VA pictures into caches the driver refuses on the GPU
On the rt platform on Linux a decode's picture lands in its output's device cache by the driver's video processing writing the cache in place, and where the driver's import refuses the cache's layout, by the CPU: the frame read back into host memory, copied into the session's staging and from there into the cache. The guest's decoder asks its outputs of CoreVideo, which lays them out itself (measured: at 1920x1080, rows of 1920 bytes, the luma plane at byte 32 and the chroma at byte 2088992), and radeonsi's import refuses that on the AMD GPUs we have: the RX 550's refuses rows below its pitch of 2048 bytes, the 780M's rows off a multiple of 256. On the RX 550 a walk's 1080p H.264 and HEVC clips took that way for each of their 894 pictures (walk b1, m3-max-66052). Now the session's copier, gpu_copy's ScratchCopier, takes such a picture at that refusal: the driver's video processing writes the picture into a scratch of the session's, laid out as the driver's imports must be (each plane at its dma-buf's first byte or whole rows after it, the even width's rows at a pitch on 256), and fill's videoEncodeFill kernel copies each plane's crop from it into the cache at the cache's own offset and pitch, as plain words; the copy is waited for before the picture counts as landed, as the CPU's copy is. The copier is reached only where the in-place write was refused, for a plane in a device cache outside its surface, whatever the GPU or its driver: every host whose import refuses the guest's rows takes it (the RX 550 and the 780M), and none is chosen by name. It declines, so that the CPU copies as before, a plane in the guest's pages or in a surface, a crop that does not fill its rows in whole 32-bit words (rows of 1366 or 642 bytes), and an offset or pitch off a word. Where the platform "makes no GPU copies" on Linux: |
||
|
|
f2e2801297 |
🐎 Make a walk's untaken pre-pass shapes at its first dispatch
A command buffer's pre-pass hands its dispatches' new pipeline shapes to the compile pool, which makes them on all of its threads but one. On a cold boot on um790's RTX 2080 (m3-max-65818), the boot's 52 makes ahead queued 4265.6 ms in all behind one another at that cap, and the walk waited at each dispatch whose shape was still queued or being made: 31 waits, 1044.5 ms, before the desktop came up, 384.6 ms of it at 15 shapes it made itself, one at each dispatch, while the compile threads were idle. Each shape handed is of one of the buffer's own dispatches, whose commit waits for it in any case. So the walk's thread now makes the shapes no compile thread took yet at its first dispatch, beside the compile threads, then dispatches. The pool's order and cap are unchanged, so library and pipeline creates keep the thread left to them. The makes the walk ran are counted (dispatch-prepass-made-on-walk) and logged at debug. The test that held a queued make waiting for a compile thread now sees the walk make it at its first dispatch, and not before; a new one sees a walk that ends before its first dispatch drop them; the device release's test expects the one shape its walk made. |
||
|
|
741ca9d519 |
🐎 Hand back the heap a heavy pipeline make left free
On Linux with glibc, a pipeline make's translation frees nearly all it used as the make returns. glibc, though, keeps the free chunks below its heaps' tops resident, so the VM's process stayed at its largest make's level, up to about 450 MiB. Now each compile-pool make of 250 ms or more asks a thread of its own, reims-vgpu.heap-trim, to run malloc_trim(0). One trim runs at a time, and the asks made while it runs become one more trim. For the host, resident memory falls after heavy creates (the ledger's kernel: 158 MiB to 32 MiB). The first trim is logged at info and later ones at debug, each with resident bytes before and after and the trim's time. The counts line carries heap-trims, heap-trim-us and heap-trim-returned-kib. Nothing changes for the guest. No reply, value or order it sees moves, and the compile's thread only asks for the trim. macOS, Windows and musl do nothing. What is left: a trim takes each glibc arena's lock in turn, so a thread the guest waits on (a make's or the ring's) that allocates meanwhile can wait up to the trim's own time. That was 5.04 ms at most in a cold launch of the modelling app on a 780M, and the contention itself was not measured. |
||
|
|
88f07d368f |
🐛 Draw a shown surface through a view at an index of its own
The display's passes (the present shaders' conversion and the colour's) sampled a presented IOSurface's texture through the texture's own resource index, which is the guest's. The guest's indices belong to its processes: when one ends (a logout, a window server restart), its indices go back to the guest's kext, and the next process's texture made at one of them takes that index's element at once. The display can still show the old texture and draws it again at each refresh, so a refresh drew the new texture's pixels into the window, or undefined ones once that texture had gone and emptied the element, until the guest presented again. The display now samples the texture through a view of its own: the whole texture in its own pixel format, at one of the platform's own indices, made at the texture's first such draw and kept with the decoder's entry and with each of the display's holds of it, so a later present or refresh of that texture makes no Vulkan call. The copy path reads the image through no index and is unchanged. Where the platform refuses the view, the draw answers nothing: the window keeps its last frame and the host's read of the display answers black, counted as display-view-refused. No draw falls back to the guest's index. For the host: a refresh after the guest reuses the shown texture's index still shows that texture. a_color_draws_a_presented_surface_through_its_tables and a_surface_takes_the_table_at_its_own_size_in_unorm now expect the view, not the surface, in the fragment binds. |
||
|
|
11055c78d5 |
⬆️ Build on metal2vulkan development 82e7c39216
Moves both metal2vulkan revs from d83fb05624 to 82e7c39216, 65 commits on its
development branch, named green by its checks (m3-max-59311). The runtime's
crate takes its published name there (9a1c8fe6dc): metal2vulkan-rt 0.0.0 is
now metal2vulkan-runtime 0.2.0, its library metal2vulkan_runtime. The
dependency key, the crate's paths (each still `as rt`), the lock's entry and
the docs, comments, log lines and scripts that named the crate follow it. The
rename changes no API.
On rt:
- A command buffer waiting for a shared event's value whose signal is
submitted is Scheduled as it is submitted (4730af16e7): its scheduled
handlers run on the submit thread then, and its queue's later command
buffers are no longer held behind it. A wait for a value that neither the
host set nor a submitted signal promises stays held, Committed, as before
(counted in Metrics::event_holds, fb4b77048c). GPU order and completion are
unchanged. The docs that said rt's completion thread runs a held command
buffer's scheduled handlers now say its submit thread does.
- Copies over buffers are tracked by the memory a buffer lies in, never its
id (7e38a29b69): a texture over one buffer sees a draw through a texture
over another buffer over the same bytes, in one command buffer and across
a held group.
- A kernel that reads buffers through an argument buffer's pointer members,
or through a gpuAddress the CPU wrote into a constant buffer, now makes
(3cdca62567, c0403a1c98); the translator refused it (IdentityDomains).
- A refused kernel input names its kind (98895eb6d2, 1c26e1dc54):
Gap::KernelInput { kind }, so the refusal's text, in the log and in the
NSError's description, carries the kind. It is still counted as
KernelInput.
- Memory goes back sooner. The release of a texture or block that an unsent
upload holds sends the upload at once (0277c68696). A texture longer than
a 16 MiB block has its block to itself and gives it back at its release
(61949e8ba4). Every free of device memory on a normal path is made by the
block-maker thread, and counted against the submits it meets (4c808ffa6d,
09735ad792). New gauges tell texture blocks apart from the consumer's
Private takes (b3f6c859dd).
- ComputePipelineState::dispatch_variant, the key of the VkPipeline a dispatch
runs (82e7c39216), which this tree does not call yet.
- The translator's old path is deleted (0b94d919d9 to 16c831165d): its
profile comes from Vulkan queries alone, with no policy switches and no
driver-fact tables. SEMANTICS_VERSION goes from 2201 to 2203 and
RUNTIME_VERSION from 2540 to 2541, so rt's shader and pipeline caches miss
once: the first run on each host translates its pipelines again.
The rest is metal2vulkan's own: its conformance declarations and ledger, its
generated documents and the tests of each change. The NSError texts the guest
receives, and the comments of the wire header and the guest's sources that the
prebuilt kext sets and the option ROM record, keep the old name here; commits
of their own change them.
|
||
|
|
28a777a8f6 |
🐎 Make a command buffer's dispatch shapes ahead of its walk
On the rt platform a dispatch's first use of a shape (its threadgroup size, threadgroup memory lengths and grid) makes the kernel's VkPipeline on the walk's thread, and the buffer's commit, with its process's wait for it, waits for that make. As a queue's service thread begins a buffer with a compute encoder, its pre-pass (graphics::decode::prepass) reads the dispatches through the message's views of the table and hands each shape not handed before to the compile pool, one compile a shape, which calls the state's prepare_dispatch while the walk goes on: rt makes the VkPipeline at the size the dispatch gives, and lowers nothing. A dispatch then finds its pipeline made, or waits for the one thread making it. It is bounded: a compute state's entry remembers the last 64 shapes handed, a buffer hands 32 at the most, and the pool runs these makes on all its threads but one, after every library and pipeline create. The walk waits for none of it. Right after the walk and commit, before the message lets go of anything, the pre-pass is closed: the shapes no thread took are dropped, and the walk's thread waits for those being made, so a compute state the guest destroyed during the walk is still let go of where its view closes, and the indices it gives back go back in the same order. Each wait is counted (dispatch-prepass-waited, -wait-ns, -wait-max-ns), and the first of each walk end (committed, refused, faulted) is logged. Nothing the guest or the host sees changes: prepare_dispatch reports nothing, and each dispatch's results and errors are decided in the walk as before. The tests on the fake platform hold that each buffer completes as before, and that a make the walk never reaches ends before the buffer's views close. docs/conventions.md names the one exception to "compiles run only inside the wait that needs them". |
||
|
|
8c40add9ac |
📝 Say what the tree runs on now the old platform is gone [ci skip]
The cutdel branch deletes VulkanPlatform, metal2vulkan-runtime and the rt feature, so RtPlatform over metal2vulkan-rt is the only platform. These docs still described the old one: its answer policies, its exact switches, MoltenVK on the Mac, its in-place guest memory, its records cache, its device recovery and its Metal-answer tests. - conventions.md: the guest-memory-in-place rule is replaced by the rt rule (rt allocates GPU memory, the device maps its blocks into the guest, textures sync at the guest's events, and there is one VkDevice per process). The degradation codes are now rt-unbuilt and rt-refused, and the deleted codes are dropped. - accuracy-ledger.md: restated for rt, which has no switches. It keeps the device's own arithmetic notes (tagged as measured before rt), the 19 unbuilt pieces and rt's refusal kinds, and device loss. - api.md, README.md: REIMS_VGPU_EXACT, _CENSUS_DIR and _TRACE_DEGRADE are gone, and STRICT now covers running out of memory only. The let-go and the quiesce describe one platform. - architecture.md, development.md, testing.md, qemu.md: KosmicKrisp in place of MoltenVK; RtPlatform, rt_window and RtBlocks in place of VulkanPlatform, the old window sink and HostBlocks; no Metal-answer comparisons and no opt-in GPU-fault tests. - lessons.md: the four lessons about deleted code only (the Metal comparison after MoltenVK, the runtime's shadows, device recovery and the in-place check) are dropped. The lessons that still bind mark their deleted names. - video/vaapi.md, graphics-kext/design.md: the GPU plane copy and the compositor mirror are marked as gone. - AGENTS.md: only the Vulkan platform's "Where things are" row changes. |
||
|
|
83fb05ed2e |
🐎 Tell the guest a drawn picture is done before its draw
On the rt platform on Windows, a picture whose output's planes lie in a cache's surface over Direct3D 11 textures lands by a draw from the texture the driver decoded it into. The landing waited for the decode, drew, and only then did the guest hear of the frame: a command buffer of the decode alone posted its CB_COMPLETE at its platform end, behind the session's signal. A player that holds each picture keeps one decode in flight, so each picture took the decode, the draw (4.4 to 5.2 ms of a 4K HEVC picture on a UHD 630) and the guest's own work in turn (docs/video/bugs.md, B96). The landing now tells of the decode done between its wait for the decode and its draw, as the VA-API arm's video processing on Linux does as it issues its copy. What changes for the guest: such a command buffer's CB_COMPLETE goes as the decode is done, in its queue's order, with GPU times of 0, while the draw runs. Nothing else moves. The session signals the decode once the draw is done and the platform holds what it wrote, and the buffer's end, its surface timeline and every read of the output wait for that signal: a command buffer of another queue that uses the output (a blit or copy from its texture or its buffer among them), a decode into it, a lock's download and a present. No reader sees the picture half drawn. A draw that fails falls back to the CPU's copy, still before the signal; a picture that fails to land after its CB_COMPLETE fails the session's next decode in its stead, counted as video-landing-failure-carried, as on Linux. No test held the old order: the drawn landing needs vaon12 and a decode. New tests: a session posts a picture's completion at its decode-done tell and signals the decode only once the rest of its landing is done; and a blit of another queue from the output, its texture's texels and its buffer's bytes, copies only behind its wait for the decode's buffer's end, which that buffer signals only behind its wait for its session's value. The tests of a reader on another queue, a decode, a download and a present after a completion at the decode hold for the draw as for the copy. |
||
|
|
6c47de82f2 |
🐎 Wait for the spare being made rather than make a second
A drawn cache's ask that found no spare made its own surface on the ring while the spares' thread could be making the very spare it asked for. Two makes at once contend in the driver: in held 4K H.264 on the UHD 630 (m3-max-56925, round 1 pass 2), 78 makes on the ring took 29.2 ms each and the spares' thread's 162 took 21.0 ms, where the same pass made each on the ring at 9.8 ms before the spares (m3-max-56661), and the pass fell from 76.1 to 44.3 fps. So an ask whose make is running waits for it and takes its spare, bounded at ten slices of 10 ms, past which it makes its own as before. Counted: video-drawn-spares-waited, the asks that waited, with video-drawn-spares-wait-ns their wait and video-drawn-spares-wait-max-ns the longest, so a boot shows each take waits about one make. |
||
|
|
a71bbb8934 |
🐎 Make video caches' D3D11 surfaces ahead, as deep as decodes
On Windows a video cache's surface over two Direct3D 11 textures is made at the guest's first texture over one of its planes, on the ring-0 thread that carries that texture make out, and the guest's next messages wait for it. A player that holds every picture it decoded takes a new IOSurface, and so a new surface, for each picture. Measured on the UHD 630 (2026-11-19, a macOS guest's 4K playback, pictures held): the targets' make took 9.3 to 9.8 ms on the ring and their import about 0.7 ms a picture between the HEVC stream's decodes, of a 26 to 33 ms gap from one decode op to the next, as the guest keeps one HEVC decode in flight; the H.264 stream's first round made them in 14.7 to 18.2 ms. Each ask now takes a spare made ahead for the same plane shapes, formats and device recoveries, where one is kept, and hands the makes that bring its spares back up to the depth to a thread of their own (reims-vgpu.graphics-drawn-spares-<i>), which nothing waits for; an ask that finds none makes its own as before. The depth is the guest's decodes in flight at its last decode (the session's value less its event's signalled value), at least one and at most 8 spares in all, which bounds their memory; the makes run one at a time under the device's reset gate held shared. The guest sees the same surfaces: only the thread and the time of their make change. Counted as video-drawn-spares-used, -missed, -made and -dropped. |
||
|
|
d5ba78e948 |
🐛 Fail the next decode where a picture fails after its completion
A picture whose copy into its output's caches fails after its command buffer completed at the decode can no longer fail that command buffer: the guest was told it landed. The session's next decode now fails in its stead, its command buffer completing as one whose picture did not land, so the guest sees the decode error one picture late (an HEVC picture's schedule gets kVTVideoDecoderMalfunctionErr) instead of never. The decode after it is not affected. It is counted as the degradation video-landing-failure-carried and logged once per process. |
||
|
|
c8fdccabfa |
🆕 Draw VA-API's pictures into surfaces over Direct3D 11 textures
On Windows on the rt platform, a video cache's two planes can lie in a surface over two shared Direct3D 11 textures that the VA-API arm draws each picture into (PlaneDraw), in place of the CPU's copy. The platform imports the textures through GpuDevice::import_d3d11_surface, which rt_platform answers through a stub of rt's provisional Device::import_d3d11_surface, the signature of m2v's 42993be0bc: it refuses every surface, counted (rt-refused-d3d11-surface), so each picture still lands by the CPU's copy until the pin carries the import. Swapping the stub for rt's call is one function and its plane type. The draws are made at the arm's open (RtCopies::new), so no picture waits for their devices and pipelines. A drawn picture holds the textures' keyed mutexes across the draw, waits on the landing's thread, releases them, and then says the writes are done (external_writes_done). Each draw is counted by picture and KiB (video-pictures-drawn, video-drawn-kib): one GPU pass per picture that a Mac does not make. A plane not drawn falls to the CPU's copy into its image. |
||
|
|
db9acd7854 |
🆕 Count Private takes longer than the guest's 16 MiB block
The guest's Metal bundle is to ask for Private blocks of 16 MiB, metal2vulkan-rt's allocation unit (MemoryClass::block_len), which rt's block maker makes ahead of need, so the host answers such a take with no allocation of the driver's in it. An object whose span is longer takes a block of its own, which rt allocates in the take, on the context's take worker. Those takes are now counted apart among the sourced ones: private-take-span, and private-take-span-us, the source's time for them, with the first one's line in each boot's log. UNIT_LEN names the unit, from rt's block_len. Nothing the guest or the host observes changes: the counts and the log line are diagnostics. |
||
|
|
860570b8d1 |
🐛 Keep a Managed buffer made off its copy's address, not refuse it
Where the guest took MANAGED_AT_COPY and the platform makes the Managed buffer at an address other than its CPU copy's (a copy in no block the platform knows, such as one over the region), the host refused the create, so the guest's id stood for a refused object: nil where bound, its uses dropped. Metal makes that buffer, so the host must not refuse it. The host now keeps the buffer the platform made. It is the buffer the same create makes from a guest that did not take the bit: the same platform call, the same pin left unkept and counted, the same binding. Each such create is counted as managed-at-copy-unkept, the first logged. What changes for the guest on a unified rt host: such a create is a live buffer, bound and used as without the bit, rather than a refused object. Its gpuAddress is the address the guest posted, which the buffer is not at, as a guest's own pick is not on that host today. Nothing changes where the copy lies in a block the platform knows, nor on a host that does not offer the bit. The wire header's doc for the bit says so. The prebuilt sets and the option ROM's record are rebuilt from it in their own commit. The tests compare the answers with the same create's without the bit: the decoder test its result, the platform's calls, the binding, the GPU address, the unkept pin's count, a didModifyRange and a synchronize; the rt GPU test its result, the binding and rt's address over the region. |
||
|
|
b406d180c5 |
🆕 Offer MANAGED_AT_COPY on a unified GPU of the rt platform
What changes for the guest: on a host whose GPU shares the CPU's memory, on metal2vulkan-rt's platform, with the Shared pool, the device offers feature bit 63. A guest that takes it makes each Managed buffer at its CPU copy's GPU address, so the gpuAddress its argument buffers and pointers hold is the buffer's bytes, and it takes no Private block for it. Before, the guest held its own pick in a Private block, rt made the buffer at the copy's address instead, and a kernel reaching the buffer through its gpuAddress read the Private block; each pick also held a Private take (1308 such picks and four 256 MiB Private blocks on a 780M desktop walk). Where the guest took the bit and the platform does not make the buffer at the copy's address (a copy in no block it knows), the host refuses the create, as Metal answers nil, counted managed-at-copy-refused; it never makes the buffer at an address of its own. A GPU of its own memory keeps two copies, the Vulkan platform pins each buffer at the guest's pick, and a device with no pool keeps the slabs' copies in region heaps: none offers the bit, and their guests see no change. |
||
|
|
6d7081f890 |
📝 List the contexts' Private takes after the predication's code
The rebase onto development put the contexts' Private takes after the Vulkan platform's command predication in the conventions' list of counted codes, which left two "and"s in one list. Drop the first. [ci skip] |
||
|
|
d3fe2293b3 |
🆕 Decode video on the rt platform on Windows, landed by the CPU
On the rt platform, a Windows host answered the guest no hardware video. It now opens the VA-API arm there, on Mesa's VA-on-D3D12 driver, at the DXGI adapter whose LUID Vulkan answers for rt's device (HostGpu::luid). The guest sees H.264 and HEVC decodes where the driver has them, and no encoder, as on Linux's rt arm. rt imports no image of the shared Direct3D 12 texture a picture decodes into: the UHD 630's driver faults binding a two-plane image imported from its D3D11 handle, and refuses single-plane images from the D3D12 resource. So the session's copier declines each picture at the GPU's copy, counted as rt-video-gpu-copy-declined, and each lands by vaGetImage and the CPU's copy. On the old platform on that GPU the CPU's copy took 18.77, 68.35 and 79.28 ms a picture (1080p NV12, 4K NV12, 4K P010) against the GPU copy's 1.47, 4.18 and 10.36 ms; bugs.md B94 records it and the measured way out. |
||
|
|
cf6bc1e7c0 |
🐎 Take Private blocks from the source on a worker per context
PRIVATE_TAKE was carried out on the context's lane. On metal2vulkan-rt each take is one of rt's Private blocks, a driver allocation, and NVIDIA's driver holds the device's other calls while it allocates. On an RTX 3090 a boot took 7 blocks of 256 MiB, 52.7 ms in all and 11.5 ms at most, each on the control ring's lane, which held every context's next messages behind it. A take of the source's now goes to its context's worker (reims-vgpu.graphics-private-take), as POOL_TAKE's does. The worker takes the block from the source and answers. A context's takes are answered in its own order, so a take waits only behind its own context's earlier takes. A take that its context's close, the device's reset or its release ended is never answered, and the block its worker was taking goes back to the source. The device's release waits for the workers, so none calls the source past it; a worker that the exit gate parks counts as gone. Where the platform gives no Private blocks, the host's pick is still answered at once on the lane. The source decides this, never the driver or the device. What the guest observes: only when PRIVATE_BLOCK comes. It may now come after the answers to messages the context posted after the take. Its status, address and length are unchanged. The kext waits for PRIVATE_BLOCK with no deadline, on the thread whose create found no room, so no other wait changes. The degradation counts carry the takes by cause: - private-take-queued: a take that waited behind its context's earlier take; - private-take-sourced: a take its worker took from the source, with private-take-sourced-us, the source's time for those takes; - private-take-lane-us-most: the longest a take held the thread that carried it out. No block is made ahead: a 256 MiB Private make holds an NVIDIA device for 6.5 ms (RTX 3090) to 8 ms (RTX 2080) on any thread, while 16 MiB units stay at the baseline (a no-boot probe). Smaller blocks are the guest's change, in its own commit. |
||
|
|
5a13c1e930 |
🆕 Count each kind of message the decoder did not carry out
A message the decoder did not carry out was logged once per kind at warn, and every later one only at debug, so a boot's degradation counts showed none of them. On rt without the guest RAM lease, a walk refused 805 no-copy creates and 701 textures over them, and the counts said nothing. Each is now counted by why: decode-malformed, -unknown-command, -refused, -bad-reference and -bad-resource-id from DecodeError, and decode-faulted for a raise. This applies at the stage-3 report, a pipeline or library create's refusal, and a deferred op's raise. A message of a context closed before it came is owed nothing and is not counted. The lines are unchanged. docs/conventions.md lists the codes. A test refuses two event creates: one warn line, and decode-refused counts 2. |
||
|
|
3eab605b32 |
🆕 Count the commits of a process holding an escaped read-only copy
On Linux and Windows, a no-copy buffer over pages the process maps read-only lies over a copy of those pages. Once such a buffer's identity has escaped, the GPU may read the copy through memory after the guest's CPU has changed the pages, with no binding naming the buffer. This commit records how often that situation arises, and pins the runtime behaviour that keeps it correct. The behaviour is unchanged: the decoder adds nothing to any command buffer. Metal requires an encoder to make resident (useResource:usage:) any buffer a function reaches through memory, and that names the buffer as a use. At the commit, the runtime copies in every copy that a command buffer's uses name, and every copy where its work may reach memory that no use names (metal2vulkan's command_buffer/mod.rs:4747-4772 at the pinned commit, which picks the copies at 4754-4766). A reach of a buffer that no encoder made resident is undefined in Metal, and on the runtime it reads zero (residency.rs). What the decoder adds is bookkeeping: - each process's count of its live escaped copies (Context::escaped_copies), which a copy joins at its first note and leaves when it is dropped; - escaped-copy-commits, which counts each command buffer begun by a process that holds one, in the degradation counts line and the recorder's stats. The first such command buffer is logged at info. on_vulkan_an_escaped_copy_reached_by_its_address_reads_the_cpus_writes pins today's runtime. A kernel reaches the escaped copy only through an address it loads, with the encoder having made the copy resident. It reads the pages' old bytes, then their new ones after the CPU's write. |
||
|
|
8447199fee |
🆕 Note a no-copy buffer's identity the first time it escapes
The host reads a no-copy buffer's bytes in place. The guest's Metal can hand that buffer's identity to the app, or write it where the GPU reads, with no message naming the buffer, and from then on the GPU may reach the buffer through memory alone. The host had no way to know which buffers that happened to. This commit adds a note for it, so the host can tell them apart. The note is RGFX_CMD_BUFFER_ESCAPED (0x23b), RgfxBufferEscaped of 32 bytes: the buffer's object id and the act, one of GPU_ADDRESS, ARGUMENT_ENCODER, RESOURCE_ID and RESIDENCY_SET. The device offers it as RGFX_FEATURE_BUFFER_ESCAPED (bit 56), and both kexts carry it. The submit gate takes it in a batch, like a Managed range's write: unwaited, a fixed size, naming no block and making no object. The bundle marks each covered buffer as it is made (_rgfxEscape, set by rgfxOwesEscapeNote) where the host took the feature. The first of these acts in the buffer's life posts the note, before the act returns: - a read of the buffer's gpuAddress; - an argument encoder's setBuffer(s) of it, or setTexture(s) of a texture or view over it; - a read of such a texture's or view's gpuResourceID; - the buffer, or such a texture, joining a residency set. Every later act is one relaxed load. Wire order holds the note ahead of any command buffer that could use the identity. The note goes on ring 0, posted or held in the serialiser to go before the next commit's messages, and the device carries out a command buffer only after every ring-0 message its process posted before it. Across threads, the act's slow path posts the note under the buffer's lock and then clears the mark with a release store. Every commit takes an acquire fence before it posts, so a commit after an act that found the mark clear posts after the note. The covered buffers are the app's no-copy buffers over its own pages (BUFFER_OVER_PAGES, writable or read-only, bit 24) and over bytes already in a block of the process (BUFFER_OVER_HOST_MEMORY). Managed buffers, heaps over pages, IOSurface shadows and buffers placed in a slab's heap (BUFFER_AT_OFFSET) are not covered. A slab buffer made with an address of its own is covered too: a Shared buffer past 2 MiB over a slab of the process's own pages, a device buffer, or a no-copy buffer's shadow (RgfxSlabSource::Made's ownsAddress). It reaches the host as the same BUFFER_OVER_PAGES or BUFFER_OVER_HOST_MEMORY message as an app's no-copy buffer, and the host takes every such message alike. Leaving slab buffers out would leave the host unable to read the mark as "this buffer's identity never left". The host marks the buffer's entry escaped, once for its life, and a later note changes nothing. A note for an object that is not such a buffer is a bad reference. A note for an object whose create the host refused is dropped, as any naming of one is. Escapes are counted in the degradation counts line and in the recorder's stats (`counted <code> <n>` lines), with no new stream records: - buffer-escaped-gpu-address, -argument-encoder, -resource-id and -residency-set, by the act that noted the escape; - buffer-escaped-read-only-pages, the escaped buffers over a copy of their pages; - no-copy-buffers, every no-copy buffer made, of which the escapes are a share. Each act's first escape is also logged at info. This changes nothing the guest observes. No one waits for the note, it has no reply, and the mark changes no answer, object, address or command. Both prebuilt sets and the option ROM's record are rebuilt from these sources. The ROM's bytes do not change: its record changes only by the wire header's hash. |
||
|
|
7efe324717 |
🆕 Count the buffers made over read-only guest pages, and their KiB
At the runtime's cutover every host makes a no-copy buffer over pages the guest maps read-only over a copy of them, the Mac included, where today it imports them in place. To know what that copy costs a guest, the decoder now counts each such buffer it makes, once a boot, in the degradation counts' line: `read-only-pages-buffers` (how many were made) and `read-only-pages-kib` (their bytes' sum in KiB, rounded up). A BUFFER_OVER_PAGES over a block the kext marks RGFX_SURFACE_PAGES_READ_ONLY is the only such object: the bundle sends read-only Shared memory there with bit 24, and a heap, an indirect command buffer's slots or a Managed object's CPU copy over the block is refused. The count is taken there, in the decoder every host shares, so it means the same on Linux, Windows and macOS. The counts' line is where they go: docs/conventions.md lists every kind counted since the process began there, not degradations alone (the rings' `vblank-dropped` and `*-post-waited` among them), and says no count goes elsewhere. On macOS the buffers are no degradation; on Linux and Windows the runtime also counts their copies, with failed imports, under its own code. answer.rs gains count_kind_by, which adds an amount to a kind's count. Diagnostics only: no ring message, value or answer the guest sees changes. |
||
|
|
aa28476e9d |
📝 Name Windows beside Linux and macOS in the window and OS docs [ci skip]
The swapchain, the window's presenter, the display's sink and the window system's extensions present on Windows too, through SDL's Win32 surface (os/windows.rs's WINDOW_SURFACE_EXTENSIONS), but their docs said "either OS" or named Linux and macOS alone. rust-toolchain.toml still named the Metal platform, deleted on 11-07. caps.rs's table gave a host's naming of its device by Metal's registry ID (open_device, a handshake) as the reason for the stand-in; no host names its device so now, and the reason that holds is that Metal's core count and driver sizes for that GPU are found by that ID. Comments and docs only. |
||
|
|
4b866b6914 |
🐛 Fail the command buffer a predicated loop overran in
A loop of command predication that ran past the iterations laid down for it set a flag in its command buffer's state buffer, and a completed handler of the platform's own read the flag and ended the process. That handler ran on the runtime's thread outside every refusal scope, so a guest whose loop ran on, or anything that wrote the flag, ended QEMU. The state buffer is host data the GPU writes, and after the runtime's cutover every byte on the device is guest-writable. The flags are now read where the runtime's own failures are read, once the command buffer completed with none: by each completed and completion-seen handler's read, and by status, error and waitUntilCompleted. An overrun is a failure that is none of Metal's, dying where it is read, as the others do. What the guest sees: inside the graphics lane's refusal scope, which every guest command buffer's handlers carry, the read is refused and the command buffer completes with status Error and an internal error (RGFX_CB_INTERNAL), after its event signals and in its queue's order, and QEMU goes on. Each such command buffer is counted once as the degradation predication-loop-overrun. Outside every scope (the library's own tests) it still ends the process, now at the first read of the completion. The death test now dies at the wait, and two tests pin the refused completion and a loop that ends within its copies. |
||
|
|
d1e692f573 |
📝 Freeze the old runtime and pin development commits [ci skip]
metal2vulkan is replacing its runtime with a new crate that has one path for every device. reims-vgpu's rules now say what that means here until the cutover: the current runtime takes regression fixes only, from one lane at most, and nothing extends its device tables, device checks or queue-sharing policies. reims-vgpu builds its side of the new contract: runtime-owned memory mapped into the guest, device-image textures synced at the guest's events, and host-assigned addresses with one VkDevice per guest process. At the cutover that replaces guest memory in place, which conventions.md now says. The pin rule now states what the owner set on 2026-11-17: the pin is an exact commit on metal2vulkan's development, on the remote before ours is pushed, and a regression it brings is fixed forward rather than routed around by holding or rolling back the pin. |
||
|
|
02e97ee449 |
🐎 Keep VideoToolbox's host messages off the control ring
An encode's frame at 1080p and 8 Mbit/s goes to the guest as two or more 16 KiB VT_MESSAGE events. Two of them do not fit the control completion ring's 32 KiB at once, so an encode filled that ring about once a frame: control-ring-full and control-ring-post-waited 592 times in an arm64 26.6.2 boot's encode bench (potluck job m3-max-38178). A full ring holds back the display's VBLANKs and the presents' answers while the guest encodes. Feature bit 54, VT_RING, which the device offers wherever its host offers VT_MESSAGES and the arm64e kext takes with it, moves those messages into the VideoToolbox ring: a 2 MiB ring at region offset 0x20000, in the room between the control completion ring's span and the guest's allocations, which the kexts already map with the control rings. It is the device's memory, so the kext wires none of the guest's RAM for it and frees nothing at the service's stop or its unload. Each message there is followed on the control completion ring by a 24-byte VT_RING event (0x40f) carrying the ring's count through it. The kext takes the ring through that count as it takes the event, so the messages keep their place among the control ring's events. A message that finds the ring full goes onto the control completion ring as before, after the VT_RINGs of the messages ahead of it, and the spell is counted as vt-ring-full. A guest or host without the bit gets VT_MESSAGE events as before. What the guest observes: the feature bit offered with VT_MESSAGES, and the host's messages in the VideoToolbox ring with VT_RING events instead of VT_MESSAGE events, in the same order. |
||
|
|
8742a21507 |
🐛 Log the bundle's lines with their text public
macOS 26's unified log shows an NSLog argument that is an object or a string made at run time as <private>, so the bundle's diagnostics named nothing there: RealityKit's usdz Quick Look preview logged "RGFX: <private>: no reflection (<private>); answered nil" and no more. The bundle's Objective-C sources now log through rgfxLogLine, which formats the line as NSLog does, logs it as one public string on the bundle's subsystem at the default level NSLog used, and writes it to stderr where NSLog wrote there too (the death checks read a death's words there). bundle_log_check.sh fails a bundle that calls NSLog. |
||
|
|
d5dbecbdac |
📝 Say how Windows-only code is checked [ci skip]
The library builds and tests on Windows now, so AGENTS.md says Windows is being brought up on homelab-mac-mini-2018, with nothing shipped for it yet. Checking a change gets a row for Windows-only code: the check's Windows clippy, then the crate's tests on the mini through scripts/internal/windows-tests.sh. The note on what the check covers off the host's own target now names the Windows clippy. conventions.md's list of per-OS files gains the Vulkan crate's os/windows.rs and the graphics crate's unix/windows splits. |
||
|
|
9a4f391b23 |
📝 Say that Windows runs the window's callbacks on reims-vgpu.ui [ci skip]
With the window on Windows SDL3's on the library's own thread, as on Linux, the C API's thread rules name Windows beside Linux: the header (from window.rs, regenerated), docs/api.md and the feature's note in reims-vgpu's manifest. docs/conventions.md says Windows takes Linux's host-call catch. |