commit_and_submit: on a grouping driver, submit a batch alone where the group would go at once
On lavapipe (and on every Mesa driver, whose queues merge a submission that signals nothing into the next), commit_and_submit's committing thread never submitted anything: tests::commit_and_submit printed "0 of 40 handlers on the caller; passes at commit 40, batches 0", and six of its tests failed (lines 126, 217, 284, 427, 535, 624), with deferred_calls.rs:1106 (the check and handler ran on the scheduler's thread, not the lowering thread). Under the default CompletionPolicy::Grouped there, every batch "may wait in a group" (group::groups), and scheduler::plain refused any such batch to a thread other than the scheduler's, so each commit went to the scheduler's thread, a wake and a pass away: the extension did nothing on the drivers it was made for (the runtime README states it submits the ready command buffers needing no host step and no storage-form switch; only the method's doc said "no group"). A pass that holds a batch in the group sends the group at its end unless two or more earlier submissions of its VkQueue are not seen complete (Group::keeps). So where at most one runs, a committing thread now submits such a batch alone (CommandBufferShared::goes_alone_at_commit, read from the queue's timeline without its lock, as keeps reads it): it reaches the GPU no later than through the scheduler, and the wake and pass are saved. Where two or more run, it is left to the scheduler's thread, which holds it in the group with the commits that join it, as before. submit_batch takes `alone`, which a thread other than the scheduler's passes, so such a batch never joins the group. A thread about to block keeps leaving groupable batches to the scheduler. Docs: commit_and_submit's doc, the scheduler module doc, the runtime README and the Grouped row of docs/FAST-PATHS.md (its switch and forms unchanged). Verified on lavapipe (layer 1.4.363) by the commit_and_submit and deferred_calls tests and the grouped-submission lane at this commit and with plain()'s change reverted, in one job (see the report for the job id). (cherry picked from commit 25a43729192f80d5fc2ca3af42ef4c14596ae1f0)
This commit is contained in:
1 parent
80ccff1ce9
commit
4d4e103471
6 files changed
+44
-18
No files matched your search
@@ -402,7 +402,9 @@ Calls Metal does not have, for a consumer that emulates a Metal device:
|
||||
- `CommandBuffer::commit_and_submit` commits as `commit` does, then submits on the calling thread
|
||||
where no other submission pass is under way: the ready command buffers in commit order, this
|
||||
one among them, each needing no host step and no switch of a storage form, up to the pass's
|
||||
bound (one held back, another queue's waiting for its check or an event, holds back only the
|
||||
bound (under `CompletionPolicy::Grouped`, on a driver whose batches may wait in a group, one
|
||||
goes alone where its `VkQueue` runs at most one earlier submission not seen complete, and is
|
||||
left to the scheduler's thread to group where two or more run; one held back, another queue's waiting for its check or an event, holds back only the
|
||||
later commits that wait behind it, as on the scheduler's thread), their submission checks run
|
||||
inside the call just before each submission (unless one waits for a shared event's GPU signal
|
||||
to land, which the scheduler's thread waits for; a plain event's wait goes to the `VkQueue`, as
|
||||
|
||||
@@ -120,6 +120,18 @@ impl CommandBufferShared {
|
||||
groups(&self.device, self.queue.vk_queue())
|
||||
}
|
||||
|
||||
/// Whether a committing thread submits a batch of it that may wait in a group
|
||||
/// ([`groups`]) alone, rather than leave it to the scheduler's thread
|
||||
/// (`scheduler::plain`, `CommandBuffer::commit_and_submit`): where its `VkQueue` runs at most
|
||||
/// one earlier submission not seen complete, the pass that held it would send the group at its
|
||||
/// end ([`Group::keeps`]), so it reaches the GPU no later, and the commit saves the scheduler's
|
||||
/// wake and pass. Where two or more run, the scheduler's thread holds it in the group, with
|
||||
/// the commits that join it. Read without the queue's lock, as `keeps` reads it: a submission
|
||||
/// seen complete meanwhile only lowers the count.
|
||||
pub(crate) fn goes_alone_at_commit(&self) -> bool {
|
||||
(self.device.shared().queues[self.queue.vk_queue()].pending_beyond_one()).is_none()
|
||||
}
|
||||
|
||||
/// A batch of it was held in the scheduler's group.
|
||||
pub(crate) fn held_in_group(&self) {
|
||||
self.group_hold.fetch_or(IN_GROUP, Ordering::SeqCst);
|
||||
|
||||
@@ -2847,7 +2847,11 @@ impl CommandBuffer {
|
||||
/// on a thread of its own; the runtime's hands it to its scheduler thread, a wake and a pass
|
||||
/// away. Here, where no other submission pass is under way, this thread makes it: it submits
|
||||
/// the device's ready batches in commit order, this one's among them, each needing no host
|
||||
/// step, no group and no switch of a storage form, up to the pass's bound. A batch held back
|
||||
/// step and no switch of a storage form, up to the pass's bound. Under
|
||||
/// `CompletionPolicy::Grouped`, on a driver whose batches may wait in a group for one kernel
|
||||
/// submission, a batch goes alone where its `VkQueue` runs at most one earlier submission not
|
||||
/// seen complete (the group would go at once), and is left to the scheduler's thread, which
|
||||
/// holds it in the group, where two or more run. A batch held back
|
||||
/// (another queue's, for its checks, an event value or a host step) holds back only the later
|
||||
/// commits that wait behind it, as on the scheduler's thread: those of its own queue, and
|
||||
/// another queue's whose resources it uses. What it leaves goes to the scheduler's thread,
|
||||
|
||||
@@ -412,12 +412,14 @@ impl CommandBufferShared {
|
||||
/// encoders of it a rebind encodes again (`reencode.rs`, [`Submitting::Later`]), or while the
|
||||
/// group held must go first ([`Submitting::AfterGroup`]): the caller holds the batch back at its
|
||||
/// place. Where the group went in this batch's submission, its outcome is the group's
|
||||
/// (`Group::take_outcome`).
|
||||
/// (`Group::take_outcome`). With `alone`, it never waits in the group: a thread other than
|
||||
/// the scheduler's submits it (`scheduler::submit_plain_ready`).
|
||||
pub(crate) fn submit_batch(
|
||||
self: &Arc<Self>,
|
||||
index: usize,
|
||||
last: bool,
|
||||
event_waits: &[(vk::Semaphore, u64)],
|
||||
alone: bool,
|
||||
scheduler: &mut scheduler::State,
|
||||
) -> Result<Submitting, CommandBufferError> {
|
||||
let device = &self.device;
|
||||
@@ -436,7 +438,8 @@ impl CommandBufferShared {
|
||||
let met = (event_waits.iter()).any(|&wait| scheduler.group.meets(wait));
|
||||
let joins = {
|
||||
let sync = &state.batches.all()[index];
|
||||
group::groups(device, queue)
|
||||
!alone
|
||||
&& group::groups(device, queue)
|
||||
&& !(last && super::fences::ends_at_fence(device, queue))
|
||||
&& !met
|
||||
&& sync.binary_waits.is_empty()
|
||||
|
||||
@@ -21,8 +21,10 @@
|
||||
//! `CommandBuffer::commit_and_submit`, a runtime extension). Its commit is posted with no wake,
|
||||
//! and where no passer is counted it makes one pass as a thread about to block does: it takes
|
||||
//! in what the inbox holds and submits, in commit order, the line heads that are ready and need
|
||||
//! nothing of this thread (no host step, no group, no switch of a storage form, no rebind's
|
||||
//! encoding) and wait behind no earlier commit, as this thread's own pass picks them
|
||||
//! nothing of this thread (no host step, no switch of a storage form, no rebind's encoding; a
|
||||
//! batch that may wait in a group goes alone where its `VkQueue` runs at most one earlier
|
||||
//! submission not seen complete, as the group would go at once, and is left to this thread to
|
||||
//! hold where two or more run) and wait behind no earlier commit, as this thread's own pass picks them
|
||||
//! ([`Order::next`], [`is_behind`]), up to [`PASS_SUBMISSIONS`]; their submission handlers then
|
||||
//! run on it, in their turn ([`Turns`]), and their transitions to `Scheduled` run on it where
|
||||
//! plain, else go to their queues' contexts. The first head in commit order ready but for its
|
||||
@@ -1625,7 +1627,7 @@ fn submit_ready(
|
||||
};
|
||||
let submitted = held
|
||||
.buffer
|
||||
.submit_batch(held.index, held.last, &waits, state);
|
||||
.submit_batch(held.index, held.last, &waits, false, state);
|
||||
// Its waits for values found reached go: it waits for none of them.
|
||||
if matches!(
|
||||
submitted,
|
||||
@@ -1833,7 +1835,7 @@ fn submit_plain_ready(
|
||||
};
|
||||
let answer = held
|
||||
.buffer
|
||||
.submit_batch(held.index, held.last, &waits, state);
|
||||
.submit_batch(held.index, held.last, &waits, true, state);
|
||||
// Its waits for values found reached go: it waits for none of them.
|
||||
if matches!(answer, Ok(Submitting::Submitted(_))) {
|
||||
held.hold_ended();
|
||||
@@ -1877,10 +1879,9 @@ fn submit_plain_ready(
|
||||
state.order.put_back(queue, sequence, held);
|
||||
return submitted;
|
||||
}
|
||||
// Unreachable: `groups` stops holding for a queue but never starts (its `flights` are
|
||||
// set once, `device/relay.rs`), so a batch [`plain_ready`] found ungrouped has
|
||||
// `joins` false and submits alone (`command_buffer/group.rs`), and this pass runs
|
||||
// only while the group holds no batch, so `admits` holds for it. Held as the thread's
|
||||
// Unreachable: this pass submits each batch alone (`joins` false,
|
||||
// `command_buffer/group.rs`), and runs only while the group holds no batch, so
|
||||
// `admits` holds for it. Held as the thread's
|
||||
// own pass holds one all the same, and this pass ends there: the thread, which the
|
||||
// caller wakes, sends the group at once, as it does for any group one of whose
|
||||
// command buffers a thread waits for (`Group::keeps`).
|
||||
@@ -2000,11 +2001,15 @@ fn plain(
|
||||
if untracked_decodes > 0 || (!decodes.is_empty() && reads_decoding(held, decodes)) {
|
||||
return false;
|
||||
}
|
||||
let quiet = match passer {
|
||||
Passer::Waiting => held.buffer.submits_without_the_program(),
|
||||
Passer::Committing => held.buffer.submits_at_commit(),
|
||||
};
|
||||
quiet && !held.buffer.groups()
|
||||
// A batch that may wait in the group is the scheduler thread's to hold, but for a committing
|
||||
// thread's where its `VkQueue` would see the group go at once (`goes_alone_at_commit`).
|
||||
match passer {
|
||||
Passer::Waiting => held.buffer.submits_without_the_program() && !held.buffer.groups(),
|
||||
Passer::Committing => {
|
||||
held.buffer.submits_at_commit()
|
||||
&& (!held.buffer.groups() || held.buffer.goes_alone_at_commit())
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
/// The checks of the first line head in commit order whose checks a committing thread may run
|
||||
|
||||
+1
-1
@@ -34,7 +34,7 @@ three consumer pipelines: A2X (`a2x-s4`, `a2x-s96`), Xgc14 (`xgc14-bgra8`) and X
|
||||
|---|---|---|---|---|
|
||||
| A blend into a packed 16-bit attachment the device renders through its word view (`A1BGR5Unorm`, `ABGR4Unorm` on the RTX 5080; `WordAttachment`), which the function computes in the interlocked storage form, reads the attachment's codes, where Metal's tile holds the pass's clear and each earlier blend's result as a `half`, finer; under fast math it also sums a few states otherwise than Metal. Every device rendering such an attachment. | The in-shader blend over the codes (no switch) | **Not built yet:** the extended-range attachments' `half` shadow (`render/extended_shadow.rs`, `VariantKey::extended_shadows`) taken by word attachments: the runtime's shadow start and end, its load of the codes and the clear's halves, and the word's shadowed variant in `lower::fragment::fetch`, for a single-sampled pass and a multisampled one (an extended-range color's shadow holds per sample, from the pass's clear). Fast math's regrouped sums have no model | One code: without fast math exact over a loaded attachment (the 2,891 states of the M3 sweep, every channel), under fast math 3,527 of 94,732,288 channels a code apart; after a clear or an earlier blend in the pass, a code apart where the two readings store different codes. `DeviceColorConversion` (`device-color-conversion`) | Not measured. Expected from the shadow's form: an `R16G16B16A16_SFLOAT` image of the pass's extent per such color (8 bytes a pixel, 16.6 MB at 1920x1080), set at the draw it starts by a fill or a load dispatch, and an 8-byte storage read and write per blended fragment inside the interlock beside the word's |
|
||||
| A heap's colour texture that Metal keeps losslessly compressed (`allowGPUOptimizedContents`, no `ShaderWrite`, `PixelFormatView` or `ShaderAtomic` usage, 16 texels or more a side), on a driver whose compressed images may keep their texels apart from the memory they are bound to (`DriverFact::CompressedImagesHideAliasedWrites`: ANV), is the driver's compressed optimal image, its compression and fast clears kept. A texture Metal keeps uncompressed takes the uncompressed image under either value. The runtime's choice: no pipeline differs. | `heap_compression = HeapCompressionPolicy::Compressed` | `heap_compression = HeapCompressionPolicy::Uncompressed`: an image the driver keeps uncompressed in the heap's bytes, as for a texture Metal keeps uncompressed: host-transfer usage where the device enabled `hostImageCopy` (`heap-texture-host-transfer`), else a linear image (`heap-texture-linear`), else the optimal one (`heap-texture-hides-aliased-writes`) | A write through a buffer or another texture over the texture's bytes may leave its texels as they were or change them otherwise than as written, where Metal's texture reads opaque magenta (`0xffff00ff`) in every texel of drawn content the write covers and the written bytes where it held only a clear; the texture's own writes may show in those bytes compressed. Within Metal's contract: Metal documents such a texture's layout as its own (`allowGPUOptimizedContents` lets it "adjust the private layout"), so no write through another view over its bytes has a defined result there either. `HeapTextureCompressed` (`heap-texture-compressed`), announced once per device where such a texture is made; `runtime_lane::heap_textures` | ANV (Iris Xe of RPL-P; `heap_textures::heap_compression_costs`), a 2048x2048 `RGBA8Unorm` render target in a `Private` placement heap: a pass that clears it 26.9 us against 676.2-676.5 us; a copy into another such texture 647.7-649.1 us against 673.9-693.2 us |
|
||||
| Batches of command buffers committed on one queue that the scheduler finds ready together (a backlog) go to the driver in one `vkQueueSubmit`, at most four, only the last signalling the queue's timeline, on a device whose own check finds a submission that signals nothing merged into the next (`submit_check.rs`, once per driver, release and kernel: one `vkQueueSubmit` of four empty infos against four calls of one, merged where the one costs at most 0.6 of the four; Mesa 26.2.6's RADV on the Radeon 780M, the RX 7900 XTX and the RX 550 at 0.33-0.38, ANV on the Iris Xe of RPL-P at 0.39, MoltenVK 1.4.2 on the M3 Max at 0.98; a device whose check has not answered, or that does not merge, takes the ungrouped form under either value of the switch): one kernel submission, where ANV on i915 lists every `VkDeviceMemory` in each (the consumer's guest drag on the Iris Xe: about 300 entries per execbuffer, 260 of them its host imports, at 112 to 128 execbuffers a frame). A batch's event signals ride to the group's end, which signals each event's semaphore to the highest index the batches held signal it to (an event's indices rise in commit order). A batch that signals a binary semaphore, takes a fence, binds a sparse update, does first work, names the caller's wrapped image, or waits for anything not seen complete (an event, another queue's work) goes alone, after the batches held: a batch with a wait leads a group, never joins one. So that checked command buffers (the consumer checks each) are found ready together, the submission checks of up to three batches right behind a line's head that goes run with the head's, in commit order, none committed after another queue's batch: such a check runs before the previous batch's `vkQueueSubmit` rather than after it, in the scheduler pass that submits its own batch. A pass that finds no batch ready sends the batches held, unless two or more earlier submissions of their `VkQueue` are not seen complete: the GPU runs those first in any case, so the batches stay held, and those committed meanwhile join them, until one submission is left in flight (a completion turn wakes the scheduler at its value), the group fills, a later batch sends it, a head waits for the GPU, or a thread waits for one of their command buffers' completion, which sends them at once; a batch that ends a command buffer with a switch of storage forms riding on it, which settles by its submission's outcome, is never kept so. A held batch that ends its command buffer is `Scheduled` as it is held, its submission handlers run first, then its scheduled handlers, and its kernel end time set, as an M3 Max schedules a command buffer committed behind running work 0.04 to 0.18 ms after its commit. The runtime's: no pipeline differs. | `completion = CompletionPolicy::Grouped` | `completion = CompletionPolicy::Exact`: one submission per batch, each signalling its own values; each line's head checked alone | Each command buffer of a submission but the last is seen complete (status, completed handlers, waits), and the event values it signals are reached (by the GPU waits on other queues, the host's waits, value reads and listeners), once the last completed: late by the GPU time of at most three later batches (about 0.1 to 0.2 ms each in the consumer's compositor frames on the Iris Xe; about 20 ms behind a 20 ms batch), never early, in commit order. Metal's contract states no bound on when completion is seen (an M3 Max reports a command buffer complete, its handlers, status, waits and event listeners alike, 0.04 to 0.10 ms after its GPU end), and no member but the first waits, so no wait holds a member back: a valid program sees only later completion, as of slower GPU work. A batch kept while earlier work runs is seen complete within the same bound, and, where the one submission left in flight ends before its group reaches the GPU, late besides by that gap: at most a completion turn's reaction and the group's `vkQueueSubmit`. Commands, barriers and GPU times are unchanged. `GroupedCompletion` (`grouped-completion`), announced once per device at its first such submission; `runtime_lane::grouped_submissions` | ANV (Iris Xe of RPL-P; `frame_costs::frame_costs_over_imports`, the checked device, 67 command buffers a frame, GPU at 467-783 MHz), with 520 host imports live, where the Exact form's submissions fall behind the commits as the guest's do: 32.0-33.2 kernel submissions a frame against 67.0, 3.4-3.5 ms of execbuffer ioctl a frame against 6.9-7.9 ms, the scheduler thread's CPU 61-63 us a command buffer against 121-136 us, a frame through completion 4.7-5.9 ms against 8.6-9.7 ms; in the guest's shape with 520 (a second queue taking every 20th command buffer, each signalling a shared event, every 10th waiting for one): 26.2-26.7 kernel submissions a frame against 67.0, 2.8 ms of ioctl a frame against 6.9-7.0 ms, the scheduler 52-53 us a command buffer against 122-123 us, a frame through completion 6.0 ms against 8.7 ms; with 260Line truncated
|
||||
| Batches of command buffers committed on one queue that the scheduler finds ready together (a backlog) go to the driver in one `vkQueueSubmit`, at most four, only the last signalling the queue's timeline, on a device whose own check finds a submission that signals nothing merged into the next (`submit_check.rs`, once per driver, release and kernel: one `vkQueueSubmit` of four empty infos against four calls of one, merged where the one costs at most 0.6 of the four; Mesa 26.2.6's RADV on the Radeon 780M, the RX 7900 XTX and the RX 550 at 0.33-0.38, ANV on the Iris Xe of RPL-P at 0.39, MoltenVK 1.4.2 on the M3 Max at 0.98; a device whose check has not answered, or that does not merge, takes the ungrouped form under either value of the switch): one kernel submission, where ANV on i915 lists every `VkDeviceMemory` in each (the consumer's guest drag on the Iris Xe: about 300 entries per execbuffer, 260 of them its host imports, at 112 to 128 execbuffers a frame). A batch's event signals ride to the group's end, which signals each event's semaphore to the highest index the batches held signal it to (an event's indices rise in commit order). A batch that signals a binary semaphore, takes a fence, binds a sparse update, does first work, names the caller's wrapped image, or waits for anything not seen complete (an event, another queue's work) goes alone, after the batches held: a batch with a wait leads a group, never joins one. So that checked command buffers (the consumer checks each) are found ready together, the submission checks of up to three batches right behind a line's head that goes run with the head's, in commit order, none committed after another queue's batch: such a check runs before the previous batch's `vkQueueSubmit` rather than after it, in the scheduler pass that submits its own batch. A pass that finds no batch ready sends the batches held, unless two or more earlier submissions of their `VkQueue` are not seen complete: the GPU runs those first in any case, so the batches stay held, and those committed meanwhile join them, until one submission is left in flight (a completion turn wakes the scheduler at its value), the group fills, a later batch sends it, a head waits for the GPU, or a thread waits for one of their command buffers' completion, which sends them at once; a batch that ends a command buffer with a switch of storage forms riding on it, which settles by its submission's outcome, is never kept so. A batch a committing thread submits (`CommandBuffer::commit_and_submit`) goes alone where its `VkQueue` runs at most one earlier submission not seen complete, as the pass that held it would send the group at once; where two or more run it is left to the scheduler's thread, which holds it. A held batch that ends its command buffer is `Scheduled` as it is held, its submission handlers run first, then its scheduled handlers, and its kernel end time set, as an M3 Max schedules a command buffer committed behind running work 0.04 to 0.18 ms after its commit. The runtime's: no pipeline differs. | `completion = CompletionPolicy::Grouped` | `completion = CompletionPolicy::Exact`: one submission per batch, each signalling its own values; each line's head checked alone | Each command buffer of a submission but the last is seen complete (status, completed handlers, waits), and the event values it signals are reached (by the GPU waits on other queues, the host's waits, value reads and listeners), once the last completed: late by the GPU time of at most three later batches (about 0.1 to 0.2 ms each in the consumer's compositor frames on the Iris Xe; about 20 ms behind a 20 ms batch), never early, in commit order. Metal's contract states no bound on when completion is seen (an M3 Max reports a command buffer complete, its handlers, status, waits and event listeners alike, 0.04 to 0.10 ms after its GPU end), and no member but the first waits, so no wait holds a member back: a valid program sees only later completion, as of slower GPU work. A batch kept while earlier work runs is seen complete within the same bound, and, where the one submission left in flight ends before its group reaches the GPU, late besides by that gap: at most a completion turn's reaction and the group's `vkQueueSubmit`. Commands, barriers and GPU times are unchanged. `GroupedCompletion` (`grouped-completion`), announced once per device at its first such submission; `runtime_lane::grouped_submissions` | ANV (Iris Xe of RPL-P; `frame_costs::frame_costs_over_imports`, the checked device, 67 command buffers a frame, GPU at 467-783 MHz), with 520 host imports live, where the Exact form's submissions fall behind the commits as the guest's do: 32.0-33.2 kernel submissions a frame against 67.0, 3.4-3.5 ms of execbuffer ioctl a frame against 6.9-7.9 ms, the scheduler thread's CPU 61-63 us a command buffer against 121-136 us, a frame through completion 4.7-5.9 ms against 8.6-9.7 ms; in the guest's shape with 520 (a second queue taking every 20th Line truncated
|
||||
| Batches of command buffers on one `VkQueue`, on a driver measured to start no kernel submission of a queue before the one before it completed (ANV, RADV and NVIDIA's; `batch_order.rs`), are ordered by their ends: each ends with a barrier ordering its work before every later command of its `VkQueue` (the exact form's end orders it before the host's reads and writes alone), so a batch that depends on an earlier one there begins with no barrier of its own, often no command buffer of barriers, and its first encoder's GPU start is written at the bottom of the pipe, once everything before it completed. Metal starts an independent command buffer committed behind running work while that work runs (an M3 Max under macOS 27.0.1, probe `gpustart`); those drivers ran two batches of independent work one after the other under every shape measured (no end barrier, the host's or the widened one; in one `vkQueueSubmit` or two, merged into one kernel submission or not), where two dispatches of one command buffer ran side by side. The runtime's: no pipeline differs. | `batch_order = BatchOrderPolicy::Ends` | `batch_order = BatchOrderPolicy::Exact`: a barrier for each dependency of a batch's work on an earlier batch's of its `VkQueue`, the end's barrier to the host's reads and writes alone, the GPU start written at the top of the pipe; every other driver takes it under either value | None: on those drivers each batch starts once the one before it completed under either value, so the work's order, its results and its GPU times are the same, and a batch's GPU start is the end of the work before it, when such a driver starts it. Not announced; `runtime_lane::commit_work` and `runtime_lane::gpu_times` test both values | UHD 770 (ANV, RPL-S), the consumer's frame shape over 520 host imports, 67 command buffers a frame, Grouped completion, the widened end barrier against the exact form (a probe build of each): with no fill ahead of each command buffer, 67.0 command buffers submitted a frame against 129.3-129.7, the GPU's span a frame 1.84-1.90 ms against 1.99-2.06 ms, a frame through completion 2.13-2.22 ms against 2.27-2.38 ms; with a 1 MiB fill ahead of each, 134.0 against 262.9, 8.03-8.22 ms against 8.32-8.42 ms, 9.00-9.15 ms against 9.25-9.36 ms. Radeon 780M (RADV, Mesa 26.0.8), this switch: with no fill, 67.0 against 128.9-129.0, a frame through completion 48.3-48.6 ms against 42.6-47.0 ms; with a 16 MiB fill committed at once, 134.0 against 251.0-251.1, 50.6-50.8 ms against 50.8-57.3 ms; committed every 1 ms, 134.0 against 249.7-250.2, 71.3-83.6 ms against 106.3-113.6 ms (each kernel submission there leaves about 2.5 ms of the GPU idle over 520 host imports, which sets these frames) |
|
||||
| Command queues on a device whose GPU idles when consecutive work comes from another `VkQueue` share `VkQueue`s by choice (`queue_share.rs`): the runtime's own self-check, not a `DriverFact` row, measures that idling once per driver, release and runtime on a thread of its own and keeps its verdict (`Idles`, `DoesNotIdle`, `Unchecked`) in the shader cache's directory, as the in-place check keeps its own (`queue_switch_check.rs`: 48.7 to 51.3 us a switch on the RTX 5080 Laptop GPU, NVIDIA 615.71.09, `Idles` above 20 us). A command queue that makes a command buffer while it holds no other uncompleted one moves onto the busy `VkQueue` of its family whose oldest batch has run under 0.5 ms, the most batches in flight first, so short command buffers of several queues run with no switch between them. A queue one of whose command buffers ran on the GPU for over 2 ms, by its own timestamps (not the host's view of how long it ran as its `VkQueue`'s oldest, which also holds its wait for the GPU to start it and the waiter's lateness to see it complete), is long: no queue joins its `VkQueue` while it lives, and it moves once more, at its next idle point, to an idle `VkQueue` no long or unshared queue holds. A queue whose command buffers must never wait behind another queue's (a compositor's beside an application's) is made with `Device::new_command_queue_unshared`: it never moves and no queue joins its `VkQueue`. Presenting queues and a queue that lent its `VkQueue` (`with_vk_queue`) never move. Before the verdict, and where it is not `Idles` or there are no two `VkQueue`s of one family (MoltenVK, RADV, lavapipe), every queue keeps the `VkQueue` it took at its creation; so does every queue of a device whose command buffers write no GPU timestamps it reads (`gpu_times_from_host`, or a driver whose timestamps wait for every queue's), which does not share and is counted (`WorkCounts::queue_sharing_untimed`). The runtime's: no pipeline differs. | `queue_sharing = QueueSharingPolicy::Adaptive` | `queue_sharing = QueueSharingPolicy::PerQueue`: each command queue keeps the `VkQueue` it took at its creation, round robin, and the check does not run | A command buffer waits behind the command buffers of the queues sharing its `VkQueue`, where Metal's queues wait for each other only inside one command. The residual stall: once per logical queue that goes long, for a queue that joined its `VkQueue` during its short phase, about one long command buffer's length: the command buffers committed behind that queue's first long one there wait for its whole length (and those behind its later ones while it holds work, until its next idle point). Measured on the RTX 5080 Laptop GPU beside an application that alternates draws with 30 ms command buffers: a shared compositor's commits at 4,800 a second had 64 completions over 10 ms, at most 26.4 to 30.1 ms, in each of 3 runs of each of two such shapes (one join each), against none over 10 ms under `PerQueue` in those 6 runs (at most 5.6 to 9.7 ms); with 2 ms of draws between long command buffers, none over 10 ms in 3 runs (at most 5.7 to 9.8 ms) against 7, 0 and 0 under `PerQueue` (at most 6.9 to 11.2 ms). On an unshared queue, 0 over 10 ms in every run. A command buffer's GPU start time includes the other queues' work before it. `QueueSharing` (`queue-sharing`), at the device's first join | Command buffers a second on the RTX 5080 Laptop GPU, one-draw command buffers, each thread its own queue, the default against `PerQueue`, runs after a lock hold's first: 8 threads with 3 in flight 50.7k to 54.7k against 27.4k to 28.0k (5 runs each); 8 threads with 1 in flight 47.0k to 50.1k against 13.9k to 14.3k (5); 2 threads with 3 in flight 28.0k to 53.7k against 21.4k to 28.0k (10 each, in turn, the default above `PerQueue` in each pair; no thread's queue marked long), and beside another process's 30 ms command buffers 5.1k to 6.7k against 4.0k to 4.1k (3 each; the host's view marked a thread's queue long in 1 of 3 runs, which then ran at `PerQueue`'s 4.1k); 2 threads with 1 in flight 16.9k to 20.7k against 10.1k to 11.5k (5); one thread over 16 queues in turn 21.7k to 43.3k against 10.2k to 11.1k, over 2,048 20.0k to 39.2k against 10.2k to 11.2k (4). Beside an application whose queue never shared with the compositor (isolation, 300 and 30 dispatches), both 0 over 10 ms |
|
||||
| A chain of `half` additions, subtractions and products on a device without `shaderFloat16` (vk12-floor, SwiftShader, Pascal; capability emulation: the module computes each in `float` and rounds it by the device's `OpQuantizeToF16`): an operation whose flags hold `contract` and `reassoc` and whose result only such operations read is held at `float` precision unrounded, so the chain rounds where a value leaves it (a store, an output, a conversion, a comparison, a call, a phi, a vector move, an operation without both flags), one quantize per exit instead of one per operation (`lower::arith::half_chain`). A device with `shaderFloat16` computes `half` alike under either value. | `half_chains = HalfChainPolicy::AtExits` | `half_chains = HalfChainPolicy::EachOperation`: every operation's result rounded to `half`, as the AIR computes it | The result may differ from the rounded operations' by the roundings the chain skips, each within half a unit in the last place of a `half` at its step, compounded along the chain; a value inside the chain past `half`'s range (65504) stays finite where the rounded operations reach infinity. Within the AIR's flags, which let a compiler regroup and fuse such operations. `FastMathRewrites` (`fast-math-rewrites`) | Not timed. Size on vk12-floor (the fixtures' SPIR-V words, the default against the accurate form): `hfb_filter_bank` 121,270 against 131,766 (1,024 quantizes against 2,464), `grd_half_many_samples` 82,019 against 84,627, `nan_half_fast` 9,808 against 9,832 |
|
||||
|
||||
Reference in new issue
Block a user