Tests: three device tests hold on a loaded device by their own inputs and structural bounds
What and why, one test each; the runtime does not change. - every_device_schedules_a_wait_for_an_event_s_value_as_it_is_submitted: the two queues' expected runs (BODY_RUN, 1 ms, the test's own input) are set as each round begins, not once before both. Its 60.9 s on a loaded lavapipe (m3-max-68664, command.rs:188) was the test's own room deadlock, not the runtime: round 1's command buffers retire and their measured runs replace the input (QueueInner::ran, rising at once to a longer run). Past 2 ms, round 2's `next` has no room (submit::room: the two runs behind the oldest past GROUP_RUN) while Busy's gate holds every completion, so its submission waits out the 60 s PATIENCE. Each round now prints the runs its input replaces. PATIENCE stays. - every_device_keeps_heap_textures_read_through_their_indices_past_their_release: the pass that samples as its textures drop is sized from the GPU span of round 0's one sampling dispatch, to about 200 ms of run (PASS_RUN), at most the 40,000 dispatches it always took (about 200 ms on an RTX 3090). On a loaded lavapipe the fixed 40,000 ran past PATIENCE at finished() (m3-max-68664, 79.5 s). It now asserts the drop came before the pass's GPU end, so the round is the release while its pass runs that it names, and prints the count it took. - every_device_rates_a_one_piece_command_buffer_without_the_run_ahead_of_it: the short command buffer's rate behind the long one is bounded structurally, its run (one threadgroup: the rate) under the long one's run left as the short one was submitted (end - sent_at, about 20 ms). A pair begun at its submission, or anywhere earlier in the long run, holds at least that much; the right pair holds its own run alone. The bound it replaces, under twice the rate alone, compared two single runs of about 100 us taken milliseconds apart, and on lavapipe the device is the host CPU: under load the rate behind came to 2.26 times (220300000 ps against 97564000 ps alone, m3-max-68647), the run itself, as the pair measured it. The rate alone and the ratio are still printed. Verified: see the branch's lavapipe and compile jobs, named where it is handed over.
This commit is contained in:
1 parent
58e9267b6c
commit
5686863157
3 files changed
+53
-19
No files matched your search
@@ -250,17 +250,22 @@ mod on_device {
|
||||
/// (`use_heap`), reaching them through the resource IDs its argument buffer holds. Their last
|
||||
/// handles drop after the commit, in three forms: while the command buffer waits on an event
|
||||
/// (committed, not submitted), while long work committed ahead of it on its queue runs, and
|
||||
/// 20 ms into a pass of `SAMPLINGS` dispatches, while it samples them. The heap's range and
|
||||
/// each form's GPU span beside the drop's host time are printed, so a fault's address and
|
||||
/// time can be placed. A texture's going waits for the command buffers committed before its
|
||||
/// release (`crate::memory::Wait`): each completes with no error, and its pass reads the
|
||||
/// textures as they were.
|
||||
/// 20 ms into a pass of about `PASS_RUN` of dispatches, while it samples them: as many as the
|
||||
/// GPU span of the first form's one dispatch gives, at most `SAMPLINGS`, the drop asserted
|
||||
/// before the pass's GPU end. The heap's range and each form's GPU span beside the drop's
|
||||
/// host time are printed, so a fault's address and time can be placed. A texture's going
|
||||
/// waits for the command buffers committed before its release (`crate::memory::Wait`): each
|
||||
/// completes with no error, and its pass reads the textures as they were.
|
||||
#[cfg(any(m2v_cpu_icd, all(m2v_gpu, m2v_gpu_hazards)))]
|
||||
#[test]
|
||||
fn every_device_keeps_heap_textures_read_through_their_indices_past_their_release() {
|
||||
/// The dispatches of the pass that samples while its textures drop: about 200 ms on an
|
||||
/// RTX 3090.
|
||||
/// The most dispatches of the pass that samples while its textures drop: about 200 ms on
|
||||
/// an RTX 3090.
|
||||
const SAMPLINGS: u32 = 40_000;
|
||||
/// The GPU run, in nanoseconds, that pass is sized to, from the GPU span of the first
|
||||
/// form's one dispatch: on a CPU device under load the fixed `SAMPLINGS` ran past the
|
||||
/// tests' patience.
|
||||
const PASS_RUN: u64 = 200_000_000;
|
||||
use crate::tests::command::on_device::shared_event;
|
||||
use crate::tests::compute::on_device::step;
|
||||
use crate::tests::gpu_span::on_device::{dispatches_for, long, words, WORDS};
|
||||
@@ -347,6 +352,7 @@ mod on_device {
|
||||
let count = dispatches_for(name, &queue, &ahead_state, &busy, 200_000_000);
|
||||
let event = shared_event(&device);
|
||||
let mut unlike = Vec::new();
|
||||
let mut samplings = SAMPLINGS;
|
||||
for (round, form) in ["at an event wait", "behind long work", "while it runs"]
|
||||
.into_iter()
|
||||
.enumerate()
|
||||
@@ -373,7 +379,7 @@ mod on_device {
|
||||
encoder.set_buffer(Some(&out), 0, 1).expect("out");
|
||||
(encoder.set_sampler_state(Some(&sampler), 0)).expect("the sampler");
|
||||
(encoder.use_heap(heap.block)).expect("the heap");
|
||||
for _ in 0..if round == 2 { SAMPLINGS } else { 1 } {
|
||||
for _ in 0..if round == 2 { samplings } else { 1 } {
|
||||
(encoder.dispatch_threadgroups([1, 1, 1], [SIDE, SIDE, 1]))
|
||||
.unwrap_or_else(|error| panic!("{name}: {error}"));
|
||||
}
|
||||
@@ -408,6 +414,22 @@ mod on_device {
|
||||
"{name}: {form}: dropped at {dropped}, the pass's GPU span {start}..{end}; \
|
||||
loss {loss:?}, error {error:?}, read {read:?}"
|
||||
);
|
||||
if round == 0 && end > start {
|
||||
samplings = u32::try_from(PASS_RUN / (end - start))
|
||||
.map_or(SAMPLINGS, |count| count.clamp(1, SAMPLINGS));
|
||||
println!(
|
||||
"{name}: one sampling dispatch's GPU span {} ns: the pass while it runs \
|
||||
takes {samplings} dispatches",
|
||||
end - start
|
||||
);
|
||||
}
|
||||
if round == 2 && loss.is_none() && error.is_none() {
|
||||
assert!(
|
||||
dropped < end,
|
||||
"{name}: {form}: the textures dropped at {dropped}, after the pass's GPU \
|
||||
end {end}"
|
||||
);
|
||||
}
|
||||
if loss.is_some() || error.is_some() || read != want {
|
||||
unlike.push(form);
|
||||
}
|
||||
|
||||
@@ -1039,12 +1039,6 @@ pub(crate) mod on_device {
|
||||
arena.buffer(),
|
||||
);
|
||||
let (queue, signaller_queue) = (queue(&device), self::queue(&device));
|
||||
// Each queue's expected run 1 ms, the test's own input, so the device has room for the
|
||||
// three submissions at once (`submit::room`).
|
||||
for queue in [&queue, &signaller_queue] {
|
||||
let probe = queue.command_buffer().expect("a command buffer");
|
||||
probe.queue().set_run_for_test(BODY_RUN);
|
||||
}
|
||||
let log = Log::default();
|
||||
let submitted = |command_buffer: &CommandBuffer| {
|
||||
let before = device.counters().metrics().submissions;
|
||||
@@ -1069,6 +1063,20 @@ pub(crate) mod on_device {
|
||||
("plain", &plain, (&a, &b), 1),
|
||||
("shared", shared.as_event(), (&c, &d), 3),
|
||||
] {
|
||||
// Each queue's expected run 1 ms, the test's own input, set as each round begins,
|
||||
// so the device has room for the round's three submissions at once
|
||||
// (`submit::room`) while Busy's gate holds every completion. The runs the round
|
||||
// before measured would stand in its place (`QueueInner::ran`, rising at once to a
|
||||
// longer run): past 2 ms, on a loaded device, `next` would have no room, and no
|
||||
// completion would come to make it. Printed, the runs it replaces.
|
||||
for queue in [&queue, &signaller_queue] {
|
||||
let probe = queue.command_buffer().expect("a command buffer");
|
||||
println!(
|
||||
"{name}: {label}: a queue's run before the round's input {:?} ns",
|
||||
probe.queue().expected_run()
|
||||
);
|
||||
probe.queue().set_run_for_test(BODY_RUN);
|
||||
}
|
||||
let busy = Busy::new(&device);
|
||||
let signaller = signaller_queue.command_buffer().expect("a command buffer");
|
||||
(signaller.encode_signal_event(event, 1)).expect("a signal");
|
||||
|
||||
@@ -532,8 +532,10 @@ mod on_device {
|
||||
/// committed to a queue right behind another queue's command buffer of about 20 ms of
|
||||
/// dispatches, uncut (its kernel's rate the test's own), submitted while the long one is on
|
||||
/// the device (its submission seen before the long one's GPU end, and its own end after it),
|
||||
/// takes a rate under twice the rate it takes alone. The ratio is printed. A start written
|
||||
/// before the long one ends would put its tail in the rate.
|
||||
/// takes a rate whose run is shorter than the long one's run left as it was submitted: a pair
|
||||
/// begun at its submission, or anywhere earlier in the long one's run, would hold at least that
|
||||
/// much. The rate it takes alone and the ratio are printed: on a CPU device the run itself
|
||||
/// moves with the host's load.
|
||||
#[test]
|
||||
fn every_device_rates_a_one_piece_command_buffer_without_the_run_ahead_of_it() {
|
||||
each_device("pieces_rate_behind", |name, _, device| {
|
||||
@@ -616,10 +618,12 @@ mod on_device {
|
||||
(end - start.min(end)) / 1000,
|
||||
(end - sent_at) / 1000
|
||||
);
|
||||
// One threadgroup: its run is its rate, in picoseconds.
|
||||
assert!(
|
||||
behind_rate < alone.saturating_mul(2),
|
||||
"{name}: the rate behind the long command buffer, {behind_rate} ps, against \
|
||||
{alone} ps alone"
|
||||
behind_rate / 1000 < end - sent_at,
|
||||
"{name}: the rate behind the long command buffer, {behind_rate} ps a threadgroup, \
|
||||
holds the {} us of the long one's run left as the short one was submitted",
|
||||
(end - sent_at) / 1000
|
||||
);
|
||||
});
|
||||
}
|
||||
|
||||
Reference in new issue
Block a user