Validation: a play's gauges at frames 100 and 200 go out as the matrix's records, every kind on its end lines
What: - The runtime backend's end lines (`Backend::live`) carry every count of an object kind the runtime keeps live: samplers, LOD clamp variants, level elements, kernel variants and entries, render contents, attachment views, descriptor slots, device samplers, shadows, resolve images, plane stand-ins, buffer set pools, surface buffers, indirect command buffers, releases waiting and handles out join them, and the pipeline cache's bytes. - At the ends of frames 100 and 200 (GAUGE_FRAMES) the player reads them once they hold still (Backend::settled_live): the runtime backend reads them every 10 ms until no release waits and two reads in a row agree on every recorded kind, for at most 2 s, a wait no frame's time holds. What the program released goes on the runtime's block-maker and reaper threads after the work before it retired, so a read straight after the frame's waits could differ between two plays. - command-replay prints, where the play ended frame 200 and skipped nothing by then, `M2V-MATRIX gauge replay-rt/STEM/GAUGE@100` and `@200` for each kind of GAUGED (gauge_records). scripts/matrix/results.py judges them as it judges the harness's: equal at 100 and 200, blocks no higher at 200. - Left out, and why: handles_out (1 while the play holds the device), releases_waiting (lowered by the block-maker thread whenever it runs), private_units (a layout of memory that follows the bytes the program holds), and every byte and age gauge, which follows the program's content and the pool's idle clock: the pipeline cache's data (bound 128 MiB), the translator's entries' bytes (bound 64 MiB), the staging bytes, the pool's allocated, idle, reserved, reused, taken and block bytes, and the shadows', resolve images' and stand-ins' bytes, whose counts are recorded. Why: the matrix's leak rule (live gauges per resource kind flat between iterations 100 and 200) reached only the harness's compute workloads. The kinds only draws and passes make (render contents, attachment views, shadows, resolve images, stand-ins, the samplers draws reach) had no such check, and a play's end lines lacked 17 of the kinds. Docs: REPLAY-STREAM.md section 10 (the end line's gauges, the settled read, the records), VALIDATION.md's gauge row, command-replay's module doc. Tests: replay::tests the_player_settles_the_gauges_at_frames_100_and_200_alone and the_gauge_records_are_the_counted_kinds_at_frames_100_and_200; replay::rt_replay the_end_lines_carry_every_gauge_the_gauge_records_carry (device); test_results.py test_a_plays_gauges_at_frames_100_and_200_are_held_flat_as_the_harness_s. Verified: in the hand-over.
This commit is contained in:
1 parent
da37e9e5df
commit
f4eb47d792
10 files changed
+287
-27
No files matched your search
@@ -44,7 +44,9 @@
|
||||
//! short, `skipped ...` where the backend skipped what its runtime does not build (such a play is
|
||||
//! no gate result), `gaps ...` where it met a typed gap, on the runtime where the play
|
||||
//! finished its range and skipped nothing the matrix's judged metrics (`M2V-MATRIX metric
|
||||
//! replay-rt/STEM/RANGE/NAME N`, `docs/REPLAY-STREAM.md`, section 10), then `ok`, `ids: ...` or
|
||||
//! replay-rt/STEM/RANGE/NAME N`, `docs/REPLAY-STREAM.md`, section 10), where it ended frame 200
|
||||
//! and skipped nothing by then its gauge records at frames 100 and 200 (`M2V-MATRIX gauge
|
||||
//! replay-rt/STEM/GAUGE@F N`), then `ok`, `ids: ...` or
|
||||
//! `error WHAT`, the skipped line and this one ending `; not a verdict past frame F, call C` where
|
||||
//! the backend skipped anything (`F` and `C` the first skip's frame and stream position); a play
|
||||
//! that ends where an object's ID differs, the compute pipeline states' typed gap aside, ends
|
||||
@@ -119,10 +121,10 @@
|
||||
use metal2vulkan_validation::gpu::wait::{parse_wait_timeout, set_wait_timeout, WAIT_TIMEOUT_FLAG};
|
||||
use metal2vulkan_validation::gpu::DeviceType;
|
||||
use metal2vulkan_validation::replay::{
|
||||
compare_dumps, compare_plays, display_library, judged_records, recording_range, segments,
|
||||
shown_differences, Backend, CommandBufferList, ManagedCopies, NewRuntime, PlayError, Player,
|
||||
RangeSource, RecordingRange, StreamError, StreamReader, StreamWriter, Value, VideoHandle,
|
||||
FLAG_COMPLETION_BYTES_RECORDED, RECORDED_RANGES,
|
||||
compare_dumps, compare_plays, display_library, gauge_records, judged_records, recording_range,
|
||||
segments, shown_differences, Backend, CommandBufferList, ManagedCopies, NewRuntime, PlayError,
|
||||
Player, RangeSource, RecordingRange, StreamError, StreamReader, StreamWriter, Value,
|
||||
VideoHandle, FLAG_COMPLETION_BYTES_RECORDED, RECORDED_RANGES,
|
||||
};
|
||||
use std::collections::{BTreeMap, HashSet};
|
||||
use std::io::Write as _;
|
||||
@@ -802,7 +804,8 @@ type Presents = (Vec<u64>, PathBuf);
|
||||
/// keeping its bytes in the directory given, and on the runtime,
|
||||
/// where `judged`
|
||||
/// names the stream's first segment, writing the matrix's judged metrics of a play that finished
|
||||
/// its range (`judged_records`): the exit status.
|
||||
/// its range (`judged_records`) and its gauge records at frames 100 and 200 (`gauge_records`): the
|
||||
/// exit status.
|
||||
fn run<B: Backend>(
|
||||
backend: &mut B,
|
||||
reader: &mut StreamReader,
|
||||
@@ -892,6 +895,9 @@ fn run<B: Backend>(
|
||||
for line in judged_records(first, &played, &ended, until) {
|
||||
report.line(&line);
|
||||
}
|
||||
for line in gauge_records(first, &played) {
|
||||
report.line(&line);
|
||||
}
|
||||
}
|
||||
match ended {
|
||||
// Played to the end, the IDs a shader reads differing from the program's: no fault, hang
|
||||
|
||||
@@ -24,13 +24,15 @@ mod value;
|
||||
pub use compare::{compare_plays, shown_differences};
|
||||
pub use covers::SlotStage;
|
||||
pub use dumps::{compare_dumps, CommandBufferList, Comparison, Difference, Part};
|
||||
pub use new_runtime::{judged_records, Ended, ManagedCopies, NewRuntime, VideoHandle};
|
||||
pub use new_runtime::{
|
||||
gauge_records, judged_records, Ended, ManagedCopies, NewRuntime, VideoHandle, GAUGED,
|
||||
};
|
||||
pub use pixels::Shape;
|
||||
pub use player::WAIT_COMPLETED;
|
||||
pub use player::{
|
||||
Backend, Check, Counters, Counts, End, IdDiffers, Made, ManagedReads, PlayError, Player,
|
||||
ReadClass, ReadCopy, Relaid, Report, Shown, TextureWrites,
|
||||
};
|
||||
pub use player::{GAUGE_FRAMES, WAIT_COMPLETED};
|
||||
pub use prepass::{Ahead, AheadGrid};
|
||||
pub use range::{
|
||||
display_library, recording_range, sidecar, RangeRow, RangeSource, RecordingRange,
|
||||
|
||||
@@ -2,12 +2,58 @@
|
||||
//! counts two plays of one stream at one commit on one card give alike, summed over the whole
|
||||
//! play as the runtime executed it, each an `M2V-MATRIX metric` record that the matrix holds equal
|
||||
//! to its base's (`docs/VALIDATION.md`, "Records and rules"). A play that did not finish its range
|
||||
//! gives none, so the base's records it lacks fail it.
|
||||
//! gives none, so the base's records it lacks fail it. And the matrix's gauge records of a play:
|
||||
//! each kind of object the runtime keeps live, at the ends of frames 100 and 200, which the
|
||||
//! matrix holds flat.
|
||||
|
||||
use crate::replay::player::{PlayError, Report};
|
||||
use crate::replay::player::{PlayError, Report, GAUGE_FRAMES};
|
||||
use crate::replay::range::stem;
|
||||
use std::path::Path;
|
||||
|
||||
/// The gauges of a play's end lines (`Backend::live`) that its gauge records carry
|
||||
/// ([`gauge_records`]): each a count of one kind of object the runtime keeps live, which the
|
||||
/// matrix holds equal at frames 100 and 200 (`blocks`, the memory pool's allocations, no higher
|
||||
/// at 200), as it holds the harness's between its 100th and 200th runs. Left out:
|
||||
/// `handles_out`, 1 while the play holds the device; `releases_waiting`, which the runtime's
|
||||
/// block-maker thread lowers as the work before each release retires, whenever it runs;
|
||||
/// `private_units`, the pool's allocations that hold the Private blocks taken, a layout of memory
|
||||
/// that follows the bytes the program holds; and every byte and age gauge, which follows the
|
||||
/// program's content and the pool's idle clock (the pipeline cache's data, within its bound of
|
||||
/// 128 MiB; the translator's entries' bytes, within 64 MiB; the staging bytes; the allocations',
|
||||
/// takes' and blocks' bytes, idle, reserved or in use; the shadows', resolve images' and stand-ins'
|
||||
/// bytes, whose counts are here).
|
||||
pub const GAUGED: [&str; 29] = [
|
||||
"blocks",
|
||||
"imports",
|
||||
"exports",
|
||||
"surface_imports",
|
||||
"surface_buffers",
|
||||
"buffers",
|
||||
"textures",
|
||||
"textures_copied_over",
|
||||
"samplers",
|
||||
"lod_clamp_variants",
|
||||
"level_elements",
|
||||
"pipelines",
|
||||
"kernels",
|
||||
"kernel_variants",
|
||||
"kernel_entries",
|
||||
"render_contents",
|
||||
"attachment_views",
|
||||
"command_buffers",
|
||||
"descriptor_slots",
|
||||
"events",
|
||||
"device_samplers",
|
||||
"shadows",
|
||||
"resolve_images",
|
||||
"plane_stand_ins",
|
||||
"timestamp_pools",
|
||||
"occlusion_pools",
|
||||
"buffer_set_pools",
|
||||
"indirect_command_buffers",
|
||||
"stage_entries",
|
||||
];
|
||||
|
||||
/// Each judged metric: its name, the executed counters it adds and the one it takes away. A new
|
||||
/// texture is zeroed by a clear, and the barriers leave out the one after an upload's clears
|
||||
/// (`texture_clear_barriers`).
|
||||
@@ -53,3 +99,28 @@ pub fn judged_records(
|
||||
});
|
||||
records.collect()
|
||||
}
|
||||
|
||||
/// The gauge records of the play of the stream whose first segment is `first`, with `report`, one
|
||||
/// line each: `M2V-MATRIX gauge replay-rt/STEM/GAUGE@F N`, `STEM` as [`judged_records`] has it,
|
||||
/// for each gauge of [`GAUGED`] at the end of each frame `F` of [`GAUGE_FRAMES`], read once the
|
||||
/// gauges held still (`Backend::settled_live`). A play that ended no frame 200, and one whose
|
||||
/// backend skipped anything by then, give none.
|
||||
pub fn gauge_records(first: &Path, report: &Report) -> Vec<String> {
|
||||
let last = GAUGE_FRAMES[GAUGE_FRAMES.len() - 1];
|
||||
let skipped = (report.first_skip).is_some_and(|(frame, _)| frame <= last as u64);
|
||||
if report.ends.len() <= last || skipped {
|
||||
return Vec::new();
|
||||
}
|
||||
let stream = stem(first).replace(char::is_whitespace, "_");
|
||||
let stream = &stream;
|
||||
let records = GAUGE_FRAMES.iter().flat_map(|&frame| {
|
||||
let live = &report.ends[frame].live;
|
||||
GAUGED.iter().filter_map(move |&gauge| {
|
||||
let value = live.get(gauge)?;
|
||||
Some(format!(
|
||||
"M2V-MATRIX gauge replay-rt/{stream}/{gauge}@{frame} {value}"
|
||||
))
|
||||
})
|
||||
});
|
||||
records.collect()
|
||||
}
|
||||
@@ -86,7 +86,7 @@ pub(super) mod unwritten;
|
||||
mod videos;
|
||||
|
||||
pub(super) use exported::{LANDINGS, MAKINGS, PARTS, UNJUDGED};
|
||||
pub use judged::judged_records;
|
||||
pub use judged::{gauge_records, judged_records, GAUGED};
|
||||
|
||||
use super::args::{arg, data, metal, option_sets, refuse, uint, variant, Fields};
|
||||
use super::covers::SlotStage;
|
||||
@@ -936,6 +936,12 @@ fn texture_class(pf: rt::PixelFormat, usage: rt::TextureUsage) -> Option<rt::Ind
|
||||
/// threads.
|
||||
const QUIESCE: std::time::Duration = std::time::Duration::from_secs(30);
|
||||
|
||||
/// How often [`NewRuntime`]'s settled read of the gauges reads them again (`Backend::settled_live`).
|
||||
const SETTLE_STEP: std::time::Duration = std::time::Duration::from_millis(10);
|
||||
|
||||
/// How long a settled read of the gauges waits for them to hold still at most.
|
||||
const SETTLE_LIMIT: std::time::Duration = std::time::Duration::from_secs(2);
|
||||
|
||||
/// What the play's device left once [`NewRuntime::end`] tore it down: the runtime's gauges, read
|
||||
/// after the device dropped, and whether it quiesced in time.
|
||||
#[derive(Clone, Debug, PartialEq, Eq)]
|
||||
@@ -3449,12 +3455,30 @@ impl Backend for NewRuntime {
|
||||
("buffers", gauges.buffers),
|
||||
("textures", gauges.textures),
|
||||
("textures_copied_over", gauges.textures_copied_over),
|
||||
("samplers", gauges.samplers),
|
||||
("lod_clamp_variants", gauges.lod_clamp_variants),
|
||||
("level_elements", gauges.level_elements),
|
||||
("pipelines", gauges.pipelines),
|
||||
("kernels", gauges.kernels),
|
||||
("kernel_variants", gauges.kernel_variants),
|
||||
("kernel_entries", gauges.kernel_entries),
|
||||
("render_contents", gauges.render_contents),
|
||||
("attachment_views", gauges.attachment_views),
|
||||
("command_buffers", gauges.command_buffers),
|
||||
("descriptor_slots", gauges.descriptor_slots),
|
||||
("events", gauges.events),
|
||||
("device_samplers", gauges.device_samplers),
|
||||
("shadows", gauges.shadows),
|
||||
("resolve_images", gauges.resolve_images),
|
||||
("plane_stand_ins", gauges.plane_stand_ins),
|
||||
("timestamp_pools", gauges.timestamp_pools),
|
||||
("occlusion_pools", gauges.occlusion_pools),
|
||||
("buffer_set_pools", gauges.buffer_set_pools),
|
||||
("surface_buffers", gauges.surface_buffers),
|
||||
("indirect_command_buffers", gauges.indirect_command_buffers),
|
||||
("releases_waiting", gauges.releases_waiting),
|
||||
("handles_out", gauges.handles_out),
|
||||
("pipeline_cache_bytes", gauges.pipeline_cache_bytes),
|
||||
("spilled_bytes", gauges.spilled_bytes),
|
||||
("managed_spilled_bytes", gauges.managed_spilled_bytes),
|
||||
("shared_allocation_bytes", gauges.shared_allocation_bytes),
|
||||
@@ -3485,6 +3509,27 @@ impl Backend for NewRuntime {
|
||||
])
|
||||
}
|
||||
|
||||
/// The gauges once the runtime's own threads have freed what the frame's work held: what the
|
||||
/// program released goes on the block-maker and reaper threads once the work committed before
|
||||
/// the release retired, after the waits that end the frame. Read every `SETTLE_STEP` until no
|
||||
/// release waits and two reads in a row agree on every gauge the matrix's records carry
|
||||
/// ([`GAUGED`]), for at most `SETTLE_LIMIT`, past which the last read stands.
|
||||
fn settled_live(&mut self) -> Counters {
|
||||
let deadline = std::time::Instant::now() + SETTLE_LIMIT;
|
||||
let mut live = self.live();
|
||||
while std::time::Instant::now() < deadline {
|
||||
std::thread::sleep(SETTLE_STEP);
|
||||
let next = self.live();
|
||||
let still = (judged::GAUGED.iter()).all(|&gauge| live.get(gauge) == next.get(gauge));
|
||||
let waiting = next.get("releases_waiting").copied().unwrap_or(0);
|
||||
live = next;
|
||||
if still && waiting == 0 {
|
||||
break;
|
||||
}
|
||||
}
|
||||
live
|
||||
}
|
||||
|
||||
/// A `pipeline I wall_nanos=N kernel=new|again` line for each compute pipeline state made, in
|
||||
/// order: its making's wall time, and whether its kernel was new to the play. Where the makes
|
||||
/// were written or pooled (`with_states`), the `states` line after the pool made every state
|
||||
|
||||
@@ -27,6 +27,11 @@ use std::time::{SystemTime, UNIX_EPOCH};
|
||||
/// A runtime's counters, cumulative, by name.
|
||||
pub type Counters = BTreeMap<&'static str, u64>;
|
||||
|
||||
/// The frames (counted from 0) at whose end the player reads the runtime's gauges once they hold
|
||||
/// still ([`Backend::settled_live`]): a play's loop iterations 100 and 200, between which the
|
||||
/// matrix holds each kind of object the runtime keeps live flat (`gauge_records`).
|
||||
pub const GAUGE_FRAMES: [usize; 2] = [100, 200];
|
||||
|
||||
/// The counts the stream fixes, the same on every play of it on any runtime: the calls played,
|
||||
/// the command buffers committed, the encoders made, the draws, dispatches and blit commands
|
||||
/// their calls issued, the buffer slots their set-buffer calls set (`binds`), the address-looking
|
||||
@@ -165,6 +170,14 @@ pub trait Backend {
|
||||
/// (`Report::ends`), never as growth.
|
||||
fn live(&mut self) -> Counters;
|
||||
|
||||
/// The runtime's gauges once what its own threads free after the frame's work retired has
|
||||
/// gone, which the end of each frame of [`GAUGE_FRAMES`] reports, so that two plays of one
|
||||
/// stream read them alike there. A backend whose gauges move on no thread of its own reads
|
||||
/// them now.
|
||||
fn settled_live(&mut self) -> Counters {
|
||||
self.live()
|
||||
}
|
||||
|
||||
/// What the backend skipped so far, of every kind, in one count: the player notes the frame
|
||||
/// and call where it first grows (`Report::first_skip`). A backend that skips nothing answers
|
||||
/// 0.
|
||||
@@ -1602,13 +1615,26 @@ impl<'b, B: Backend> Player<'b, B> {
|
||||
times.gpu_busy = covered(&mut self.intervals);
|
||||
self.times = Times::default();
|
||||
self.intervals.clear();
|
||||
let unix_nanos = (SystemTime::now().duration_since(UNIX_EPOCH))
|
||||
.map_or(0, |since| {
|
||||
u64::try_from(since.as_nanos()).unwrap_or(u64::MAX)
|
||||
});
|
||||
let resident_bytes = resident_bytes();
|
||||
// At the matrix's frames the gauges are read once they hold still, a wait of the
|
||||
// player's own that no frame's time holds.
|
||||
let live = match GAUGE_FRAMES.contains(&(frame as usize)) {
|
||||
true => {
|
||||
let live = self.backend.settled_live();
|
||||
self.frame_began = Some(std::time::Instant::now());
|
||||
live
|
||||
}
|
||||
false => self.backend.live(),
|
||||
};
|
||||
self.report.ends.push(End {
|
||||
wall_nanos: u64::try_from((now - began).as_nanos()).unwrap_or(u64::MAX),
|
||||
unix_nanos: (SystemTime::now().duration_since(UNIX_EPOCH)).map_or(0, |since| {
|
||||
u64::try_from(since.as_nanos()).unwrap_or(u64::MAX)
|
||||
}),
|
||||
resident_bytes: resident_bytes(),
|
||||
live: self.backend.live(),
|
||||
unix_nanos,
|
||||
resident_bytes,
|
||||
live,
|
||||
times,
|
||||
});
|
||||
if let Some(out) = &mut self.frame_out {
|
||||
|
||||
@@ -144,7 +144,7 @@ use crate::candidate::LayerOn;
|
||||
use crate::gpu::{self, DeviceType};
|
||||
use crate::replay::{
|
||||
Backend, CommandBufferList, NewRuntime, PlayError, Player, ReadCopy, Report, StreamReader,
|
||||
StreamWriter, Value, WAIT_COMPLETED,
|
||||
StreamWriter, Value, GAUGED, WAIT_COMPLETED,
|
||||
};
|
||||
use crate::ScratchDir;
|
||||
use metal2vulkan_devtools::metallib::{metallib, wrap, MtlbFunction};
|
||||
@@ -3344,6 +3344,21 @@ fn an_index_released_after_a_held_commit_is_kept_back_though_it_names_nothing()
|
||||
kept_back("held-unnamed", &held_placement(&dir, other, Held::Unnamed));
|
||||
}
|
||||
|
||||
/// The runtime backend's end lines carry every gauge the matrix's gauge records of a play carry
|
||||
/// (`GAUGED`), as they stand and once they hold still (`Backend::settled_live`).
|
||||
#[test]
|
||||
fn the_end_lines_carry_every_gauge_the_gauge_records_carry() {
|
||||
let cache = ScratchCache::new().unwrap();
|
||||
let mut backend = NewRuntime::new(rt_device(&cache), gpu::TEST_DEVICE).unwrap();
|
||||
for live in [backend.live(), backend.settled_live()] {
|
||||
let missing: Vec<&str> = (GAUGED.iter().copied())
|
||||
.filter(|gauge| !live.contains_key(gauge))
|
||||
.collect();
|
||||
assert!(missing.is_empty(), "gauges the end lines lack: {missing:?}");
|
||||
}
|
||||
backend.end().result().unwrap();
|
||||
}
|
||||
|
||||
/// A play that ends with a command buffer held on an event no record signals still ends its
|
||||
/// device: once it dropped, every gauge reads zero, and each goes out as the matrix's line,
|
||||
/// `M2V-MATRIX gauge KEY@drop 0`.
|
||||
|
||||
@@ -9,11 +9,11 @@ use super::new_runtime::indices::Indices;
|
||||
use super::new_runtime::places::Waiting;
|
||||
use super::new_runtime::second::merge;
|
||||
use super::new_runtime::unwritten::Unwritten;
|
||||
use super::new_runtime::{judged_records, Ended};
|
||||
use super::new_runtime::{gauge_records, judged_records, Ended};
|
||||
use super::pixels::{difference, Shape};
|
||||
use super::player::{
|
||||
Backend, Counters, Counts, IdDiffers, Made, PlayError, Player, ReadCopy, Relaid, Report, Shown,
|
||||
TextureWrites, WAIT_COMPLETED,
|
||||
Backend, Counters, Counts, End, IdDiffers, Made, PlayError, Player, ReadCopy, Relaid, Report,
|
||||
Shown, TextureWrites, GAUGE_FRAMES, WAIT_COMPLETED,
|
||||
};
|
||||
use super::stream::{segments, Call, StreamError, StreamReader, StreamWriter};
|
||||
use super::value::{hex, Value};
|
||||
@@ -578,6 +578,8 @@ struct Kept {
|
||||
/// Whether it skips every draw, and the draws it skipped.
|
||||
skips_draws: bool,
|
||||
skipped: u64,
|
||||
/// The settled reads of its gauges it was asked (`Backend::settled_live`).
|
||||
settled: u64,
|
||||
/// The frame and position of each call it was told it plays next.
|
||||
located: Vec<(u64, u64)>,
|
||||
/// The texture slots each compute pipeline state's kernel writes; one not here answers none.
|
||||
@@ -720,6 +722,13 @@ impl Backend for Kept {
|
||||
Counters::from([("calls", self.calls.len() as u64)])
|
||||
}
|
||||
|
||||
fn settled_live(&mut self) -> Counters {
|
||||
self.settled += 1;
|
||||
let mut live = self.live();
|
||||
live.insert("settled", self.settled);
|
||||
live
|
||||
}
|
||||
|
||||
fn recorded_unified_memory(&mut self, unified: bool) {
|
||||
self.unified = Some(unified);
|
||||
}
|
||||
@@ -900,6 +909,65 @@ fn a_short_play_gives_no_judged_metric() {
|
||||
assert_eq!(judged_records(first, &report, &ended, None), none);
|
||||
}
|
||||
|
||||
/// The player reads the gauges once they hold still at the ends of frames 100 and 200 alone
|
||||
/// (`Backend::settled_live`), and every other frame's as they stand.
|
||||
#[test]
|
||||
fn the_player_settles_the_gauges_at_frames_100_and_200_alone() {
|
||||
let mut kept = Kept::default();
|
||||
let (report, ended) = played(&mut kept, |w| {
|
||||
w.call("MTLCreateSystemDefaultDevice", 0, 1, &[], &[])?;
|
||||
for _ in 0..=GAUGE_FRAMES[1] {
|
||||
w.call("m2v.present", 1, 0, &[Value::Nil], &[])?;
|
||||
}
|
||||
Ok(())
|
||||
});
|
||||
ended.as_ref().unwrap();
|
||||
assert_eq!((report.ends.len(), kept.settled), (201, 2));
|
||||
let settled: Vec<(usize, u64)> = (report.ends.iter().enumerate())
|
||||
.filter_map(|(frame, end)| Some((frame, *end.live.get("settled")?)))
|
||||
.collect();
|
||||
assert_eq!(settled, [(100, 1), (200, 2)]);
|
||||
}
|
||||
|
||||
/// The matrix's gauge records of a play are its end lines' counts of the kinds the matrix holds
|
||||
/// flat, at frames 100 and 200, under the stream's first segment's stem (whitespace made `_`):
|
||||
/// `M2V-MATRIX gauge replay-rt/STEM/GAUGE@F N`, in the kinds' order, a kind the backend does not
|
||||
/// report left out, and no other gauge (here `handles_out` and `shadow_bytes`). A play that ended
|
||||
/// no frame 200, and one whose backend skipped anything by then, give none.
|
||||
#[test]
|
||||
fn the_gauge_records_are_the_counted_kinds_at_frames_100_and_200() {
|
||||
let first = std::path::Path::new("streams/a b.0000.m2vr");
|
||||
let live = |textures: u64| {
|
||||
Counters::from([
|
||||
("textures", textures),
|
||||
("blocks", 2),
|
||||
("handles_out", 1),
|
||||
("shadow_bytes", textures * 64),
|
||||
])
|
||||
};
|
||||
let mut report = Report {
|
||||
ends: vec![End::default(); 201],
|
||||
..Report::default()
|
||||
};
|
||||
report.ends[100].live = live(3);
|
||||
report.ends[200].live = live(4);
|
||||
let records = [
|
||||
"M2V-MATRIX gauge replay-rt/a_b/blocks@100 2",
|
||||
"M2V-MATRIX gauge replay-rt/a_b/textures@100 3",
|
||||
"M2V-MATRIX gauge replay-rt/a_b/blocks@200 2",
|
||||
"M2V-MATRIX gauge replay-rt/a_b/textures@200 4",
|
||||
];
|
||||
assert_eq!(gauge_records(first, &report), records);
|
||||
report.first_skip = Some((201, 7));
|
||||
assert_eq!(gauge_records(first, &report), records);
|
||||
let none: [String; 0] = [];
|
||||
report.first_skip = Some((200, 7));
|
||||
assert_eq!(gauge_records(first, &report), none);
|
||||
report.first_skip = None;
|
||||
report.ends.truncate(200);
|
||||
assert_eq!(gauge_records(first, &report), none);
|
||||
}
|
||||
|
||||
/// The gauges the runtime's backend reads once its device dropped go out as the matrix's
|
||||
/// lines, `M2V-MATRIX gauge replay-rt/device/GAUGE@drop N`: three fields after the marker, the
|
||||
/// key ending in `@drop`, as `scripts/matrix/results.py` reads a record, whose rule fails a gauge
|
||||
|
||||
+26
-6
@@ -1129,13 +1129,21 @@ union of the GPU intervals of the command buffers the frame waited for, where th
|
||||
them, which runs beside the rest, then `gpu_longest` and `gpu_longest_cb`, the longest of those
|
||||
intervals, one command buffer's, and that command buffer's stream id (the first of equal ones; 0
|
||||
and 0 where the runtime gives none); and the backend's gauges then, as they stand, never as growth:
|
||||
the runtime's live blocks, buffers, textures, pipelines, kernels, command buffers, timestamp and
|
||||
occlusion query pools, spilled bytes, Managed buffers'
|
||||
the runtime's live blocks, imports, exports, surface imports, surface buffers, buffers, textures and
|
||||
those copied over, samplers, LOD clamp variants, level elements, pipelines, kernels, kernel
|
||||
variants and entries, render contents, attachment views, command buffers, descriptor slots,
|
||||
events, device samplers, shadows, resolve images, plane stand-ins, timestamp, occlusion and buffer
|
||||
set pools, indirect command buffers, releases waiting, handles out, the pipeline cache's bytes,
|
||||
spilled bytes, Managed buffers'
|
||||
spilled bytes (`managed_spilled_bytes`: the bytes of those whose GPU copy the player placed in a
|
||||
spilled Private block) and idle Shared and
|
||||
Private bytes the pool keeps, and the bytes
|
||||
spilled Private block), the pool's Shared and Private bytes allocated, idle (and the idle ones'
|
||||
ages), reserved and reused long, its Private units and their bytes used, the texture blocks'
|
||||
bytes and those held, the Private takes' bytes and those held, the textures' own allocations'
|
||||
bytes, the staging bytes, the translator's entries and their bytes, and the bytes
|
||||
of the blocks the backend holds for the stream by class, `shared_block_bytes` and
|
||||
`private_block_bytes`),
|
||||
`private_block_bytes`; at the ends of frames 100 and 200, the gauges once they hold still: read
|
||||
every 10 ms until no release waits and two reads in a row agree on every kind the gauge records
|
||||
below carry, for at most 2 seconds, a wait of the player's own that no frame's time holds),
|
||||
`devices apart from the guest's: #ID ...` where the stream recorded devices besides the one the
|
||||
guest makes its objects on (section 4), `check ID frame F SHA256 match|differs|unrecorded|covered|receiver` (`F` the frame it was read in, the presents played before it), ending `(CPU copy)` or `(device copy, read back)` for a buffer with two copies (above), `id ID RECORDED PLAYED` for each object whose runtime
|
||||
gives another `gpuResourceID` than the program saw (both in hex, `PLAYED` `none` where the
|
||||
@@ -1251,7 +1259,19 @@ metric replay-rt/STEM/RANGE/NAME N` (`STEM` the first segment's stem, whitespace
|
||||
`new_texture_zeroed_bytes`, their bytes), each one two plays of one stream at one commit
|
||||
on one card gave alike, which the matrix's rule (`scripts/matrix/results.py`) holds equal to the
|
||||
base's, failing a play whose base has a record it lacks; a play that did not finish its range
|
||||
prints none,
|
||||
prints none; where the play ended frame 200 and the backend skipped nothing by then, the matrix's
|
||||
gauge records, one line each, `M2V-MATRIX gauge replay-rt/STEM/GAUGE@F N` for `F` 100 and 200 and
|
||||
each count of a kind of object the runtime keeps live on the frame's `end` line (its blocks,
|
||||
imports, exports, surface imports, surface buffers, buffers, textures and those copied over, samplers,
|
||||
LOD clamp variants, level elements, pipelines, kernels, kernel variants and entries, render
|
||||
contents, attachment views, command buffers, descriptor slots, events, device samplers, shadows,
|
||||
resolve images, plane stand-ins, timestamp, occlusion and buffer set pools, indirect command
|
||||
buffers and the translator's entries), which the matrix's rule holds equal between the two
|
||||
frames (`blocks`, the pool's allocations, no higher at 200), as it holds the harness's between
|
||||
its 100th and 200th runs; the handles out (1 while the play holds the device), the releases
|
||||
waiting (which the runtime's own thread lowers whenever it runs), the Private units (a layout of
|
||||
memory that follows the bytes the program holds) and every byte and age gauge (which follow the
|
||||
program's content and the pool's idle clock) are not records,
|
||||
then `ok`, `ids: played to the end; N objects' gpuResourceID differ from the recording's` where
|
||||
the play ended but objects whose ID the program saw have other IDs in the runtime, or
|
||||
`error WHAT`. Where the backend skipped anything, the `skipped` line and the last
|
||||
|
||||
+1
-1
@@ -283,7 +283,7 @@ changes the harness sets the base for the next.
|
||||
|---|---|---|
|
||||
| `metric` | A deterministic count per frame or per command buffer: submissions, passes, barriers, bytes copied, pipelines created; and the replay player's totals of a play (`replay-rt/STREAM/RANGE/NAME`, [REPLAY-STREAM.md](REPLAY-STREAM.md) section 10), each one two plays of one stream at one commit on one card gave alike, printed only by a play that finished its range and skipped nothing | It is larger than the base's; a replay total, when it differs from the base's either way, or when the base has it and the leg does not (`EQUAL_METRICS`) |
|
||||
| `instructions` | User-space CPU instructions per draw or per dispatch, and per harness run, the p50 over the row's timed runs: the whole process's (`harness-<runtime>/<row>/per_run`), and where the runtime names its threads, theirs with the harness's thread (`.../own_per_run`) and the rest, a driver's own threads (`.../others_per_run`) | It is more than 1% over the base's; the harness's counts are judged by the instructions gate instead (below) |
|
||||
| `gauge` | Live objects of one resource kind, the key ending in the point it was read at: `@100` and `@200` (loop iterations), `@drop` (after the device dropped) | `@drop` is not 0, or `@200` differs from `@100`; for the memory pool's `blocks`, which frees allocations an earlier workload left idle once the most bytes in use over its window falls and the device is quiet for 20 ms, only `@200` over `@100` |
|
||||
| `gauge` | Live objects of one resource kind, the key ending in the point it was read at: `@100` and `@200` (loop iterations: the harness's 100th and 200th runs, and a play's frames 100 and 200, `replay-rt/STREAM/GAUGE`, [REPLAY-STREAM.md](REPLAY-STREAM.md) section 10), `@drop` (after the device dropped) | `@drop` is not 0, or `@200` differs from `@100`; for the memory pool's `blocks`, which frees allocations an earlier workload left idle once the most bytes in use over its window falls and the device is quiet for 20 ms, only `@200` over `@100` |
|
||||
| `time` | A duration in microseconds: what a program waits on in a harness workload's run, timed on the host: for the frame rows (`frame`, `frame_5cb`), their throughput, two runs in flight, from one run's last completed handler to the next's, and their latency from idle as rows of their own (`<row>_from_idle`), one run in flight, from its first commit to its last completed handler; for another workload that times its command buffers, its last command buffer's commit-to-complete time (the others' lateness is a column of the harness's table and no record), else the host wall time a run adds (a run's GPU time is a record of its own, `harness-gpu-<runtime>/<row>`, parked here) | Only as a cross-GPU outlier: its ratio to the base's is more than 1.25 times the median of that ratio over at least 3 GPUs. A leg with such an outlier of a harness row's time has its harness timed once more after every leg is in, and an outlier fails the leg only where both passes agree |
|
||||
| `size` | The size a harness row whose size follows the device ran at (`long_4cb`) | Never: it says what work the row's times measured |
|
||||
| `locks` | The lock budget's locked instructions per million added commands (`lock_budget/draw`, `lock_budget/bound_draw`, `lock_budget/dispatch`; rt's `tests::locks`), the whole process's in user space, on a node whose matrix setup names its CPU's event in `M2V_LOCK_EVENT` (`cpu_core/r21d0`, `r1e25`) | The test fails past 0.25 per added command, on every node alike; on a node whose setup names the event, a GPU leg missing any of the three fails; elsewhere each budget test passes counting nothing and prints `M2V-MATRIX uncounted lock_budget/<key>`, which the leg's line shows as `not counted` |
|
||||
|
||||
@@ -172,6 +172,13 @@ class RuleTests(unittest.TestCase):
|
||||
"gauge harness-new/creates/device/blocks: 1 live at device drop",
|
||||
"gauge harness-new/long_4cb/blocks: 8 at iteration 100, 9 at 200"])
|
||||
|
||||
def test_a_plays_gauges_at_frames_100_and_200_are_held_flat_as_the_harness_s(self):
|
||||
play = {"replay-rt/s/textures@100": 40, "replay-rt/s/textures@200": 41,
|
||||
"replay-rt/s/blocks@100": 9, "replay-rt/s/blocks@200": 8,
|
||||
"replay-rt/s/render_contents@100": 5, "replay-rt/s/render_contents@200": 5}
|
||||
self.assertEqual(self.problems(recs(gauge=play), None),
|
||||
["gauge replay-rt/s/textures: 40 at iteration 100, 41 at 200"])
|
||||
|
||||
def test_a_failed_suite_fails_the_leg(self):
|
||||
leg = leg_of(recs(), code=100)
|
||||
self.assertEqual(results.leg_problems(leg, recs(), None), ["suite rt exited 100"])
|
||||
|
||||
Reference in new issue
Block a user