The unshared-queue test bursts on until a choice withholds a join

tests::queue_share_device::no_queue_joins_an_unshared_queue_s_vk_queue_and_
one_placed_there_leaves asserts that, where the device shares VkQueues, at
least one of the choices its three other queues make after the unshared
queue's 16 bursts withheld a join from the unshared queue's VkQueue
(WorkCounts::joins_withheld_from_unshared), so that its check that no
queue landed there is not empty. A choice withholds one only while that
VkQueue is busy and its oldest batch young (queue_share.rs), which a choice
made right after a burst finds unless the host comes back late: each burst
is 24 command buffers of a 1 MiB fill, done on the RTX 5080 within some
tens of microseconds. On a development round's RTX 5080 suite partition
(dv-rt1-221823, at 7e9acd5e73) none of the 48 choices withheld one, and
the test failed at its assertion.

The test now goes on bursting past the 16, where the device shares, until
a choice withheld a join, for at most its WAIT (20 s), and prints the
bursts and the choices' counts. Nothing else changes.

Verified, RTX 5080, entry holds-holds-unshared-1-010148 (c, beside a
development lane), eight copies of the test at once for 5 min each:
- development's test with the counts printed (scratch, 16 bursts): 72 of
  72 passed; in each Adaptive leg every choice either withheld a join or
  found no other VkQueue busy (the burst seen complete before it),
  withheld 1 to 42 of the 48, the least 1 against 47 found idle: the
  choices that withhold none find the burst done, the failure's case, not
  a busy VkQueue passed over unseen.
- this change: 80 of 80 passed, each within the 16 bursts there (withheld
  3 to 44 of 48), so the longer run is taken only where a choice missed
  them all.
- its build under --cfg m2v_gpu: no warning (msi, m3-max-7629).

(cherry picked from commit 0af88b819edb4977a9a67911bfd0dbb3d9e859d3)
This commit is contained in:
Anees Iqbal committed 2026-11-08 01:16:06 -08:00
1 parent 3738986cb0
commit 96ba9a104c
1 file changed
+20 -2
@@ -345,7 +345,19 @@ fn no_queue_joins_an_unshared_queue_s_vk_queue_and_one_placed_there_leaves() {
// robin's next `VkQueue` (`Device::new_command_queue_unshared`), so every `round_robin`-th
// queue after it is on its `VkQueue` (on a device of one queue, each), and no other.
let round_robin = device.shared().round_robin();
for _ in 0..16 {
// A choice withholds a join from the unshared queue's `VkQueue` only while that
// `VkQueue` is busy and its oldest batch in flight young (`queue_share.rs`), as a choice
// right after a burst finds it, unless the host was slow to come back from the burst
// (its batches complete or seen complete long before): where the device shares, the
// bursts go on past the 16 until a choice withheld one, for at most `WAIT`.
let began = Instant::now();
let mut bursts = 0;
while bursts < 16
|| (shares
&& device.work_counts().joins_withheld_from_unshared == 0
&& began.elapsed() < WAIT)
{
bursts += 1;
let kept = burst(&unshared, &scratch, 24);
for (after, queue) in others.iter().enumerate() {
let made = queue.command_buffer().unwrap();
@@ -365,8 +377,14 @@ fn no_queue_joins_an_unshared_queue_s_vk_queue_and_one_placed_there_leaves() {
home,
"the unshared queue moved"
);
let counts = device.work_counts();
println!(
"{bursts} bursts: {} choices withheld a join from the unshared queue's VkQueue, {} \
found no other VkQueue busy",
counts.joins_withheld_from_unshared, counts.picks_with_none_busy
);
if shares {
assert!(device.work_counts().joins_withheld_from_unshared > 0);
assert!(counts.joins_withheld_from_unshared > 0);
// Every round robin's `VkQueue` holds a queue, so the next unshared queue shares
// one with a queue, which leaves at its next idle point.
let filled: Vec<CommandQueue> = (0..round_robin)