Memory: the pools of exportable buffers get their growth blocks made ahead
A creation call that places an exportable buffer (new_exportable_buffer, an exportable buffer descriptor, the in-place check's buffers) in a pool with no room made the pool's 64 MiB block itself, on the program's thread. keep_room made blocks ahead (memory/ready.rs) only for the pools the runtime's encodings and commits place in and for the host copies' pool, so every growth block of Holds::Exports and Holds::DmaBufs was made in place. Now each pool of exportable buffers that grew within KEPT_EMPTY_FOR and lacks room for a whole block gets a block started ahead at each creation call's keep_room (Memory::exported_growing, ready_if_growing, the kept pools' tail of keep_room moved into it), made right after a burst of the device's submissions ended, as the kept pools' blocks are. makes_ahead covers those pools, so the placement that finds no room takes the block made ahead or waits for its making (place, take_ready) and counts a block it makes itself in buffer_blocks_made_in_place. keep_room makes no block for such a pool in place: its placements are the creation calls. The reclaim bench gains an arm of exportable buffers made by the runtime (24 of 32 MiB a phase, one every 400 ms) and prints blocks_ahead_waited_for. The citation of a consumer's wait is replaced by these measurements; FAST-PATHS's row on kept blocks says blocks are made ahead for pools that grew, the exportable ones among them. Verified, on a Radeon 780M (RADV PHOENIX, Mesa 26.2.6, gem10, MESA_VK_DEVICE_SELECT '1002:15bf!'): - reclaim_submit_bench_exportable in release under --cfg m2v_gpu, exclusive, two rounds each, the negative being memory.rs and memory/ready.rs as on development (job m3-max-12103): the creation calls that made blocks in place took 10.0 to 10.8 ms (quiet, round 1), 12.9 to 15.0 ms (fragmented: free memory in single pages, round 1) and 12.0 to 13.7 ms (fragmented, round 2; 0.3 ms at most in round 2's quiet phase). With the change no creation call took over 0.3 ms in any phase: 10 blocks made ahead and 2 in place (the pool's first two) in each quiet phase, 12 ahead and 0 in place in each fragmented one, 0 waited for. Turnarounds of 8 ms or more: 0 in every phase both ways (an exportable block holds no submission). - blocks_ahead's new test a_growing_pool_of_exportable_buffers_gets_its_new_blocks_made_ahead: 6 of the pool's last 6 blocks made ahead, 0 in place; with memory.rs as on development it fails, 0 of 6 made ahead (job m3-max-12111). - The whole runtime lib under --cfg m2v_gpu (debug): 1997 of 1997 passed (job m3-max-12109); clippy on the runtime crate, all targets and features, clean. And on lavapipe (llvmpipe, LLVM 23.1.4) under --cfg m2v_cpu_icd: blocks_ahead and clip_bursts pass (the later clips allocated nothing: [(0, 0), (0, 0)]; job m3-max-12110), clippy clean, and the new test fails, 0 of 6, with memory.rs as on development (job m3-max-12112). Not run: NVIDIA, MoltenVK. (cherry picked from commit 5a862c6ab9ebf0a6f2effeb8776aaac6de3bed16)
This commit is contained in:
1 parent
5561cbf475
commit
9e663b770c
6 files changed
+199
-52
No files matched your search
@@ -106,14 +106,15 @@
|
||||
//! a heap is allocated as before.
|
||||
//!
|
||||
//! - **Blocks made ahead** (`memory/ready.rs`). Each pool the encodings and commits place their
|
||||
//! own resources in ([`keep_room`]) gets a block made off the program's thread while it grows,
|
||||
//! and the pool a color texture's host-transfer image places in ([`Memory::host_copy_pool`])
|
||||
//! gets its blocks so: each made right after a burst of the device's submissions ended, since
|
||||
//! a block's `vkAllocateMemory` holds the device's submissions while it runs on RADV and on
|
||||
//! NVIDIA's driver, then every page of its mapping read once before anything is placed in it,
|
||||
//! so that no host copy's first touch faults on memory whose kernel work waits behind the
|
||||
//! program's queued GPU work. A call that needs room takes the pool's block made ahead, or
|
||||
//! waits for its making, rather than make a block of its own.
|
||||
//! own resources in ([`keep_room`]) and each pool of exportable buffers ([`allocate_exported`])
|
||||
//! gets a block made off the program's thread while it grows, and the pool a color texture's
|
||||
//! host-transfer image places in ([`Memory::host_copy_pool`]) gets its blocks so: each made
|
||||
//! right after a burst of the device's submissions ended, since a block's `vkAllocateMemory`
|
||||
//! holds the device's submissions while it runs on RADV and on NVIDIA's driver, then every page
|
||||
//! of its mapping read once before anything is placed in it, so that no host copy's first touch
|
||||
//! faults on memory whose kernel work waits behind the program's queued GPU work. A call that
|
||||
//! needs room takes the pool's block made ahead, or waits for its making, rather than make a
|
||||
//! block of its own.
|
||||
|
||||
use super::buffer::usage;
|
||||
use super::device::lock;
|
||||
@@ -2316,13 +2317,31 @@ impl Memory {
|
||||
}
|
||||
|
||||
/// Whether blocks are made ahead for `pool` (`memory/ready.rs`): one the encodings and commits
|
||||
/// place their own resources in ([`Memory::kept`], once found), or the pool host copies place
|
||||
/// in ([`Memory::host_copy_pool`], once found).
|
||||
/// place their own resources in ([`Memory::kept`], once found), a pool of exportable buffers
|
||||
/// ([`Holds::Exports`], [`Holds::DmaBufs`]), or the pool host copies place in
|
||||
/// ([`Memory::host_copy_pool`], once found).
|
||||
fn makes_ahead(&self, pool: (Holds, u32)) -> bool {
|
||||
self.host_copy_pool == Some(Some(pool))
|
||||
|| pool.0.handle().is_some()
|
||||
|| (self.kept.as_ref()).is_some_and(|kept| kept.contains(&pool))
|
||||
}
|
||||
|
||||
/// The pools of exportable buffers ([`Holds::Exports`], [`Holds::DmaBufs`]) that grew within
|
||||
/// [`KEPT_EMPTY_FOR`] (`allocate_exported`'s pooled placements): those whose blocks are made
|
||||
/// ahead while they grow, besides [`Memory::kept`]'s.
|
||||
fn exported_growing(&mut self) -> Vec<(Holds, u32)> {
|
||||
let types = self.types.len() as u32;
|
||||
let pools = (0..types).flat_map(|type_index| {
|
||||
[Holds::Exports, Holds::DmaBufs].map(|holds| (holds, type_index))
|
||||
});
|
||||
pools
|
||||
.filter(|&(holds, type_index)| {
|
||||
let grew = self.pool(holds, type_index).grew(None);
|
||||
grew.is_some_and(|at| at.elapsed() < KEPT_EMPTY_FOR)
|
||||
})
|
||||
.collect()
|
||||
}
|
||||
|
||||
/// Add the block made ahead for `pool` to it where its making ended (`memory/ready.rs`):
|
||||
/// whether one was added. A making that failed is let go of.
|
||||
fn add_ready(&mut self, pool: (Holds, u32)) -> bool {
|
||||
@@ -3880,7 +3899,9 @@ pub(super) fn keep_none(memory: &Mutex<Memory>, device: &ash::Device) {
|
||||
/// blocks carry one. A block that fails to be made, or a pool the query fails for, is left to the
|
||||
/// placement that needs it. A pool that grew within [`KEPT_EMPTY_FOR`] and lacks room for a whole
|
||||
/// block, holding no block made ahead, gets one started, through `functions`, made once a burst
|
||||
/// of `quiet`'s queue uses ended. The pool host copies place in, where `copies` says the device
|
||||
/// of `quiet`'s queue uses ended; so does each pool of exportable buffers that grew so
|
||||
/// (`allocate_exported`), whose room is otherwise left to its placements, which are the creation
|
||||
/// calls themselves. The pool host copies place in, where `copies` says the device
|
||||
/// copies color textures on the host, gets its block made ahead once it lacks room for half a
|
||||
/// block; its making is never waited for here, as its pages' reads may wait behind the program's
|
||||
/// GPU work, and its block is never added here: the placement there that finds no room adds it
|
||||
@@ -3951,22 +3972,44 @@ pub(super) fn keep_room(
|
||||
guard.ahead.made_in_place(pool.0);
|
||||
break;
|
||||
}
|
||||
let mut guard = lock(memory);
|
||||
let pool_of = guard.pool(pool.0, pool.1);
|
||||
let grew = (pool_of.grew(None)).is_some_and(|at| at.elapsed() < KEPT_EMPTY_FOR);
|
||||
if !grew || pool_of.has_room(maker.block_bytes) || guard.readying_at(pool).is_some() {
|
||||
continue;
|
||||
}
|
||||
let addressed = pool.0.buffers().then(|| Arc::clone(counts));
|
||||
let started = ready::Readying::start(
|
||||
guard.maker(),
|
||||
Arc::clone(functions),
|
||||
Arc::clone(quiet),
|
||||
addressed,
|
||||
(pool, maker.block_bytes),
|
||||
);
|
||||
guard.readying.extend(started);
|
||||
ready_if_growing(&mut lock(memory), pool, counts, (functions, quiet));
|
||||
}
|
||||
// The pools of exportable buffers, which the creation calls themselves place in
|
||||
// (`allocate_exported`): a block made ahead once one grew, which the placement that finds no
|
||||
// room takes, or waits for, rather than make a 64 MiB block on the program's thread; never a
|
||||
// block made here, which that placement would make as soon.
|
||||
let mut guard = lock(memory);
|
||||
for pool in guard.exported_growing() {
|
||||
ready_if_growing(&mut guard, pool, counts, (functions, quiet));
|
||||
}
|
||||
}
|
||||
|
||||
/// Start making a block ahead for `pool` (`memory/ready.rs`), through `functions`, made once a
|
||||
/// burst of `quiet`'s queue uses ended, with a buffer of addresses counted in `counts` where its
|
||||
/// blocks carry one, where the pool grew within [`KEPT_EMPTY_FOR`], lacks room for a whole block
|
||||
/// and holds no block made ahead.
|
||||
fn ready_if_growing(
|
||||
memory: &mut Memory,
|
||||
pool: (Holds, u32),
|
||||
counts: &Arc<Counters>,
|
||||
(functions, quiet): (&Arc<Functions>, &Arc<QueueQuiet>),
|
||||
) {
|
||||
let bytes = memory.block_bytes;
|
||||
let ahead = memory.readying_at(pool).is_some();
|
||||
let pool_of = memory.pool(pool.0, pool.1);
|
||||
let grew = (pool_of.grew(None)).is_some_and(|at| at.elapsed() < KEPT_EMPTY_FOR);
|
||||
if !grew || pool_of.has_room(bytes) || ahead {
|
||||
return;
|
||||
}
|
||||
let addressed = pool.0.buffers().then(|| Arc::clone(counts));
|
||||
let started = ready::Readying::start(
|
||||
memory.maker(),
|
||||
Arc::clone(functions),
|
||||
Arc::clone(quiet),
|
||||
addressed,
|
||||
(pool, bytes),
|
||||
);
|
||||
memory.readying.extend(started);
|
||||
}
|
||||
|
||||
/// Start making a block ahead for the pool host copies place in (`memory/ready.rs`,
|
||||
|
||||
@@ -1,7 +1,8 @@
|
||||
//! Pooled blocks made ahead, off the program's thread, before any resource is placed in them:
|
||||
//! for each pool the runtime's encodings and commits place their own resources in
|
||||
//! (`memory::keep_room`) while it grows, and for the pool a color texture's host-transfer image
|
||||
//! places in (`texture/host_copy.rs`). Each is allocated right after a burst of the device's
|
||||
//! (`memory::keep_room`) and each pool of exportable buffers (`memory::allocate_exported`) while
|
||||
//! it grows, and for the pool a color texture's host-transfer image places in
|
||||
//! (`texture/host_copy.rs`). Each is allocated right after a burst of the device's
|
||||
//! submissions returned, then every page of its mapping is read once by the host.
|
||||
//!
|
||||
//! **Why right after a burst.** A block's `vkAllocateMemory` holds the device's submissions
|
||||
@@ -33,7 +34,13 @@
|
||||
//! like a guest's scroll on the 780M (from 20 to 63 live blocks of 64 MiB in about 20 s, about 4
|
||||
//! a second) finds a block made when it needs one; and for the host copies' pool once that
|
||||
//! lacks room for half a block, the first by the device's first creation call, before the
|
||||
//! program queued work.
|
||||
//! program queued work. A pool of exportable buffers, which the creation calls themselves place
|
||||
//! in, gets its block started the same way once it grew, so that the creation call that finds
|
||||
//! no room there takes a block made ahead rather than make one on the program's thread (on a
|
||||
//! Radeon 780M a creation call that made such a 64 MiB block itself took 10.0 to 15.0 ms in
|
||||
//! three of four phases of `tests::reclaim_submit_bench`, quiet and fragmented, and none took
|
||||
//! over 0.3 ms with the blocks made ahead); none of its blocks is made by a creation call that
|
||||
//! places nothing there.
|
||||
//! - **Added where room is needed.** A creation call that finds such a pool without room for
|
||||
//! half a block (`memory::keep_room`), and a placement that finds no room (`memory::place`),
|
||||
//! add the pool's block made ahead once its making ended. Where the making is under way they
|
||||
|
||||
@@ -6,7 +6,8 @@
|
||||
//!
|
||||
//! The first run makes `Private` buffers of a guest's scroll, eight to a block, and waits for every
|
||||
//! making to end between two creations: what it holds is where the blocks are made, not how soon
|
||||
//! a making ends. The second makes them back to back beside two threads that keep the device's
|
||||
//! a making ends. A run of exportable buffers does the same: their pool, which the creation calls
|
||||
//! themselves place in (`memory::allocate_exported`), gets its blocks made ahead too. The second makes them back to back beside two threads that keep the device's
|
||||
//! queues in use with no pause of 1 ms, so a making waits out its whole wait for a burst's end
|
||||
//! (`QUIET_MOST`) unless a call cuts it short: the creation call that needs the block while its
|
||||
//! making still waits so returns well within that wait, the making allocating at once.
|
||||
@@ -14,7 +15,9 @@
|
||||
//! Device tests: compiled only under the GPU safety cfgs (`m2v_gpu`, `m2v_cpu_icd`).
|
||||
|
||||
use super::freed_memory::device;
|
||||
use crate::{Buffer, CommandBufferStatus, Device, ResourceOptions, TextureDescriptor, WorkCounts};
|
||||
use crate::{
|
||||
Buffer, CommandBufferStatus, Device, Error, ResourceOptions, TextureDescriptor, WorkCounts,
|
||||
};
|
||||
use metal2vulkan::metal::{PixelFormat, TextureUsage};
|
||||
use std::sync::atomic::{AtomicBool, Ordering};
|
||||
use std::time::{Duration, Instant};
|
||||
@@ -125,6 +128,74 @@ fn a_growing_pool_s_new_blocks_are_made_ahead_and_none_in_place() {
|
||||
assert_eq!(waited_for, 0, "a call waited for a making that had ended");
|
||||
}
|
||||
|
||||
/// The pool of exportable buffers grows as the runtime's own pools do: once it grew, each new
|
||||
/// block there is made ahead, and no creation call makes one itself (on a Radeon 780M such a
|
||||
/// making took the creation call 10.0 to 15.0 ms: `tests::reclaim_submit_bench`).
|
||||
#[test]
|
||||
fn a_growing_pool_of_exportable_buffers_gets_its_new_blocks_made_ahead() {
|
||||
let scratch = Scratch::new("exportable");
|
||||
let device = device(&scratch.0);
|
||||
let mut held = Vec::new();
|
||||
// The counts after an exportable buffer made into `held` and the makings it started; `None`
|
||||
// where the device makes no exportable buffer.
|
||||
let make = |held: &mut Vec<Buffer>| {
|
||||
assert!(held.len() < MOST, "the pool never grew as far");
|
||||
match device.new_exportable_buffer(BUFFER_BYTES, ResourceOptions::private()) {
|
||||
Err(Error::NotImplemented(_)) => return None,
|
||||
made => held.push(made.unwrap()),
|
||||
}
|
||||
makings_ended(&device);
|
||||
Some(device.work_counts())
|
||||
};
|
||||
// Every pooled block made from here on is the exportable pool's: the first creation made each
|
||||
// other pool's first block.
|
||||
let Some(start) = make(&mut held) else {
|
||||
println!(
|
||||
"BLOCKS-AHEAD {}: makes no exportable buffer, so no such pool grows",
|
||||
device.name()
|
||||
);
|
||||
return;
|
||||
};
|
||||
let blocks =
|
||||
|counts: &WorkCounts| counts.pooled_memory_blocks_made - start.pooled_memory_blocks_made;
|
||||
let mut counts = start;
|
||||
// Its first growth, made in place, as nothing grew before it.
|
||||
while blocks(&counts) < 1 {
|
||||
counts = make(&mut held).unwrap();
|
||||
let dedicated = counts.dedicated_memory_blocks_live - start.dedicated_memory_blocks_live;
|
||||
if blocks(&counts) == 0 && dedicated >= 2 {
|
||||
println!(
|
||||
"BLOCKS-AHEAD {}: places each exportable buffer in a dedicated allocation, so no \
|
||||
such pool grows",
|
||||
device.name()
|
||||
);
|
||||
return;
|
||||
}
|
||||
}
|
||||
let before = counts;
|
||||
while blocks(&counts) - blocks(&before) < GROWTH {
|
||||
counts = make(&mut held).unwrap();
|
||||
}
|
||||
let in_place = counts.buffer_blocks_made_in_place - before.buffer_blocks_made_in_place;
|
||||
let ahead = counts.buffer_blocks_made_ahead - before.buffer_blocks_made_ahead;
|
||||
println!(
|
||||
"BLOCKS-AHEAD {}: {} exportable buffers of {BUFFER_BYTES} bytes; over their pool's last {} \
|
||||
blocks, {ahead} made ahead, {in_place} in place",
|
||||
device.name(),
|
||||
held.len(),
|
||||
blocks(&counts) - blocks(&before),
|
||||
);
|
||||
assert_eq!(
|
||||
in_place, 0,
|
||||
"a creation call made a block of exportable buffers itself"
|
||||
);
|
||||
assert_eq!(
|
||||
ahead,
|
||||
blocks(&counts) - blocks(&before),
|
||||
"only {ahead} of the blocks were made ahead"
|
||||
);
|
||||
}
|
||||
|
||||
/// Sets its flag as it goes, so the threads that keep the queues in use stop however the test
|
||||
/// ends.
|
||||
struct Stops<'a>(&'a AtomicBool);
|
||||
|
||||
@@ -38,6 +38,11 @@
|
||||
//! holds its verdicts knows them as it is made, where the first starts no check (a buffer's
|
||||
//! making starts none), its blocks plain, as a driver's first device's are until a texture over
|
||||
//! host pages starts the check and it answers.
|
||||
//! - **Exportable, made by the runtime**: an exportable `Private` buffer of
|
||||
//! [`RUNTIME_BUFFER_BYTES`] (`Device::new_exportable_buffer`) every [`RUNTIME_EVERY`], at most
|
||||
//! [`RUNTIME_BUFFERS`] a phase: the pool of exportable buffers grows, its blocks made ahead
|
||||
//! (`memory/ready.rs`), each a buffer object of its own reservation, so that the makings timed
|
||||
//! are the creation calls, on the calling thread.
|
||||
//! - **System heap, 64 MiB**, **System heap, 16 MiB** and **System heap, 4 MiB**: allocations of
|
||||
//! the device's first memory type that is host-visible and host-coherent but not device-local or
|
||||
//! cached (where a unified-memory device's `Private` blocks lie, `memory.rs`, `candidates`), of
|
||||
@@ -85,19 +90,20 @@
|
||||
//! the turnaround each, those of 8 ms or more and of 17 ms or more, the median, 99th percentile and
|
||||
//! slowest; the command buffers submitted, those the committing thread submitted
|
||||
//! (`WorkCounts::batches_submitted_at_commit`) and the time spent in `vkQueueSubmit`
|
||||
//! (`WorkCounts::batch_submit_nanos`); the makings, their median and slowest, the runtime's
|
||||
//! blocks made ahead and in place, its buffers' blocks made exportable and plain, every plain
|
||||
//! block of buffers made (`WorkCounts::plain_buffer_blocks_made`), and its buffers laid in plain
|
||||
//! blocks while the check was pending or once it refused such blocks; the host's
|
||||
//! reclaim over the phase (`/proc/vmstat`: pages kswapd and direct reclaim scanned, compaction
|
||||
//! stalls, allocation stalls, pages swapped out); the memory the fragmenting took, the host's free
|
||||
//! memory and the cgroup's room it was sized from; the free blocks of each order before and after
|
||||
//! the fragmenting and after the phase (`/proc/buddyinfo`); and the slowest submissions',
|
||||
//! turnarounds' and makings' `CLOCK_MONOTONIC` times, to line up with a kernel trace taken beside
|
||||
//! the run. Ignored: run it in release under
|
||||
//! `--cfg m2v_gpu` on Linux, alone on its host (it presses the whole host's memory), one arm at a
|
||||
//! time, in a cgroup with room for nearly all of the host's free memory: `cargo nextest run
|
||||
//! --release -p metal2vulkan-runtime --lib --run-ignored all reclaim_submit_bench --no-capture`.
|
||||
//! (`WorkCounts::batch_submit_nanos`); the makings, their median and slowest, the runtime's blocks
|
||||
//! made ahead and in place and the blocks made ahead a call waited for
|
||||
//! (`WorkCounts::blocks_ahead_waited_for`), its buffers' blocks made exportable and plain, every
|
||||
//! plain block of buffers made (`WorkCounts::plain_buffer_blocks_made`), and its buffers laid in
|
||||
//! plain blocks while the check was pending or once it refused such blocks; the host's reclaim over
|
||||
//! the phase (`/proc/vmstat`: pages kswapd and direct reclaim scanned, compaction stalls,
|
||||
//! allocation stalls, pages swapped out); the memory the fragmenting took, the host's free memory
|
||||
//! and the cgroup's room it was sized from; the free blocks of each order before and after the
|
||||
//! fragmenting and after the phase (`/proc/buddyinfo`); and the slowest submissions', turnarounds'
|
||||
//! and makings' `CLOCK_MONOTONIC` times, to line up with a kernel trace taken beside the run.
|
||||
//! Ignored: run it in release under `--cfg m2v_gpu` on Linux, alone on its host (it presses the
|
||||
//! whole host's memory), one arm at a time, in a cgroup with room for nearly all of the host's free
|
||||
//! memory: `cargo nextest run --release -p metal2vulkan-runtime --lib --run-ignored all
|
||||
//! reclaim_submit_bench --no-capture`.
|
||||
|
||||
use super::host_residency::{device, Scratch};
|
||||
use crate::{
|
||||
@@ -393,6 +399,8 @@ fn monotonic() -> f64 {
|
||||
enum Making {
|
||||
/// The runtime's `Private` buffers (the module docs).
|
||||
Runtime,
|
||||
/// The runtime's exportable `Private` buffers (the module docs).
|
||||
Exportable,
|
||||
/// Allocations of `bytes` of the memory type `index`, [`RAW_BYTES`] a phase, exportable as
|
||||
/// `export`'s handle type where given.
|
||||
Raw {
|
||||
@@ -419,7 +427,7 @@ fn make(
|
||||
) -> Vec<(Duration, f64)> {
|
||||
let mut times = Vec::new();
|
||||
let (every, most) = match making {
|
||||
Making::Runtime => (RUNTIME_EVERY, RUNTIME_BUFFERS),
|
||||
Making::Runtime | Making::Exportable => (RUNTIME_EVERY, RUNTIME_BUFFERS),
|
||||
Making::Raw { bytes, .. } => (
|
||||
RAW_EVERY.mul_f64(bytes as f64 / (64 * MIB) as f64),
|
||||
(RAW_BYTES / bytes) as usize,
|
||||
@@ -435,6 +443,11 @@ fn make(
|
||||
.new_buffer(RUNTIME_BUFFER_BYTES, ResourceOptions::private())
|
||||
.unwrap(),
|
||||
),
|
||||
Making::Exportable => made.buffers.push(
|
||||
device
|
||||
.new_exportable_buffer(RUNTIME_BUFFER_BYTES, ResourceOptions::private())
|
||||
.unwrap(),
|
||||
),
|
||||
Making::Raw {
|
||||
index,
|
||||
bytes,
|
||||
@@ -534,7 +547,8 @@ fn phase(
|
||||
turnaround {} of 8 ms or more, {} of 17 ms or more, ms median {turn_median:.3}, p99 \
|
||||
{turn_p99:.3}, slowest {turn_slowest:.3}; command buffers submitted {submitted}, by the \
|
||||
committing thread {}, in vkQueueSubmit {:.1} ms, {:.3} ms each; {} makings, ms median \
|
||||
{make_median:.1}, slowest {make_slowest:.1}; blocks made ahead {}, in place {}; \
|
||||
{make_median:.1}, slowest {make_slowest:.1}; blocks made ahead {}, in place {}, \
|
||||
waited for {}; \
|
||||
blocks of the runtime's buffers made exportable {}, made plain {}, plain blocks of \
|
||||
buffers made {}; buffers in plain blocks awaiting the check {}, by its refusal {}; \
|
||||
reclaim: {}; blocks live {}, empty {}; MemAvailable {} MiB",
|
||||
@@ -550,6 +564,7 @@ fn phase(
|
||||
makes.len(),
|
||||
counts.buffer_blocks_made_ahead - earlier.buffer_blocks_made_ahead,
|
||||
counts.buffer_blocks_made_in_place - earlier.buffer_blocks_made_in_place,
|
||||
counts.blocks_ahead_waited_for - earlier.blocks_ahead_waited_for,
|
||||
counts.fd_buffer_blocks_made - earlier.fd_buffer_blocks_made,
|
||||
counts.fd_buffer_blocks_plain - earlier.fd_buffer_blocks_plain,
|
||||
counts.plain_buffer_blocks_made - earlier.plain_buffer_blocks_made,
|
||||
@@ -587,6 +602,8 @@ enum Arm {
|
||||
Runtime {
|
||||
settled: bool,
|
||||
},
|
||||
/// The runtime's exportable buffers.
|
||||
Exportable,
|
||||
SystemHeap {
|
||||
bytes: u64,
|
||||
export: Option<Handle>,
|
||||
@@ -630,6 +647,7 @@ fn arm(label: &str, arm: Arm) {
|
||||
}
|
||||
Making::Runtime
|
||||
}
|
||||
Arm::Exportable => Making::Exportable,
|
||||
Arm::SystemHeap { bytes, export } => Making::Raw {
|
||||
index: system_heap(),
|
||||
bytes,
|
||||
@@ -1119,6 +1137,12 @@ fn reclaim_submit_bench_runtime_settled() {
|
||||
);
|
||||
}
|
||||
|
||||
#[test]
|
||||
#[ignore = "a measurement that presses the host's memory: run alone on its host by name"]
|
||||
fn reclaim_submit_bench_exportable() {
|
||||
arm("exportable, made by the runtime", Arm::Exportable);
|
||||
}
|
||||
|
||||
#[test]
|
||||
#[ignore = "a measurement that presses the host's memory: run alone on its host by name"]
|
||||
fn reclaim_submit_bench_system_heap_64mib() {
|
||||
|
||||
@@ -5046,9 +5046,9 @@ pub struct WorkCounts {
|
||||
/// Of `pooled_memory_blocks_made`, the blocks of buffers made ahead off the program's thread,
|
||||
/// each right after a burst of the device's submissions ended, and added to their pool where
|
||||
/// room was needed: blocks of the pools the runtime's encodings and commits place their own
|
||||
/// resources in, made while such a pool grows (`memory/ready.rs`). A block's
|
||||
/// `vkAllocateMemory` holds the device's submissions while it runs on RADV and on NVIDIA's
|
||||
/// driver, so it is made between them.
|
||||
/// resources in, and of the pools of exportable buffers (`exported_memory.rs`), made while
|
||||
/// such a pool grows (`memory/ready.rs`). A block's `vkAllocateMemory` holds the device's
|
||||
/// submissions while it runs on RADV and on NVIDIA's driver, so it is made between them.
|
||||
pub buffer_blocks_made_ahead: u64,
|
||||
/// The blocks of buffers of those pools a call made itself, finding none made ahead: a
|
||||
/// creation call that found its pool without room for half a block, or a placement that
|
||||
|
||||
+5
-3
@@ -986,9 +986,11 @@ driver's. Each is open work.
|
||||
waited 1 ms (longest 0.39 to 0.67 ms), 16 empty blocks (1 GiB) kept between the clips. A first
|
||||
clip still makes its blocks: 16 allocations, against 44 when each picture had an allocation of
|
||||
its own, with 3 to 5 commits waiting 1 ms or more (longest 10.9 to 19.6 ms): its blocks'
|
||||
`vkAllocateMemory` holds every submission, and a block made ahead of its placements, on a thread
|
||||
of the device's own, would hold the frames it meets as long (the row above), so none is. Metal's
|
||||
command buffers wait for no allocation. Not announced.
|
||||
`vkAllocateMemory` holds every submission. A pool that grew gets its next block made ahead
|
||||
(`memory/ready.rs`; the pools of exportable buffers, which hold the pictures, among them), right
|
||||
after a burst of the device's submissions ended, and a creation call that needs it while its
|
||||
making still waits for that end makes it at once and waits for it, as for a block made in place.
|
||||
Metal's command buffers wait for no allocation. Not announced.
|
||||
- **With unified memory, `Private` memory lies in the system heap's types before the device-local
|
||||
ones, its buffers' blocks there allocated exportable but for buffers that declare their padding
|
||||
unobserved: about 1 µs a submission for each such block held.** Where the device has unified memory and a heap that is not
|
||||
|
||||
Reference in new issue
Block a user