Files
metal2vulkan/docs
Anees Iqbal 5efe2f1d73 Test queue limits count the program's live command queue handles
The runtime tests' default queue limits count the queues the program holds, not live ones

The check that fails a test needing the queue plan counted live queues
(QueueShared). A command buffer holds its queue's QueueShared, and the
runtime's threads let a completed one go a moment after its wait
returns. So a test that let a queue go and then made two more could
fail or pass by timing.

The check now counts the command queues the program holds a handle of:
- each QueueLine counts, under cfg(test), the command buffers alive
  whose `commandQueue` it is;
- a queue the program made is held where its strong references
  outnumber those command buffers plus the caller's upgrade
  (QueueLine::held_by_the_program, Line::program_queues_held);
- a command buffer takes its count before its handle of the queue and
  drops it after, so a count in passing reads one fewer, never one
  more.

The product's count of live queues (WorkCounts::command_queues_live_most)
is unchanged.

The device test a_default_test_device_fails_where_its_work_needs_the_plan
now keeps a command buffer of a queue it let go before making the
third. The live-queue count panicked there; the held count does not.
The message reads "while the program holds 2 of its command queues".
docs/VALIDATION.md and TEST_QUEUE_LIMITS' doc say the same.

The command buffer's count among its queue's is a guard held for its drop: _counted

Clippy (-D warnings) refused 3d6e4e5957's field `counted`, never read:
the field exists for its Drop, which takes the command buffer's count
off its queue's. Named _counted, as a guard held for its drop.

The test limits' check runs where the program makes a queue, not where a recovery places one again

With the held count, a recovery's queue that took its place on the new
generation counted itself and the program's other queues. So
device_recovery's a_loss_holds_the_hang_s_queue_until_the_recovery and
work_held_unsubmitted_at_a_loss_fails_as_its_victims_in_queue_order (two
queues each) failed on lavapipe at 577d649100. The rest of the suite
passed: 2741 of 2743.

The check now runs in Device::command_queue, for a new round-robin or
unshared queue of the program's, before its place. A queue placed again
after a recovery was counted where it was made.

Verified: job 31249 at 1f69cb2e0c: clippy plain, --cfg m2v_gpu and
--cfg m2v_cpu_icd; queue_limits, queue_limits_device and device_recovery on
lavapipe three times (22/22 each); the runtime suite on lavapipe 2743/2743;
a negative control (the old live count) fails at the third queue. Test-only
(cfg(test)).
2026-11-14 21:02:38 -08:00
..