player: a pipeline state's making counts what it made, lowered, loaded and VkPipelines, and a load makes its content new
What: each group and each slow making carries "L lowered, D loaded, P VkPipelines" (translations, translations_loaded, pipelines_created). A making is of "new" content where it made any of them, and "held" where it made none. Why: the warm pass of m3-max-60954 showed the first form calling a load-only compute state "held", and using the word "cold" in a second pass. Verified: the same test, which now also checks the counts and the held state's zero driver time, green in m3-max-60980.
This commit is contained in:
1 parent
10d00d44b4
commit
999b82bfe2
3 files changed
+108
-52
No files matched your search
@@ -1,11 +1,12 @@
|
||||
//! Where each pipeline state's making went, from the runtime's own counters read on the play's
|
||||
//! thread before and after it (`rt::Metrics`): the translator's time (`translation_nanos`), the
|
||||
//! driver's (`pipeline_creation_nanos`, its `vkCreate*Pipelines` calls), and the rest of the
|
||||
//! making's wall time, on the clock they count (`rt::host_time`). A making is cold where it lowered a function or made a `VkPipeline`
|
||||
//! (`translations` or `pipelines_created` rose: the device held no content for the state), held
|
||||
//! otherwise. The counters sum the calls of every thread, so a making while a call of the
|
||||
//! pre-pass ran (`prepass::Pool::quiet`) counts that call's work too: such makings are counted
|
||||
//! apart, and their times are not one making's.
|
||||
//! making's wall time, on the clock they count (`rt::host_time`); and what it made: functions
|
||||
//! lowered (`translations`), lowerings loaded from the cache directory (`translations_loaded`) and
|
||||
//! `VkPipeline`s made (`pipelines_created`). A making that made any of them is of a content new to
|
||||
//! the device, held otherwise. The counters sum the calls of every thread, so a making while a
|
||||
//! call of the pre-pass ran (`prepass::Pool::quiet`) counts that call's work too: such makings are
|
||||
//! counted apart, and their figures are not one making's.
|
||||
|
||||
use super::prepass::Pool;
|
||||
use super::rt;
|
||||
@@ -42,10 +43,42 @@ impl Split {
|
||||
}
|
||||
}
|
||||
|
||||
/// The makings of one kind summed: how many, and their times.
|
||||
/// What a making made, or several: functions lowered, lowerings loaded and `VkPipeline`s.
|
||||
#[derive(Clone, Copy, Default)]
|
||||
struct Made {
|
||||
lowered: u64,
|
||||
loaded: u64,
|
||||
pipelines: u64,
|
||||
}
|
||||
|
||||
impl Made {
|
||||
fn add(&mut self, other: Made) {
|
||||
self.lowered += other.lowered;
|
||||
self.loaded += other.loaded;
|
||||
self.pipelines += other.pipelines;
|
||||
}
|
||||
|
||||
/// Whether it made anything: the content was new to the device.
|
||||
fn any(&self) -> bool {
|
||||
self.lowered + self.loaded + self.pipelines > 0
|
||||
}
|
||||
|
||||
/// `L lowered, D loaded, P VkPipelines`.
|
||||
fn text(&self) -> String {
|
||||
let Made {
|
||||
lowered,
|
||||
loaded,
|
||||
pipelines,
|
||||
} = self;
|
||||
format!("{lowered} lowered, {loaded} loaded, {pipelines} VkPipelines")
|
||||
}
|
||||
}
|
||||
|
||||
/// The makings of one kind summed: how many, what they made and their times.
|
||||
#[derive(Default)]
|
||||
struct Sum {
|
||||
states: u64,
|
||||
made: Made,
|
||||
split: Split,
|
||||
}
|
||||
|
||||
@@ -53,19 +86,20 @@ struct Sum {
|
||||
struct Slow {
|
||||
state: u64,
|
||||
kinds: &'static str,
|
||||
cold: bool,
|
||||
beside: bool,
|
||||
made: Made,
|
||||
split: Split,
|
||||
}
|
||||
|
||||
/// The counters a split reads: `translation_nanos`, `pipeline_creation_nanos`, `translations`
|
||||
/// and `pipelines_created`.
|
||||
fn read(device: &rt::Device) -> [u64; 4] {
|
||||
/// The counters a split reads: `translation_nanos`, `pipeline_creation_nanos`, `translations`,
|
||||
/// `translations_loaded` and `pipelines_created`.
|
||||
fn read(device: &rt::Device) -> [u64; 5] {
|
||||
let metrics = device.counters().metrics();
|
||||
[
|
||||
metrics.translation_nanos,
|
||||
metrics.pipeline_creation_nanos,
|
||||
metrics.translations,
|
||||
metrics.translations_loaded,
|
||||
metrics.pipelines_created,
|
||||
]
|
||||
}
|
||||
@@ -74,7 +108,7 @@ fn read(device: &rt::Device) -> [u64; 4] {
|
||||
/// counters, and the clock.
|
||||
pub(super) struct Mark {
|
||||
quiet: Option<u64>,
|
||||
counters: [u64; 4],
|
||||
counters: [u64; 5],
|
||||
began: u64,
|
||||
}
|
||||
|
||||
@@ -91,11 +125,11 @@ impl Mark {
|
||||
}
|
||||
}
|
||||
|
||||
/// The pipeline states' makings, cold and held, the makings beside a pre-pass call, and the
|
||||
/// slowest ([`SLOWEST`]), slowest first.
|
||||
/// The pipeline states' makings, of new contents and held ones, the makings beside a pre-pass
|
||||
/// call, and the slowest ([`SLOWEST`]), slowest first.
|
||||
#[derive(Default)]
|
||||
pub(super) struct Makes {
|
||||
cold: Sum,
|
||||
new: Sum,
|
||||
held: Sum,
|
||||
beside: u64,
|
||||
slowest: Vec<Slow>,
|
||||
@@ -115,19 +149,24 @@ impl Makes {
|
||||
let wall = rt::host_time().saturating_sub(mark.began);
|
||||
let counters = read(device);
|
||||
let quiet = (mark.quiet).is_some_and(|begun| prepass.is_none_or(|p| p.quiet_since(begun)));
|
||||
let [translation, driver, lowered, pipelines] =
|
||||
let [translation, driver, lowered, loaded, pipelines] =
|
||||
std::array::from_fn(|at| counters[at].saturating_sub(mark.counters[at]));
|
||||
let cold = lowered > 0 || pipelines > 0;
|
||||
let made = Made {
|
||||
lowered,
|
||||
loaded,
|
||||
pipelines,
|
||||
};
|
||||
let split = Split {
|
||||
wall,
|
||||
translation,
|
||||
driver,
|
||||
};
|
||||
let sum = match cold {
|
||||
true => &mut self.cold,
|
||||
let sum = match made.any() {
|
||||
true => &mut self.new,
|
||||
false => &mut self.held,
|
||||
};
|
||||
sum.states += 1;
|
||||
sum.made.add(made);
|
||||
sum.split.add(split);
|
||||
self.beside += u64::from(!quiet);
|
||||
let at = (self.slowest.iter())
|
||||
@@ -137,8 +176,8 @@ impl Makes {
|
||||
let slow = Slow {
|
||||
state,
|
||||
kinds: kinds(),
|
||||
cold,
|
||||
beside: !quiet,
|
||||
made,
|
||||
split,
|
||||
};
|
||||
self.slowest.insert(at, slow);
|
||||
@@ -147,27 +186,30 @@ impl Makes {
|
||||
wall
|
||||
}
|
||||
|
||||
/// `pipeline makes N states: C cold, SPLIT; H held, SPLIT; B beside a pre-pass call ...`,
|
||||
/// then `pipeline make slowest K #ID KINDS cold|held: SPLIT` for each of the slowest.
|
||||
/// `pipeline makes N states: C new (MADE), SPLIT; H held, SPLIT; B beside a pre-pass call
|
||||
/// ...`, then `pipeline make slowest K #ID KINDS new|held (MADE): SPLIT` for each of the
|
||||
/// slowest.
|
||||
pub(super) fn lines(&self) -> Vec<String> {
|
||||
let (cold, held) = (&self.cold, &self.held);
|
||||
let (new, held) = (&self.new, &self.held);
|
||||
let mut lines = vec![format!(
|
||||
"pipeline makes {} states: {} cold, {}; {} held, {}; {} beside a pre-pass call, whose \
|
||||
work their times count",
|
||||
cold.states + held.states,
|
||||
cold.states,
|
||||
cold.split.text(),
|
||||
"pipeline makes {} states: {} new ({}), {}; {} held, {}; {} beside a pre-pass call, \
|
||||
whose work their figures count",
|
||||
new.states + held.states,
|
||||
new.states,
|
||||
new.made.text(),
|
||||
new.split.text(),
|
||||
held.states,
|
||||
held.split.text(),
|
||||
self.beside,
|
||||
)];
|
||||
for (at, slow) in self.slowest.iter().enumerate() {
|
||||
lines.push(format!(
|
||||
"pipeline make slowest {} #{} {} {}: {}{}",
|
||||
"pipeline make slowest {} #{} {} {} ({}): {}{}",
|
||||
at + 1,
|
||||
slow.state,
|
||||
slow.kinds,
|
||||
if slow.cold { "cold" } else { "held" },
|
||||
if slow.made.any() { "new" } else { "held" },
|
||||
slow.made.text(),
|
||||
slow.split.text(),
|
||||
if slow.beside {
|
||||
", beside a pre-pass call"
|
||||
|
||||
@@ -12,9 +12,10 @@
|
||||
//! - A compute pipeline state the runtime answers with a typed gap is skipped and counted by the
|
||||
//! gap, and a dispatch of it is skipped, and the play goes on.
|
||||
//! - Each pipeline state's making is split by the runtime's counters into the translator's time,
|
||||
//! the driver's and the rest: a kernel's first state and a render state are cold, each with
|
||||
//! both halves, and a second state of the kernel is held, with no driver time; the slowest are
|
||||
//! listed by object, with their stages' kinds.
|
||||
//! the driver's and the rest, beside what it made: a kernel's first state and a render state
|
||||
//! are of contents new to the device, which lowered their functions and made a `VkPipeline`,
|
||||
//! with both halves' times, and a second state of the kernel is held, which made nothing and
|
||||
//! took no driver time; the slowest are listed by object, with their stages' kinds.
|
||||
//! - A compute encoder's `setStageInRegion:` plays: the runtime takes it.
|
||||
//! - The host's library from source is made of its display library where the backend has it, a
|
||||
//! function of it with it; without it both are skipped.
|
||||
@@ -1070,12 +1071,23 @@ fn each_pipeline_state_s_making_is_split_into_the_translator_s_and_the_driver_s_
|
||||
.find(|line| line.starts_with("pipeline makes "))
|
||||
.unwrap_or_else(|| panic!("{lines:?}"));
|
||||
assert!(
|
||||
summary.starts_with("pipeline makes 3 states: 2 cold, "),
|
||||
summary.starts_with("pipeline makes 3 states: 2 new ("),
|
||||
"{summary}"
|
||||
);
|
||||
let end = "; 0 beside a pre-pass call, whose work their times count";
|
||||
let end = "; 0 beside a pre-pass call, whose work their figures count";
|
||||
assert!(summary.ends_with(end), "{summary}");
|
||||
let [wall, translation, driver, other] = split_after(summary, " cold, ");
|
||||
// The kernel's one or two lowerings and the render state's two, and its triangle class.
|
||||
let (_, made) = summary.split_once(" new (").unwrap();
|
||||
let (made, _) = made.split_once(')').unwrap();
|
||||
let count = |what: &str| -> u64 {
|
||||
let word = made.split(", ").find(|part| part.ends_with(what));
|
||||
word.and_then(|part| part.split(' ').next()?.parse().ok())
|
||||
.unwrap()
|
||||
};
|
||||
assert!(count(" lowered") >= 3, "{summary}");
|
||||
assert_eq!(count(" loaded"), 0, "{summary}");
|
||||
assert!(count(" VkPipelines") >= 1, "{summary}");
|
||||
let [wall, translation, driver, other] = split_after(summary, "VkPipelines), ");
|
||||
assert!(
|
||||
translation > 0.0 && driver > 0.0 && other >= 0.0,
|
||||
"{summary}"
|
||||
@@ -1092,11 +1104,11 @@ fn each_pipeline_state_s_making_is_split_into_the_translator_s_and_the_driver_s_
|
||||
.collect();
|
||||
assert_eq!(slowest.len(), 3, "{lines:?}");
|
||||
for (state, kinds) in [
|
||||
(7, "kernel cold"),
|
||||
(8, "kernel held"),
|
||||
(9, "vertex+fragment cold"),
|
||||
(7, "kernel new ("),
|
||||
(8, "kernel held (0 lowered, 0 loaded, 0 VkPipelines): wall "),
|
||||
(9, "vertex+fragment new ("),
|
||||
] {
|
||||
let named = format!(" #{state} {kinds}: wall ");
|
||||
let named = format!(" #{state} {kinds}");
|
||||
assert!(
|
||||
slowest.iter().any(|line| line.contains(&named)),
|
||||
"{slowest:?}"
|
||||
|
||||
+15
-13
@@ -973,19 +973,21 @@ making's wall time, and whether no state of another specialization of the kernel
|
||||
function by name, was made before), its `commit lock wait longest N ns` (the runtime's
|
||||
`commit_lock_wait_max_nanos`: the longest wait of a commit for the runtime's work lock in the play;
|
||||
the executed counter `commit_lock_wait_nanos` gives the waits by frame, summed), its
|
||||
`pipeline makes N states: C cold, SPLIT; H held, SPLIT; B beside a pre-pass call, whose work their
|
||||
times count` and, for each of the ten slowest makings, slowest first, `pipeline make slowest K #ID
|
||||
KINDS cold|held: SPLIT` (where each render and compute pipeline state's making went, read from the
|
||||
runtime's counters on the player's thread before and after it: `SPLIT` is `wall W ms =
|
||||
translation T ms + driver D ms + other O ms`, the making's wall time on the runtime's clock,
|
||||
`host_time`, and of it the translator's calls, `translation_nanos`, the driver's
|
||||
`vkCreate*Pipelines` calls, `pipeline_creation_nanos`, and the rest; a making is cold where it
|
||||
lowered a function or made a `VkPipeline`, `translations` or `pipelines_created` rose, and held
|
||||
where the device held the state's content; the counters sum every thread's calls, so the `B`
|
||||
makings during which a pre-pass thread ran a call, each marked `, beside a pre-pass call`, count
|
||||
that call's work too; `ID` the state's object and `KINDS` `kernel`, or `vertex` or
|
||||
`post-tessellation vertex`, where the library states a `patchType`, then `+fragment` where the
|
||||
state has a fragment function; states the runtime refused are not among them), its
|
||||
`pipeline makes N states: C new (MADE), SPLIT; H held, SPLIT; B beside a pre-pass call, whose work
|
||||
their figures count` and, for each of the ten slowest makings, slowest first, `pipeline make
|
||||
slowest K #ID KINDS new|held (MADE): SPLIT` (where each render and compute pipeline state's making
|
||||
went, read from the runtime's counters on the player's thread before and after it: `MADE` is `L
|
||||
lowered, D loaded, P VkPipelines`, the functions the translator lowered, `translations`, the
|
||||
lowerings read from the cache directory, `translations_loaded`, and the `VkPipeline`s made,
|
||||
`pipelines_created`; `SPLIT` is `wall W ms = translation T ms + driver D ms + other O ms`, the
|
||||
making's wall time on the runtime's clock, `host_time`, and of it the translator's calls,
|
||||
`translation_nanos`, the driver's `vkCreate*Pipelines` calls, `pipeline_creation_nanos`, and the
|
||||
rest; a making that made any of the three is of a content new to the device, and one that made
|
||||
none is of a content the device held; the counters sum every thread's calls, so the `B` makings
|
||||
during which a pre-pass thread ran a call, each marked `, beside a pre-pass call`, count that
|
||||
call's work too; `ID` the state's object and `KINDS` `kernel`, or `vertex` or `post-tessellation
|
||||
vertex`, where the library states a `patchType`, then `+fragment` where the state has a fragment
|
||||
function; states the runtime refused are not among them), its
|
||||
`skipped render states GAP N, the first #ID: WHY` for each
|
||||
typed gap a render pipeline state met (`GAP` the runtime's gap as Rust prints it for debugging, such
|
||||
as `RenderPipeline { kind: DepthAttachment }`, or `Translation(KIND)` where the translator refused
|
||||
|
||||
Reference in new issue
Block a user