Joined completions: the order test off its own queue; a private doc link to a test-only constant

Fix forward of RUNTIME 2459 (3de483d86f), and of the runtime private-doc pass red since RUNTIME 2437/2441.

Joined completions lane: the order test's first work on a queue of its own

an_unmarked_command_buffer_is_seen_complete_at_its_own_end failed once in
a release lavapipe run (debug runs passed): grouped 0 and 3 kernel
submissions where the device groups, so M went alone and U closed no
group. The first command buffer, which does the buffers' first work, filled
the 64 MiB buffer on the test's own queue. A queue's expected run is raised
at once by a longer command buffer (command_buffer/group.rs, "Bounded by its
expected run"), and a batch whose queue's expected run is past GROUP_RUN
(16 ms) goes alone (batches_alone_run_long). On a loaded host lavapipe's
64 MiB fill can take longer than that. The first work now runs on a second
command queue of the same device, so the test queue's expected run is the
warm-up's short fills'.

The lane's report also counts batches_alone_run_long, so a run that goes
alone for its expected run says so.

Verified: the release lavapipe run follows on this commit.

contexts: device_limit's doc names TEST_LIMIT without a link

TEST_LIMIT exists only in device test builds, so the private-items
Rustdoc pass (CI's "Private intra-doc links", ceiling 0 for the runtime)
found an unresolved link at contexts/mod.rs:102:
`cargo doc -p metal2vulkan-runtime --all-features --no-deps
--document-private-items` under RUSTDOCFLAGS=-Dwarnings exited 101 in msi job
m3-max-36795. The doc now names it as code.

Joined completions lane: the order test requires M not alone for its queue's expected run

The run-past-bound count the lane's report gained was read only by Debug,
which dead-code analysis ignores: clippy under --cfg m2v_gpu and
--cfg m2v_cpu_icd failed on 'field `long` is never read' (msi job
m3-max-36836; plain clippy, runtime-alone clippy, Rustdoc and the private-doc
pass of all six crates passed there). The order test now asserts it is 0
where the device groups: a batch alone for its queue's expected run is the
precondition the test's first work moved to a queue of its own, and the
assertion names it if it fails again.

Verified: m3-max-36867 at 9dd95c628d clippy plain, --cfg m2v_gpu, --cfg m2v_cpu_icd 0, joined_completions on lavapipe 5/5; m3-max-36836 at fa3b876cb5 rustdoc 0 and the private-doc pass 0 for all six crates; m3-max-36835 (release, lavapipe) joined_completions 5/5 with the counters moving (marked: 7 batches in 2 submissions; unmarked: 7 submissions; order test grouped 1, long 0).
This commit is contained in:
Anees Iqbal committed 2026-11-16 08:40:23 -08:00
1 parent 5dcb87e2e2
commit c9bad0206e
2 files changed
+15 -5

No files matched your search

@@ -99,7 +99,7 @@ pub(crate) static TEST_LIMIT: std::sync::atomic::AtomicUsize =
std::sync::atomic::AtomicUsize::new(0);
/// The most threads a device's pool runs at once: [`THREADS`], or a device test's cap
/// ([`TEST_LIMIT`]).
/// (`TEST_LIMIT`).
pub(crate) fn device_limit() -> usize {
#[cfg(all(test, any(m2v_gpu, m2v_cpu_icd)))]
if let limit @ 1.. = TEST_LIMIT.load(Ordering::Relaxed) {
@@ -42,8 +42,10 @@ const LONG_FILLS: usize = 16;
const LONG_BYTES: u64 = 64 << 20;
/// What a run moved: the `vkQueueSubmit` calls that held several batches, the batches they held,
/// the kernel submissions in all, the groups an unmarked batch closed, the grouped-completion
/// notices, and whether the device groups marked batches ([`groups`]).
/// the kernel submissions in all, the groups an unmarked batch closed, the batches that went alone
/// because no group is kept under `Exact` or because their queue's expected run was past a
/// group's bound, the grouped-completion notices, and whether the device groups marked batches
/// ([`groups`]).
#[derive(Debug)]
struct Moved {
grouped: u64,
@@ -51,6 +53,7 @@ struct Moved {
submissions: u64,
closed: u64,
unkept: u64,
long: u64,
heard: usize,
grouping: bool,
}
@@ -63,6 +66,7 @@ impl Moved {
submissions: after.queue_submissions - before.queue_submissions,
closed: after.group_ends_closed - before.group_ends_closed,
unkept: after.batches_held_alone_unkept - before.batches_held_alone_unkept,
long: after.batches_alone_run_long - before.batches_alone_run_long,
heard,
grouping,
}
@@ -226,8 +230,10 @@ fn an_unmarked_command_buffer_is_seen_complete_at_its_own_end() {
.new_buffer(LONG_BYTES, ResourceOptions::private())
.unwrap();
// Their first work (`texture/first_move.rs`) done before: a batch that takes it waits in no
// group.
let first = queue.command_buffer().unwrap();
// group. On a queue of its own: a long fill on `queue` would raise its expected run past
// the group's bound (the runtime's `GROUP_RUN`), and `M` would go alone.
let aside = device.new_command_queue().unwrap();
let first = aside.command_buffer().unwrap();
let mut blit = first.blit_command_encoder().unwrap();
blit.fill_buffer(&small, 0..BYTES, 0).unwrap();
blit.fill_buffer(&large, 0..LONG_BYTES, 0).unwrap();
@@ -289,6 +295,10 @@ fn an_unmarked_command_buffer_is_seen_complete_at_its_own_end() {
"at U's completed handler, M complete and L still running"
);
if moved.grouping {
assert_eq!(
moved.long, 0,
"{moved:?}: M alone for its queue's expected run"
);
assert!(moved.grouped >= 1 && moved.closed >= 1, "{moved:?}");
} else {
assert_eq!((moved.grouped, moved.closed), (0, 0), "{moved:?}");