Runtime tests: six more Managed-form tests run in both forms
The tests of upload, import, spill, sites, gpu_span and resolve that read a Managed buffer's form (Device::has_unified_memory, or a Managed buffer they make) ran each device in its own form only, so lavapipe and the integrated cards never took their two-copy arm. Each now runs through tests::command::on_device::each_device_in_both_forms, which runs a one-copy device once more through the two-copy view: - upload: every_device_counts_and_times_its_own_command_buffers - import: every_device_releases_an_import_under_a_managed_buffer_dropped_before_any_commit - spill: every_device_spills_private_memory_out_of_device_memory - gpu_span: every_device_leaves_a_copy_in_out_of_the_gpu_span_it_goes_ahead_of - resolve: every_device_resolves_a_loaded_pass_into_a_shader_read_texture_over_a_buffer - sites: every_device_counts_each_allocation_site_apart, through the new each_device_in_both_forms_with, which opens both runs with the test's own options (MakerTest::Fail here); each_device_in_both_forms is it with the default options. docs/VALIDATION.md names the six modules among those that run both forms. Test-only: no product source changes. Verification (lavapipe two-copy runs counted per test, lint) is in the landing line.
This commit is contained in:
1 parent
0cd1618247
commit
8006d54fbb
8 files changed
+31
-19
No files matched your search
@@ -232,16 +232,23 @@ pub(crate) mod on_device {
|
||||
/// through the two-copy view (`DeviceOptions::two_copies`), where it keeps a device copy as
|
||||
/// a discrete GPU does and `has_unified_memory` answers false. The second run's name is the
|
||||
/// device's with ", two copies" after it.
|
||||
pub(crate) fn each_device_in_both_forms(
|
||||
pub(crate) fn each_device_in_both_forms(test: &str, body: impl FnMut(&str, &Instance, Device)) {
|
||||
each_device_in_both_forms_with(test, DeviceOptions::default, body);
|
||||
}
|
||||
|
||||
/// [`each_device_in_both_forms`] with `options` for each device, the two-copy view's run
|
||||
/// opened with them too.
|
||||
pub(crate) fn each_device_in_both_forms_with(
|
||||
test: &str,
|
||||
options: impl Fn() -> DeviceOptions,
|
||||
mut body: impl FnMut(&str, &Instance, Device),
|
||||
) {
|
||||
let instance = crate::tests::validation::instance(&[]);
|
||||
let devices = devices_of_the_cfgs_kind(&instance);
|
||||
assert!(!devices.is_empty(), "no device of this cfg's kind");
|
||||
for (name, physical) in &devices {
|
||||
let device = Device::new(physical, DeviceOptions::default())
|
||||
.unwrap_or_else(|error| panic!("{name}: {error}"));
|
||||
let device =
|
||||
Device::new(physical, options()).unwrap_or_else(|error| panic!("{name}: {error}"));
|
||||
let unified = device.has_unified_memory();
|
||||
run_settled(test, &instance, name, device, &mut body);
|
||||
if !unified {
|
||||
@@ -249,7 +256,7 @@ pub(crate) mod on_device {
|
||||
}
|
||||
let view = DeviceOptions {
|
||||
two_copies: true,
|
||||
..DeviceOptions::default()
|
||||
..options()
|
||||
};
|
||||
let device =
|
||||
Device::new(physical, view).unwrap_or_else(|error| panic!("{name}: {error}"));
|
||||
|
||||
@@ -5,7 +5,9 @@
|
||||
|
||||
#[cfg(any(m2v_gpu, m2v_cpu_icd))]
|
||||
pub(crate) mod on_device {
|
||||
use crate::tests::command::on_device::{each_device, finished, Arena};
|
||||
use crate::tests::command::on_device::{
|
||||
each_device, each_device_in_both_forms, finished, Arena,
|
||||
};
|
||||
use crate::tests::compute::on_device::step;
|
||||
use crate::tests::managed::on_device::new_managed;
|
||||
use crate::{
|
||||
@@ -93,7 +95,7 @@ pub(crate) mod on_device {
|
||||
/// puts the upload inside it. Only where the Managed buffer has a device copy.
|
||||
#[test]
|
||||
fn every_device_leaves_a_copy_in_out_of_the_gpu_span_it_goes_ahead_of() {
|
||||
each_device("copy-in outside the span", |name, _, device| {
|
||||
each_device_in_both_forms("copy-in outside the span", |name, _, device| {
|
||||
if device.has_unified_memory() {
|
||||
println!("copy-in outside the span: {name}: unified, no copy-in");
|
||||
return;
|
||||
|
||||
@@ -156,7 +156,9 @@ fn host_memory_takes_the_first_coherent_listed_type_offered() {
|
||||
#[cfg(any(m2v_gpu, m2v_cpu_icd))]
|
||||
pub(crate) mod on_device {
|
||||
use crate::memory::Release;
|
||||
use crate::tests::command::on_device::{each_device, finished, within, Busy};
|
||||
use crate::tests::command::on_device::{
|
||||
each_device, each_device_in_both_forms, finished, within, Busy,
|
||||
};
|
||||
use crate::tests::devices_of_the_cfgs_kind;
|
||||
use crate::texture::TextureObject;
|
||||
use crate::{
|
||||
@@ -528,7 +530,7 @@ pub(crate) mod on_device {
|
||||
/// import host memory has nothing to show.
|
||||
#[test]
|
||||
fn every_device_releases_an_import_under_a_managed_buffer_dropped_before_any_commit() {
|
||||
each_device("import_managed_drop", |name, _, device| {
|
||||
each_device_in_both_forms("import_managed_drop", |name, _, device| {
|
||||
let counters = device.counters();
|
||||
let Some((_, alignment)) = device.core().imports.host.as_ref() else {
|
||||
println!("import: {name}: imports no host memory");
|
||||
|
||||
@@ -84,7 +84,7 @@ fn a_resolving_action_needs_a_resolve_texture_and_unknown_resolves_where_one_is_
|
||||
|
||||
#[cfg(any(m2v_gpu, m2v_cpu_icd))]
|
||||
mod on_device {
|
||||
use crate::tests::command::on_device::each_device;
|
||||
use crate::tests::command::on_device::{each_device, each_device_in_both_forms};
|
||||
use crate::tests::draw::on_device::{
|
||||
descriptor, examples, floats, pass, run, state, target, Buffers, SIDE,
|
||||
};
|
||||
@@ -747,7 +747,7 @@ mod on_device {
|
||||
let Some(library) = examples() else {
|
||||
return;
|
||||
};
|
||||
each_device("resolve_over", |name, _, device| {
|
||||
each_device_in_both_forms("resolve_over", |name, _, device| {
|
||||
let format = PixelFormat::BGRA8UnormSRGB;
|
||||
let color = four_of(name, &device, format, WALK)
|
||||
.unwrap_or_else(|error| panic!("{name}: Vulkan requires 4 samples: {error}"));
|
||||
|
||||
@@ -10,7 +10,7 @@ mod on_device {
|
||||
use crate::fill::ZEROS;
|
||||
use crate::memory::MakerTest;
|
||||
use crate::ring::{Writes, CHUNK};
|
||||
use crate::tests::command::on_device::{each_device_with, within};
|
||||
use crate::tests::command::on_device::{each_device_in_both_forms_with, within};
|
||||
use crate::{
|
||||
Device, DeviceOptions, HostBytes, MemoryClass, Metrics, PixelFormat, Region,
|
||||
SiteAllocations, StorageMode, Texture, TextureDescriptor, TextureType, TextureUsage,
|
||||
@@ -106,7 +106,7 @@ mod on_device {
|
||||
maker: MakerTest::Fail,
|
||||
..DeviceOptions::default()
|
||||
};
|
||||
each_device_with("allocation_sites", options, |name, _, device| {
|
||||
each_device_in_both_forms_with("allocation_sites", options, |name, _, device| {
|
||||
count_each_site(name, &device);
|
||||
});
|
||||
}
|
||||
|
||||
@@ -12,7 +12,7 @@
|
||||
|
||||
#[cfg(any(m2v_gpu, m2v_cpu_icd))]
|
||||
mod on_device {
|
||||
use crate::tests::command::on_device::each_device;
|
||||
use crate::tests::command::on_device::each_device_in_both_forms;
|
||||
use crate::tests::compute::on_device::WORDS;
|
||||
use crate::tests::managed::on_device::two_copy_rule;
|
||||
use crate::{MemoryClass, PixelFormat, TextureDescriptor, TextureType, TextureUsage};
|
||||
@@ -30,7 +30,7 @@ mod on_device {
|
||||
|
||||
#[test]
|
||||
fn every_device_spills_private_memory_out_of_device_memory() {
|
||||
each_device("spill", |name, _, device| {
|
||||
each_device_in_both_forms("spill", |name, _, device| {
|
||||
let core = device.core();
|
||||
let counters = device.counters();
|
||||
wait_until("a wholly free unit in each class", || {
|
||||
|
||||
@@ -30,7 +30,7 @@ mod on_device {
|
||||
use crate::staging::REGION_LEN;
|
||||
use crate::submit::{HOMES_PRUNE, UPLOAD_BYTES, UPLOAD_ENTRIES};
|
||||
use crate::tests::command::on_device::{
|
||||
behind_busy, each_device, finished, within, Busy, PATIENCE,
|
||||
behind_busy, each_device, each_device_in_both_forms, finished, within, Busy, PATIENCE,
|
||||
};
|
||||
use crate::tests::devices_of_the_cfgs_kind;
|
||||
use crate::{
|
||||
@@ -703,7 +703,7 @@ mod on_device {
|
||||
#[test]
|
||||
fn every_device_counts_and_times_its_own_command_buffers() {
|
||||
use crate::tests::managed::on_device::new_managed;
|
||||
each_device("own command buffers", |name, _, device| {
|
||||
each_device_in_both_forms("own command buffers", |name, _, device| {
|
||||
let counters = device.counters();
|
||||
let copies = !device.has_unified_memory();
|
||||
let timed = cfg!(m2v_cpu_icd);
|
||||
|
||||
+4
-3
@@ -65,9 +65,10 @@ it with the import families filtered.
|
||||
|
||||
A Managed buffer's two copies need no cfg. Under `m2v_cpu_icd` and `m2v_gpu` alike, the device
|
||||
tests of `metal2vulkan-runtime` whose work a Managed buffer's form decides (those of
|
||||
`tests::managed` that make a Managed buffer, and those of `tests::copy_over`, `tests::blit` and
|
||||
`tests::over` that read the device's form) run each device in its own form and, on a device that
|
||||
keeps one copy (`Device::has_unified_memory` true: an integrated GPU, or lavapipe), once more
|
||||
`tests::managed` that make a Managed buffer, and those of `tests::copy_over`, `tests::blit`,
|
||||
`tests::over`, `tests::upload`, `tests::import`, `tests::spill`, `tests::sites`, `tests::gpu_span`
|
||||
and `tests::resolve` that read the device's form) run each device in its own form and, on a device
|
||||
that keeps one copy (`Device::has_unified_memory` true: an integrated GPU, or lavapipe), once more
|
||||
through the two-copy view (`DeviceOptions`'s test-only `two_copies`, read where the device decides
|
||||
its form; `tests::command::on_device::each_device_in_both_forms`). Through the view the device
|
||||
keeps a Private device copy of every Managed buffer, as a discrete GPU does, and
|
||||
|
||||
Reference in new issue
Block a user