RUNTIME 2466: GPU start: written before the batch's first work, and at the top of the pipe on every driver

What: a timed command buffer's first batch with first work (new resources'
first moves and zero fills, Managed copies in, staged copies) writes its start
timestamp in that work's command buffer, after an execution barrier from every
command before and before the work; and every start is written at the top of
the pipe, where batches ordered by their ends wrote it at the bottom.

Why: GPUStartTime must say when the GPU began the command buffer's work. In a
traced Geekbench-like compute pass on an RX 7900 XTX (RADV, Mesa 26.2.6), the
gfx ring's drm_sched jobs placed on the trace's clock (the job trace drifts
39.8 ppm against it, fitted per pass) showed command buffers whose start lay
in the last tenth of their own job: spans of 1 us on jobs of 4.5 to 36.5 ms.
Two causes. (a) The first work is inserted ahead of the start, and the start,
at the bottom of the pipe under by-ends ordering, waited for it: managed copies
in of the guest's did_modify_range ranges were 0.25 to 6.98 GB per workload.
(b) With no first work too (prefixed starts, 237 first-work batches of 7486),
about 1700 command buffers read their bottom-of-pipe start late; a Radeon 780M
showed the same. That GPU time counted as "submitted, GPU not started" in the
consumer's split: 4.06 s of its 5.90 s on the XTX.

Ordering (every driver path): the first work's start follows an execution
barrier ALL_COMMANDS -> ALL_COMMANDS, whose "first synchronization scope
includes all commands that occur earlier in submission order" and "second
synchronization scope includes all commands that occur later in submission
order" (vkCmdPipelineBarrier), the timestamp write among them. A start at the
top of the pipe where batches are ordered by their ends is held by the earlier
batch's end barrier, Barrier::to_all (src ALL_COMMANDS, dst ALL_COMMANDS and
HOST), by the same clause. Where batches are not ordered by their ends the
starts were at the top already and are unchanged; a start after a barrier
planned before the first encoder stays at the bottom, after that barrier.

Whether Metal's span holds a Managed copy in on a Mac with a discrete GPU is
not measured (the 5300M oracle can say).

Verified: compile and device runs pending (tests/start_stamp.rs).

Also folded: the test of a command buffer's GPU start against its own long work and its batch's
first work (e86e9d356e).
This commit is contained in:
Anees Iqbal committed 2026-11-16 10:17:56 -08:00
1 parent 4933e7cba9
commit 35ac917d6f
10 files changed
+315 -34

No files matched your search

