From 4ab995b621bbe2f7c4d7846925b86fa7e51a4fc7 Mon Sep 17 00:00:00 2001 From: Anees Iqbal Date: Fri, 27 Nov 2026 04:47:23 -0800 Subject: [PATCH] Runtime docs: a value seen on the host is gated by a host wait, never by the counter read complete.rs's module doc now states the planner's one reading for the tree: a retirement, a host read of bytes the GPU wrote, a value the guest sees that a GPU signal raised, and a free are gated by vkWaitSemaphores (a timeout of 0 allowed), never by vkGetSemaphoreCounterValue alone; the counter read may find which value to confirm. It rests on the Vulkan specification's Fences section (7.3: waiting on a fence, by vkWaitForFences or by polling vkGetFenceStatus, defines an execution dependency), the semaphores' overview (7.4: a dependency "between a queue operation and the host") and the memory model's System-Synchronizes-With note ("signal operations happening before host operations that wait on them"); Host Operations on Semaphores (7.4.4) carries no such sentence. The Queue Operation section (3.2.1) gives what came before a signal a wait has seen. VK_KHR_timeline_semaphore's issue 5 is no longer cited: it states no order. The host-visibility paragraph (record::end's Reach::Host barrier, then host coherence or crate::coherence) stays. run()'s comment on the completion loop's zero-timeout wait is unchanged. Doc only. Verification: cargo fmt here; Rustdoc with -D warnings in the lane's lint job. --- crates/metal2vulkan-runtime/src/complete.rs | 40 ++++++++++----------- 1 file changed, 20 insertions(+), 20 deletions(-) diff --git a/crates/metal2vulkan-runtime/src/complete.rs b/crates/metal2vulkan-runtime/src/complete.rs index e1dea0e1c..cfb2da52e 100644 --- a/crates/metal2vulkan-runtime/src/complete.rs +++ b/crates/metal2vulkan-runtime/src/complete.rs @@ -2,27 +2,27 @@ //! their completed handlers, follows the event signals it submitted and runs listeners, and ends //! the work in flight at a loss. //! -//! **What a value seen on the host means.** A host wait (`vkWaitSemaphores`) or a counter read -//! (`vkGetSemaphoreCounterValue`) that finds a timeline semaphore at or above the value a -//! submission signals means that signal operation has happened: +//! **What a value seen on the host means.** A retirement, a host read of bytes the GPU wrote, a +//! value the guest sees that a GPU signal raised, and a free are gated by a host wait on the +//! semaphore's value (`vkWaitSemaphores`, a timeout of 0 allowed), never by a counter read +//! (`vkGetSemaphoreCounterValue`) alone; the counter read may find which value to confirm. The +//! Vulkan specification states an execution dependency for waiting on a fence, by +//! `vkWaitForFences` or by polling `vkGetFenceStatus` (Fences, 7.3), and for a semaphore names +//! the host's wait alone: the semaphores' overview (7.4) has them "insert a dependency ... between +//! a queue operation and the host", and the memory model's System-Synchronizes-With note lists +//! "signal operations happening before host operations that wait on them". Host Operations on +//! Semaphores (7.4.4) carries no "defines an execution dependency" sentence. Once a wait has seen +//! a value, the Queue Operation section (3.2.1) gives what came before its signal: "Before a +//! fence or semaphore is signaled, it is guaranteed that any previously submitted queue +//! operations have completed execution, and that memory writes from those queue operations are +//! available to future queue operations." //! -//! - the Vulkan specification's Queue Operation section (3.2.1): "Before a fence or semaphore is -//! signaled, it is guaranteed that any previously submitted queue operations have completed -//! execution, and that memory writes from those queue operations are available to future queue -//! operations."; -//! - its Semaphore Signaling section (7.4.1): a timeline semaphore "is considered signaled with -//! respect to the counter value set to be signaled"; -//! - `VK_KHR_timeline_semaphore`, issue 5: "Both a non-blocking query of the current payload value -//! of the synchronization primitive, and a blocking wait operation are provided.": the query is -//! one of the two documented forms of a host wait. -//! -//! Host Operations on Semaphores (7.4.4) carries no "defines an execution dependency" sentence, -//! unlike the fence wait's (7.3, Fences). Host visibility does not come from the semaphore: it -//! comes from the barrier `record::end` records at the end of each segment that writes Shared -//! memory or signals an event (`Reach::Host`, whose second scope is `ALL_COMMANDS | HOST` with -//! `HOST_READ` among its accesses). After it, host-coherent memory holds the writes for the host, -//! and where the Shared memory type is not host-coherent, the flush then invalidate of -//! `crate::coherence` makes them visible. +//! Host visibility does not come from the semaphore: it comes from the barrier `record::end` +//! records at the end of each segment that writes Shared memory or signals an event +//! (`Reach::Host`, whose second scope is `ALL_COMMANDS | HOST` with `HOST_READ` among its +//! accesses). After it, host-coherent memory holds the writes for the host, and where the Shared +//! memory type is not host-coherent, the flush then invalidate of `crate::coherence` makes them +//! visible. use crate::capture::CopyIn; use crate::command::{self, CbInner, CommandBufferError, DeviceLoss, Gpu, Handlers, Pending};