🎨 Rewrap the lines the runtime's rename ran past 100 columns

The rename of metal2vulkan-rt to metal2vulkan-runtime lengthened each mention
by five columns, and 43 lines of comments, docs and string literals ran past
the tree's 100 (the C API's two paragraphs were rewrapped in a16076ff37). Each
moves its last words to the next line of its paragraph, cascading where that
line runs over in turn; no word changes. A string literal moves words only
across its backslash-newline continuations, so every string reads as before:
each file's comment words, code tokens and decoded strings were compared
before and after, all equal. No log line, message or test changes.
This commit is contained in:
Anees Iqbal committed 2026-11-20 10:03:54 -08:00
1 parent b6b5a99619
commit 42d93ec745
26 files changed
+124 -121

No files matched your search

+3 -3
View File
@@ -13,9 +13,9 @@
//! - every struct the host writes starts with `struct_size` ([`sized`]);
//! - every callback table has one `ctx` and one `destroy` ([`table`]).
//!
//! The exports are made over [`Plat`]: `RtPlatform`, over metal2vulkan-runtime, on the host's Vulkan
//! driver on Linux and Windows and on Mesa's KosmicKrisp on macOS; and core's testkit platform in this crate's unit tests, which then run the
//! product's code.
//! The exports are made over [`Plat`]: `RtPlatform`, over metal2vulkan-runtime, on the host's
//! Vulkan driver on Linux and Windows and on Mesa's KosmicKrisp on macOS; and core's testkit
//! platform in this crate's unit tests, which then run the product's code.
// On the Vulkan platform, a debug build's proof that the runtime's types are `Send` and `Sync`
// nests deeper than rustc's default limit of 128 (E0275).
@@ -377,10 +377,10 @@ fn user_selection(var: impl Fn(&str) -> Option<OsString>) -> Vec<(&'static str,
.collect()
}
/// The device of `seen` (an instance's physical devices that meet metal2vulkan-runtime's floor, in the
/// loader's order) the rt platform opens (`crate::rt_platform`), and logged: the device the host's
/// user's selection variables name, else the one GPU, else the first by kind (the module doc).
/// `None` where no device is a candidate.
/// The device of `seen` (an instance's physical devices that meet metal2vulkan-runtime's floor, in
/// the loader's order) the rt platform opens (`crate::rt_platform`), and logged: the device the
/// host's user's selection variables name, else the one GPU, else the first by kind (the module
/// doc). `None` where no device is a candidate.
pub(crate) fn chosen(seen: &[Seen]) -> Option<usize> {
for (at, device) in seen.iter().enumerate() {
log::info!(target: TARGET, "Vulkan device {at}: {}", device.describe());
+10 -10
View File
@@ -130,16 +130,16 @@ pub(crate) unsafe fn device_local_budget_of(
}
/// The bytes of `memory`'s heaps, every one of them, summed (`GpuDevice::memory_heaps_total`),
/// which bound the guest's Shared pool's range. Every heap, not only the heap of metal2vulkan-runtime's
/// Shared memory type (host-visible, host-coherent and host-cached), whose blocks fill the pool: a
/// heap's size is how the driver accounts for its memory, not what it will allocate (on a 780M,
/// RADV gives that type a 5.52 GiB heap beside an 11.05 GiB device-local one, measured with
/// `vulkaninfo` on 2026-11-18, both from the same system memory), and the runtime takes Shared
/// blocks until the driver refuses one. The sizes, not `VK_EXT_memory_budget`'s budgets: the
/// pool's range is guest physical addresses held for the device's life, which RAM fills only as
/// the pool takes blocks, while a budget is what the process may allocate at the moment it is
/// read, which other processes move, and which a driver may answer past its heap's size
/// ([`device_local_budget_of`]).
/// which bound the guest's Shared pool's range. Every heap, not only the heap of
/// metal2vulkan-runtime's Shared memory type (host-visible, host-coherent and host-cached), whose
/// blocks fill the pool: a heap's size is how the driver accounts for its memory, not what it will
/// allocate (on a 780M, RADV gives that type a 5.52 GiB heap beside an 11.05 GiB device-local one,
/// measured with `vulkaninfo` on 2026-11-18, both from the same system memory), and the runtime
/// takes Shared blocks until the driver refuses one. The sizes, not `VK_EXT_memory_budget`'s
/// budgets: the pool's range is guest physical addresses held for the device's life, which RAM
/// fills only as the pool takes blocks, while a budget is what the process may allocate at the
/// moment it is read, which other processes move, and which a driver may answer past its heap's
/// size ([`device_local_budget_of`]).
pub(crate) fn memory_heaps_total_of(memory: &vk::PhysicalDeviceMemoryProperties) -> u64 {
memory
.memory_heaps_as_slice()
+3 -3
View File
@@ -1,8 +1,8 @@
//! The trace's clock ([`trace_clock`]).
/// The trace's clock: rt's host clock, in nanoseconds (`metal2vulkan_runtime::host_time`), the clock
/// rt's command buffers' times count, so a command buffer's times and the trace's events are of
/// one clock.
/// The trace's clock: rt's host clock, in nanoseconds (`metal2vulkan_runtime::host_time`), the
/// clock rt's command buffers' times count, so a command buffer's times and the trace's events are
/// of one clock.
pub fn trace_clock() -> u64 {
metal2vulkan_runtime::host_time()
}
@@ -641,8 +641,8 @@ fn deferred_refused(length: u64) -> ! {
call: DEFERRED_SEL,
},
&format!(
"metal2vulkan-runtime refused the memory of a deferred buffer of {length} bytes at a use \
that answers no refusal ({DEFERRED_REFUSED_CODE})"
"metal2vulkan-runtime refused the memory of a deferred buffer of {length} bytes at a \
use that answers no refusal ({DEFERRED_REFUSED_CODE})"
),
)
}
@@ -2011,8 +2011,8 @@ fn both_refused(sel: &'static str, dma_buf: &rt::Error, pointer: &rt::Error) {
if !BOTH_REFUSED_SAID.swap(true, Ordering::Relaxed) {
log::info!(
target: TARGET,
"{sel}: metal2vulkan-runtime refused both a dma-buf of the pages of a no-copy buffer or \
heap ({dma_buf}) and their pointer ({pointer}); each such import is counted from \
"{sel}: metal2vulkan-runtime refused both a dma-buf of the pages of a no-copy buffer \
or heap ({dma_buf}) and their pointer ({pointer}); each such import is counted from \
here ({IMPORTS_DMA_BUF_AND_POINTER_REFUSED})"
);
}
@@ -1,5 +1,5 @@
//! The rt platform's device ([`RtDevice`]): one metal2vulkan-runtime device for the process, made of
//! the physical device the library's choice of device picks ([`open`]), with its answers
//! The rt platform's device ([`RtDevice`]): one metal2vulkan-runtime device for the process, made
//! of the physical device the library's choice of device picks ([`open`]), with its answers
//! (`super::answers`), its command queues (`super::queue`), its buffers (`super::buffer`), heaps
//! (`super::heap`) and the blocks it knows ([`KnownBlocks`]), its textures (`super::texture`),
//! events and fences, and the reservation of resource indices as rt's index grants. Every other
@@ -88,9 +88,9 @@ fn refused(sel: &'static str, why: &dyn std::fmt::Display) {
log::warn!(
target: TARGET,
kind:% = EXPORT_REFUSED_CODE;
"{sel}: metal2vulkan-runtime makes no exportable buffer ({why}); the buffer is made as any \
other, and the host's video lands its pictures another way ({EXPORT_REFUSED_CODE}), \
counted from here"
"{sel}: metal2vulkan-runtime makes no exportable buffer ({why}); the buffer is made as \
any other, and the host's video lands its pictures another way \
({EXPORT_REFUSED_CODE}), counted from here"
);
}
}
@@ -113,8 +113,8 @@ fn refused(desc: &SurfaceDesc<'_>, why: &dyn std::fmt::Display) {
log::warn!(
target: TARGET,
kind:% = SURFACE_REFUSED_CODE;
"an exported surface of {desc:?}: metal2vulkan-runtime makes none ({why}); its planes stay \
in images of their own, and the host's video lands its pictures another way \
"an exported surface of {desc:?}: metal2vulkan-runtime makes none ({why}); its planes \
stay in images of their own, and the host's video lands its pictures another way \
({SURFACE_REFUSED_CODE}), counted from here"
);
}
@@ -172,8 +172,8 @@ pub(super) fn exported_surface(
log::warn!(
target: TARGET,
kind:% = SURFACES_COPIED_CODE;
"an exported surface of {desc:?}: metal2vulkan-runtime made it in the copy form \
({reason:?}), its planes copied into and back ({SURFACES_COPIED_CODE}), \
"an exported surface of {desc:?}: metal2vulkan-runtime made it in the copy \
form ({reason:?}), its planes copied into and back ({SURFACES_COPIED_CODE}), \
counted from here"
);
}
@@ -202,8 +202,8 @@ pub(super) const NON_VOLATILE: u64 = 2;
/// `MTLPurgeableStateEmpty`, the last state.
const EMPTY: u64 = 4;
/// `id<MTLTexture>` on metal2vulkan-runtime: rt's texture and what the platform answers of it beyond
/// rt's descriptor.
/// `id<MTLTexture>` on metal2vulkan-runtime: rt's texture and what the platform answers of it
/// beyond rt's descriptor.
pub struct RtTexture {
/// rt's texture.
rt: rt::Texture,
@@ -1480,8 +1480,8 @@ fn counted_copy(bytes: usize) {
if !COPIED.swap(true, Ordering::Relaxed) {
log::warn!(
target: "reims_vgpu_vulkan::rt_platform",
"{REPLACE}: the guest's bytes are copied before metal2vulkan-runtime takes them, a copy \
Metal does not make ({COPY_CODE}), counted from here"
"{REPLACE}: the guest's bytes are copied before metal2vulkan-runtime takes them, a \
copy Metal does not make ({COPY_CODE}), counted from here"
);
}
}
@@ -231,8 +231,8 @@ pub fn refused_error(piece: Unbuilt, sel: &'static str) -> NsErrorText {
/// The line of the process's first refusal of `piece`, at `sel`.
fn refusal_line(piece: Unbuilt, sel: &'static str) -> String {
format!(
"reims-vgpu: {sel}: {} is not built on metal2vulkan-runtime; refused ({}), the first of its \
kind\n",
"reims-vgpu: {sel}: {} is not built on metal2vulkan-runtime; refused ({}), the first of \
its kind\n",
piece.what(),
piece.code()
)
@@ -395,8 +395,8 @@ pub fn refused_as(sel: &'static str, kind: RtRefusal, why: &dyn std::fmt::Displa
count_refusal(kind);
if first(&SAID_RT, kind.at()) {
say(&format!(
"reims-vgpu: {sel}: metal2vulkan-runtime refused it ({why}); refused ({}), the first of \
its kind\n",
"reims-vgpu: {sel}: metal2vulkan-runtime refused it ({why}); refused ({}), the first \
of its kind\n",
kind.code()
));
}
@@ -443,8 +443,8 @@ pub fn rt_refused_texture(sel: &'static str, error: &rt::Error) -> RtRefusal {
super::diag::refusal(error);
if first {
say(&format!(
"reims-vgpu: {sel}: metal2vulkan-runtime refused it ({error}); refused ({code}), the first \
of its format\n"
"reims-vgpu: {sel}: metal2vulkan-runtime refused it ({error}); refused ({code}), the \
first of its format\n"
));
}
RtRefusal::Gap
@@ -784,8 +784,9 @@ mod tests {
assert_eq!(
detail_line("newTextureWithDescriptor:", &samples, &name, Some(&what)),
format!(
"reims-vgpu: newTextureWithDescriptor:: metal2vulkan-runtime refused it ({samples}); \
the first of Limit-TextureSamples (rt-refused-limit): a texture of format 70\n"
"reims-vgpu: newTextureWithDescriptor:: metal2vulkan-runtime refused it \
({samples}); the first of Limit-TextureSamples (rt-refused-limit): a texture of \
format 70\n"
)
);
let points = rt::Error::Unsupported(rt::Gap::Draw {
@@ -798,8 +799,8 @@ mod tests {
"Draw-Points",
None
),
"reims-vgpu: drawPrimitives:vertexStart:vertexCount:: metal2vulkan-runtime refused it (a \
draw with Points is not built); the first of Draw-Points (rt-refused-gap)\n"
"reims-vgpu: drawPrimitives:vertexStart:vertexCount:: metal2vulkan-runtime refused it \
(a draw with Points is not built); the first of Draw-Points (rt-refused-gap)\n"
);
let kind = "test-first-named";
assert!(first_named(kind.to_owned()));
+4 -3
View File
@@ -1,6 +1,7 @@
//! Our side of metal2vulkan-runtime's seam: what the Vulkan platform gives rt, built on rt at the commit
//! the workspace pins. Its tests run it on the GPU each test host holds, but on the Mac: rt's floor
//! refuses MoltenVK (it lacks `nullDescriptor`), and the tests have not run on KosmicKrisp.
//! Our side of metal2vulkan-runtime's seam: what the Vulkan platform gives rt, built on rt at the
//! commit the workspace pins. Its tests run it on the GPU each test host holds, but on the Mac:
//! rt's floor refuses MoltenVK (it lacks `nullDescriptor`), and the tests have not run on
//! KosmicKrisp.
//!
//! - **Sampler IDs** ([`sampler_ids`]): rt's creation of a pipeline state takes one sampler ID
//! for each sampler the state numbers, each constexpr sampler's an index of a live grant.
+7 -7
View File
@@ -523,8 +523,8 @@ impl<P: ApiPlatform> GraphicsDevice<P> {
// The GPU's memory heaps, summed, which size the guest's Shared pool's range below.
let memory_heaps = gpu_device.memory_heaps_total();
// The source of the guest's pool's blocks and of its contexts' Private blocks: the
// platform's where it gives blocks (metal2vulkan-runtime's), else the process's own memory
// for the pool and the host's picks of Private addresses.
// platform's where it gives blocks (metal2vulkan-runtime's), else the process's own
// memory for the pool and the host's picks of Private addresses.
let block_source = platform.block_source(&gpu_device);
// The guest's Shared pool, its blocks the source's. Its range is what the GPU's
// memory heaps hold, of the addresses the host can give.
@@ -1277,11 +1277,11 @@ impl<P: ApiPlatform> GraphicsDevice<P> {
/// the last call of the host's before its exit, on the thread that then exits. Its answer is
/// whether the host may then call `exit`. The library's threads park at their next step and
/// the steps in progress on other threads are waited for; on the platform over
/// metal2vulkan-runtime, then, where a GPU device is still live, rt's threads end and its GPU work
/// completes, and the process's GPU work after it is refused. Nothing is freed. On the
/// platform over metal2vulkan-runtime, true where it keeps no GPU device (the release of the last
/// graphics device let go of it, [`Self::let_go_of_gpu`]) and the steps ended in time; false
/// where it keeps one, stopped or not, since its runtime supports no `exit` with a device
/// metal2vulkan-runtime, then, where a GPU device is still live, rt's threads end and its GPU
/// work completes, and the process's GPU work after it is refused. Nothing is freed. On the
/// platform over metal2vulkan-runtime, true where it keeps no GPU device (the release of the
/// last graphics device let go of it, [`Self::let_go_of_gpu`]) and the steps ended in time;
/// false where it keeps one, stopped or not, since its runtime supports no `exit` with a device
/// live. On the Vulkan platform, true only where it never asked its runtime for a GPU device
/// in the process and the steps ended in time; false once it did, let go of since or not,
/// since that runtime's exit hook, registered as the device was made, waits for the runtime's
@@ -2175,8 +2175,8 @@ mod tests {
assert_eq!(count(), before + 1);
}
/// On metal2vulkan-runtime's platform, a `Managed` buffer over a slab's CPU copy (a Shared buffer in
/// a heap over a block of the guest's Shared pool, at the block's GPU address,
/// On metal2vulkan-runtime's platform, a `Managed` buffer over a slab's CPU copy (a Shared
/// buffer in a heap over a block of the guest's Shared pool, at the block's GPU address,
/// `POOL_ADDRESSES`), which the GPU reads and writes by a blit. On a GPU that shares the CPU's
/// memory the device offers `MANAGED_AT_COPY`, the guest posts its copy's address, and the
/// buffer is the copy's bytes at that address: the GPU reads what the CPU wrote, before and
@@ -8253,8 +8253,8 @@ fn encode_home<P: Platform>(
Ok(true)
}
/// The longest piece of a staged copy (the module doc, "Staged copies"): metal2vulkan-runtime's unit,
/// the length of each allocation its pool makes ([`MemoryClass::block_len`]), so a piece is
/// The longest piece of a staged copy (the module doc, "Staged copies"): metal2vulkan-runtime's
/// unit, the length of each allocation its pool makes ([`MemoryClass::block_len`]), so a piece is
/// carved from the pool's free ranges, or is the start of one unit's allocation where none fits,
/// and never takes an allocation of a surface's length.
///
@@ -128,8 +128,8 @@
//! pages block's `SURFACE_PAGES` is answered with a GPU address for the first byte of its view
//! ([`SurfaceViews::pages_address`]), and the guest places each `BUFFER_OVER_PAGES` over the
//! block there, plus the buffer's offset in the view: buffers over the same bytes, which share
//! a block, share their address, as they share the import of its pages on metal2vulkan-runtime. Here
//! the address is the host's pick in `[2^43, 2^44)` (`pool::addresses`), holding Metal's span
//! a block, share their address, as they share the import of its pages on metal2vulkan-runtime.
//! Here the address is the host's pick in `[2^43, 2^44)` (`pool::addresses`), holding Metal's span
//! of the view's length until the block goes. The first buffer made there is pinned there, as a
//! buffer at the guest's own pick is, and the block keeps it until it goes, so the address
//! reaches the view's pages for as long as any buffer over the block lives; a buffer made there
@@ -138,8 +138,8 @@
//! gets no address here: each of its buffers lies over a copy of its own.
//!
//! Where the platform keeps a pin only inside a block it knows and knows a view's import as one
//! (metal2vulkan-runtime's, [`ViewImports`]), the address is the import's own: a block's view and its
//! import are made at its `SURFACE_PAGES`, before the answer, rather than at its first
//! (metal2vulkan-runtime's, [`ViewImports`]), the address is the import's own: a block's view and
//! its import are made at its `SURFACE_PAGES`, before the answer, rather than at its first
//! `BUFFER_OVER_PAGES`, so the view joins no group, and every buffer over the block at the
//! address plus its offset is pinned there, a range of the import with no import of its own; no
//! buffer is kept. The import is known while the view's import buffer lives: in the block's entry,
@@ -155,14 +155,14 @@
//! until the cache lets it go. A block of pages its process maps read-only is made so too, one
//! known import a view, its address the import's and its buffers pinned in it, the import asked
//! as read-only: the platform makes it a copy of the pages whose GPU writes are dropped at each
//! completion (metal2vulkan-runtime's, its `buffer` module's docs, "Read-only memory"), so a GPU write
//! through its buffers never reaches the pages, as Metal's GPU drops it. Such a view is cached
//! apart: a read-only block takes only a cached view whose import drops the GPU's writes, and
//! any other block only one whose import keeps them. The refusals above stay.
//! completion (metal2vulkan-runtime's, its `buffer` module's docs, "Read-only memory"), so a GPU
//! write through its buffers never reaches the pages, as Metal's GPU drops it. Such a view is
//! cached apart: a read-only block takes only a cached view whose import drops the GPU's writes,
//! and any other block only one whose import keeps them. The refusals above stay.
//!
//! **Surfaces with no views** (`ApiPlatform::SURFACE_VIEWS`). A platform may keep no view of an
//! IOSurface's pages (metal2vulkan-runtime, whose surfaces are device images that the device cache's
//! copies sync at the guest's events): an IOSurface block's `SURFACE_PAGES`, and a deferred
//! IOSurface's pages (metal2vulkan-runtime, whose surfaces are device images that the device
//! cache's copies sync at the guest's events): an IOSurface block's `SURFACE_PAGES`, and a deferred
//! block's pages, then make no view and import nothing, however the guest's RAM is mapped, its
//! runs checked as a view's are ([`PagesRefusal::Unviewed`], counted), and a block named by its
//! runs that gets no device cache makes none either ([`Unmade::make`]). The surface takes a copy
@@ -4883,10 +4883,10 @@ pub(super) mod tests {
}
/// On a platform that keeps no view of an IOSurface's pages (`ApiPlatform::SURFACE_VIEWS`
/// false, metal2vulkan-runtime's), an IOSurface block's `SURFACE_PAGES` makes no view and imports
/// nothing, though the guest's RAM is mapped, counted as kept unviewed, and bad runs are still
/// refused as bad runs; a pages block, an app's no-copy memory, still takes its view and its
/// known import, at its `SURFACE_PAGES` answer
/// false, metal2vulkan-runtime's), an IOSurface block's `SURFACE_PAGES` makes no view and
/// imports nothing, though the guest's RAM is mapped, counted as kept unviewed, and bad runs
/// are still refused as bad runs; a pages block, an app's no-copy memory, still takes its view
/// and its known import, at its `SURFACE_PAGES` answer
#[test]
fn surfaces_take_no_view_where_the_platform_keeps_none_but_pages_blocks_do() {
const IMPORTS: u64 = 0x6_0000_0000;
+11 -11
View File
@@ -5,9 +5,9 @@
//!
//! **Pins not kept.** On such a platform any other pinned object lies at the platform's own
//! address, which the guest's pointers to it do not hold. The platform counts each such object
//! once (metal2vulkan-runtime's `rt-gpu-address-unpinned`); the decoder, which knows what each create
//! makes, counts it again under its kind's code ([`Codes::unpinned`]), so the kinds' counts sum to
//! that total. A pin counts where the decoder passed it to the platform and the object made
//! once (metal2vulkan-runtime's `rt-gpu-address-unpinned`); the decoder, which knows what each
//! create makes, counts it again under its kind's code ([`Codes::unpinned`]), so the kinds' counts
//! sum to that total. A pin counts where the decoder passed it to the platform and the object made
//! answers another `gpuAddress` ([`made`]). A texture placed by the device at the guest's own pick
//! is counted apart, as [`TEXTURE_PICKS`]: no platform takes a texture's pin, so none is in the
//! total, and its `gpuAddress` is the guest's answer alone.
@@ -17,14 +17,14 @@
//! holds a [`Live`], which counts it gone as the entry goes.
//!
//! **Imports.** Each make the decoder or the device asks of the platform runs as a make of its
//! kind on its thread (`reims_vgpu_vulkan::answer::making_as`, [`Codes::imports`]): metal2vulkan-runtime
//! counts each import of the host's memory it makes there under that kind, with the most live at
//! once, and under its total (`rt-imports`), so the kinds' counts sum to it. Each refusal of rt's
//! there is counted under the kind too (`reims_vgpu_vulkan::answer::refusing_as`,
//! [`Codes::refused`]), beside its own code (`rt-refused-vulkan` and the others). The device's
//! own makes that import are kinds of their own: the views of pages blocks ([`Kind::PagesView`]),
//! the views a device cache's copies use ([`Kind::CacheView`]) and the display's scanout
//! ([`Kind::Scanout`]).
//! kind on its thread (`reims_vgpu_vulkan::answer::making_as`, [`Codes::imports`]):
//! metal2vulkan-runtime counts each import of the host's memory it makes there under that kind,
//! with the most live at once, and under its total (`rt-imports`), so the kinds' counts sum to it.
//! Each refusal of rt's there is counted under the kind too
//! (`reims_vgpu_vulkan::answer::refusing_as`, [`Codes::refused`]), beside its own code
//! (`rt-refused-vulkan` and the others). The device's own makes that import are kinds of their own:
//! the views of pages blocks ([`Kind::PagesView`]), the views a device cache's copies use
//! ([`Kind::CacheView`]) and the display's scanout ([`Kind::Scanout`]).
//!
//! On a platform that places a pinned object anywhere (`ApiPlatform::PINS_IN_BLOCKS` false, the
//! default, the fake platform's) no pin or object is counted here, and none of its makes imports through a counted path.
+3 -3
View File
@@ -4,9 +4,9 @@
//! A device is made from one config ([`GraphicsConfig`]) holding closures for its callbacks, and
//! answers a [`Result`] with what refused it ([`Error`]). It is generic over the platform with
//! [`DefaultPlatform`] as the default, so its forwarding is unit-tested on core's fake platform.
//! The platform is `RtPlatform`, over metal2vulkan-runtime, on the host's Vulkan driver on Linux and
//! Windows and on macOS on Mesa's KosmicKrisp; it draws the device's window into a swapchain of its
//! window, on macOS one over the window's `CAMetalLayer`.
//! The platform is `RtPlatform`, over metal2vulkan-runtime, on the host's Vulkan driver on Linux
//! and Windows and on macOS on Mesa's KosmicKrisp; it draws the device's window into a swapchain of
//! its window, on macOS one over the window's `CAMetalLayer`.
//!
//! The library logs through the `log` crate: a Rust host installs its own logger.
+2 -2
View File
@@ -285,8 +285,8 @@ mod fake {
parking_lot::const_mutex(Vec::new());
/// Has `platform` import each pages block's view as a block it knows, through `imports`, as
/// metal2vulkan-runtime's does ([`ApiPlatform::view_imports`]): a graphics device made on it from
/// now on offers what goes with them. The entries of processes gone are dropped here.
/// metal2vulkan-runtime's does ([`ApiPlatform::view_imports`]): a graphics device made on it
/// from now on offers what goes with them. The entries of processes gone are dropped here.
#[cfg(test)]
pub(crate) fn fake_view_imports(
platform: &Arc<FakePlatform>,
+8 -7
View File
@@ -54,12 +54,12 @@
//!
//! # The block source
//!
//! [`BlockSource`] is metal2vulkan-runtime's block calls as its API names them (`Device::take_block`,
//! `release_block`, [`BlockInfo`]). On the rt platform the source is the runtime's blocks
//! ([`rt_blocks::RtBlocks`], the platform's `ApiPlatform::block_source`), each known to its device
//! while handed out. A platform that gives none (the testkit's) takes [`HostBlocks`], blocks of
//! the process's own memory, which hands blocks out, keeps them ready and frees them as the
//! runtime does.
//! [`BlockSource`] is metal2vulkan-runtime's block calls as its API names them
//! (`Device::take_block`, `release_block`, [`BlockInfo`]). On the rt platform the source is the
//! runtime's blocks ([`rt_blocks::RtBlocks`], the platform's `ApiPlatform::block_source`), each
//! known to its device while handed out. A platform that gives none (the testkit's) takes
//! [`HostBlocks`], blocks of the process's own memory, which hands blocks out, keeps them ready and
//! frees them as the runtime does.
//!
//! The host maps a block into the guest whole host pages at a time: a block whose mapping does
//! not start at a host page, or whose length is no whole number of them, goes back to the source
@@ -217,7 +217,8 @@ pub const PIECE_ALIGN: u64 = 2 << 20;
/// source (the module doc's "Headroom and giving blocks back").
pub const RELEASE_DELAY: Duration = Duration::from_secs(5);
/// A block's storage mode as the guest's buffers in it see it (metal2vulkan-runtime's `MemoryClass`).
/// A block's storage mode as the guest's buffers in it see it (metal2vulkan-runtime's
/// `MemoryClass`).
#[derive(Clone, Copy, Debug, PartialEq, Eq, Hash)]
#[allow(
dead_code,
+2 -2
View File
@@ -1,6 +1,6 @@
//! [`HostBlocks`]: a [`BlockSource`] of the process's own memory, which hands blocks out, keeps
//! them ready and frees them as metal2vulkan-runtime's device does, until the pool takes its blocks from
//! that runtime: then only the source changes.
//! them ready and frees them as metal2vulkan-runtime's device does, until the pool takes its blocks
//! from that runtime: then only the source changes.
//!
//! Each block is zeroed memory of the process's, aligned to 2 MiB and touched a byte a page before
//! it goes out, as the runtime touches a Shared block. A block given back goes to the ready set
+8 -8
View File
@@ -5,10 +5,10 @@
//!
//! # A block
//!
//! On a source that gives Private blocks (metal2vulkan-runtime's device), a take is one block of the
//! source's ([`BlockSource::take_block`] of [`MemoryClass::Private`]): device memory no one maps,
//! at the block's own GPU address, the whole of it the context's (the take's length rounded up to
//! rt's 64 KiB, carved from one of its 16 MiB allocations where it fits, else the start of an
//! On a source that gives Private blocks (metal2vulkan-runtime's device), a take is one block of
//! the source's ([`BlockSource::take_block`] of [`MemoryClass::Private`]): device memory no one
//! maps, at the block's own GPU address, the whole of it the context's (the take's length rounded
//! up to rt's 64 KiB, carved from one of its 16 MiB allocations where it fits, else the start of an
//! allocation of its own: [`super::BLOCK_LEN`]). The guest asks for blocks of [`UNIT_LEN`], rt's
//! allocation unit, each a range of an allocation rt's block maker may have made ahead of need; an
//! object whose span is longer takes a block of its own length, which rt allocates in the take
@@ -24,8 +24,8 @@
//! source gives no Private blocks, is answered at once on the thread that carries the take out,
//! the context's lane. A source's block may be an allocation of the driver's, which waits for the
//! memory and, on NVIDIA's driver, holds the device's other calls while it allocates (about
//! 0.08 ms a MiB of Private memory, metal2vulkan-runtime's `memory.rs`, `ALLOCATION_LEN`): on an RTX
//! 3090 a boot whose guest asked for blocks of 256 MiB took 7, 52.7 ms in all and 11.5 ms at
//! 0.08 ms a MiB of Private memory, metal2vulkan-runtime's `memory.rs`, `ALLOCATION_LEN`): on an
//! RTX 3090 a boot whose guest asked for blocks of 256 MiB took 7, 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
//! (**measured**). So a take of
//! the source's goes to its context's worker (`reims-vgpu.graphics-private-take`), which takes
@@ -88,8 +88,8 @@ pub const SOURCED_CODE: &str = "private-take-sourced";
pub const SOURCED_US_CODE: &str = "private-take-sourced-us";
/// The length of the guest's Private blocks, `kPrivateBlockBytes` in its Metal bundle: 16 MiB,
/// metal2vulkan-runtime's allocation unit ([`metal2vulkan_runtime::MemoryClass::block_len`]), which rt's
/// block maker makes ahead of need while the class's free bytes are fewer than half of one. A
/// metal2vulkan-runtime's allocation unit ([`metal2vulkan_runtime::MemoryClass::block_len`]), which
/// rt's block maker makes ahead of need while the class's free bytes are fewer than half of one. A
/// longer take is an object's own span, which rt makes an allocation for in the take.
pub const UNIT_LEN: u64 = metal2vulkan_runtime::MemoryClass::Private.block_len();
+3 -3
View File
@@ -1,6 +1,6 @@
//! [`RtBlocks`], the pool's [`BlockSource`] over metal2vulkan-runtime's blocks (`Device::take_block`
//! and `release_block`), the runtime the device runs on from the cutover: the source of the
//! guest's Shared pool and of its contexts' Private blocks on the rt platform
//! [`RtBlocks`], the pool's [`BlockSource`] over metal2vulkan-runtime's blocks
//! (`Device::take_block` and `release_block`), the runtime the device runs on from the cutover: the
//! source of the guest's Shared pool and of its contexts' Private blocks on the rt platform
//! (`ApiPlatform::block_source`). Its tests run it on the GPU each test host holds, but on the
//! Mac, whose Vulkan, MoltenVK, rt's floor refuses.
//!
+4 -4
View File
@@ -92,10 +92,10 @@
//! # Its GPU address
//!
//! Each carve has a GPU address from its carving, which its take's answer gives the guest
//! (`POOL_ADDRESSES`): where its piece's block has one (metal2vulkan-runtime's), the block's address
//! at the carve's offset in it, so a heap the guest places there is a range of the block; where it
//! has none (`HostBlocks`), the host's pick ([`super::addresses`]), freed with the carve. A carve
//! with no room left for its pick is not carved, as one with no room in a piece.
//! (`POOL_ADDRESSES`): where its piece's block has one (metal2vulkan-runtime's), the block's
//! address at the carve's offset in it, so a heap the guest places there is a range of the block;
//! where it has none (`HostBlocks`), the host's pick ([`super::addresses`]), freed with the carve.
//! A carve with no room left for its pick is not carved, as one with no room in a piece.
use std::collections::{BTreeMap, VecDeque};
use std::ops::Range;
+2 -2
View File
@@ -1652,8 +1652,8 @@ fn the_release_leaves_the_blocks_with_a_live_ledger_until_its_drop() {
assert_eq!(blocks.counts(), (0, 2));
}
/// A source whose blocks have GPU addresses, as metal2vulkan-runtime's do: [`HostBlocks`]' blocks, the
/// `n`th handed out at `ADDRESSED + n * BLOCK_LEN`.
/// A source whose blocks have GPU addresses, as metal2vulkan-runtime's do: [`HostBlocks`]' blocks,
/// the `n`th handed out at `ADDRESSED + n * BLOCK_LEN`.
struct Addressed {
blocks: HostBlocks,
handed: Mutex<u64>,
+2 -2
View File
@@ -189,8 +189,8 @@ submitted and the rest ends unrun, the GPU completes what was submitted, and the
end. Every wait ends within the call's bound, and nothing is freed. It answers true where the steps
ended in time and the library holds no GPU device the exit could meet: none was opened in the
process, or the release of the last graphics device let go of it. It answers false otherwise,
quiesced or not, and where a step outlasted the wait, since metal2vulkan-runtime supports an `exit` with
a device live on no device (its README, "Quiesce and exit"): on an RTX 3090 (620.70.06), 3 of 9
quiesced or not, and where a step outlasted the wait, since metal2vulkan-runtime supports an `exit`
with a device live on no device (its README, "Quiesce and exit"): on an RTX 3090 (620.70.06), 3 of 9
power-offs that called `exit` after the quiesce stopped everything in time ended with `SIGSEGV` in a
thread of the driver's own while its exit handler waited on a lock. On false the library writes its
degradation counts then, as the exit gate's handler would, and the host runs its own exit work and
+2 -2
View File
@@ -955,8 +955,8 @@ take's worker zeroes the carve; a piece is found only once the host says it is i
The source is rt's blocks (`pool::RtBlocks`, the platform's `ApiPlatform::block_source`), each known
to its device while handed out; where a platform gives none (the testkit's), it is `HostBlocks`, the
process's own memory, in the same shape (`take_block`, `release_block`). A piece the pool asks for
itself is one of metal2vulkan-runtime's units, 16 MiB (`BLOCK_LEN`, read from rt), and a take longer than
a unit has a piece of its own length. The pool keeps 64 MiB of empty pieces as headroom
itself is one of metal2vulkan-runtime's units, 16 MiB (`BLOCK_LEN`, read from rt), and a take longer
than a unit has a piece of its own length. The pool keeps 64 MiB of empty pieces as headroom
(`HEADROOM`), from the guest driver's take of `POOL` on (`Host::pool_taken`), so the guest's first
takes find them, and gives a piece above them that stays empty past `RELEASE_DELAY` back to the
source, which keeps it ready or frees it. Before a block goes back the pool takes its piece out of