scheduler_held_wakes: read the counts once the scheduler sleeps again
The pass that sends a batch counts a slice's rescue only after its
submission returned (scheduler/mod.rs, `pass`), so the batch's command
buffer can complete, and the test's poll see it, before that count is
made. On gem10's PHOENIX under load (round 44505b3807) the held-wake
test read 0 rescues while its steps showed the slice's pass send the
kept group and then "a slice's rescue" 350 us after the kept fill's
completion was published: the test, not the product, was wrong.
Each of the file's three reads of the counts after the work now waits
for the scheduler's thread to sleep again (scheduler_wakes' `asleep`,
now pub(super)), when no pass is under way and its counts are made.
The two tests that assert no rescue came read too early in the same
way and could pass with a rescue uncounted. event_wake_bench and
submit_long_bench print the same delta and take the same wait.
Verified: see the lane's lavapipe control (a 20 ms delay before the
count: the old test fails, this one passes) and the PHOENIX run.
This commit is contained in:
1 parent
25c7f896f9
commit
1448ca32d6
4 files changed
+9
-1
No files matched your search
@@ -148,6 +148,7 @@ fn repeat(rig: &Rig, shape: Shape, value: u64, times: &mut Times) {
|
||||
assert!(start.elapsed() < WAIT, "the completed handler never ran");
|
||||
std::thread::sleep(Duration::from_micros(50));
|
||||
};
|
||||
super::scheduler_wakes::asleep(device, "the waiting command buffer's pass");
|
||||
times.rescues += device.work_counts().scheduler_slice_rescues - before;
|
||||
let mut ahead_end = t0;
|
||||
for other in &ahead {
|
||||
|
||||
@@ -33,6 +33,7 @@
|
||||
//! `DeviceOptions::assume_submissions_merge`.
|
||||
|
||||
use super::plan_room::device_with_room;
|
||||
use super::scheduler_wakes::asleep;
|
||||
use crate::command_buffer::completion::trace::{self, Point};
|
||||
use crate::{
|
||||
Buffer, CommandBuffer, CommandBufferStatus, CommandQueue, Device, DeviceKind, DeviceOptions,
|
||||
@@ -181,6 +182,7 @@ fn a_kept_group_whose_completion_was_published_as_it_was_kept_goes_in_that_pass(
|
||||
completes(&second, "the second command buffer");
|
||||
trace::release(Point::KeptGate);
|
||||
let took = completes(&kept, "the kept command buffer");
|
||||
asleep(&device, "the kept group's pass");
|
||||
let after = device.work_counts();
|
||||
let rescues = after.scheduler_slice_rescues - before.scheduler_slice_rescues;
|
||||
let kept_groups = after.groups_kept_pending - before.groups_kept_pending;
|
||||
@@ -265,6 +267,7 @@ fn a_held_batch_whose_wake_never_came_goes_at_the_next_slice() {
|
||||
completes(&first, "the first command buffer");
|
||||
completes(&second, "the second command buffer");
|
||||
let took = completes(&kept, "the kept command buffer");
|
||||
asleep(&device, "the kept group's pass");
|
||||
let after = device.work_counts();
|
||||
let steps = trace::stop();
|
||||
let rescues = after.scheduler_slice_rescues - before.scheduler_slice_rescues;
|
||||
@@ -367,6 +370,7 @@ fn a_batch_held_for_an_unshared_queue_goes_at_the_completion_published_as_it_was
|
||||
trace::release(Point::Leave);
|
||||
let took = completes(&behind, "the command buffer behind");
|
||||
completes(&ahead, "the first command buffer");
|
||||
asleep(&device, "the pass behind the first command buffer");
|
||||
let after = device.work_counts();
|
||||
let rescues = after.scheduler_slice_rescues - before.scheduler_slice_rescues;
|
||||
let looks = after.heads_held_for_unshared_isolation - before.heads_held_for_unshared_isolation;
|
||||
|
||||
@@ -127,7 +127,9 @@ fn settle(completed: &AtomicU64, count: u64, what: &str) {
|
||||
|
||||
/// Wait until the scheduler's thread sleeps (`Scheduler::asleep`), failing where it stays awake
|
||||
/// for [`BOUND`]: what the last commit or completion set going is over, and no pass is under way.
|
||||
fn asleep(device: &Device, what: &str) {
|
||||
/// The counts a pass makes are then made: a pass counts a slice's rescue once its submission
|
||||
/// returned (`WorkCounts::scheduler_slice_rescues`), which the batch's completion can come before.
|
||||
pub(super) fn asleep(device: &Device, what: &str) {
|
||||
let since = Instant::now();
|
||||
while !device.shared().scheduler.asleep() {
|
||||
assert!(
|
||||
|
||||
@@ -285,6 +285,7 @@ fn run(device: &Device, arm: Arm, chain: &Chain, fill: &Buffer) -> (WorkCounts,
|
||||
for command_buffer in flight {
|
||||
command_buffer.wait_until_completed_for(WAIT).unwrap();
|
||||
}
|
||||
super::scheduler_wakes::asleep(device, "the arm's last pass");
|
||||
let after = device.work_counts();
|
||||
stop.store(true, Ordering::Relaxed);
|
||||
if let Some(thread) = compositor {
|
||||
|
||||
Reference in new issue
Block a user