+9 -14
View File
@@ -26,15 +26,20 @@
//! On those drivers ([`ends_order`]) the default form orders batches by their ends: every batch
//! ends with [`Barrier::to_all`], every write before every access of every later command of its
//! `VkQueue`, so the tracker plans no barrier after an access of an earlier batch there
//! ([`Tracker::by_ends`](crate::tracker::Tracker)), and a batch's start timestamp is written at the
//! bottom of the pipe ([`start_stage`]): once everything before it in submission order completed,
//! which is when such a driver starts it. A batch no longer needs a command buffer of barriers
//! ([`Tracker::by_ends`](crate::tracker::Tracker)). A batch's start timestamp, written at the top
//! of the pipe as on every driver (`gpu_time.rs`), is then written once everything before it in
//! submission order completed, which is when such a driver starts it: the earlier batch's
//! [`Barrier::to_all`] holds it, as "the second synchronization scope includes all commands that
//! occur later in submission order" (`vkCmdPipelineBarrier`), its destination stages all commands.
//! A start written at the bottom of the pipe there read late on RADV (Mesa 26.2.6) on an RX 7900
//! XTX and a Radeon 780M: in a traced compute benchmark's pass, a population of command buffers
//! read their start in the last tenth of their own kernel job, spans of 1 us on jobs of 4.5 to
//! 36.5 ms. A batch no longer needs a command buffer of barriers
//! for a dependency on the batch before it (on the UHD 770, with the consumer's frames over 520
//! host imports, 67.0 command buffers submitted a frame against 129.3 to 129.7), and runs as the
//! driver ran it before. Elsewhere, and under `BatchOrderPolicy::Exact`, the exact form.
use crate::tracker::Barrier;
use ash::vk;
use metal2vulkan::device::{BatchOrderPolicy, DevicePolicy};
use metal2vulkan::vk::DriverId;
@@ -61,13 +66,3 @@ pub(crate) fn end(by_ends: bool) -> Barrier {
false => Barrier::to_host(),
}
}
/// The stage a batch's start timestamp is written at where nothing is planned before it: the
/// top of the pipe, as its work begins, or, where batches are ordered `by_ends`, the bottom,
/// once everything before it completed.
pub(crate) fn start_stage(by_ends: bool) -> vk::PipelineStageFlags {
match by_ends {
true => vk::PipelineStageFlags::BOTTOM_OF_PIPE,
false => vk::PipelineStageFlags::TOP_OF_PIPE,
}
}
@@ -88,8 +88,9 @@ pub(crate) struct KeptBarriers {
/// The timestamps a barrier command buffer writes into a timed command buffer's slot of the
/// device's timestamp pools (`gpu_time::Slot`): with `start`, the slot reset before its barriers
/// and the start timestamp before them at the top of the pipe (the bottom where batches are
/// ordered by their ends: `batch_order.rs`), or with `after` after them at the bottom of the pipe;
/// and the start timestamp before them at the top of the pipe (`batch_order.rs`: where batches
/// are ordered by their ends, the earlier batch's end barrier holds it), or with `after` after them
/// at the bottom of the pipe;
/// with `end`, the end timestamp after them.
#[derive(Clone, Copy, Debug, PartialEq, Eq)]
pub(crate) struct SlotStamps {
@@ -396,8 +397,8 @@ impl KeptBarriers {
exit_guard::called(Call::CmdResetQueryPool);
}
if !stamps.after {
let stage = crate::batch_order::start_stage(shared.by_ends);
raw.cmd_write_timestamp(buffer, stage, stamps.queries, stamps.first);
let top = vk::PipelineStageFlags::TOP_OF_PIPE;
raw.cmd_write_timestamp(buffer, top, stamps.queries, stamps.first);
exit_guard::called(Call::CmdWriteTimestamp);
}
}
@@ -6248,9 +6248,8 @@ impl CommandBufferShared {
/// first `VkCommandBuffer` of the command buffer's first encoder, which opens its first batch:
/// take the slot now, and write the start into its third query as `raw`'s first commands, the
/// reset of the end and of that query (where the device does not reset the slot on the host as
/// it takes it), then the timestamp at the top of the pipe (the bottom where batches are
/// ordered by their ends: `batch_order.rs`; `gpu_time.rs`). The first batch's submission
/// decides which start is read (`submit.rs`).
/// it takes it), then the timestamp at the top of the pipe (`batch_order.rs`; `gpu_time.rs`).
/// The first batch's submission decides which start is read (`submit.rs`).
fn open_start(&self, state: &mut State, raw: vk::CommandBuffer) {
let timing = &self.device.shared().timing;
let first_batch = match state.batches.all() {
@@ -6282,8 +6281,8 @@ impl CommandBufferShared {
device.cmd_reset_query_pool(raw, queries, prefix - 1, 2);
exit_guard::called(Call::CmdResetQueryPool);
}
let stage = crate::batch_order::start_stage(self.device.shared().by_ends);
device.cmd_write_timestamp(raw, stage, queries, prefix);
let top = vk::PipelineStageFlags::TOP_OF_PIPE;
device.cmd_write_timestamp(raw, top, queries, prefix);
exit_guard::called(Call::CmdWriteTimestamp);
}
state.prefix = Some(raw);
@@ -159,7 +159,16 @@
//! ([`fences`](super::fences)), at which the command buffer then finishes.
//!
//! **GPU times** (`gpu_time.rs`). In a timed command buffer, the start timestamp is written at the
//! top of the pipe, before every barrier and encoder of its first batch: by its first encoder's
//! top of the pipe, before every barrier and encoder of its first batch. Where that batch has first
//! work (**New resources' first work**, above: zeros, moves, `Managed` copies in), the work's own
//! command buffer writes it first, after an execution barrier from every command before ("the
//! first synchronization scope includes all commands that occur earlier in submission order ...
//! the second synchronization scope includes all commands that occur later in submission order",
//! `vkCmdPipelineBarrier`), so the start follows every earlier command of the queue and precedes
//! the work, whose GPU time is the command buffer's: on an RX 7900 XTX, a command buffer's copies
//! in of the ranges `did_modify_range` named ran 4.5 to 36.5 ms before a start written after them.
//! (Whether Metal's span holds a `Managed` copy in on a Mac with a discrete GPU is not measured.)
//! Elsewhere it is written by its first encoder's
//! first command buffer, which wrote it into its slot's third query as it opened, where the batch
//! plans nothing before that encoder (no barrier, no image moved, and no
//! [`Barrier::after_completed`] where the driver stalls on semaphore operations) and the command
@@ -175,8 +184,10 @@
//! starts after that work ended, as Metal's does: on an M3 Max under macOS 27.0.1, a fill committed
//! behind a running fill of the same bytes started 0.5 to 0.9 us after the first's `GPUEndTime` (10
//! of 10), and one of other bytes while the first ran (probe `gpustart`). Where batches are ordered
//! by their ends (`batch_order.rs`), every start is written at the bottom of the pipe, as such a
//! driver starts no batch before the ones before it ended. The end of its last batch writes the end
//! by their ends (`batch_order.rs`), the end barrier of the batch before ([`Barrier::to_all`], all
//! commands to all commands) holds every start, at the top of the pipe, until the batches before it
//! ended, as such a driver starts no batch before them; one written at the bottom of the pipe there
//! read late on RADV. The end of its last batch writes the end
//! timestamp at the bottom of the pipe, after its barriers. The scheduler's host times as it begins
//! the first batch and ends the last submission are the kernel times.
//!
@@ -889,6 +900,14 @@ impl CommandBufferShared {
// module docs).
let by_barrier = shared.completed_by_barrier;
let mut completed_barrier = by_barrier.then(Barrier::after_completed);
// A first batch with first work (new resources' first moves and fills, copies in) writes
// the start in that work's command buffer, before the work, which runs in the batch's
// submission before its commands: the command buffer's GPU work begins there
// (**GPU times**, the module docs).
let first_start = start_stamp.filter(|_| first_work.has_first() || first_work.has_staged());
if first_start.is_some() {
start_stamp = None;
}
// The first encoder's prefix wrote the start where the batch plans nothing before that
// encoder (no barrier, no image moved, no barrier for completed work) and its first
// command buffer goes to the queue as recorded (`gpu_time.rs`): then no command buffer of
@@ -983,6 +1002,12 @@ impl CommandBufferShared {
let recorded = (has_first || has_staged)
.then(|| {
self.record_raw(&mut state, |_, buffer| {
if let Some((queries, first, _)) = first_start {
// SAFETY: the command buffer is recording, outside a render pass, and is
// submitted first in the batch; the slot is the command buffer's, which
// only its batches write.
unsafe { record_first_start(shared, buffer, queries, first) };
}
if has_first {
// SAFETY: the command buffer is recording, outside a render pass; it is
// submitted first in the batch, before any later one, and every batch on
@@ -2240,8 +2265,8 @@ impl CommandBufferShared {
exit_guard::called(Call::CmdResetQueryPool);
}
if !stamps.after {
let stage = crate::batch_order::start_stage(device.shared().by_ends);
raw.cmd_write_timestamp(buffer, stage, queries, first);
let top = vk::PipelineStageFlags::TOP_OF_PIPE;
raw.cmd_write_timestamp(buffer, top, queries, first);
exit_guard::called(Call::CmdWriteTimestamp);
}
}
@@ -2295,6 +2320,45 @@ fn bind_error(device: &crate::Device, failure: BindFailure) -> CommandBufferErro
}
}
/// Record a first batch's start into `buffer`, the command buffer of its first work, before that
/// work: the reset of the slot's start and end where the device does not reset it on the host as
/// it is taken, an execution barrier from every command before to every command after, then the
/// start into query `first` of `queries` at the top of the pipe (**GPU times**, the module docs).
///
/// # Safety
///
/// `buffer` is recording, outside a render pass, and is submitted first in its batch; the slot is
/// the command buffer's, which no other command buffer writes meanwhile.
unsafe fn record_first_start(
shared: &crate::device::DeviceShared,
buffer: vk::CommandBuffer,
queries: vk::QueryPool,
first: u32,
) {
let raw = shared.vk();
let all = vk::PipelineStageFlags::ALL_COMMANDS;
// SAFETY: the caller's contract.
unsafe {
if !shared.timing.resets_on_host() {
raw.cmd_reset_query_pool(buffer, queries, first, 2);
exit_guard::called(Call::CmdResetQueryPool);
}
raw.cmd_pipeline_barrier(
buffer,
all,
all,
vk::DependencyFlags::empty(),
&[],
&[],
&[],
);
exit_guard::called(Call::CmdPipelineBarrier);
let top = vk::PipelineStageFlags::TOP_OF_PIPE;
raw.cmd_write_timestamp(buffer, top, queries, first);
exit_guard::called(Call::CmdWriteTimestamp);
}
}
/// The timestamps a barrier command buffer writes into its command buffer's slot of the device's
/// timestamp pools, each the slot's pool, its first query and the holding's lease
/// (`gpu_time::Slot::lease`): the start (after resetting the slot) before its barriers at the top
@@ -380,8 +380,8 @@ pub(super) struct DeviceShared {
/// `command_buffer/submit.rs`).
pub(super) completed_by_barrier: bool,
/// Each batch ends with `Barrier::to_all`, so a later batch of its `VkQueue` plans no barrier
/// for its accesses, and a batch's start timestamp is written at the bottom of the pipe
/// (`batch_order.rs`).
/// for its accesses, and holds a later batch's start timestamp, at the top of the pipe, until
/// it ended (`batch_order.rs`).
pub(crate) by_ends: bool,
/// The last sparse binding of a no-copy buffer's dma-bufs (`dma_buf.rs`) the host has not
/// seen complete: the internal timeline and the value it signals, which every later
+7 -2
View File
@@ -22,8 +22,13 @@
//! the batch begins with no command buffer of its own, and the prefix's start is the command
//! buffer's. It is the same place: either start is written at the top of the pipe, after every
//! command submitted before the batch's work and before any of it; where batches are ordered by
//! their ends (`batch_order.rs`), at the bottom, once every command submitted before it
//! completed, when such a driver starts the batch. Elsewhere (a barrier planned
//! their ends (`batch_order.rs`), once every command submitted before it completed, which the
//! earlier batch's end barrier to all later commands holds, when such a driver starts the
//! batch. A first batch with first work (new resources' first moves and fills, `Managed`
//! copies in: `texture/first_move.rs`) writes the start in that work's command buffer instead,
//! after a barrier from every command before and before the work, which runs in the batch's
//! submission ahead of its commands, so its GPU time is the command buffer's
//! (`command_buffer/submit.rs`). Elsewhere (a barrier planned
//! there, a caller's image moved first, the encoder run again or not at all) a command buffer of
//! barriers writes the first start before the barrier, as without a prefix, and that start is
//! read; the prefix's is written after it and never read. A Metal counter sample buffer's slot
@@ -829,6 +829,8 @@ mod staging_waits;
mod stall;
mod stand_in;
#[cfg(any(m2v_gpu, m2v_cpu_icd))]
mod start_stamp;
#[cfg(any(m2v_gpu, m2v_cpu_icd))]
mod stencil_target;
#[cfg(any(m2v_gpu, m2v_cpu_icd))]
mod storage_creation_times;
@@ -0,0 +1,215 @@
//! A command buffer's GPU start (`gpu_time.rs`) against the GPU work its submission carries.
//!
//! - **Its own long work.** A compute encoder of [`DISPATCHES`] dispatches over [`FLOATS`] floats,
//! its pipeline made and its buffers' first work done by a command buffer before it, committed
//! once that one completed: its GPU start lies in the first half of its life from its kernel end
//! time to its GPU end, as the GPU starts the work once the submission reaches it, not at its
//! end.
//! - **The batch's first work.** The next command buffer after a new `Private` buffer of
//! [`FIRST`] bytes (its fill with zeros, `texture/first_move.rs`) and, on a device without
//! unified memory, a `Managed` buffer of [`FIRST`] bytes whose whole range `did_modify_range`
//! named (its copy in, `managed_copy.rs`), the command buffer one blit fill of a word of the
//! `Managed` buffer (else of a buffer made before): its GPU span holds at least half the time
//! that work adds to its life against the same fill without it, as the work runs in its own
//! submission, before its commands. Where the device's fill queue took the work
//! (`device/staging.rs`: it runs before the batch, outside it), the leg says so and checks
//! nothing.
//!
//! Each leg prints its times (`START-STAMP`). Device tests: compiled only under the GPU safety
//! cfgs (`m2v_gpu`, `m2v_cpu_icd`), on the kind of device the cfg selects.
use super::blit_holds::{device, Scratch, WAIT};
use super::encoder_holds::library;
use crate::{
Buffer, CommandBuffer, CommandBufferStatus, CommandQueue, ComputePipelineState, CpuCacheMode,
HazardTrackingMode, PipelineOptions, ResourceOptions, Size, StorageMode,
};
/// The floats each long dispatch scales.
const FLOATS: u64 = 1 << 24;
/// The long encoder's dispatches; a CPU device runs fewer.
const DISPATCHES: usize = match cfg!(m2v_cpu_icd) {
true => 4,
false => 64,
};
/// The bytes of each buffer of the first work.
const FIRST: u64 = match cfg!(m2v_cpu_icd) {
true => 64 << 20,
false => 256 << 20,
};
/// The kernel, and the fixture it is in.
const FIXTURE: &str = "examples/runtime_examples.ll";
const KERNEL: &str = "scale_and_offset";
/// A completed command buffer's kernel end time and GPU times, in seconds of the host's clock.
#[derive(Clone, Copy, Debug)]
struct Times {
kernel_end: f64,
start: f64,
end: f64,
}
impl Times {
/// From its kernel end time to its GPU end.
fn life(self) -> f64 {
self.end - self.kernel_end
}
/// From its GPU start to its GPU end.
fn span(self) -> f64 {
self.end - self.start
}
/// From its kernel end time to its GPU start.
fn lead(self) -> f64 {
self.start - self.kernel_end
}
fn line(self) -> String {
format!(
"life {:.3} ms, kernel end to GPU start {:.3} ms, GPU span {:.3} ms",
self.life() * 1e3,
self.lead() * 1e3,
self.span() * 1e3
)
}
}
/// Commit `command_buffer`, hold that it completed, and read its times.
fn run(command_buffer: &CommandBuffer) -> Times {
command_buffer.commit().unwrap();
command_buffer.wait_until_completed_for(WAIT).unwrap();
assert_eq!(command_buffer.status(), CommandBufferStatus::Completed);
Times {
kernel_end: command_buffer.kernel_end_time(),
start: command_buffer.gpu_start_time().unwrap(),
end: command_buffer.gpu_end_time().unwrap(),
}
}
/// A command buffer of `queue`'s of one compute encoder that scales [`FLOATS`] floats of `input`
/// into `output` with `state`, `times` over.
fn scale(
queue: &CommandQueue,
state: &ComputePipelineState,
(input, output): (&Buffer, &Buffer),
times: usize,
) -> CommandBuffer {
let command_buffer = queue.command_buffer().unwrap();
let mut encoder = command_buffer.compute_command_encoder().unwrap();
encoder.set_compute_pipeline_state(state).unwrap();
encoder.set_buffer(Some(input), 0, 0).unwrap();
encoder.set_buffer(Some(output), 0, 1).unwrap();
encoder.set_bytes(&1.0f32.to_le_bytes(), 2).unwrap();
for _ in 0..times {
(encoder.dispatch_threads(Size::new(FLOATS, 1, 1), Size::new(256, 1, 1))).unwrap();
}
encoder.end_encoding().unwrap();
command_buffer
}
/// A command buffer of `queue`'s of one blit fill of `target`'s first word.
fn fill(queue: &CommandQueue, target: &Buffer) -> CommandBuffer {
let command_buffer = queue.command_buffer().unwrap();
let mut blit = command_buffer.blit_command_encoder().unwrap();
blit.fill_buffer(target, 0..4, 7).unwrap();
blit.end_encoding().unwrap();
command_buffer
}
#[test]
fn a_command_buffer_s_gpu_start_comes_before_its_own_long_work() {
let scratch = Scratch::new("start-stamp-long");
let device = device(&scratch.0);
let queue = device.new_command_queue().unwrap();
let function = library(&device, FIXTURE)
.new_function_with_name(KERNEL)
.unwrap();
let state = (device
.new_compute_pipeline_state_with_function(&function, &PipelineOptions::default()))
.unwrap();
let bytes = FLOATS * 4;
let input = device
.new_buffer(bytes, ResourceOptions::private())
.unwrap();
let output = device
.new_buffer(bytes, ResourceOptions::private())
.unwrap();
// Its pipeline made, its buffers' first work done.
run(&scale(&queue, &state, (&input, &output), 1));
let long = run(&scale(&queue, &state, (&input, &output), DISPATCHES));
eprintln!(
"START-STAMP long {}: {DISPATCHES} dispatches: {}",
device.name(),
long.line()
);
assert!(
long.lead() <= long.life() / 2.0,
"the GPU start lies in the second half of the command buffer's life: {}",
long.line()
);
}
#[test]
fn a_command_buffer_s_gpu_span_holds_its_batch_s_first_work() {
let scratch = Scratch::new("start-stamp-first");
let device = device(&scratch.0);
let queue = device.new_command_queue().unwrap();
let two_copies = !device.properties().has_unified_memory;
let small = device.new_buffer(4096, ResourceOptions::private()).unwrap();
// Its first work done, then the fill alone.
run(&fill(&queue, &small));
let alone = run(&fill(&queue, &small));
let before = device.work_counts();
let fresh = device
.new_buffer(FIRST, ResourceOptions::private())
.unwrap();
let managed = two_copies.then(|| {
let options = ResourceOptions::new(
StorageMode::Managed,
CpuCacheMode::DefaultCache,
HazardTrackingMode::Default,
);
let buffer = device.new_buffer(FIRST, options).unwrap();
let contents = buffer.contents().expect("a Managed buffer's host copy");
// SAFETY: the buffer's host copy of `FIRST` bytes, which no command buffer uses yet.
unsafe { std::ptr::write_bytes(contents.as_ptr(), 0x5a, FIRST as usize) };
buffer.did_modify_range(0..FIRST).unwrap();
buffer
});
let with = run(&fill(&queue, managed.as_ref().unwrap_or(&small)));
let after = device.work_counts();
let copied_in = after.managed_bytes_copied_in - before.managed_bytes_copied_in;
let zero_fills = after.new_buffer_zero_fills - before.new_buffer_zero_fills;
let on_fill_queue = after.fill_queue_submissions - before.fill_queue_submissions;
let added = with.life() - alone.life();
eprintln!(
"START-STAMP first work {}: {zero_fills} zero fills, {copied_in} bytes copied in, \
{on_fill_queue} fill-queue submissions; alone: {}; with it: {}; it adds {:.3} ms",
device.name(),
alone.line(),
with.line(),
added * 1e3
);
drop(fresh);
if on_fill_queue > 0 {
eprintln!("START-STAMP first work: the fill queue took it, before the batch: no check");
return;
}
assert!(zero_fills > 0, "the new buffer took no fill with zeros");
if two_copies {
assert!(
copied_in >= FIRST,
"{copied_in} bytes copied in, of {FIRST}"
);
}
assert!(
with.span() >= added / 2.0,
"the GPU span leaves out the batch's first work: {:.3} ms added, span {:.3} ms",
added * 1e3,
with.span() * 1e3
);
}
+1 -1
View File
@@ -94,7 +94,7 @@ pub const ARTIFACT_FORMAT_VERSION: u32 = 524;
/// changes no behaviour, and then updates that hash alone with the commit saying why, or changes
/// behaviour and also bumps this version. The commit that bumps it says what changed; this comment
/// keeps no history.
pub const RUNTIME_VERSION: u32 = 2465;
pub const RUNTIME_VERSION: u32 = 2466;
/// The digest of the sources this build of the crate was compiled from: SHA-256, as lowercase hex,
/// of the manifest, the build script, and exactly the files the crate roots' module tree compiles
+1 -1
View File
@@ -36,7 +36,7 @@ three consumer pipelines: A2X (`a2x-s4`, `a2x-s96`), Xgc14 (`xgc14-bgra8`) and X
| A heap's colour texture that Metal keeps losslessly compressed (`allowGPUOptimizedContents`, no `ShaderWrite`, `PixelFormatView` or `ShaderAtomic` usage, 16 texels or more a side), on a driver whose compressed images may keep their texels apart from the memory they are bound to (`DriverFact::CompressedImagesHideAliasedWrites`: ANV), is the driver's compressed optimal image, its compression and fast clears kept. A texture Metal keeps uncompressed takes the uncompressed image under either value. The runtime's choice: no pipeline differs. | `heap_compression = HeapCompressionPolicy::Compressed` | `heap_compression = HeapCompressionPolicy::Uncompressed`: an image the driver keeps uncompressed in the heap's bytes, as for a texture Metal keeps uncompressed: host-transfer usage where the device enabled `hostImageCopy` (`heap-texture-host-transfer`), else a linear image (`heap-texture-linear`), else the optimal one (`heap-texture-hides-aliased-writes`) | A write through a buffer or another texture over the texture's bytes may leave its texels as they were or change them otherwise than as written, where Metal's texture reads opaque magenta (`0xffff00ff`) in every texel of drawn content the write covers and the written bytes where it held only a clear; the texture's own writes may show in those bytes compressed. Within Metal's contract: Metal documents such a texture's layout as its own (`allowGPUOptimizedContents` lets it "adjust the private layout"), so no write through another view over its bytes has a defined result there either. `HeapTextureCompressed` (`heap-texture-compressed`), announced once per device where such a texture is made; `runtime_lane::heap_textures` | ANV (Iris Xe of RPL-P; `heap_textures::heap_compression_costs`), a 2048x2048 `RGBA8Unorm` render target in a `Private` placement heap: a pass that clears it 26.9 us against 676.2-676.5 us; a copy into another such texture 647.7-649.1 us against 673.9-693.2 us. The compressed image lies in the heap only where the heap's answer holds it (`heap_answers = HeapAnswerPolicy::Device`, the next row). This 2048x2048 texture's does not under either answer policy, so it takes the linear image under either compression value: a clear 963.5 us against 958.4 us under `heap_answers = HeapAnswerPolicy::Metal`, 955.3 us against 971.4 us under the default, the copy 488-496 us |
| A heap texture whose image of the route the device takes for it needs more bytes or a coarser alignment of the heap than Metal's answer (each of a guest compositor's 22 heap shapes, `RGBA16Float` 2D arrays of one slice and 2D textures to 456x255: on ANV, whose compressed images align to 64 KiB; on the RTX 3090 at 1024; on the RX 7900 XTX at 256 to 64 KiB, where Metal answers 128 for each but the 299x299 array's 16 KiB): the size query (`heapTextureSizeAndAlign`) answers the larger of Metal's answer and that image's, and the texture lies in that image in the heap's bytes. A `Shared` texture's answer also holds the linear image a heap over host pages binds for it. Its alignment is the device's up to a heap's memory's own, 256 KiB, past which no image binds there (on the RX 7900 XTX, 128 KiB for a depth image and 256 KiB for a 4-sample render target past 128 texels a side). Where that image's alignment is past 256 KiB, or past both 4 KiB and the texture's size, the texture's image that a 4 KiB alignment holds takes its place (host-transfer usage, else linear), the answer that one's; else Metal's answer, as under the switch. A multisample texture takes it too and lies in its image in the heap's bytes, in the driver's layout of its samples, where under the switch it is a shadow of its samples in Metal's tiles (`heap_placed_targets`: a frame's 4-sample `RGBA16Float` and `Depth32Float` targets placed in a tracked `Private` heap). Metal's measured answers (4:2:2, one-plane YCbCr, two-plane extended-range, `X32_Stencil8`, `BlockWritesOnly` textures) and textures whose image lies in memory of its own keep Metal's answer. The runtime's choice: no pipeline differs. | `heap_answers = HeapAnswerPolicy::Device` | `heap_answers = HeapAnswerPolicy::Metal`: Metal's answer; the texture lies in an image that fits it (host-transfer usage, else linear: `heap-texture-host-transfer`, `heap-texture-linear`), else is a shadow of the heap's bytes in Metal's tiles, copied in before and out after the commands that use it (`shadowed-texture`) | A heap holds fewer such textures than Metal's: of the 22 shapes, the small arrays answer 4096 bytes where Metal answers 128 to 2176 (on ANV and the XTX; the XTX's 1x1 answers 256), and the 22 answers take 3769962 bytes of heaps placed one after another on ANV and 4155498 on the XTX, against Metal's 3656426 (`heap_texture_images`, `HEAP-COUNT`). A program that places a heap's resources by sizes of its own rather than the query's may overlap the texture with its neighbour; Metal's answer differs by GPU too (65536 on an AMD Radeon Pro 5300M, 4096 on an Intel UHD 630, 128 on an M3). `HeapTextureLargerThanMetal` (`heap-texture-larger-than-metal`), announced once per device; `tests::heap`, `tests::heap_placed_targets`, `heap_shadow_costs::heap_texture_images` | Of the 22 shapes made in heaps under the switch (`heap_texture_images`), on ANV (Iris Xe of RPL-P) 14 lie in an image put in place of their first one and 7 are shadows in Metal's tiles; on the RX 7900 XTX (RADV) 1 and 8, every other answer Metal's; under the default none on either. ANV (`heap_shadow_costs::heap_texture_shadow_costs`), a 1x1 `RGBA16Float` array held as a shadow: a frame that clears it and blits it 34.7 us in the heap against 8.2 us outside |
| Batches of command buffers committed on one queue that the scheduler finds ready together (a backlog) go to the driver in one `vkQueueSubmit`, at most four and at most 16 ms of their queues' expected GPU runs summed (`GROUP_RUN`, `command_buffer/group.rs`: a kernel job that a timeout ends as a whole, as Linux's amdgpu ends one past 2 s by default, never carries more of the others' expected work than that), only the last signalling the queue's timeline, on a device whose own check finds a submission that signals nothing merged into the next (`submit_check.rs`, once per driver, release and kernel: one `vkQueueSubmit` of four empty infos against four calls of one, merged where the one costs at most 0.6 of the four; Mesa 26.2.6's RADV on the Radeon 780M, the RX 7900 XTX and the RX 550 at 0.33-0.38, ANV on the Iris Xe of RPL-P at 0.39, MoltenVK 1.4.2 on the M3 Max at 0.98; a device whose check has not answered, or that does not merge, takes the ungrouped form under either value of the switch): one kernel submission, where ANV on i915 lists every `VkDeviceMemory` in each (the consumer's guest drag on the Iris Xe: about 300 entries per execbuffer, 260 of them its host imports, at 112 to 128 execbuffers a frame). A batch's event signals ride to the group's end, which signals each event's semaphore to the highest index the batches held signal it to (an event's indices rise in commit order). A batch that signals a binary semaphore, takes a fence, binds a sparse update, does first work, names the caller's wrapped image, or waits for anything not seen complete (an event, another queue's work) goes alone, after the batches held: a batch with a wait leads a group, never joins one. Nor does an unshared queue's batch (`Device::new_command_queue_unshared`) on a `VkQueue` whose other queues' work is held back for it (`UnsharedIsolationPolicy::Bounded`, the default), and no group is kept there while earlier work runs (below): on RADV, ANV and lavapipe, whose one graphics `VkQueue` every command queue shares, a live unshared queue so keeps no group of any queue. Each batch on a `VkQueue` whose batches group that goes in a kernel submission of its own counts once by why (`WorkCounts::batches_alone_unshared` and kin), and `WorkCounts::batches_of_unshared_queues` counts the unshared queues' batches under either value. So does a batch whose queue's expected run is unknown (none of its batches seen complete yet) or would take the group past 16 ms (`WorkCounts::group_ends_long`), leading the next group where its own run is within the bound; a queue's expected GPU run follows its command buffers' own GPU times by their timestamps (raised at once by a longer one, halved toward a shorter one), which other `VkDevice`s' work on the GPU does not lengthen; with `DeviceOptions::gpu_times_from_host` it follows those host times, which hold other clients' work on the GPU too, so under contention there a queue's batches may stop grouping. So that checked command buffers (the consumer checks each) are found ready together, the submission checks of up to three batches right behind a line's head that goes run with the head's, in commit order, none committed after another queue's batch: such a check runs before the previous batch's `vkQueueSubmit` rather than after it, in the scheduler pass that submits its own batch. A pass that finds no batch ready sends the batches held, unless two or more earlier submissions of their `VkQueue` are not seen complete: the GPU runs those first in any case, so the batches stay held, and those committed meanwhile join them, until one submission is left in flight (a completion turn wakes the scheduler at its value), the group fills, a later batch sends it, a head waits for the GPU, or a thread waits for one of their command buffers' completion, which sends them at once; nor are they kept where the scheduler's thread runs next a submission handler of another queue's command buffer (one a pass that settled a switch of storage forms keeps; the thread hands every other pass's to the device's handler threads, where none holds its passes back): they go first, as Metal schedules a queue's command buffers whatever another queue's handler does (an M3 Max, probe `cross_queue_handler_waits`); a batch that ends a command buffer with a switch of storage forms riding on it, which settles by its submission's outcome, is never kept so. A batch a committing thread submits (`CommandBuffer::commit_and_submit`) goes alone where its `VkQueue` runs at most one earlier submission not seen complete, as the pass that held it would send the group at once; where two or more run it is left to the scheduler's thread, which holds it. A held batch that ends its command buffer is `Scheduled` as it is held, its submission handlers run first, then its scheduled handlers, and its kernel end time set, as an M3 Max schedules a command buffer committed behind running work 0.04 to 0.18 ms after its commit. The runtime's: no pipeline differs. | `completLine truncated
| Batches of command buffers on one `VkQueue`, on a driver measured to start no kernel submission of a queue before the one before it completed (ANV, RADV and NVIDIA's; `batch_order.rs`), are ordered by their ends: each ends with a barrier ordering its work before every later command of its `VkQueue` (the exact form's end orders it before the host's reads and writes alone), so a batch that depends on an earlier one there begins with no barrier of its own, often no command buffer of barriers, and its first encoder's GPU start is written at the bottom of the pipe, once everything before it completed. Metal starts an independent command buffer committed behind running work while that work runs (an M3 Max under macOS 27.0.1, probe `gpustart`); those drivers ran two batches of independent work one after the other under every shape measured (no end barrier, the host's or the widened one; in one `vkQueueSubmit` or two, merged into one kernel submission or not), where two dispatches of one command buffer ran side by side. The runtime's: no pipeline differs. | `batch_order = BatchOrderPolicy::Ends` | `batch_order = BatchOrderPolicy::Exact`: a barrier for each dependency of a batch's work on an earlier batch's of its `VkQueue`, the end's barrier to the host's reads and writes alone, the GPU start written at the top of the pipe; every other driver takes it under either value | None: on those drivers each batch starts once the one before it completed under either value, so the work's order, its results and its GPU times are the same, and a batch's GPU start is the end of the work before it, when such a driver starts it. Not announced; `runtime_lane::commit_work` and `runtime_lane::gpu_times` test both values | UHD 770 (ANV, RPL-S), the consumer's frame shape over 520 host imports, 67 command buffers a frame, Grouped completion, the widened end barrier against the exact form (a probe build of each): with no fill ahead of each command buffer, 67.0 command buffers submitted a frame against 129.3-129.7, the GPU's span a frame 1.84-1.90 ms against 1.99-2.06 ms, a frame through completion 2.13-2.22 ms against 2.27-2.38 ms; with a 1 MiB fill ahead of each, 134.0 against 262.9, 8.03-8.22 ms against 8.32-8.42 ms, 9.00-9.15 ms against 9.25-9.36 ms. Radeon 780M (RADV, Mesa 26.0.8), this switch: with no fill, 67.0 against 128.9-129.0, a frame through completion 48.3-48.6 ms against 42.6-47.0 ms; with a 16 MiB fill committed at once, 134.0 against 251.0-251.1, 50.6-50.8 ms against 50.8-57.3 ms; committed every 1 ms, 134.0 against 249.7-250.2, 71.3-83.6 ms against 106.3-113.6 ms (each kernel submission there leaves about 2.5 ms of the GPU idle over 520 host imports, which sets these frames) |
| Batches of command buffers on one `VkQueue`, on a driver measured to start no kernel submission of a queue before the one before it completed (ANV, RADV and NVIDIA's; `batch_order.rs`), are ordered by their ends: each ends with a barrier ordering its work before every later command of its `VkQueue` (the exact form's end orders it before the host's reads and writes alone), so a batch that depends on an earlier one there begins with no barrier of its own, often no command buffer of barriers, and its GPU start, written at the top of the pipe, waits behind that end barrier until everything before it completed. Metal starts an independent command buffer committed behind running work while that work runs (an M3 Max under macOS 27.0.1, probe `gpustart`); those drivers ran two batches of independent work one after the other under every shape measured (no end barrier, the host's or the widened one; in one `vkQueueSubmit` or two, merged into one kernel submission or not), where two dispatches of one command buffer ran side by side. The runtime's: no pipeline differs. | `batch_order = BatchOrderPolicy::Ends` | `batch_order = BatchOrderPolicy::Exact`: a barrier for each dependency of a batch's work on an earlier batch's of its `VkQueue`, the end's barrier to the host's reads and writes alone, the GPU start written at the top of the pipe; every other driver takes it under either value | None: on those drivers each batch starts once the one before it completed under either value, so the work's order, its results and its GPU times are the same, and a batch's GPU start is the end of the work before it, when such a driver starts it. Not announced; `runtime_lane::commit_work` and `runtime_lane::gpu_times` test both values | UHD 770 (ANV, RPL-S), the consumer's frame shape over 520 host imports, 67 command buffers a frame, Grouped completion, the widened end barrier against the exact form (a probe build of each): with no fill ahead of each command buffer, 67.0 command buffers submitted a frame against 129.3-129.7, the GPU's span a frame 1.84-1.90 ms against 1.99-2.06 ms, a frame through completion 2.13-2.22 ms against 2.27-2.38 ms; with a 1 MiB fill ahead of each, 134.0 against 262.9, 8.03-8.22 ms against 8.32-8.42 ms, 9.00-9.15 ms against 9.25-9.36 ms. Radeon 780M (RADV, Mesa 26.0.8), this switch: with no fill, 67.0 against 128.9-129.0, a frame through completion 48.3-48.6 ms against 42.6-47.0 ms; with a 16 MiB fill committed at once, 134.0 against 251.0-251.1, 50.6-50.8 ms against 50.8-57.3 ms; committed every 1 ms, 134.0 against 249.7-250.2, 71.3-83.6 ms against 106.3-113.6 ms (each kernel submission there leaves about 2.5 ms of the GPU idle over 520 host imports, which sets these frames) |
| Command queues on a device whose GPU idles when consecutive work comes from another `VkQueue` share `VkQueue`s by choice (`queue_share.rs`): the runtime's own self-check, not a `DriverFact` row, measures that idling once per driver, release and runtime on a thread of its own and keeps its verdict (`Idles`, `DoesNotIdle`, `Unchecked`) in the shader cache's directory, as the in-place check keeps its own (`queue_switch_check.rs`: 48.7 to 51.3 us a switch on the RTX 5080 Laptop GPU, NVIDIA 615.71.09, `Idles` above 20 us). A command queue that makes a command buffer while it holds no other uncompleted one moves onto the busy `VkQueue` of its family whose oldest batch has run under 0.5 ms, the most batches in flight first, so short command buffers of several queues run with no switch between them. A queue one of whose command buffers ran on the GPU for over 2 ms, by its own timestamps (not the host's view of how long it ran as its `VkQueue`'s oldest, which also holds its wait for the GPU to start it and the waiter's lateness to see it complete), or held its `VkQueue` for over 2 ms from the submission of a batch that waited on the GPU for another `VkQueue`'s work (an `MTLEvent`'s signal, the tracker's wait, new resources' first work) to its own GPU end, is long: no queue joins its `VkQueue` while it lives, and it moves once more, at its next idle point, to an idle `VkQueue` no long or unshared queue holds. A queue whose command buffers must never wait behind another queue's (a compositor's beside an application's) is made with `Device::new_command_queue_unshared`: it never moves and no queue joins its `VkQueue`. Under either value, as a queue is made, it takes the round robin's `VkQueue` the fewest live command queues hold, of those no unshared queue holds, in turn among equals, and an unshared queue one no command queue holds where one is free (one pass over the `VkQueue`s' counts; one that finds none shares the one the fewest hold, `WorkCounts::unshared_queues_sharing_a_vk_queue`). Presenting queues and a queue that lent its `VkQueue` (`with_vk_queue`) never move. Before the verdict, and where it is not `Idles` or there are no two `VkQueue`s of one family (MoltenVK, RADV, lavapipe), every queue keeps the `VkQueue` it took at its creation; so does every queue of a device whose command buffers write no GPU timestamps it reads (`gpu_times_from_host`, or a driver whose timestamps wait for every queue's), which does not share and is counted (`WorkCounts::queue_sharing_untimed`). The runtime's: no pipeline differs. | `queue_sharing = QueueSharingPolicy::Adaptive` | `queue_sharing = QueueSharingPolicy::PerQueue`: each command queue keeps the `VkQueue` it took at its creation (the fewest live queues' as above), and the check does not run | A command buffer waits behind the command buffers of the queues sharing its `VkQueue`, where Metal's queues wait for each other only inside one command. The residual stall: once per logical queue that goes long, for a queue that joined its `VkQueue` during its short phase, about one long command buffer's length: the command buffers committed behind that queue's first long one there wait for its whole length (and those behind its later ones while it holds work, until its next idle point). Measured on the RTX 5080 Laptop GPU beside an application that alternates draws with 30 ms command buffers: a shared compositor's commits at 4,800 a second had 64 completions over 10 ms, at most 26.4 to 30.1 ms, in each of 3 runs of each of two such shapes (one join each), against none over 10 ms under `PerQueue` in those 6 runs (at most 5.6 to 9.7 ms); with 2 ms of draws between long command buffers, none over 10 ms in 3 runs (at most 5.7 to 9.8 ms) against 7, 0 and 0 under `PerQueue` (at most 6.9 to 11.2 ms). On an unshared queue, 0 over 10 ms in every run. A command buffer's GPU start time includes the other queues' work before it. `QueueSharing` (`queue-sharing`), at the device's first join | Command buffers a second on the RTX 5080 Laptop GPU, one-draw command buffers, each thread its own queue, the default against `PerQueue`, runs after a lock hold's first: 8 threads with 3 in flight 50.7k to 54.7k against 27.4k to 28.0k (5 runs each); 8 threads with 1 in flight 47.0k to 50.1k against 13.9k to 14.3k (5); 2 threads with 3 in flight 28.0k to 53.7k against 21.4k to 28.0k (10 each, in turn, the default above `PerQueue` in each pair; no thread's queue marked long), and beside another process's 30 ms command buffers 5.1k to 6.7k against 4.0k to 4.1k (3 each; the host's view marked a thread's queue long in 1 of 3 runs, which then ran at `PerQueue`'s 4.1k); 2 threads with 1 in flight 16.9k to 20.7k against 10.1k to 11.5k (5); one thread over 16 queues in turn 21.7k to 43.3k against 10.2k to 11.1k, over 2,048 20.0k to 39.2k against 10.2k to 11.2k (4). Beside an application whose queue never shared with the compositor (isolation, 300 and 30 dispatches), both 0 over 10 ms |
| A chain of `half` additions, subtractions and products on a device without `shaderFloat16` (vk12-floor, SwiftShader, Pascal; capability emulation: the module computes each in `float` and rounds it by the device's `OpQuantizeToF16`): an operation whose flags hold `contract` and `reassoc` and whose result only such operations read is held at `float` precision unrounded, so the chain rounds where a value leaves it (a store, an output, a conversion, a comparison, a call, a phi, a vector move, an operation without both flags), one quantize per exit instead of one per operation (`lower::arith::half_chain`). A device with `shaderFloat16` computes `half` alike under either value. | `half_chains = HalfChainPolicy::AtExits` | `half_chains = HalfChainPolicy::EachOperation`: every operation's result rounded to `half`, as the AIR computes it | The result may differ from the rounded operations' by the roundings the chain skips, each within half a unit in the last place of a `half` at its step, compounded along the chain; a value inside the chain past `half`'s range (65504) stays finite where the rounded operations reach infinity. Within the AIR's flags, which let a compiler regroup and fuse such operations. `FastMathRewrites` (`fast-math-rewrites`) | Not timed. Size on vk12-floor (the fixtures' SPIR-V words, the default against the accurate form): `hfb_filter_bank` 121,270 against 131,766 (1,024 quantizes against 2,464), `grd_half_many_samples` 82,019 against 84,627, `nan_half_fast` 9,808 against 9,832 |
| A texture that samples, reads, renders into it or is written through a shader (`ShaderWrite` or `ShaderAtomic` usage, of texels of 1, 2, 4, 8 or 16 bytes) over host pages (a no-copy buffer's, or a no-copy heap's buffer's, imported by their pointer or as dma-bufs; or a buffer in fresh pages; or a copied host buffer's copy of them, `copied.rs`, its image bound in the copy's memory where the check passed for the pages, and for the copy's fresh pages or, for a `DRM_FORMAT_MOD_LINEAR` image in memory the device allocates, its pooled memory, `WorkCounts::copied_textures_in_place`) is a linear image aliasing the pages in place, where the device makes the image (its format and usage linear, at the pages' pitch) and its own check shows that the operations Vulkan lets read and write every byte bound to it leave every byte alone while the CPU writes beside it: the image's first move (`VUID-VkImageCreateInfo-pNext-01443` makes such an image start `UNDEFINED`), and for one that renders a render pass's load and store operations and its moves into `ATTACHMENT_FEEDBACK_LOOP_OPTIMAL_EXT` and back, and for one a shader writes a kernel's storage writes of its texels (which of a linear image a driver may widen past a texel), each access checked apart (a shader's writes of 1- or 2-byte texels apart from those of wider ones, which a driver may store through a wider access), and each apart for texels that share a line of the device's memory (`nonCoherentAtomSize`, "the size and alignment in bytes that bounds concurrent access to host-mapped device memory") with bytes beside them and for texels that share none (their start, their end and, with bytes between rows, each row's start and end on a line; `in_place::RowEnds`): a byte changed beside texels that share none fails both, one changed beside texels that share one fails those alone (the Iris Xe, ANV, Mesa 26.2.6, whose clear and store, and draws, write back whole the 64-byte line that holds a row's last texels, fails renders, and writes, for rows that end inside a line, a byte between rows changed, and passes both for rows that end on one: a 3840x2160 `BGRA8Unorm` surface's 15360-byte rows are 240 lines each). Over a no-copy buffer's dma-buf pages the image is a `DRM_FORMAT_MOD_LINEAR` one whose first move acquires it from `VK_QUEUE_FAMILY_FOREIGN_EXT`, in one of two forms, each judged by a class of its own: bound at the texels' offset in the import the buffer lies in, its plane at offset 0, where that is one import dedicated to nothing and the driver takes such an image there (no dedicated allocation required, `VUID-vkBindImageMemory-image-01445`; none of the buffer's, `-memory-10926`; its alignment dividing the offset, `-None-10735`), with no dma-buf or import of its own (`PagesClass::DmaBufInImport`, `WorkCounts::dma_buf_images_in_import`); else over a dma-buf of its own pages in a dedicated import (`PagesClass::DmaBuf`; RADV, **Known gaps**). A kernel's writes of a texture over a buffer's rows (no IOSurface plane's) whose rows, each to its pitch, start and end on a line, its buffer holding the last row to its pitch, take a verdict of their own from the same rounds, which a round that changed only bytes of its rows' padding (after a row's last texel, before its pitch, the last row's included) passes (`in_place::Padding`, `Access::BufferWrites`): Metal leaves those bytes to the GPU there (an Intel UHD Graphics 630 under macOS 26.7.1 wrote older values back over the CPU's writes to them under a kernel's writes of a texture over a buffer, the last row's included, where an M3 Max under macOS 27.0.1 and a Radeon Pro 5300M kept them, and all three kept them under draws, clears and stores and over IOSurfaces; `crates/metal2vulkan-conformance/probes/row_padding_writes.m`), and the rule follows the x86 Macs' envelope (docs/API.md, section 10, **Kernels**), so the Iris Xe's written textures over a buffer take the image in place whatever their rows' ends. A deliberate, scoped exception to relying on documented Vulkan behaviour alone, the owner's rulings (2026-10-26, and 2026-10-27 and 2026-11-07 for render targets and written textures: the GPU works on the caller's pages in place as a Mac's does, whatever a linear image costs it, on a discrete GPU too; `in_place.rs`). A texture over a buffer of the runtime's pooled memory whose rows the device's own linear image lays out otherwise (a padded pitch the driver does not take: ANV lays linear rows tight; rows apart only over a buffer that declares them unobserved, `BufferDescriptor::padding_unobserved`) is, by the same rule, a `DRM_FORMAT_MOD_LINEAR` image at Metal's pitch bound in the buffer's memory, at any size, where the device makes one (no external memory, which Vulkan allows: `VUID-VkImageCreateInfo-tiling-02261`, `VUID-vkBindImageMemory-image-01445`), made `UNDEFINED` (`VUID-VkImageCreateInfo-initialLayout-12478`), whose first move the check's pooled class judges (`PagesClass::Pooled`: a buffer of that memory, its images at Metal'Line truncated