Runtime tests: the early member's fed run is checked exactly, not by a wall-clock ratio
every_device_feeds_an_early_members_run_to_its_queue_as_the_last_retires asserted l_run * 3 < a_run: that after A's handler the expected run fell by more than a third. The run falls by the GPU runs it takes (QueueInner::ran halves it toward each shorter one, queue::next_run), so the bound held only while A's and L's timestamped fill runs stayed short beside the run A's handler saw. Alone on lavapipe at 256 bits the ratio is about 4 (125M ns at A's handler, 31M at L's). It failed once in a full-suite run of the merged-tree check (m3-max-85067, llvmpipe LLVM 23.1.1 at 256 bits, the test 0.94 s there against 0.11 s alone), where the CPU ICD's fills ran long. The check is now exact: from the run A's handler saw, the run L's handler sees is next_run of A's GPU run, then of L's, each its command buffer's gpu_end_time minus gpu_start_time. Those are the spans the runtime fed (complete.rs feeds an early member's deferred span, and command.rs L's own, from the same placed times it stores). Nothing in it depends on how long the runs took. With the retirement count's +2 between the handlers, it says the queue took exactly A's run and then L's after A's handler. The bound is not widened; the ratio is gone.
This commit is contained in:
1 parent
6af0aa8c9b
commit
48a22a206f
1 file changed
+15
-6
@@ -5100,7 +5100,9 @@ pub(crate) mod on_device {
|
||||
/// feeds them as the last retires, where one signal for the group fed them, so what the
|
||||
/// submit thread joins and parts meanwhile reads what it read then. A's handler, after A's
|
||||
/// retirement, sees them as they stood; L's, after the last's, sees the count two higher and
|
||||
/// the run fed twice, each run halving the way down from the long run the test set.
|
||||
/// the run A's handler saw fed A's GPU run and then L's (`queue::next_run`), each the span of
|
||||
/// its own timestamps: values the runtime recorded, so the check holds however long the runs
|
||||
/// took on a loaded device.
|
||||
#[test]
|
||||
fn every_device_feeds_an_early_members_run_to_its_queue_as_the_last_retires() {
|
||||
each_device("command_group_apart_feeds_late", |name, _, device| {
|
||||
@@ -5150,11 +5152,18 @@ pub(crate) mod on_device {
|
||||
a_retired + 2,
|
||||
"{name}: A's run fed its queue as L retired"
|
||||
);
|
||||
// Each run halves the way down to a short command buffer's: fed twice after A's
|
||||
// handler, the run comes to about a quarter of what A's handler saw; once, a half.
|
||||
assert!(
|
||||
l_run * 3 < a_run,
|
||||
"{name}: the run fed twice after A's handler"
|
||||
// After A's handler the queue took A's run, then L's, each its timestamps' own span
|
||||
// (`QueueInner::ran`): from the run A's handler saw, exactly the run L's sees,
|
||||
// whatever the GPU times came to.
|
||||
let fed = |run: u64, command_buffer: &CommandBuffer| {
|
||||
let span =
|
||||
(command_buffer.gpu_end_time()).saturating_sub(command_buffer.gpu_start_time());
|
||||
super::next_run(Some(run), span)
|
||||
};
|
||||
assert_eq!(
|
||||
l_run,
|
||||
fed(fed(a_run, &a), &l),
|
||||
"{name}: A's run, then L's, fed after A's handler"
|
||||
);
|
||||
drop((a, l, queue));
|
||||
drop((first, second, arena, device));
|
||||
|
||||
Reference in new issue
Block a user