Runtime: Metrics::translation_at_encode_nanos, the total time of makes at encode, and its test (red)
Metrics kept a count of the translations made at encode and the longest one's time, but no total, so a consumer could not say what those makes cost over a frame or a boot: a maximum does not take the difference of two reads. This adds the field, read from its own atomic, with its doc comment, and the signature table's row. The atomic is not charged yet, so the test fails here. The test is the unattached-colours device test, which makes one render content at encode on every device: the device's total is 0 after the matching draws (a fresh device, no make at encode), rises at the first lacking pass's make and not at the second's reuse, and ends at least the longest make's time. Expected red: the first lacking pass's total does not rise.
This commit is contained in:
1 parent
79698bdd67
commit
56f890f59a
3 files changed
+36
-8
No files matched your search
@@ -886,6 +886,7 @@ struct Atomics {
|
||||
partial_variant_whole_grids: AtomicU64,
|
||||
partial_variant_ragged_grids: AtomicU64,
|
||||
translations_at_encode: AtomicU64,
|
||||
translation_at_encode_nanos: AtomicU64,
|
||||
translation_at_encode_max_nanos: AtomicU64,
|
||||
extended_view_dispatches: AtomicU64,
|
||||
level_field_commands: AtomicU64,
|
||||
@@ -2315,6 +2316,7 @@ impl Counters {
|
||||
partial_variant_whole_grids: a.partial_variant_whole_grids.load(Relaxed),
|
||||
partial_variant_ragged_grids: a.partial_variant_ragged_grids.load(Relaxed),
|
||||
translations_at_encode: a.translations_at_encode.load(Relaxed),
|
||||
translation_at_encode_nanos: a.translation_at_encode_nanos.load(Relaxed),
|
||||
translation_at_encode_max_nanos: a.translation_at_encode_max_nanos.load(Relaxed),
|
||||
extended_view_dispatches: a.extended_view_dispatches.load(Relaxed),
|
||||
level_field_commands: a.level_field_commands.load(Relaxed),
|
||||
@@ -3135,8 +3137,16 @@ pub struct Metrics {
|
||||
/// prepares every dispatch reads none of the first kind; the other three have no pre-pass.
|
||||
/// No Metal counterpart: Metal compiles a state whole when it is made.
|
||||
pub translations_at_encode: u64,
|
||||
/// The longest of those makes, in nanoseconds of [`host_time`](crate::host_time); a maximum
|
||||
/// since the device was made, so the difference of two reads does not apply to it.
|
||||
/// The nanoseconds of [`host_time`](crate::host_time) the
|
||||
/// [`translations_at_encode`](Self::translations_at_encode) took, in total, each from its
|
||||
/// start to its end on the encoding thread that made it, made or refused. A sum, so unlike
|
||||
/// [`translation_at_encode_max_nanos`](Self::translation_at_encode_max_nanos) the difference
|
||||
/// of two reads is the time of the makes between them. No Metal counterpart: Metal compiles a
|
||||
/// state whole when it is made.
|
||||
pub translation_at_encode_nanos: u64,
|
||||
/// The longest of the [`translations_at_encode`](Self::translations_at_encode), in nanoseconds
|
||||
/// of [`host_time`](crate::host_time); a maximum since the device was made, so the difference
|
||||
/// of two reads does not apply to it.
|
||||
pub translation_at_encode_max_nanos: u64,
|
||||
/// `vkAllocateMemory` and `vkFreeMemory` calls made ahead of need, off the consumer's calls:
|
||||
/// the block-maker thread's (the runtime's fixed-size internals, the pool's units, and the
|
||||
|
||||
@@ -5,10 +5,13 @@
|
||||
//! `rt6_pair`: colour 0 from fragment buffer 0 at the fragment's texel, colour 1 from buffer 2)
|
||||
//! draws in a pass of colour 0 alone, as plain Metal draws it (the conformance case
|
||||
//! `pass-pipeline-color-unattached`): through the state of its descriptor without colour 1,
|
||||
//! whose content the first such set makes and whose `VkPipeline` the first draw makes, a
|
||||
//! first-use wait. Colour 0 holds the fragment's codes in the scissor's rows and the clear in the
|
||||
//! others. A second encoder's set takes the content the device holds: no translation and no
|
||||
//! pipeline. Draws of the state in a pass of both colours, before it, make no such state at all.
|
||||
//! whose content the first such set makes, a make at encode whose time the device's total of
|
||||
//! them (`Metrics::translation_at_encode_nanos`) holds, at least its longest one's, and whose
|
||||
//! `VkPipeline` the first draw makes, a first-use wait. Colour 0 holds the fragment's codes in
|
||||
//! the scissor's rows and the clear in the others. A second encoder's set takes the content the
|
||||
//! device holds: no translation, no time at encode and no pipeline. Draws of the state in a pass
|
||||
//! of both colours, before it, make no such state at all, and the device's total time of makes
|
||||
//! at encode is 0.
|
||||
//! - A state of three colours over `cg_five` (engine `color_groups`) in a pass of colours 0 and 2
|
||||
//! is refused, `DrawKind::AttachmentFormats`: there plain Metal writes colour 1's value into
|
||||
//! colour 2's attachment (`pass-pipeline-color-unattached-between`).
|
||||
@@ -154,6 +157,10 @@ mod on_device {
|
||||
"{name}: matching draws: states without colours asked for, translations, \
|
||||
pipelines made, makes at encode"
|
||||
);
|
||||
assert_eq!(
|
||||
after.0.translation_at_encode_nanos, 0,
|
||||
"{name}: no make at encode yet: no time of them"
|
||||
);
|
||||
|
||||
// The pass of colour 0 alone, twice, each in an encoder of its own.
|
||||
let targets = [
|
||||
@@ -182,13 +189,23 @@ mod on_device {
|
||||
after.0.pipelines_created - before.0.pipelines_created,
|
||||
after.0.first_use_unfinished_waits - before.0.first_use_unfinished_waits,
|
||||
after.0.translations_at_encode - before.0.translations_at_encode,
|
||||
after.0.translation_at_encode_nanos > before.0.translation_at_encode_nanos,
|
||||
));
|
||||
}
|
||||
assert_eq!(
|
||||
each,
|
||||
vec![(1, true, 1, 1, 1), (1, false, 0, 0, 0)],
|
||||
vec![(1, true, 1, 1, 1, true), (1, false, 0, 0, 0, false)],
|
||||
"{name}: each lacking pass: states without colours asked for, whether it lowered a \
|
||||
function, pipelines made, first-use waits, makes at encode"
|
||||
function, pipelines made, first-use waits, makes at encode, whether they took time"
|
||||
);
|
||||
let metrics = counters.metrics();
|
||||
let (total, longest) = (
|
||||
metrics.translation_at_encode_nanos,
|
||||
metrics.translation_at_encode_max_nanos,
|
||||
);
|
||||
assert!(
|
||||
longest > 0 && total >= longest,
|
||||
"{name}: the makes at encode took {total} ns in total, the longest {longest} ns"
|
||||
);
|
||||
let want: Vec<u8> = (0..SIDE * SIDE)
|
||||
.flat_map(|at| {
|
||||
|
||||
@@ -1746,6 +1746,7 @@ field metal2vulkan-runtime::Metrics.texture_clears pub texture_clears: u64
|
||||
field metal2vulkan-runtime::Metrics.texture_place_lock_waits pub texture_place_lock_waits: Timed
|
||||
field metal2vulkan-runtime::Metrics.textures_in_place_over_imports pub textures_in_place_over_imports: u64
|
||||
field metal2vulkan-runtime::Metrics.translation_at_encode_max_nanos pub translation_at_encode_max_nanos: u64
|
||||
field metal2vulkan-runtime::Metrics.translation_at_encode_nanos pub translation_at_encode_nanos: u64
|
||||
field metal2vulkan-runtime::Metrics.translation_nanos pub translation_nanos: u64
|
||||
field metal2vulkan-runtime::Metrics.translations pub translations: u64
|
||||
field metal2vulkan-runtime::Metrics.translations_at_encode pub translations_at_encode: u64
|
||||
|
||||
|
Can't render this file because it is too large.
|
Reference in new issue
Block a user