WIP submission checks (squash target: replaced by the next commit's message)
(cherry picked from commit bc0dd9f45e0e025508b25ece4f0524404d6f4e94)
This commit is contained in:
1 parent
0766e207c7
commit
2aa801ccb3
23 files changed
+1719
-324
No files matched your search
@@ -2211,9 +2211,12 @@ impl Device {
|
||||
.usage(usage(false)),
|
||||
);
|
||||
// A heap's own buffer lies where its textures can too, and is never parked. A long
|
||||
// host-visible one of the runtime's own lies in fresh pages where the device takes them.
|
||||
let wants_fresh =
|
||||
!of_heap && fresh_pages::takes_fresh_pages(size, class) && shared.host_import.is_ok();
|
||||
// host-visible one of the runtime's own lies in fresh pages where the device takes them
|
||||
// and its check found a held import adds nothing to its submissions (`fresh_pages.rs`).
|
||||
let wants_fresh = !of_heap
|
||||
&& fresh_pages::takes_fresh_pages(size, class)
|
||||
&& shared.host_import.is_ok()
|
||||
&& self.fresh_pages_pay();
|
||||
let making = (!of_heap).then_some(BufferMaking {
|
||||
size,
|
||||
class,
|
||||
|
||||
@@ -1,13 +1,15 @@
|
||||
//! Batches that go to the driver in one kernel submission (`CompletionPolicy::Grouped`).
|
||||
//!
|
||||
//! On a driver measured to merge each `vkQueueSubmit`'s `VkSubmitInfo`s that signal nothing into
|
||||
//! the next one's kernel submission ([`DriverFact::SubmissionsWithoutSignalsMerge`], whose
|
||||
//! documentation holds what was measured where), batches that signal nothing but their queue's
|
||||
//! timeline may wait and go in one call for the cost of one kernel submission. The question is
|
||||
//! the driver's, and the fact answers it, never the driver's name: a driver without the fact
|
||||
//! takes the ungrouped path, each batch its own `vkQueueSubmit`, which is what every batch took
|
||||
//! before grouping and is exact alike -- a group changes when a `vkQueueSubmit` is made and
|
||||
//! nothing it submits.
|
||||
//! On a device whose check found one `vkQueueSubmit` of `VkSubmitInfo`s that signal nothing to
|
||||
//! cost about one of its submissions (`submit_check.rs`, `Check::Merge`: Mesa's common queue
|
||||
//! merges each into the next one's kernel submission, `vulkan/runtime/vk_queue.c`), batches that
|
||||
//! signal nothing but their queue's timeline may wait and go in one call for the cost of one
|
||||
//! kernel submission. The question is the device's, and its check answers it, never the driver's
|
||||
//! name nor its GPU's: a device whose check found otherwise, or has not answered, takes the
|
||||
//! ungrouped path, each batch its own `vkQueueSubmit`, which is what every batch took before
|
||||
//! grouping and is exact alike -- a group changes when a `vkQueueSubmit` is made and nothing it
|
||||
//! submits. Each command buffer of a group is exact on every driver by Vulkan's own rules (the
|
||||
//! bullets below), so the check decides only where grouping pays.
|
||||
//!
|
||||
//! - **What waits.** A batch the scheduler submits waits here, submitted by nothing yet, where it
|
||||
//! signals nothing but its queue's timeline and its events' semaphores: no binary semaphore,
|
||||
@@ -88,8 +90,7 @@ use crate::exit_guard::{self, Call};
|
||||
use crate::gpu_time;
|
||||
use crate::Device;
|
||||
use ash::vk;
|
||||
use metal2vulkan::device::{CompletionPolicy, DriverFact};
|
||||
use std::collections::BTreeSet;
|
||||
use metal2vulkan::device::CompletionPolicy;
|
||||
use std::sync::atomic::Ordering;
|
||||
use std::sync::Arc;
|
||||
|
||||
@@ -105,12 +106,11 @@ const BATCH_INFOS: usize = 2;
|
||||
const MOST_INFOS: usize = GROUP_BATCHES * BATCH_INFOS + 1 + BATCH_INFOS;
|
||||
|
||||
/// Whether `device`'s batches on `VkQueue` `queue` may wait in a group: its policy groups them,
|
||||
/// its driver is measured to merge a submission that signals nothing into the next (the module
|
||||
/// docs), and the queue's failures are not relayed (each relayed batch takes a fence,
|
||||
/// `device/relay.rs`).
|
||||
/// its check found a submission that signals nothing merged into the next (the module docs), and
|
||||
/// the queue's failures are not relayed (each relayed batch takes a fence, `device/relay.rs`).
|
||||
pub(crate) fn groups(device: &Device, queue: usize) -> bool {
|
||||
device.compile_device().policy().completion == CompletionPolicy::Grouped
|
||||
&& merges_submissions(&device.properties().driver_facts)
|
||||
&& device.submissions_merge()
|
||||
&& device.shared().flights(queue).is_none()
|
||||
}
|
||||
|
||||
@@ -174,14 +174,6 @@ const IN_GROUP: u8 = 1;
|
||||
/// A command buffer's `group_hold` bit: a thread waits for its completion.
|
||||
const WAITED_FOR: u8 = 2;
|
||||
|
||||
/// Whether the driver merges a `VkSubmitInfo` that signals nothing into the next one's kernel
|
||||
/// submission ([`DriverFact::SubmissionsWithoutSignalsMerge`]): the driver's facts alone answer
|
||||
/// it, and nothing of the driver's identity, so a test can hand it the facts of each committed
|
||||
/// profile (`tests::batches::only_drivers_measured_to_merge_their_submissions_group_their_batches`).
|
||||
pub(crate) fn merges_submissions(facts: &BTreeSet<DriverFact>) -> bool {
|
||||
facts.contains(&DriverFact::SubmissionsWithoutSignalsMerge)
|
||||
}
|
||||
|
||||
/// What sent a group held (`WorkCounts::group_ends_full` and kin).
|
||||
#[derive(Clone, Copy, Debug, PartialEq, Eq)]
|
||||
pub(crate) enum GroupEnd {
|
||||
|
||||
@@ -54,11 +54,6 @@ mod submit;
|
||||
pub(super) use completion::Completion;
|
||||
pub(super) use first_submission::{NotedTable, ReplayTable};
|
||||
use follow::{Follow, Release};
|
||||
/// Whether a driver's facts merge a submission that signals nothing into the next, for the test
|
||||
/// that holds every committed profile to the fact
|
||||
/// (`tests::batches::only_drivers_measured_to_merge_their_submissions_group_their_batches`).
|
||||
#[cfg(test)]
|
||||
pub(crate) use group::merges_submissions;
|
||||
pub(super) use group::{Group, GroupEnd, GROUP_BATCHES};
|
||||
use rebound_use::{ReboundUse, Unlogged};
|
||||
pub(super) use submit::{BatchLists, Submitting};
|
||||
|
||||
@@ -1,6 +1,7 @@
|
||||
//! The runtime's own holds of a device: its check of textures in place (`in_place_check.rs`) and
|
||||
//! its warm pass (`warm/pass.rs`), each on a thread of its own, which hold the device while they
|
||||
//! make objects on it and let it go between their steps.
|
||||
//! The runtime's own holds of a device: its check of textures in place (`in_place_check.rs`), its
|
||||
//! submission checks (`submit_check.rs`) and its warm pass (`warm/pass.rs`), each on a thread of
|
||||
//! its own, which hold the device while they make objects on it and let it go between their steps
|
||||
//! (the submission checks, for their whole run, reading the stop between their steps).
|
||||
//!
|
||||
//! - **Two counts.** Every handle of the device is counted here, as the program's or as a
|
||||
//! holder's. A handle a holder takes ([`WeakDevice::hold`]) is a holder's, and so is each handle
|
||||
@@ -14,7 +15,8 @@
|
||||
//! release of the program's last command buffer) it waits for nothing: those threads serve the
|
||||
//! work the holds may wait for, and the program's work there ends where it ends already.
|
||||
//! - **The wait is a step.** A holder reads the stop between its steps
|
||||
//! ([`Device::holds_go_on`]): the check between its rounds, the warm pass between its records.
|
||||
//! ([`Device::holds_go_on`]): the in-place check between its rounds, the submission checks
|
||||
//! between theirs, the warm pass between its records.
|
||||
//! So the wait is at most the check's round in progress (and its release of its buffer), or the
|
||||
//! record the pass is making. It happens only at teardown.
|
||||
//! - **Exact.** A holder's take and a holder's handle's clone and drop count under the registry's
|
||||
@@ -43,6 +45,8 @@ pub(crate) enum Holder {
|
||||
InPlaceCheck,
|
||||
/// The warm pass, between its records.
|
||||
WarmPass,
|
||||
/// The submission checks, between their rounds, phases and copies.
|
||||
SubmitCheck,
|
||||
}
|
||||
|
||||
/// A device's registry of its handles and the runtime's own holds (the module docs).
|
||||
@@ -63,7 +67,7 @@ pub(crate) struct Holds {
|
||||
/// The crate's device tests' holds of each holder between its steps
|
||||
/// (`tests/teardown_threads.rs`).
|
||||
#[cfg(all(test, any(m2v_gpu, m2v_cpu_icd)))]
|
||||
held: [crate::freed_memory::held::Held; 2],
|
||||
held: [crate::freed_memory::held::Held; 3],
|
||||
}
|
||||
|
||||
/// The registry's count of the holders' handles, and its stop.
|
||||
|
||||
@@ -346,6 +346,9 @@ pub(super) struct DeviceShared {
|
||||
/// Its check of the first move of an image over host pages, per class of pages, and its
|
||||
/// verdicts (`in_place.rs`).
|
||||
pub(crate) in_place: crate::in_place::InPlaceChecks,
|
||||
/// Its checks of what its submissions cost and whether its pointer imports follow their
|
||||
/// address, and their verdicts (`submit_check.rs`).
|
||||
pub(crate) submit_checks: crate::submit_check::SubmitChecks,
|
||||
/// How no-copy buffers import host memory, or why they are refused.
|
||||
pub(super) host_import: Result<Importer, metal2vulkan::error::Unsupported>,
|
||||
/// Whether the device imports a pointer to shared memory, once asked
|
||||
@@ -1995,6 +1998,7 @@ impl Device {
|
||||
textures,
|
||||
shader_cache,
|
||||
in_place: crate::in_place::InPlaceChecks::new(fail_in_place_check),
|
||||
submit_checks: crate::submit_check::SubmitChecks::new(),
|
||||
host_import,
|
||||
shared_pointer_imports: OnceLock::new(),
|
||||
extended_dynamic_state,
|
||||
@@ -2112,6 +2116,9 @@ impl Device {
|
||||
// Its check's verdict of the GPU idling between `VkQueue`s, where none is to be measured
|
||||
// or a record holds it (`queue_share.rs`).
|
||||
device.recall_queue_switch_check();
|
||||
// Its submission checks' verdicts, where a record holds them; else the checks start
|
||||
// (`submit_check.rs`).
|
||||
device.recall_submit_checks();
|
||||
device.degrade_argument_buffers_unread();
|
||||
device.degrade_float_tininess();
|
||||
Ok(device)
|
||||
|
||||
@@ -21,12 +21,14 @@
|
||||
//! pointer), where the device kept a descriptor of each dma-buf within the descriptors the
|
||||
//! process's devices keep at most ([`kept_fds_limit`]); an import past them is made as any
|
||||
//! other and stays imported;
|
||||
//! - of its pages' pointer, on a driver whose pointer imports follow their address
|
||||
//! (`DriverFact::PointerImportsFollowTheirAddress`: ANV on i915, RADV, lavapipe): there the
|
||||
//! kept import reads, at each submission, the pages mapped at its pointer then, as an import
|
||||
//! again at the same pointer does, so releasing it changes nothing a command reads. Elsewhere
|
||||
//! a pointer import stays imported: the driver may keep the pages it was made over, as
|
||||
//! Metal's buffer does, and an import again would read those a remap put there since.
|
||||
//! - of its pages' pointer, on a device whose check found its pointer imports follow their
|
||||
//! address (`submit_check.rs`, `Device::pointer_imports_follow_their_address`; ANV on i915,
|
||||
//! RADV and lavapipe answered so): there the kept import reads, at each submission, the pages
|
||||
//! mapped at its pointer then, as an import again at the same pointer does, so releasing it
|
||||
//! changes nothing a command reads. Elsewhere, and in a buffer made before the check
|
||||
//! answered, a pointer import stays imported: the driver may keep the pages it was made
|
||||
//! over, as Metal's buffer does, and an import again would read those a remap put there
|
||||
//! since.
|
||||
//! - **Blits alone.** It stays releasable while every read of its `VkBuffer` and memory was a
|
||||
//! blit's (`Buffer::blit_at`: a copy or fill naming the buffer, a copy between it and a
|
||||
//! texture, `synchronize_resource`), which holds what it read until its command buffer
|
||||
@@ -87,7 +89,6 @@ use super::exit_guard;
|
||||
use super::host_memory::ImportWindow;
|
||||
use super::memory::MemoryClass;
|
||||
use super::Device;
|
||||
use metal2vulkan::device::DriverFact;
|
||||
use std::os::fd::OwnedFd;
|
||||
use std::ptr::NonNull;
|
||||
use std::sync::atomic::{AtomicBool, AtomicU64, Ordering};
|
||||
@@ -210,17 +211,16 @@ impl Again {
|
||||
})
|
||||
}
|
||||
|
||||
/// The pages imported at `pointer`, made again there: `None` where the device's driver may
|
||||
/// keep the pages a pointer import was made over
|
||||
/// (`DriverFact::PointerImportsFollowTheirAddress` not measured of it), so that the import
|
||||
/// The pages imported at `pointer`, made again there: `None` where the device's pointer
|
||||
/// imports may keep the pages they were made over (its check found they do, could not run,
|
||||
/// or has not answered: `Device::pointer_imports_follow_their_address`), so that the import
|
||||
/// stays imported.
|
||||
pub(super) fn pointer(
|
||||
device: &Device,
|
||||
pointer: NonNull<u8>,
|
||||
(length, window, class): (u64, ImportWindow, MemoryClass),
|
||||
) -> Option<Again> {
|
||||
let follows = (device.properties().driver_facts)
|
||||
.contains(&DriverFact::PointerImportsFollowTheirAddress);
|
||||
let follows = device.pointer_imports_follow_their_address();
|
||||
follows.then(|| Again {
|
||||
device: device.clone(),
|
||||
from: AgainFrom::Pointer(ImportedAt(pointer)),
|
||||
|
||||
@@ -8,9 +8,12 @@
|
||||
//! refuses by their pointer, imported as dma-bufs), fills a window of it with a pattern, and
|
||||
//! makes a texture over it as the program does (`Buffer::new_runtime_texture`): the texture takes
|
||||
//! the image in place exactly as the product's would ([`checking`](crate::in_place::checking)
|
||||
//! lets it whatever the verdict). A thread of its own then writes the pattern's complement into
|
||||
//! the window, each byte once, at a stride that reaches texels, the bytes between rows and the
|
||||
//! bytes after the image from its first writes, while the device makes the image's first move
|
||||
//! lets it whatever the verdict); the fresh-pages class once the device's submission checks
|
||||
//! answered whether its buffers take fresh pages (`submit_check.rs`), unchecked where they do
|
||||
//! not, as the product then makes no such buffer. A thread of its own then writes the
|
||||
//! pattern's complement into the window, each byte once, at a stride that reaches texels, the
|
||||
//! bytes between rows and the bytes after the image from its first writes, while the device
|
||||
//! makes the image's first move
|
||||
//! (an internal submission naming the texture, waited for) and until it completed. Every byte
|
||||
//! must then read the CPU's write where the CPU wrote it, and the pattern elsewhere. Each class
|
||||
//! runs every shape of [`SHAPES`] (texels of 1, 2, 4, 8 and 16 bytes, rows apart or one after
|
||||
@@ -119,6 +122,10 @@ impl Shape {
|
||||
}
|
||||
}
|
||||
|
||||
/// The longest the fresh-pages class waits for the device's submission checks, which answer
|
||||
/// whether its buffers take fresh pages (`submit_check.rs`): their run takes milliseconds.
|
||||
const SUBMIT_CHECKS_WAIT: std::time::Duration = std::time::Duration::from_secs(10);
|
||||
|
||||
/// The bytes of each class's buffer: past half a pooled block, so that a buffer of the runtime's
|
||||
/// own lies in fresh pages (`fresh_pages.rs`), and room for the largest shape's window.
|
||||
const BUFFER_BYTES: u64 = 40 << 20;
|
||||
@@ -303,6 +310,12 @@ impl ClassPages {
|
||||
/// A buffer of `length` bytes in pages of `class` on `device`, where the device makes one
|
||||
/// there; inside a section of its own.
|
||||
fn make(device: &Device, class: PagesClass, length: u64) -> Option<ClassPages> {
|
||||
// Whether the device's buffers take fresh pages is its submission checks' answer
|
||||
// (`submit_check.rs`): the class is checked once they gave it, as the product makes its
|
||||
// buffers then.
|
||||
if matches!(class, PagesClass::Fresh) {
|
||||
device.settle_submit_checks(SUBMIT_CHECKS_WAIT);
|
||||
}
|
||||
let _busy = exit_guard::enter()?;
|
||||
match class {
|
||||
PagesClass::Pointer => pointer_pages(device, length),
|
||||
|
||||
@@ -222,6 +222,7 @@ mod spares;
|
||||
mod sparse;
|
||||
mod stencil_copy;
|
||||
mod storage_placeholder;
|
||||
mod submit_check;
|
||||
mod tessellation;
|
||||
mod texture;
|
||||
mod texture_descriptor;
|
||||
|
||||
File diff suppressed because it is too large.
Load diff
@@ -1,10 +1,9 @@
|
||||
//! A command buffer's batches (`command_buffer/batches.rs`): where event waits and signals, and
|
||||
//! binary semaphore waits and signals, split its encoders; which drivers' batches may wait in
|
||||
//! a group (`command_buffer/group.rs`); and which drivers' queue failures are relayed
|
||||
//! (`device/relay.rs`).
|
||||
//! binary semaphore waits and signals, split its encoders; and which drivers' queue failures are
|
||||
//! relayed (`device/relay.rs`). Which devices' batches may wait in a group is their check's
|
||||
//! (`tests/submit_check.rs`).
|
||||
|
||||
use crate::command_buffer::batches::{Batch, Batches};
|
||||
use crate::command_buffer::merges_submissions;
|
||||
use metal2vulkan::device::{DeviceDescription, DriverFact};
|
||||
use metal2vulkan::vk::DriverId;
|
||||
|
||||
@@ -265,60 +264,6 @@ fn signals_after_a_failing_encoder_are_dropped() {
|
||||
);
|
||||
}
|
||||
|
||||
/// Whether a driver's batches may wait in one kernel submission is the driver's **fact**, never
|
||||
/// its name (`command_buffer/group.rs`): a driver measured to merge a `vkQueueSubmit`'s
|
||||
/// `VkSubmitInfo`s that signal nothing into the next one's kernel submission
|
||||
/// (`DriverFact::SubmissionsWithoutSignalsMerge`) groups its batches; every other driver takes the
|
||||
/// ungrouped path, each batch its own call, which is exact alike.
|
||||
///
|
||||
/// The check over every committed profile: a profile groups only where its driver is one the fact
|
||||
/// is measured of, so a decision that read the driver's name -- the Mesa drivers no lane measured
|
||||
/// read alike there -- would answer otherwise for one of them. A `MEASURED` row written without a
|
||||
/// measurement would show here as a MoltenVK, NVIDIA or SwiftShader profile that groups.
|
||||
#[test]
|
||||
fn only_drivers_measured_to_merge_their_submissions_group_their_batches() {
|
||||
let dir = std::path::PathBuf::from(env!("CARGO_MANIFEST_DIR"))
|
||||
.join("../metal2vulkan-validation/profiles");
|
||||
let mut read = 0;
|
||||
let mut grouped = 0;
|
||||
for entry in std::fs::read_dir(&dir).expect("validation/profiles is readable") {
|
||||
let path = entry.expect("directory entry").path();
|
||||
if path.extension().is_none_or(|x| x != "json") {
|
||||
continue;
|
||||
}
|
||||
let text = std::fs::read_to_string(&path).expect("profile is readable");
|
||||
let description =
|
||||
DeviceDescription::from_khronos_json(&text, None).expect("profile parses");
|
||||
let merges = merges_submissions(&description.driver_facts());
|
||||
if merges {
|
||||
// Only a driver the fact is measured of: Mesa's RADV, ANV and llvmpipe.
|
||||
assert!(
|
||||
matches!(
|
||||
description.driver_id,
|
||||
Some(
|
||||
DriverId::MESA_RADV
|
||||
| DriverId::INTEL_OPEN_SOURCE_MESA
|
||||
| DriverId::MESA_LLVMPIPE
|
||||
)
|
||||
),
|
||||
"{} groups its batches with no row of its driver",
|
||||
path.display()
|
||||
);
|
||||
grouped += 1;
|
||||
}
|
||||
read += 1;
|
||||
}
|
||||
assert!(read > 1, "profiles read: {read}");
|
||||
// The grouped form is reachable, and the fact alone chooses it.
|
||||
assert!(grouped > 0, "profiles that group: {grouped}");
|
||||
assert!(merges_submissions(
|
||||
&[DriverFact::SubmissionsWithoutSignalsMerge]
|
||||
.into_iter()
|
||||
.collect()
|
||||
));
|
||||
assert!(!merges_submissions(&Default::default()));
|
||||
}
|
||||
|
||||
/// Whether a device's queue failures are relayed to the command buffers that failed is the
|
||||
/// driver's **fact**, never its name (`device/mod.rs`, `device/relay.rs`): a driver that reports
|
||||
/// a command buffer's execution failure through the instance's messenger alone, and loses the
|
||||
|
||||
@@ -2,8 +2,10 @@
|
||||
//!
|
||||
//! - **A long new buffer reads zero, nothing written.** A `Shared` buffer, a write-combined one
|
||||
//! and a `Managed` one (with unified memory), each longer than half a pooled block: the `Shared`
|
||||
//! one lies in fresh pages wherever the device imports host pointers
|
||||
//! (`WorkCounts::fresh_page_buffers_made`), with the host setting none of its bytes to zero
|
||||
//! one lies in fresh pages wherever the device imports host pointers and its check found a held
|
||||
//! import adds nothing to a submission's cost (`submit_check.rs`; MoltenVK, ANV, lavapipe), and
|
||||
//! never where it found it does (RADV) (`WorkCounts::fresh_page_buffers_made`), with the host
|
||||
//! setting none of its bytes to zero
|
||||
//! (`new_buffer_bytes_cleared` unchanged); a class whose best memory type for the buffer takes
|
||||
//! no import lies where it would have, the host clearing every byte of it
|
||||
//! (a discrete card's write-combined class, measured below). Either way the buffer reads zero
|
||||
@@ -44,7 +46,7 @@ use std::path::Path;
|
||||
/// read too.
|
||||
const LONG: u64 = FRESH_PAGES_PAST + 4100;
|
||||
|
||||
/// The device the cfg selects, its shader cache in `cache`.
|
||||
/// The device the cfg selects, its shader cache in `cache`, its submission checks answered.
|
||||
fn device(cache: &Path) -> Device {
|
||||
let options = DeviceOptions {
|
||||
kinds: match cfg!(m2v_cpu_icd) {
|
||||
@@ -61,12 +63,18 @@ fn device(cache: &Path) -> Device {
|
||||
},
|
||||
..DeviceOptions::default()
|
||||
};
|
||||
Device::system_default_with(&options).unwrap()
|
||||
let device = Device::system_default_with(&options).unwrap();
|
||||
assert!(
|
||||
device.settle_submit_checks(crate::tests::SETTLE),
|
||||
"the submission checks never answered"
|
||||
);
|
||||
device
|
||||
}
|
||||
|
||||
/// Whether the device takes fresh pages: it imports host pointers.
|
||||
/// Whether the device takes fresh pages: it imports host pointers, and its check found a held
|
||||
/// import adds nothing to a submission's cost.
|
||||
fn takes_fresh_pages(device: &Device) -> bool {
|
||||
device.shared().host_import.is_ok()
|
||||
device.shared().host_import.is_ok() && device.fresh_pages_pay()
|
||||
}
|
||||
|
||||
/// Fill `buffer` with `value` on the GPU, waited for.
|
||||
|
||||
@@ -132,7 +132,7 @@ impl Drop for Scratch {
|
||||
}
|
||||
|
||||
/// The device the cfg selects: a CPU device under `m2v_cpu_icd`, else a GPU, its shader cache
|
||||
/// in `cache`.
|
||||
/// in `cache`, its submission checks answered.
|
||||
pub(super) fn device(cache: &Path) -> Device {
|
||||
let options = DeviceOptions {
|
||||
kinds: match cfg!(m2v_cpu_icd) {
|
||||
@@ -149,7 +149,14 @@ pub(super) fn device(cache: &Path) -> Device {
|
||||
},
|
||||
..DeviceOptions::default()
|
||||
};
|
||||
Device::system_default_with(&options).unwrap()
|
||||
let device = Device::system_default_with(&options).unwrap();
|
||||
// A no-copy buffer's pointer import is releasable only where the device's check found its
|
||||
// pointer imports follow their address as the buffer was made (`submit_check.rs`).
|
||||
assert!(
|
||||
device.settle_submit_checks(crate::tests::SETTLE),
|
||||
"the submission checks never answered"
|
||||
);
|
||||
device
|
||||
}
|
||||
|
||||
/// Run `test` on the device the cfg selects, where `/dev/udmabuf` opens.
|
||||
|
||||
@@ -375,6 +375,9 @@ mod stage_entries_shared;
|
||||
mod staging_waits;
|
||||
mod stand_in;
|
||||
mod storage_form;
|
||||
mod submit_check;
|
||||
#[cfg(any(m2v_gpu, m2v_cpu_icd))]
|
||||
mod submit_check_device;
|
||||
mod submit_stalls;
|
||||
#[cfg(any(m2v_gpu, m2v_cpu_icd))]
|
||||
mod submit_stalls_idle;
|
||||
@@ -431,3 +434,9 @@ mod ycbcr_device;
|
||||
mod ycbcr_in_place_loop;
|
||||
#[cfg(any(m2v_gpu, m2v_cpu_icd))]
|
||||
mod ycbcr_refresh;
|
||||
|
||||
/// How long a device test waits for the device's submission checks to answer
|
||||
/// (`Device::settle_submit_checks`): their run takes milliseconds alone, longer beside the
|
||||
/// suite's other devices.
|
||||
#[cfg(any(m2v_gpu, m2v_cpu_icd))]
|
||||
pub(crate) const SETTLE: std::time::Duration = std::time::Duration::from_secs(60);
|
||||
@@ -5,14 +5,15 @@
|
||||
//! mapped shared, imported by its pointer (`HostMemory::new`), as ANV, NVIDIA and lavapipe import
|
||||
//! it; on a device that refuses that pointer (RADV, which imports the `memfd`'s dma-bufs,
|
||||
//! `tests/host_residency.rs`), private anonymous pages, which RADV imports by their pointer. Where
|
||||
//! the driver's pointer imports follow their address
|
||||
//! (`DriverFact::PointerImportsFollowTheirAddress`: ANV on i915, RADV, lavapipe), the device
|
||||
//! releases such an import while idle and imports it again at the same pointer at its next blit.
|
||||
//! the device's check found its pointer imports follow their address (`submit_check.rs`,
|
||||
//! `Device::pointer_imports_follow_their_address`: ANV on i915, RADV and lavapipe answer so), the
|
||||
//! device releases such an import while idle and imports it again at the same pointer at its next
|
||||
//! blit.
|
||||
//! The tests release imports at once through the crate's hook (`Device::release_idle_host_imports`)
|
||||
//! and check:
|
||||
//! - that a kept import reads the pages a remap put at its address, which is the fact itself, on
|
||||
//! a device with it; on any other the test prints the pages it read, a measurement of the
|
||||
//! driver;
|
||||
//! - that a kept import reads the pages a remap put at its address, which is what the check
|
||||
//! found, on a device where it found so, for the guest's shared pages too, which the check does
|
||||
//! not map; on any other the test prints the pages it read, a measurement of the driver;
|
||||
//! - the counts that show the release and the import again ran (`WorkCounts::host_imports_released`,
|
||||
//! `host_imports_reimported`, `host_imports_resident`, `host_imports_live`), and none of a
|
||||
//! dma-buf's descriptors kept;
|
||||
@@ -21,7 +22,7 @@
|
||||
//! - that a released import reads after a remap the pages the kept one would read;
|
||||
//! - that a buffer whose Metal address was handed out stays imported.
|
||||
//!
|
||||
//! A device whose driver is not measured with the fact keeps every pointer import: the hook
|
||||
//! A device whose check found otherwise keeps every pointer import: the hook
|
||||
//! releases none, and each test says so and passes. Where the device refuses the pointers of both
|
||||
//! kinds of pages each test says so and passes without running.
|
||||
//!
|
||||
@@ -32,14 +33,17 @@ use super::host_residency::{
|
||||
counting, device, gpu_fill, gpu_read, host_page, read, release, residency, Ram, Scratch,
|
||||
};
|
||||
use crate::{Buffer, Device, Error, HostMemory, ResourceOptions};
|
||||
use metal2vulkan::device::DriverFact;
|
||||
use metal2vulkan::error::Feature;
|
||||
use std::ptr::NonNull;
|
||||
|
||||
/// Whether `device`'s driver is measured to have its pointer imports follow their address, so
|
||||
/// that the device releases them while idle.
|
||||
/// Whether `device`'s check found its pointer imports follow their address, so that the device
|
||||
/// releases them while idle: once its checks answered.
|
||||
pub(super) fn follows(device: &Device) -> bool {
|
||||
(device.properties().driver_facts).contains(&DriverFact::PointerImportsFollowTheirAddress)
|
||||
assert!(
|
||||
device.settle_submit_checks(crate::tests::SETTLE),
|
||||
"the submission checks never answered"
|
||||
);
|
||||
device.pointer_imports_follow_their_address()
|
||||
}
|
||||
|
||||
/// Run `test` on the device the cfg selects.
|
||||
|
||||
@@ -0,0 +1,93 @@
|
||||
//! The device's submission checks' verdicts and records (`submit_check.rs`), from what they
|
||||
//! measure: no device.
|
||||
|
||||
use crate::in_place::DriverIdentity;
|
||||
use crate::submit_check::{
|
||||
decode, encode, merge_verdict, record_name, tax_verdict, Measured, Verdict, MERGE_RATIO,
|
||||
TAX_FLOOR,
|
||||
};
|
||||
|
||||
/// The probe's medians (2026-11-07, Mesa 26.2.6 under Linux 7.3.1, MoltenVK 1.4.2 under macOS
|
||||
/// 27.0.1), in nanoseconds: one call of four infos and four calls apart; a submission with an
|
||||
/// import of 16 MiB held and without.
|
||||
const RADEON_780M: ([i64; 2], [i64; 2]) = ([13_200, 37_300], [20_700, 10_400]);
|
||||
const RX_7900_XTX: ([i64; 2], [i64; 2]) = ([13_400, 35_000], [15_200, 8_400]);
|
||||
const RX_550: ([i64; 2], [i64; 2]) = ([11_600, 35_100], [54_700, 8_900]);
|
||||
const IRIS_XE: ([i64; 2], [i64; 2]) = ([5_100, 13_100], [4_700, 4_500]);
|
||||
const M3_MAX: ([i64; 2], [i64; 2]) = ([4_500, 4_600], [2_700, 3_000]);
|
||||
|
||||
/// Mesa's drivers merge the calls (RADV on three generations, ANV) and MoltenVK does not; RADV
|
||||
/// taxes every submission for a held import and ANV and MoltenVK do not: the verdicts each
|
||||
/// device's numbers give, whatever its identity.
|
||||
#[test]
|
||||
fn the_probe_s_numbers_give_each_device_its_verdicts() {
|
||||
let cases = [
|
||||
("Radeon 780M", RADEON_780M, Verdict::Holds, Verdict::Holds),
|
||||
("RX 7900 XTX", RX_7900_XTX, Verdict::Holds, Verdict::Holds),
|
||||
("RX 550", RX_550, Verdict::Holds, Verdict::Holds),
|
||||
("Iris Xe", IRIS_XE, Verdict::Holds, Verdict::Fails),
|
||||
("M3 Max", M3_MAX, Verdict::Fails, Verdict::Fails),
|
||||
];
|
||||
for (name, ([merged, apart], [held, bare]), merges, taxed) in cases {
|
||||
assert_eq!(merge_verdict(merged, apart), merges, "{name}");
|
||||
assert_eq!(tax_verdict(held, bare), taxed, "{name}");
|
||||
}
|
||||
}
|
||||
|
||||
/// The bounds themselves: a call at the ratio merges and one past it does not; a held import
|
||||
/// that adds the floor, or an eighth of a slow submission, is no tax, and one past it is; no
|
||||
/// measurement (a check that timed nothing) merges.
|
||||
#[test]
|
||||
fn the_verdicts_meet_their_bounds() {
|
||||
let apart = 10_000;
|
||||
let at = (MERGE_RATIO * apart as f64) as i64;
|
||||
assert_eq!(merge_verdict(at, apart), Verdict::Holds);
|
||||
assert_eq!(merge_verdict(at + 1, apart), Verdict::Fails);
|
||||
assert_eq!(merge_verdict(0, 0), Verdict::Fails);
|
||||
assert_eq!(tax_verdict(4_000 + TAX_FLOOR, 4_000), Verdict::Fails);
|
||||
assert_eq!(tax_verdict(4_001 + TAX_FLOOR, 4_000), Verdict::Holds);
|
||||
let slow = 80_000;
|
||||
assert_eq!(tax_verdict(slow + slow / 8, slow), Verdict::Fails);
|
||||
assert_eq!(tax_verdict(slow + slow / 8 + 1, slow), Verdict::Holds);
|
||||
}
|
||||
|
||||
fn identity(device_id: u32) -> DriverIdentity {
|
||||
DriverIdentity {
|
||||
vendor_id: 0x1002,
|
||||
device_id,
|
||||
driver_version: 0x6802006,
|
||||
driver_id: 3,
|
||||
driver_name: "radv".into(),
|
||||
driver_info: "Mesa 26.2.6".into(),
|
||||
device_uuid: [7; 16],
|
||||
}
|
||||
}
|
||||
|
||||
/// A record decodes for its own identity alone, every verdict and measurement as written, and
|
||||
/// names itself apart from another identity's; a record with a pending verdict, a truncated one
|
||||
/// and one whose bytes changed decode to nothing.
|
||||
#[test]
|
||||
fn a_record_holds_its_identity_s_verdicts() {
|
||||
let (one, other) = (identity(0x15bf), identity(0x1114));
|
||||
let verdicts = [Verdict::Holds, Verdict::Holds, Verdict::Fails];
|
||||
let measured = Measured {
|
||||
merged: 13_200,
|
||||
apart: 37_300,
|
||||
held: 20_700,
|
||||
bare: 10_400,
|
||||
};
|
||||
let bytes = encode(&one, verdicts, measured);
|
||||
assert_eq!(decode(&one, &bytes), Some((verdicts, measured)));
|
||||
assert_eq!(decode(&other, &bytes), None);
|
||||
assert_ne!(record_name(&one), record_name(&other));
|
||||
assert_eq!(decode(&one, &bytes[..bytes.len() - 1]), None);
|
||||
let mut changed = bytes.clone();
|
||||
changed[60] ^= 1;
|
||||
assert_eq!(decode(&one, &changed), None);
|
||||
let pending = encode(
|
||||
&one,
|
||||
[Verdict::Holds, Verdict::Pending, Verdict::Fails],
|
||||
measured,
|
||||
);
|
||||
assert_eq!(decode(&one, &pending), None);
|
||||
}
|
||||
@@ -0,0 +1,158 @@
|
||||
//! The device's submission checks (`submit_check.rs`) on the device the cfg selects: they answer,
|
||||
//! a second device of the same driver reads their record and runs none, and the paths they choose
|
||||
//! follow their verdicts alone.
|
||||
//!
|
||||
//! - **They answer.** A device made over a fresh shader cache runs its checks once
|
||||
//! (`WorkCounts::submit_checks_run`), each verdict an answer (never pending once settled; the
|
||||
//! follows check answered on Linux where the device imports host pointers), their calls counted
|
||||
//! apart (`WorkCounts::submit_check_calls`); a second device over the same cache recalls them
|
||||
//! (`submit_checks_recalled`), runs none, and holds the same verdicts.
|
||||
//! - **The paths follow them.** Grouped batches where the merge holds
|
||||
//! (`WorkCounts::grouped_submissions`), a long `Shared` buffer in fresh pages where a held
|
||||
//! import adds nothing to a submission (`fresh_page_buffers_made`), a no-copy buffer's pointer
|
||||
//! import released while idle where pointer imports follow their address
|
||||
//! (`host_imports_released`, `tests/pointer_residency.rs` for the release itself). Each
|
||||
//! verdict is printed, with what the checks measured: the evidence of which path the device
|
||||
//! took.
|
||||
//!
|
||||
//! Device tests: compiled only under the GPU safety cfgs (`m2v_gpu`, `m2v_cpu_icd`).
|
||||
|
||||
use super::blit_holds::{Scratch, WAIT};
|
||||
use crate::fresh_pages::FRESH_PAGES_PAST;
|
||||
use crate::submit_check::{Check, Verdict};
|
||||
use crate::tests::SETTLE;
|
||||
use crate::{
|
||||
CommandBufferStatus, Device, DeviceKind, DeviceOptions, EventRef, ResourceOptions,
|
||||
ShaderCacheOptions,
|
||||
};
|
||||
use std::path::Path;
|
||||
|
||||
/// The device the cfg selects, its shader cache in `cache`.
|
||||
fn device(cache: &Path) -> Device {
|
||||
let options = DeviceOptions {
|
||||
kinds: match cfg!(m2v_cpu_icd) {
|
||||
true => vec![DeviceKind::Cpu],
|
||||
false => vec![
|
||||
DeviceKind::Discrete,
|
||||
DeviceKind::Integrated,
|
||||
DeviceKind::Virtual,
|
||||
],
|
||||
},
|
||||
shader_cache: ShaderCacheOptions {
|
||||
directory: Some(cache.to_owned()),
|
||||
..ShaderCacheOptions::default()
|
||||
},
|
||||
..DeviceOptions::default()
|
||||
};
|
||||
Device::system_default_with(&options).unwrap()
|
||||
}
|
||||
|
||||
/// Each check's verdict on `device`.
|
||||
fn verdicts(device: &Device) -> [Verdict; 3] {
|
||||
Check::ALL.map(|check| device.shared().submit_checks.verdict(check))
|
||||
}
|
||||
|
||||
#[test]
|
||||
fn the_checks_answer_once_and_a_second_device_recalls_them() {
|
||||
let scratch = Scratch::new("submit-checks");
|
||||
let first = device(&scratch.0);
|
||||
assert!(
|
||||
first.settle_submit_checks(SETTLE),
|
||||
"the checks never answered"
|
||||
);
|
||||
let answered = verdicts(&first);
|
||||
println!("{}: {}", first.name(), first.submit_check_report());
|
||||
assert!(!answered.contains(&Verdict::Pending), "{answered:?}");
|
||||
let imports = first.shared().host_import.is_ok();
|
||||
if imports && cfg!(target_os = "linux") {
|
||||
assert_ne!(
|
||||
answered[2],
|
||||
Verdict::Unchecked,
|
||||
"the follows check did not run"
|
||||
);
|
||||
}
|
||||
let counts = first.work_counts();
|
||||
assert_eq!(counts.submit_checks_run, 1);
|
||||
assert_eq!(counts.submit_checks_recalled, 0);
|
||||
assert!(
|
||||
counts.submit_check_calls > 0,
|
||||
"the checks' calls were not counted"
|
||||
);
|
||||
// The record is written soon, not at once: wait for it, as a later process would find it.
|
||||
let start = std::time::Instant::now();
|
||||
loop {
|
||||
let second = device(&scratch.0);
|
||||
assert!(
|
||||
second.settle_submit_checks(SETTLE),
|
||||
"the second device never answered"
|
||||
);
|
||||
let counts = second.work_counts();
|
||||
if counts.submit_checks_recalled == 1 {
|
||||
assert_eq!(counts.submit_checks_run, 0);
|
||||
assert_eq!(counts.submit_check_calls, 0);
|
||||
assert_eq!(verdicts(&second), answered);
|
||||
break;
|
||||
}
|
||||
assert!(start.elapsed() < WAIT, "no device recalled the record");
|
||||
drop(second);
|
||||
std::thread::sleep(std::time::Duration::from_millis(50));
|
||||
}
|
||||
}
|
||||
|
||||
/// The paths the verdicts choose: grouped batches, fresh pages, releasable pointer imports.
|
||||
#[test]
|
||||
fn the_paths_follow_the_verdicts() {
|
||||
let scratch = Scratch::new("submit-check-paths");
|
||||
let device = device(&scratch.0);
|
||||
assert!(
|
||||
device.settle_submit_checks(SETTLE),
|
||||
"the checks never answered"
|
||||
);
|
||||
println!("{}: {}", device.name(), device.submit_check_report());
|
||||
// Batches ready together behind an event the host raises go grouped where the merge holds.
|
||||
let queue = device.new_command_queue().unwrap();
|
||||
let event = device.new_shared_event().unwrap();
|
||||
let target = device.new_buffer(4096, ResourceOptions::private()).unwrap();
|
||||
let before = device.work_counts();
|
||||
let mut last = None;
|
||||
for round in 0..8u8 {
|
||||
let command_buffer = queue.command_buffer().unwrap();
|
||||
if round == 0 {
|
||||
command_buffer
|
||||
.encode_wait_for_event(EventRef::Shared(&event), 1)
|
||||
.unwrap();
|
||||
}
|
||||
let mut blit = command_buffer.blit_command_encoder().unwrap();
|
||||
blit.fill_buffer(&target, 0..4096, round).unwrap();
|
||||
blit.end_encoding().unwrap();
|
||||
command_buffer.commit().unwrap();
|
||||
last = Some(command_buffer);
|
||||
}
|
||||
std::thread::sleep(std::time::Duration::from_millis(50));
|
||||
event.set_signaled_value(1);
|
||||
let last = last.unwrap();
|
||||
assert!(last.wait_until_completed_for(WAIT).is_ok());
|
||||
assert_eq!(last.status(), CommandBufferStatus::Completed);
|
||||
let after = device.work_counts();
|
||||
let grouped = after.grouped_submissions - before.grouped_submissions;
|
||||
println!("grouped submissions: {grouped}");
|
||||
assert_eq!(
|
||||
grouped > 0,
|
||||
device.submissions_merge(),
|
||||
"grouping against the merge verdict"
|
||||
);
|
||||
// A long `Shared` buffer lies in fresh pages where a held import costs nothing.
|
||||
let before = device.work_counts().fresh_page_buffers_made;
|
||||
let long = device
|
||||
.new_buffer(FRESH_PAGES_PAST + 4096, ResourceOptions::shared())
|
||||
.unwrap();
|
||||
let made = device.work_counts().fresh_page_buffers_made - before;
|
||||
println!("fresh-page buffers made: {made}");
|
||||
let imports = device.shared().host_import.is_ok();
|
||||
assert_eq!(
|
||||
made == 1,
|
||||
imports && device.fresh_pages_pay(),
|
||||
"fresh pages against the verdict"
|
||||
);
|
||||
assert_eq!(long.in_fresh_pages(), made == 1);
|
||||
}
|
||||
@@ -11,7 +11,7 @@
|
||||
//! Device tests: compiled only under the validation crate's GPU safety cfgs (`m2v_gpu`,
|
||||
//! `m2v_cpu_icd`), on the kind of device the cfg selects.
|
||||
|
||||
use crate::command_buffer::merges_submissions;
|
||||
use crate::tests::SETTLE;
|
||||
use crate::{
|
||||
CommandBuffer, CommandBufferStatus, Device, DeviceKind, DeviceOptions, EventRef,
|
||||
ResourceOptions,
|
||||
@@ -152,9 +152,9 @@ fn an_empty_command_buffer_completes_with_no_submission() {
|
||||
/// macOS 27.0.1: its GPU times 65 to 135 us after the fill's `GPUEndTime`).
|
||||
///
|
||||
/// Under `CompletionPolicy::Exact`, so on every driver, the empty command buffer is taken with no
|
||||
/// submission in each round. Under the default, on a driver whose batches group
|
||||
/// (`DriverFact::SubmissionsWithoutSignalsMerge`: lavapipe), the scheduler may hold the fill in its
|
||||
/// group as it finds the empty one ready behind it, which then goes in the group's one
|
||||
/// submission in each round. Under the default, on a device whose batches group (its check found
|
||||
/// its submissions merge, `submit_check.rs`: lavapipe among them), the scheduler may hold the fill
|
||||
/// in its group as it finds the empty one ready behind it, which then goes in the group's one
|
||||
/// submission with the fill: either way it makes no submission of its own.
|
||||
#[test]
|
||||
fn an_empty_command_buffer_completes_behind_its_queue_s_earlier_work() {
|
||||
@@ -166,8 +166,11 @@ fn an_empty_command_buffer_completes_behind_its_queue_s_earlier_work() {
|
||||
/// [`an_empty_command_buffer_completes_behind_its_queue_s_earlier_work`] under `completion`.
|
||||
fn completes_behind(completion: CompletionPolicy) {
|
||||
let device = device_with(completion);
|
||||
let groups = completion == CompletionPolicy::Grouped
|
||||
&& merges_submissions(&device.properties().driver_facts);
|
||||
assert!(
|
||||
device.settle_submit_checks(SETTLE),
|
||||
"the submission checks never answered"
|
||||
);
|
||||
let groups = completion == CompletionPolicy::Grouped && device.submissions_merge();
|
||||
let queue = device.new_command_queue().unwrap();
|
||||
let target = device.new_buffer(FILL, ResourceOptions::private()).unwrap();
|
||||
// Whether the fill was still running when the empty command buffer was committed, in some
|
||||
|
||||
@@ -8,8 +8,8 @@
|
||||
//!
|
||||
//! Nor does it submit a batch of a queue whose batches wait in the scheduler's group
|
||||
//! (`command_buffer/group.rs`), which is the scheduler thread's to hold and to send: under the
|
||||
//! default `CompletionPolicy::Grouped`, on a driver measured to merge a submission that signals
|
||||
//! nothing into the next (`DriverFact::SubmissionsWithoutSignalsMerge`), that is every queue. So
|
||||
//! default `CompletionPolicy::Grouped`, on a device whose check found a submission that signals
|
||||
//! nothing merged into the next (`submit_check.rs`), that is every queue. So
|
||||
//! the waiter's own submissions are counted under `CompletionPolicy::Exact`, where no queue's
|
||||
//! batches group on any driver, and under the default each test checks that a waiting thread
|
||||
//! submits nothing where the device's batches group, and submits as under `Exact` elsewhere.
|
||||
@@ -25,7 +25,7 @@
|
||||
//! Device tests: compiled only under the validation crate's GPU safety cfgs (`m2v_gpu`,
|
||||
//! `m2v_cpu_icd`), on the kind of device the cfg selects.
|
||||
|
||||
use crate::command_buffer::merges_submissions;
|
||||
use crate::tests::SETTLE;
|
||||
use crate::{
|
||||
Buffer, CommandBuffer, CommandQueue, Device, DeviceKind, DeviceOptions, ResourceOptions,
|
||||
ShaderCacheOptions,
|
||||
@@ -252,8 +252,8 @@ fn a_thread_about_to_block_submits_what_it_committed_unless_a_handler_must_run()
|
||||
});
|
||||
}
|
||||
|
||||
/// Under the default `CompletionPolicy::Grouped`: where the device's batches group (its driver
|
||||
/// merges a submission that signals nothing into the next, `merges_submissions`), every batch of
|
||||
/// Under the default `CompletionPolicy::Grouped`: where the device's batches group (its check
|
||||
/// found a submission that signals nothing merged into the next), every batch of
|
||||
/// a queue is the scheduler thread's to hold in its group, so a thread waiting for its `wait`
|
||||
/// submits none of [`ROUNDS`] (`scheduler::plain_ready`) and the scheduler's thread submits them
|
||||
/// all; elsewhere, the scheduler's thread [`Held`], it submits each, as under `Exact`. `submitted` runs the plain rounds
|
||||
@@ -267,7 +267,11 @@ fn under_the_default(
|
||||
let device = device(cache, CompletionPolicy::Grouped);
|
||||
let queue = device.new_command_queue().unwrap();
|
||||
let side = device.new_command_queue().unwrap();
|
||||
let groups = merges_submissions(&device.properties().driver_facts);
|
||||
assert!(
|
||||
device.settle_submit_checks(SETTLE),
|
||||
"the submission checks never answered"
|
||||
);
|
||||
let groups = device.submissions_merge();
|
||||
let batches = submitted(&device, &queue, (!groups).then_some(&side));
|
||||
println!(
|
||||
"under the default, batches grouping {groups}: submitted by waiters for the {wait}: \
|
||||
|
||||
@@ -230,6 +230,9 @@ pub(crate) struct Counters {
|
||||
joins_withheld_from_unshared: AtomicU64,
|
||||
queue_switch_checks_run: AtomicU64,
|
||||
queue_switch_checks_recalled: AtomicU64,
|
||||
submit_checks_run: AtomicU64,
|
||||
submit_checks_recalled: AtomicU64,
|
||||
submit_check_calls: AtomicU64,
|
||||
queue_sharing_untimed: AtomicU64,
|
||||
slot_wait_nanos: AtomicU64,
|
||||
completed_waits: AtomicU64,
|
||||
@@ -2191,6 +2194,22 @@ impl Counters {
|
||||
(self.queue_switch_checks_recalled).fetch_add(1, Ordering::Relaxed);
|
||||
}
|
||||
|
||||
/// The device's submission checks ran in this process (`submit_check.rs`).
|
||||
pub(crate) fn submit_checks_ran(&self) {
|
||||
(self.submit_checks_run).fetch_add(1, Ordering::Relaxed);
|
||||
}
|
||||
|
||||
/// Their verdicts were read from the record of an earlier run (`submit_check.rs`).
|
||||
pub(crate) fn submit_checks_recalled(&self) {
|
||||
(self.submit_checks_recalled).fetch_add(1, Ordering::Relaxed);
|
||||
}
|
||||
|
||||
/// The submission checks made `calls` `vkQueueSubmit` calls, which `queue_submissions` does
|
||||
/// not count (`submit_check.rs`).
|
||||
pub(crate) fn submit_check_called(&self, calls: usize) {
|
||||
(self.submit_check_calls).fetch_add(calls as u64, Ordering::Relaxed);
|
||||
}
|
||||
|
||||
/// A device that could share `VkQueue`s does not: its command buffers write no timestamps it
|
||||
/// reads (`queue_switch_check::timed`).
|
||||
pub(crate) fn queue_sharing_untimed(&self) {
|
||||
@@ -4756,6 +4775,15 @@ pub struct WorkCounts {
|
||||
/// Devices whose verdict of that check was read from the record of an earlier one of the same
|
||||
/// driver, device and runtime: no check ran for them.
|
||||
pub queue_switch_checks_recalled: u64,
|
||||
/// Runs in this process of the device's submission checks (`submit_check.rs`: whether
|
||||
/// `VkSubmitInfo`s that signal nothing merge, whether a held host-pointer import adds to every
|
||||
/// submission's cost, whether a pointer import follows its address), whatever they answered.
|
||||
pub submit_checks_run: u64,
|
||||
/// Devices whose submission checks' verdicts were read from the record of an earlier run of
|
||||
/// the same driver, device, kernel and runtime: no check ran for them.
|
||||
pub submit_checks_recalled: u64,
|
||||
/// The `vkQueueSubmit` calls the submission checks made, which `queue_submissions` leaves out.
|
||||
pub submit_check_calls: u64,
|
||||
/// Devices of `QueueSharingPolicy::Adaptive` with two `VkQueue`s of one family to share that
|
||||
/// do not share, because their command buffers write no calibrated GPU timestamps the host
|
||||
/// reads (`gpu_times_from_host`, a driver whose timestamps wait for every queue's, or none):
|
||||
@@ -6685,6 +6713,9 @@ impl Device {
|
||||
queue_switch_checks_recalled: counters
|
||||
.queue_switch_checks_recalled
|
||||
.load(Ordering::Relaxed),
|
||||
submit_checks_run: counters.submit_checks_run.load(Ordering::Relaxed),
|
||||
submit_checks_recalled: counters.submit_checks_recalled.load(Ordering::Relaxed),
|
||||
submit_check_calls: counters.submit_check_calls.load(Ordering::Relaxed),
|
||||
queue_sharing_untimed: counters.queue_sharing_untimed.load(Ordering::Relaxed),
|
||||
completed_waits: counters.completed_waits.load(Ordering::Relaxed),
|
||||
event_waits_met: counters.event_waits_met.load(Ordering::Relaxed),
|
||||
|
||||
@@ -4,8 +4,8 @@
|
||||
//! [`BATCHES`] command buffers committed on one queue, each filling a buffer of its own with a
|
||||
//! value of its own, the first after a wait for an event the host has not raised, all wait behind
|
||||
//! that wait; once the host raises it the scheduler finds them ready together. Under the default
|
||||
//! `CompletionPolicy::Grouped`, on a driver measured to merge a submission that signals nothing
|
||||
//! into the next one (`DriverFact::SubmissionsWithoutSignalsMerge`), they go in `vkQueueSubmit`
|
||||
//! `CompletionPolicy::Grouped`, on a device whose check found a submission that signals nothing
|
||||
//! merged into the next one (the runtime's `submit_check.rs`), they go in `vkQueueSubmit`
|
||||
//! calls of up to four batches each, only the last of each signalling
|
||||
//! (`WorkCounts::grouped_submissions`,
|
||||
//! `WorkCounts::batches_grouped`), announced once ([`GROUPED`]); under `CompletionPolicy::Exact`,
|
||||
@@ -53,7 +53,7 @@ use super::{
|
||||
ScratchCache, WAIT,
|
||||
};
|
||||
use crate::gpu::TEST_DEVICE;
|
||||
use metal2vulkan::device::{CompletionPolicy, DeviceDescription, DriverFact};
|
||||
use metal2vulkan::device::CompletionPolicy;
|
||||
use metal2vulkan_runtime::{
|
||||
Buffer, CommandBuffer, CommandBufferStatus, Degradation, DeviceOptions, EventRef,
|
||||
ResourceOptions, ShaderCacheOptions, WorkCounts,
|
||||
@@ -88,12 +88,17 @@ fn group_ends(before: &WorkCounts, after: &WorkCounts) -> [u64; 7] {
|
||||
std::array::from_fn(|at| after[at] - before[at])
|
||||
}
|
||||
|
||||
/// Whether the device's driver merges a submission that signals nothing into the next: the
|
||||
/// driver's fact answers it, never its name, and the runtime reads the same fact
|
||||
/// (`DriverFact::SubmissionsWithoutSignalsMerge`, the runtime's `group.rs`), so a device whose
|
||||
/// identity no lane measured takes the ungrouped path and this lane expects it.
|
||||
fn merges(description: &DeviceDescription) -> bool {
|
||||
(description.driver_facts()).contains(&DriverFact::SubmissionsWithoutSignalsMerge)
|
||||
/// Whether the device's submissions that signal nothing merge into the next, as its check found
|
||||
/// once it answered (the runtime's `submit_check.rs`, which its `group.rs` reads): the device's
|
||||
/// own measurement, never its name nor its GPU's, so a GPU no lane measured groups where its
|
||||
/// check finds the merge, and this lane expects what the check found.
|
||||
fn merges(device: &metal2vulkan_runtime::Device) -> bool {
|
||||
assert!(
|
||||
device.settle_submit_checks(WAIT),
|
||||
"the submission checks never answered"
|
||||
);
|
||||
eprintln!("submission checks: {}", device.submit_check_report());
|
||||
device.submissions_merge()
|
||||
}
|
||||
|
||||
/// Wait until a pass has taken in every command buffer committed before the call, and ended:
|
||||
@@ -136,7 +141,7 @@ fn run(completion: CompletionPolicy, checked: bool) -> (u64, u64, u64, usize, bo
|
||||
options.policy.completion = completion;
|
||||
})
|
||||
.unwrap();
|
||||
let merging = merges(&device.properties().description);
|
||||
let merging = merges(&device);
|
||||
let queue = device.new_command_queue().unwrap();
|
||||
let event = device.new_shared_event().unwrap();
|
||||
let buffers: Vec<Buffer> = (0..BATCHES)
|
||||
@@ -393,7 +398,7 @@ fn event_scenario(completion: CompletionPolicy, steps: &[Step], last: u64) -> Sc
|
||||
options.policy.completion = completion;
|
||||
})
|
||||
.unwrap();
|
||||
let merging = merges(&device.properties().description);
|
||||
let merging = merges(&device);
|
||||
let queues = [
|
||||
device.new_command_queue().unwrap(),
|
||||
device.new_command_queue().unwrap(),
|
||||
@@ -866,7 +871,7 @@ fn behind_running_work(completion: CompletionPolicy, stretch: usize, carried: Ca
|
||||
options.policy.completion = completion;
|
||||
})
|
||||
.unwrap();
|
||||
let merging = merges(&device.properties().description);
|
||||
let merging = merges(&device);
|
||||
let queue = device.new_command_queue().unwrap();
|
||||
let large = device
|
||||
.new_buffer(RUNNING_FILL, ResourceOptions::private())
|
||||
|
||||
@@ -31,8 +31,8 @@
|
||||
//! A second measurement holds a guest's shape (`submit_per_import_guest_shape`): [`GUEST_IMPORTS`]
|
||||
//! pointer imports, of which each frame's blits read [`GUEST_USED`], in frames of
|
||||
//! [`GUEST_PER_FRAME`] command buffers. It measures frames at once, every import resident, then,
|
||||
//! where the driver's pointer imports follow their address
|
||||
//! (`DriverFact::PointerImportsFollowTheirAddress`), again once the device's residency thread
|
||||
//! where the device's check found its pointer imports follow their address (the runtime's
|
||||
//! `submit_check.rs`), again once the device's residency thread
|
||||
//! released the idle ones while paced frames kept the read ones in use. Printed as
|
||||
//! `SUBMIT-GUEST-SHAPE` lines: the imports (`WorkCounts::host_imports_live`,
|
||||
//! `host_imports_resident`, `host_imports_released`, `host_imports_reimported`), a frame's wall
|
||||
@@ -70,7 +70,6 @@ use super::host_memory::{no_copy, Mapping};
|
||||
use super::submit_costs::Execbuffers;
|
||||
use super::{validated_device_with, Messages, ScratchCache, WAIT};
|
||||
use crate::gpu::TEST_DEVICE;
|
||||
use metal2vulkan::device::DriverFact;
|
||||
use metal2vulkan_runtime::{
|
||||
Buffer, CommandBuffer, CommandBufferStatus, CommandQueue, Device, ResourceOptions,
|
||||
};
|
||||
@@ -174,6 +173,21 @@ fn hold(device: &Device, kind: Kind, n: usize) -> Held {
|
||||
}
|
||||
}
|
||||
|
||||
/// Wait for `device`'s submission checks, whose verdicts choose its paths here (whether its
|
||||
/// batches group, its long buffers take fresh pages and its idle pointer imports are released),
|
||||
/// and print them.
|
||||
fn settled(device: &Device) {
|
||||
assert!(
|
||||
device.settle_submit_checks(WAIT),
|
||||
"the submission checks never answered"
|
||||
);
|
||||
eprintln!(
|
||||
"SUBMIT-CHECKS {}: {}",
|
||||
device.name(),
|
||||
device.submit_check_report()
|
||||
);
|
||||
}
|
||||
|
||||
/// A command buffer of `queue` filling `target`'s 4 KiB with `value`, not committed.
|
||||
fn fill(queue: &CommandQueue, target: &Buffer, value: u8) -> CommandBuffer {
|
||||
let command_buffer = queue.command_buffer().unwrap();
|
||||
@@ -274,6 +288,7 @@ fn submit_per_import() {
|
||||
options.record_executions = false;
|
||||
})
|
||||
.unwrap();
|
||||
settled(&device);
|
||||
let queue = device.new_command_queue().unwrap();
|
||||
let target = device.new_buffer(4096, ResourceOptions::shared()).unwrap();
|
||||
let dma_bufs = udmabuf_openable("submit per import");
|
||||
@@ -375,6 +390,7 @@ fn submit_per_import_guest_shape() {
|
||||
options.record_executions = false;
|
||||
})
|
||||
.unwrap();
|
||||
settled(&device);
|
||||
let queue = device.new_command_queue().unwrap();
|
||||
let target = device.new_buffer(4096, ResourceOptions::shared()).unwrap();
|
||||
let pages = Mapping::anonymous(GUEST_IMPORTS * IMPORT_BYTES);
|
||||
@@ -390,11 +406,9 @@ fn submit_per_import_guest_shape() {
|
||||
.collect();
|
||||
let used = &buffers[..GUEST_USED];
|
||||
guest_measure(&device, &queue, &target, used, "at once");
|
||||
let follows =
|
||||
(device.properties().driver_facts).contains(&DriverFact::PointerImportsFollowTheirAddress);
|
||||
if !follows {
|
||||
if !device.pointer_imports_follow_their_address() {
|
||||
eprintln!(
|
||||
"SUBMIT-GUEST-SHAPE {}: pointer imports kept (the driver is not measured to have them \
|
||||
"SUBMIT-GUEST-SHAPE {}: pointer imports kept (the device's check did not find them \
|
||||
follow their address)",
|
||||
device.name()
|
||||
);
|
||||
@@ -494,6 +508,7 @@ fn submit_per_import_release_cost() {
|
||||
options.record_executions = false;
|
||||
})
|
||||
.unwrap();
|
||||
settled(&device);
|
||||
let queue = device.new_command_queue().unwrap();
|
||||
let target = device.new_buffer(4096, ResourceOptions::shared()).unwrap();
|
||||
let pages = Mapping::anonymous(GUEST_IMPORTS * IMPORT_BYTES);
|
||||
@@ -558,6 +573,7 @@ fn submit_per_fresh_page_buffer() {
|
||||
options.record_executions = false;
|
||||
})
|
||||
.unwrap();
|
||||
settled(&device);
|
||||
let queue = device.new_command_queue().unwrap();
|
||||
let target = device.new_buffer(4096, ResourceOptions::shared()).unwrap();
|
||||
for (name, count, length, shared) in FRESH_PHASES {
|
||||
|
||||
@@ -13,7 +13,12 @@
|
||||
//! [`DeviceDescription::canonical_device_id`]. MoltenVK's `deviceID` on Apple's GPUs is the macOS
|
||||
//! release and the GPU family, so a row of one names every GPU of the family under that macOS.
|
||||
//! A driver or GPU no row names takes no fact: the reader takes the route each fact's docs name
|
||||
//! for a driver without it.
|
||||
//! for a driver without it. A question a device answers about itself in a few milliseconds is no
|
||||
//! row: the runtime's device checks measure it on each device, once per driver and release
|
||||
//! (whether its submissions that signal nothing merge, whether a held host-pointer import adds to
|
||||
//! each submission's cost, whether a pointer import follows its address: the runtime's
|
||||
//! `submit_check.rs`; textures in place over host pages, `in_place_check.rs`; the GPU's idling
|
||||
//! between `VkQueue`s, `queue_switch_check.rs`).
|
||||
|
||||
use crate::device::description::APPLE_VENDOR_ID;
|
||||
use crate::device::profile::DriverWorkaround;
|
||||
@@ -730,9 +735,6 @@ const AMD_VENDOR_ID: u32 = 0x1002;
|
||||
/// ([`DeviceDescription::canonical_device_id`]).
|
||||
pub(crate) const AMD_RADEON_780M: u32 = 0x15bf;
|
||||
|
||||
/// The `deviceID` of the Radeon RX 7900 XTX (Navi 31) its rows were measured under.
|
||||
pub(crate) const AMD_RX_7900_XTX: u32 = 0x744c;
|
||||
|
||||
/// The `deviceID` of the Intel UHD Graphics 770 of Raptor Lake-S (the committed capture
|
||||
/// `intel-uhd770-rpls-anv`).
|
||||
pub(crate) const INTEL_UHD_770_RPL_S: u32 = 0xa780;
|
||||
@@ -1305,31 +1307,6 @@ pub enum DriverFact {
|
||||
/// with a 1 made a second `VkPipeline` there (Metal's specialization and pipeline compile,
|
||||
/// 5.6 to 24.5 ms).
|
||||
ConstantOffsetUniformReadsPreloaded,
|
||||
/// A cost fact (the module docs): the driver's queue is Mesa's common one, where each
|
||||
/// `vkQueueSubmit`'s `VkSubmitInfo`s that signal nothing merge into the next one's kernel
|
||||
/// submission, so batches that signal nothing but their queue's timeline may wait and go in
|
||||
/// one call for the cost of one kernel submission (Mesa 26.2.4, `vulkan/runtime/vk_queue.c`,
|
||||
/// `vk_queue_submits_merge`: "Don't merge if there are signals in between"; ANV chains the
|
||||
/// merged command buffers into one batch buffer,
|
||||
/// `anv_queue_submit_cmd_buffers_locked`). Each kernel submission costs CPU time for every
|
||||
/// `VkDeviceMemory` of the device there: ANV on i915 lists each in every execbuffer
|
||||
/// (`i915/anv_batch_chain.c`, `setup_execbuf_for_cmd_buffers`), RADV each in every CS. On a
|
||||
/// driver without it each batch takes its own `vkQueueSubmit`, which is the exact path and
|
||||
/// the one every batch took before grouping: a group changes when a batch's `vkQueueSubmit`
|
||||
/// is made and nothing it submits (`command_buffer/group.rs` in the runtime).
|
||||
///
|
||||
/// Counted where the merge pays, on Mesa 26.2.4's ANV on the Intel UHD 770: 24 kernel
|
||||
/// submissions a frame grouped against 30 ungrouped, at 67 command buffers a frame committed
|
||||
/// 1 ms apart behind 1.3 ms of GPU work each, the GPU as idle either way (0.62 ms a frame).
|
||||
///
|
||||
/// Measured without it, so not listed: MoltenVK, whose queue is its own and merges nothing
|
||||
/// -- it commits a Metal command buffer for each `VkSubmitInfo` of a call and one for a call
|
||||
/// of none with a fence (`MVKQueue::submit`), about 65 us of a thread of Metal's on an Apple
|
||||
/// M3 Max whether or not the info holds work -- and NVIDIA's proprietary driver, which has
|
||||
/// no Mesa queue. The Mesa drivers no lane measures (Turnip, V3DV, PanVK, NVK, Honeykrisp,
|
||||
/// PowerVR) take no row: the merge is in the common queue they share, but no identity of
|
||||
/// theirs was measured, so each takes the ungrouped exact path.
|
||||
SubmissionsWithoutSignalsMerge,
|
||||
/// A defect fact (the module docs): the driver reports a command buffer's execution failure
|
||||
/// only to the instance's debug-utils messengers, naming the `VkQueue` and not the
|
||||
/// submission, and by default marks the whole `VkDevice` lost for it, where Metal fails the
|
||||
@@ -1458,28 +1435,6 @@ pub enum DriverFact {
|
||||
/// Metal's by construction. On a driver with it the runtime announces no `snorm-minimum-kept`
|
||||
/// or `shared-exponent-kept`.
|
||||
TileStoreIsMetals,
|
||||
/// A buffer bound to memory the driver imported from a host pointer
|
||||
/// (`VK_EXT_external_memory_host`) reads and writes, at each submission, the pages mapped at
|
||||
/// that pointer then: pages the process maps over the address after the import (`mmap` with
|
||||
/// `MAP_FIXED`) take the place of those it was made over, for the GPU as for the CPU. Vulkan
|
||||
/// states nothing of a remap under a live import, and Metal's no-copy buffer keeps the pages
|
||||
/// wired when it was made. ANV on i915 imports a pointer as a userptr object, whose pages the
|
||||
/// kernel gets again at the next execbuffer once a remap invalidated them (Linux 7.2.9's
|
||||
/// `i915_gem_object_userptr_submit_init`, or at its first execbuffer, before which nothing was
|
||||
/// pinned); RADV imports it as an amdgpu userptr object, whose pages the kernel gets again in
|
||||
/// each command submission once a remap invalidated them (Linux 7.2.9's
|
||||
/// `amdgpu_cs_parser_bos`, through `amdgpu_ttm_tt_get_user_pages`), and refuses a shared
|
||||
/// `memfd`'s pointer where it imports private anonymous pages'; lavapipe reads the memory
|
||||
/// through the pointer itself (`lvp_AllocateMemory`'s `LVP_DEVICE_MEMORY_TYPE_USER_PTR`). On a
|
||||
/// driver with it a no-copy buffer's own pointer import is released while idle and imported
|
||||
/// again at the same pointer at its next blit, which reads the pages the kept import would
|
||||
/// read (`host_residency.rs` in the runtime): on ANV on i915 every execbuffer lists every
|
||||
/// memory of the device, an import of a pointer costing about 0.16 us of the kernel's time in
|
||||
/// each, and on RADV amdgpu gets every page of each live pointer import again in each
|
||||
/// submission: about 0.5 us an import and 29 ns a 4 KiB page on the RX 7900 XTX under Linux
|
||||
/// 7.0.0, about a quarter of that a page on the Radeon 780M under Linux 7.2.9. Elsewhere such
|
||||
/// an import stays imported, as the driver may keep the pages it was made over.
|
||||
PointerImportsFollowTheirAddress,
|
||||
/// Consecutive draws of a subpass whose fragment shaders read and write a storage image in
|
||||
/// the ordered pixel interlock, every access coherent, are ordered by the interlock alone, as
|
||||
/// Vulkan states: each fragment's interlocked operations happen before those of a later draw's
|
||||
@@ -1940,26 +1895,6 @@ const DYNAMIC_RESTART_WARNING: DriverDiagnostic = DriverDiagnostic {
|
||||
/// left a third answer; RADV on the RX 7900 XTX, clean at dd718a7905 at Mesa 26.0.8 but not
|
||||
/// measured since; and every GPU not measured, which store with `STORE`.
|
||||
///
|
||||
/// `PointerImportsFollowTheirAddress`: ANV, Mesa 26.2.4 on the Iris Xe of RPL-P under Linux 7.2.9's
|
||||
/// i915, measured with a probe outside the runtime (2026-10-17): a page of a `memfd` filled with
|
||||
/// `0xaa`, mapped shared at an address and imported by its pointer as a buffer's memory, read
|
||||
/// `0xaa` through a copy; another `memfd`'s page of `0xbb` mapped over the address with `MAP_FIXED`,
|
||||
/// the next copy read `0xbb`; a page of `0xa2` imported and replaced by one of `0xb2` before any
|
||||
/// submission, the first copy read `0xb2`. lavapipe (`MESA_LLVMPIPE`) from Mesa 26.0.8 through
|
||||
/// 26.2.4 by construction, read in both releases' `lvp_AllocateMemory`, which binds an import's
|
||||
/// buffers at the host pointer. RADV, Mesa 26.2.4 on the Radeon 780M under Linux 7.2.9's amdgpu,
|
||||
/// measured through the runtime (2026-10-17): a no-copy buffer over two fresh anonymous private
|
||||
/// pages, read by a blit; fresh anonymous pages mapped over the address with `MAP_FIXED` and
|
||||
/// `Device::host_range_remapped` told, the next blit read the new pages, and the newer ones after a
|
||||
/// second remap; remapped between the buffer's making and its first submission, the first blit
|
||||
/// read the new pages. RADV, Mesa 26.2.4 on the RX 7900 XTX under the same kernel, measured through
|
||||
/// the runtime (2026-10-22, `tests::pointer_residency` before its row): a no-copy buffer over two
|
||||
/// fresh anonymous private pages, read by a blit; fresh anonymous pages mapped over the address
|
||||
/// with `MAP_FIXED` and `Device::host_range_remapped` told, the next blit of the import kept all
|
||||
/// along read the new pages; Mesa 26.0.8 on both under Linux 7.0.0 answered the same.
|
||||
/// `tests::pointer_residency` in the runtime checks it on a device with it. Every other driver is
|
||||
/// unmeasured, and keeps its pointer imports.
|
||||
///
|
||||
/// `InterlockOrdersDraws`, measured with no barrier between such draws on any driver (a scratch
|
||||
/// build of the commit that adds it), by `runtime_lane::interlocked_draw_order` (passes of 84
|
||||
/// draws, fullscreen and held to bands, of two read-modify-writes of an `R32Uint` color that do
|
||||
@@ -2326,32 +2261,6 @@ pub(crate) const MEASURED: &[Measured<DriverFact>] = &[
|
||||
device: None,
|
||||
},
|
||||
nvidia_on(DriverFact::RowCopiesDispatchFaster, NVIDIA_RTX_5080_LAPTOP),
|
||||
Measured {
|
||||
fact: DriverFact::SubmissionsWithoutSignalsMerge,
|
||||
driver: DriverId::MESA_LLVMPIPE,
|
||||
vendor: None,
|
||||
device: None,
|
||||
},
|
||||
mesa_on(
|
||||
DriverFact::SubmissionsWithoutSignalsMerge,
|
||||
DriverId::MESA_RADV,
|
||||
(AMD_VENDOR_ID, AMD_RADEON_780M),
|
||||
),
|
||||
mesa_on(
|
||||
DriverFact::SubmissionsWithoutSignalsMerge,
|
||||
DriverId::MESA_RADV,
|
||||
(AMD_VENDOR_ID, AMD_RX_7900_XTX),
|
||||
),
|
||||
mesa_on(
|
||||
DriverFact::SubmissionsWithoutSignalsMerge,
|
||||
DriverId::INTEL_OPEN_SOURCE_MESA,
|
||||
(INTEL_VENDOR_ID, INTEL_IRIS_XE_RPL_P),
|
||||
),
|
||||
mesa_on(
|
||||
DriverFact::SubmissionsWithoutSignalsMerge,
|
||||
DriverId::INTEL_OPEN_SOURCE_MESA,
|
||||
(INTEL_VENDOR_ID, INTEL_UHD_770_RPL_S),
|
||||
),
|
||||
mesa_on(
|
||||
DriverFact::SampledDepthKeepsHiZ,
|
||||
DriverId::INTEL_OPEN_SOURCE_MESA,
|
||||
@@ -2363,27 +2272,6 @@ pub(crate) const MEASURED: &[Measured<DriverFact>] = &[
|
||||
(INTEL_VENDOR_ID, INTEL_IRIS_XE_RPL_P),
|
||||
),
|
||||
moltenvk_on_apple(DriverFact::TileStoreIsMetals),
|
||||
mesa_on(
|
||||
DriverFact::PointerImportsFollowTheirAddress,
|
||||
DriverId::INTEL_OPEN_SOURCE_MESA,
|
||||
(INTEL_VENDOR_ID, INTEL_IRIS_XE_RPL_P),
|
||||
),
|
||||
mesa_on(
|
||||
DriverFact::PointerImportsFollowTheirAddress,
|
||||
DriverId::MESA_RADV,
|
||||
(AMD_VENDOR_ID, AMD_RADEON_780M),
|
||||
),
|
||||
mesa_on(
|
||||
DriverFact::PointerImportsFollowTheirAddress,
|
||||
DriverId::MESA_RADV,
|
||||
(AMD_VENDOR_ID, AMD_RX_7900_XTX),
|
||||
),
|
||||
Measured {
|
||||
fact: DriverFact::PointerImportsFollowTheirAddress,
|
||||
driver: DriverId::MESA_LLVMPIPE,
|
||||
vendor: None,
|
||||
device: None,
|
||||
},
|
||||
mesa_on(
|
||||
DriverFact::InterlockOrdersDraws,
|
||||
DriverId::INTEL_OPEN_SOURCE_MESA,
|
||||
|
||||
@@ -4,7 +4,7 @@
|
||||
use crate::device::driver_facts::{among, Measured, MEASURED, NVIDIA_RTX_3090};
|
||||
use crate::device::{DeviceDescription, DriverFact};
|
||||
use crate::vk::DriverId;
|
||||
use std::collections::BTreeMap;
|
||||
use std::collections::{BTreeMap, BTreeSet};
|
||||
use std::path::PathBuf;
|
||||
|
||||
const APPLE: u32 = 0x106B;
|
||||
@@ -403,14 +403,12 @@ const ONE_OF_METALS: DriverFact = DriverFact::DontCareStoreIsOneOfMetals;
|
||||
const COPY_BACK: DriverFact = DriverFact::ShadowCopyBackDispatchFaster;
|
||||
const COPY_IN: DriverFact = DriverFact::ShadowCopyInDispatchFaster;
|
||||
const ROWS: DriverFact = DriverFact::RowCopiesDispatchFaster;
|
||||
const MERGES: DriverFact = DriverFact::SubmissionsWithoutSignalsMerge;
|
||||
const MESSENGER: DriverFact = DriverFact::QueueFailuresReportedByMessenger;
|
||||
const STALL: DriverFact = DriverFact::SemaphoreOperationsStallSubmits;
|
||||
const STALL_1024: DriverFact = DriverFact::SignallingSubmitsStallEvery1024;
|
||||
const SAMPLED_HIZ: DriverFact = DriverFact::SampledDepthKeepsHiZ;
|
||||
const MSAA_DEPTH: DriverFact = DriverFact::MultisampledDepthFasterOutOfGeneral;
|
||||
const TILE_STORE: DriverFact = DriverFact::TileStoreIsMetals;
|
||||
const FOLLOWS: DriverFact = DriverFact::PointerImportsFollowTheirAddress;
|
||||
const INTERLOCK_ORDER: DriverFact = DriverFact::InterlockOrdersDraws;
|
||||
const BLENDLESS: DriverFact = DriverFact::BlendlessColorAttachmentsWarn;
|
||||
const HEAP_COLORS: DriverFact = DriverFact::ColorImagesLieAsMetalHeapTextures;
|
||||
@@ -441,41 +439,21 @@ fn the_committed_profiles_drivers_have_their_facts() {
|
||||
let expected: BTreeMap<String, Vec<DriverFact>> = [
|
||||
(
|
||||
"amd-780m-hawkpoint-radv",
|
||||
vec![
|
||||
ZERO,
|
||||
FETCH,
|
||||
SPLIT,
|
||||
COLOR_BLOCKS,
|
||||
BC6H,
|
||||
BC7,
|
||||
ONE_OF_METALS,
|
||||
MERGES,
|
||||
FOLLOWS,
|
||||
],
|
||||
vec![ZERO, FETCH, SPLIT, COLOR_BLOCKS, BC6H, BC7, ONE_OF_METALS],
|
||||
),
|
||||
(
|
||||
"amd-780m-radv",
|
||||
vec![
|
||||
ZERO,
|
||||
FETCH,
|
||||
SPLIT,
|
||||
COLOR_BLOCKS,
|
||||
BC6H,
|
||||
BC7,
|
||||
ONE_OF_METALS,
|
||||
MERGES,
|
||||
FOLLOWS,
|
||||
],
|
||||
vec![ZERO, FETCH, SPLIT, COLOR_BLOCKS, BC6H, BC7, ONE_OF_METALS],
|
||||
),
|
||||
("amd-rdna2-apu-radv", vec![ZERO]),
|
||||
("amd-rdna3-radv", vec![ZERO]),
|
||||
(
|
||||
"gate-lavapipe",
|
||||
vec![DENORMALS, FRAGDEPTH, DEPTH16, FETCH, BC6H, MERGES, FOLLOWS],
|
||||
vec![DENORMALS, FRAGDEPTH, DEPTH16, FETCH, BC6H],
|
||||
),
|
||||
(
|
||||
"gate-lavapipe-x86_64",
|
||||
vec![DENORMALS, FRAGDEPTH, DEPTH16, FETCH, BC6H, MERGES, FOLLOWS],
|
||||
vec![DENORMALS, FRAGDEPTH, DEPTH16, FETCH, BC6H],
|
||||
),
|
||||
(
|
||||
"intel-arl-anv",
|
||||
@@ -498,10 +476,8 @@ fn the_committed_profiles_drivers_have_their_facts() {
|
||||
ONE_OF_METALS,
|
||||
COPY_BACK,
|
||||
ROWS,
|
||||
MERGES,
|
||||
SAMPLED_HIZ,
|
||||
MSAA_DEPTH,
|
||||
FOLLOWS,
|
||||
INTERLOCK_ORDER,
|
||||
],
|
||||
),
|
||||
@@ -518,13 +494,9 @@ fn the_committed_profiles_drivers_have_their_facts() {
|
||||
COPY_BACK,
|
||||
COPY_IN,
|
||||
ROWS,
|
||||
MERGES,
|
||||
],
|
||||
),
|
||||
(
|
||||
"lavapipe",
|
||||
vec![DENORMALS, FRAGDEPTH, DEPTH16, FETCH, BC6H, MERGES, FOLLOWS],
|
||||
),
|
||||
("lavapipe", vec![DENORMALS, FRAGDEPTH, DEPTH16, FETCH, BC6H]),
|
||||
(
|
||||
"moltenvk-m3",
|
||||
vec![
|
||||
@@ -713,23 +685,32 @@ fn nvidia_s_every_1024th_signalling_submit_stall_holds_on_the_gpu_measured() {
|
||||
);
|
||||
}
|
||||
|
||||
/// RADV on the RX 7900 XTX takes the facts measured on it: its pointer imports follow their
|
||||
/// address and its submissions without signals merge, as the 780M's do, and it reads zero past a
|
||||
/// bound index range, RADV's on every GPU; no answer measured on the 780M alone (its block decodes,
|
||||
/// `DONT_CARE` stores, interlocked split, sampled fetch) is taken. Another release takes the same.
|
||||
/// RADV on a GPU no row names takes RADV's driver-wide fact alone: the Radeon 780M's own
|
||||
/// description presented under the RX 7900 XTX's `deviceID` (0x744c) and under one no table names
|
||||
/// (0x1114) reads zero past a bound index range, as RADV does on every GPU, and takes no answer
|
||||
/// measured on the 780M alone (its block decodes, `DONT_CARE` stores, interlocked split, sampled
|
||||
/// fetch), at another release too. Whether its submissions merge and whether its pointer imports
|
||||
/// follow their address are no facts of the table: the runtime's device checks answer them on
|
||||
/// each device (`submit_check.rs` in the runtime), so a GPU no row names takes those paths too.
|
||||
#[test]
|
||||
fn the_rx_7900_xtx_takes_the_facts_measured_on_it() {
|
||||
use crate::device::driver_facts::AMD_RX_7900_XTX;
|
||||
fn a_radv_gpu_no_row_names_takes_radv_s_driver_wide_fact_alone() {
|
||||
let dir = PathBuf::from(env!("CARGO_MANIFEST_DIR")).join("../metal2vulkan-validation/profiles");
|
||||
let text = std::fs::read_to_string(dir.join("amd-780m-radv.json")).expect("amd-780m-radv");
|
||||
let mut navi31 = DeviceDescription::from_khronos_json(&text, None).expect("profile parses");
|
||||
navi31.device_id = AMD_RX_7900_XTX;
|
||||
let measured =
|
||||
std::collections::BTreeSet::from([FOLLOWS, MERGES, DriverFact::RobustIndexFetchReadsZero]);
|
||||
assert_eq!(navi31.driver_facts(), measured);
|
||||
let mut other = navi31.clone();
|
||||
other.driver_version += 1;
|
||||
assert_eq!(other.driver_facts(), measured);
|
||||
let phoenix = DeviceDescription::from_khronos_json(&text, None).expect("profile parses");
|
||||
let answers = BTreeSet::from([FETCH, SPLIT, COLOR_BLOCKS, BC6H, BC7, ONE_OF_METALS]);
|
||||
let measured = BTreeSet::from([DriverFact::RobustIndexFetchReadsZero]);
|
||||
assert_eq!(
|
||||
phoenix.driver_facts(),
|
||||
answers.union(&measured).copied().collect()
|
||||
);
|
||||
for device_id in [0x744c, 0x1114] {
|
||||
let mut unlisted = phoenix.clone();
|
||||
unlisted.device_id = device_id;
|
||||
assert_eq!(unlisted.driver_facts(), measured, "{device_id:#x}");
|
||||
let mut other = unlisted.clone();
|
||||
other.driver_version += 1;
|
||||
assert_eq!(other.driver_facts(), measured, "{device_id:#x}");
|
||||
}
|
||||
}
|
||||
|
||||
/// MoltenVK's warning of a pipeline whose restart may be disabled (`MVKPipeline.mm` lines 881-893
|
||||
|
||||
Reference in new issue
Block a user